53fafe9968cd86a2cabd01c70b7a3b75424e30f6
[motion2.git] / server / api / setting / setting.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x089f=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','order','where','pick','filter','VIRTUAL','options','Setting','includeAll','findAll','rows','params','length','include','merge','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','default_loginLogo.svg','\x20not\x20found','gdpr','addPreferred','getPreferred','default','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','client','http','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','catch'];(function(_0x3d5584,_0x78645a){var _0x561d3f=function(_0x441911){while(--_0x441911){_0x3d5584['push'](_0x3d5584['shift']());}};_0x561d3f(++_0x78645a);}(_0x089f,0x1c7));var _0xf089=function(_0x4a8589,_0x360034){_0x4a8589=_0x4a8589-0x0;var _0x5bbe68=_0x089f[_0x4a8589];return _0x5bbe68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf089('0x0'));var zipdir=require(_0xf089('0x1'));var jsonpatch=require(_0xf089('0x2'));var rp=require(_0xf089('0x3'));var moment=require(_0xf089('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf089('0x5'));var util=require(_0xf089('0x6'));var path=require(_0xf089('0x7'));var sox=require('sox');var csv=require(_0xf089('0x8'));var ejs=require(_0xf089('0x9'));var fs=require('fs');var fs_extra=require(_0xf089('0xa'));var _=require('lodash');var squel=require(_0xf089('0xb'));var crypto=require(_0xf089('0xc'));var jsforce=require(_0xf089('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf089('0x8'));var querystring=require(_0xf089('0xe'));var Papa=require(_0xf089('0xf'));var Redis=require(_0xf089('0x10'));var authService=require(_0xf089('0x11'));var qs=require(_0xf089('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf089('0x13'));var logger=require(_0xf089('0x14'))(_0xf089('0x15'));var utils=require('../../config/utils');var config=require(_0xf089('0x16'));var licenseUtil=require(_0xf089('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xf089('0x18')][_0xf089('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4ca74e,_0x3e2d3b,_0x470ba9,_0x72b34f){return new BPromise(function(_0x337673,_0x58b0db){var _0x329719=_0x72b34f||client;return _0x329719['request'](_0x4ca74e,_0x470ba9)[_0xf089('0x1a')](function(_0x528cf9){logger[_0xf089('0x1b')]('Setting,\x20%s,\x20%s',_0x3e2d3b,_0xf089('0x1c'));logger[_0xf089('0x1d')](_0xf089('0x1e'),_0x3e2d3b,_0xf089('0x1c'),JSON[_0xf089('0x1f')](_0x528cf9));if(_0x528cf9['error']){if(_0x528cf9[_0xf089('0x20')]['code']===0x1f4){logger[_0xf089('0x20')](_0xf089('0x21'),_0x3e2d3b,_0x528cf9['error'][_0xf089('0x22')]);return _0x58b0db(_0x528cf9[_0xf089('0x20')]['message']);}logger[_0xf089('0x20')](_0xf089('0x21'),_0x3e2d3b,_0x528cf9[_0xf089('0x20')][_0xf089('0x22')]);return _0x337673(_0x528cf9[_0xf089('0x20')][_0xf089('0x22')]);}else{logger[_0xf089('0x1b')](_0xf089('0x21'),_0x3e2d3b,_0xf089('0x1c'));_0x337673(_0x528cf9[_0xf089('0x23')]['message']);}})[_0xf089('0x24')](function(_0x31050f){logger[_0xf089('0x20')](_0xf089('0x21'),_0x3e2d3b,_0x31050f);_0x58b0db(_0x31050f);});});}function respondWithStatusCode(_0x599b04,_0x19e801){_0x19e801=_0x19e801||0xcc;return function(_0x249b88){if(_0x249b88){return _0x599b04[_0xf089('0x25')](_0x19e801);}return _0x599b04[_0xf089('0x26')](_0x19e801)[_0xf089('0x27')]();};}function respondWithResult(_0x49e00e,_0x3ec39b){_0x3ec39b=_0x3ec39b||0xc8;return function(_0x598a4e){if(_0x598a4e){return _0x49e00e[_0xf089('0x26')](_0x3ec39b)[_0xf089('0x28')](_0x598a4e);}};}function respondWithFilteredResult(_0x5ad3d4,_0x3ef0bc){return function(_0x5e72c9){if(_0x5e72c9){var _0x52ea47=typeof _0x3ef0bc[_0xf089('0x29')]===_0xf089('0x2a')&&typeof _0x3ef0bc[_0xf089('0x2b')]===_0xf089('0x2a');var _0x14aa96=_0x5e72c9['count'];var _0x210147=_0x52ea47?0x0:_0x3ef0bc['offset'];var _0x83d36=_0x52ea47?_0x5e72c9[_0xf089('0x2c')]:_0x3ef0bc[_0xf089('0x29')]+_0x3ef0bc[_0xf089('0x2b')];var _0x32f869;if(_0x83d36>=_0x14aa96){_0x83d36=_0x14aa96;_0x32f869=0xc8;}else{_0x32f869=0xce;}_0x5ad3d4[_0xf089('0x26')](_0x32f869);return _0x5ad3d4[_0xf089('0x2d')](_0xf089('0x2e'),_0x210147+'-'+_0x83d36+'/'+_0x14aa96)[_0xf089('0x28')](_0x5e72c9);}return null;};}function patchUpdates(_0x2df2bb){return function(_0x3f82b8){try{jsonpatch[_0xf089('0x2f')](_0x3f82b8,_0x2df2bb,!![]);}catch(_0x5b85a4){return BPromise['reject'](_0x5b85a4);}return _0x3f82b8[_0xf089('0x30')]();};}function saveUpdates(_0x41741b,_0x3fcd88){return function(_0x26ec9c){if(_0x26ec9c){return _0x26ec9c[_0xf089('0x31')](_0x41741b)['then'](function(_0x5cc632){return _0x5cc632;});}return null;};}function removeEntity(_0x355148,_0x1fbfc3){return function(_0x3d8287){if(_0x3d8287){return _0x3d8287[_0xf089('0x32')]()[_0xf089('0x1a')](function(){_0x355148[_0xf089('0x26')](0xcc)[_0xf089('0x27')]();});}};}function handleEntityNotFound(_0x29bd70,_0x41d699){return function(_0x488746){if(!_0x488746){_0x29bd70[_0xf089('0x25')](0x194);}return _0x488746;};}function handleError(_0x5becf3,_0x12e975){_0x12e975=_0x12e975||0x1f4;return function(_0x2646bf){logger['error'](_0x2646bf[_0xf089('0x33')]);if(_0x2646bf[_0xf089('0x34')]){delete _0x2646bf[_0xf089('0x34')];}_0x5becf3[_0xf089('0x26')](_0x12e975)['send'](_0x2646bf);};}exports[_0xf089('0x35')]=function(_0x4d8b0c,_0x3332f8){var _0x5ac407={},_0x5b51ba={},_0x4ef6c1={'count':0x0,'rows':[]};var _0x3bbcb3=_[_0xf089('0x36')](db['Setting']['rawAttributes'],function(_0x4f2f6f){return{'name':_0x4f2f6f[_0xf089('0x37')],'type':_0x4f2f6f[_0xf089('0x38')][_0xf089('0x39')]};});_0x5b51ba[_0xf089('0x3a')]=_['map'](_0x3bbcb3,_0xf089('0x34'));_0x5b51ba[_0xf089('0x3b')]=_[_0xf089('0x3c')](_0x4d8b0c['query']);_0x5b51ba[_0xf089('0x3d')]=_['intersection'](_0x5b51ba[_0xf089('0x3a')],_0x5b51ba[_0xf089('0x3b')]);_0x5ac407[_0xf089('0x3e')]=_[_0xf089('0x3f')](_0x5b51ba[_0xf089('0x3a')],qs[_0xf089('0x40')](_0x4d8b0c[_0xf089('0x3b')][_0xf089('0x40')]));_0x5ac407[_0xf089('0x3e')]=_0x5ac407[_0xf089('0x3e')]['length']?_0x5ac407[_0xf089('0x3e')]:_0x5b51ba[_0xf089('0x3a')];if(!_0x4d8b0c[_0xf089('0x3b')]['hasOwnProperty']('nolimit')){_0x5ac407[_0xf089('0x2b')]=qs[_0xf089('0x2b')](_0x4d8b0c[_0xf089('0x3b')]['limit']);_0x5ac407[_0xf089('0x29')]=qs[_0xf089('0x29')](_0x4d8b0c['query'][_0xf089('0x29')]);}_0x5ac407[_0xf089('0x41')]=qs['sort'](_0x4d8b0c[_0xf089('0x3b')]['sort']);_0x5ac407[_0xf089('0x42')]=qs[_0xf089('0x3d')](_[_0xf089('0x43')](_0x4d8b0c[_0xf089('0x3b')],_0x5b51ba[_0xf089('0x3d')]),_0x3bbcb3);if(_0x4d8b0c['query'][_0xf089('0x44')]){_0x5ac407[_0xf089('0x42')]=_['merge'](_0x5ac407[_0xf089('0x42')],{'$or':_[_0xf089('0x36')](_0x3bbcb3,function(_0x4f1f7){if(_0x4f1f7[_0xf089('0x38')]!==_0xf089('0x45')){var _0x1ae115={};_0x1ae115[_0x4f1f7[_0xf089('0x34')]]={'$like':'%'+_0x4d8b0c['query']['filter']+'%'};return _0x1ae115;}})});}_0x5ac407=_['merge']({},_0x5ac407,_0x4d8b0c[_0xf089('0x46')]);var _0x1567e8={'where':_0x5ac407[_0xf089('0x42')]};return db[_0xf089('0x47')]['count'](_0x1567e8)[_0xf089('0x1a')](function(_0x5e7d40){_0x4ef6c1[_0xf089('0x2c')]=_0x5e7d40;if(_0x4d8b0c[_0xf089('0x3b')][_0xf089('0x48')]){_0x5ac407['include']=[{'all':!![]}];}return db[_0xf089('0x47')][_0xf089('0x49')](_0x5ac407);})['then'](function(_0x341de8){_0x4ef6c1[_0xf089('0x4a')]=_0x341de8;return _0x4ef6c1;})[_0xf089('0x1a')](respondWithFilteredResult(_0x3332f8,_0x5ac407))[_0xf089('0x24')](handleError(_0x3332f8,null));};exports['show']=function(_0x2d15fe,_0x57111b){var _0x5bfe05={'raw':![],'where':{'id':_0x2d15fe[_0xf089('0x4b')]['id']}},_0x2c064d={};_0x2c064d['model']=_[_0xf089('0x3c')](db['Setting']['rawAttributes']);_0x2c064d['query']=_['keys'](_0x2d15fe[_0xf089('0x3b')]);_0x2c064d[_0xf089('0x3d')]=_['intersection'](_0x2c064d[_0xf089('0x3a')],_0x2c064d[_0xf089('0x3b')]);_0x5bfe05[_0xf089('0x3e')]=_[_0xf089('0x3f')](_0x2c064d[_0xf089('0x3a')],qs[_0xf089('0x40')](_0x2d15fe[_0xf089('0x3b')]['fields']));_0x5bfe05[_0xf089('0x3e')]=_0x5bfe05[_0xf089('0x3e')][_0xf089('0x4c')]?_0x5bfe05[_0xf089('0x3e')]:_0x2c064d['model'];if(_0x2d15fe[_0xf089('0x3b')][_0xf089('0x48')]){_0x5bfe05[_0xf089('0x4d')]=[{'all':!![]}];}_0x5bfe05=_[_0xf089('0x4e')]({},_0x5bfe05,_0x2d15fe[_0xf089('0x46')]);return db[_0xf089('0x47')][_0xf089('0x4f')](_0x5bfe05)['then'](handleEntityNotFound(_0x57111b,null))['then'](respondWithResult(_0x57111b,null))['catch'](handleError(_0x57111b,null));};exports[_0xf089('0x31')]=function(_0x3614c6,_0x5b89bb){if(_0x3614c6['body']['id']){delete _0x3614c6[_0xf089('0x50')]['id'];}return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x3614c6[_0xf089('0x4b')]['id']}})[_0xf089('0x1a')](handleEntityNotFound(_0x5b89bb,null))[_0xf089('0x1a')](saveUpdates(_0x3614c6[_0xf089('0x50')],null))['then'](respondWithResult(_0x5b89bb,null))['catch'](handleError(_0x5b89bb,null));};exports[_0xf089('0x51')]=function(_0x2f0ab7,_0x411820,_0x4ff11e){if(_0x2f0ab7[_0xf089('0x52')]&&_0x2f0ab7[_0xf089('0x52')][_0xf089('0x53')]){_0x2f0ab7[_0xf089('0x50')][_0xf089('0x54')]=_0x2f0ab7['file']['filename'];}return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x2f0ab7[_0xf089('0x4b')]['id']}})['then'](handleEntityNotFound(_0x411820,null))['then'](saveUpdates(_0x2f0ab7[_0xf089('0x50')],null))['then'](respondWithResult(_0x411820,null))[_0xf089('0x24')](handleError(_0x411820,null));};exports[_0xf089('0x55')]=function(_0x571bf7,_0x500e0c,_0x8dff33){if(_0x571bf7['file']&&_0x571bf7[_0xf089('0x52')][_0xf089('0x53')]){_0x571bf7[_0xf089('0x50')][_0xf089('0x56')]=_0x571bf7['file']['filename'];}return db[_0xf089('0x47')]['find']({'where':{'id':_0x571bf7[_0xf089('0x4b')]['id']}})['then'](handleEntityNotFound(_0x500e0c,null))['then'](saveUpdates(_0x571bf7[_0xf089('0x50')],null))[_0xf089('0x1a')](respondWithResult(_0x500e0c,null))['catch'](handleError(_0x500e0c,null));};var utilLicense=require('../../config/license/util');exports[_0xf089('0x57')]=function(_0x50e598,_0x3197e3,_0x145cab){var _0x8a874=_0xf089('0x58');var _0x31b1e5={'custom':![]};return utilLicense[_0xf089('0x59')]()['then'](function(_0x2bf50f){if(_0x2bf50f){_0x31b1e5=_0x2bf50f;}return db[_0xf089('0x47')]['find']({'where':{'id':_0x50e598[_0xf089('0x4b')]['id']},'attributes':[_0xf089('0x54'),_0xf089('0x56'),_0xf089('0x5a'),_0xf089('0x5b'),_0xf089('0x5c'),_0xf089('0x5d'),_0xf089('0x5e'),_0xf089('0x5f')],'raw':!![]});})[_0xf089('0x1a')](handleEntityNotFound(_0x3197e3,null))[_0xf089('0x1a')](function(_0x26c013){if(_0x26c013){var _0x2adbe0=_0x26c013[_0xf089('0x54')]&&fs[_0xf089('0x60')](path[_0xf089('0x61')](config['root'],_0x8a874,_['toLower'](_0x26c013[_0xf089('0x54')])))?path[_0xf089('0x61')](config[_0xf089('0x62')],_0x8a874,_[_0xf089('0x63')](_0x26c013[_0xf089('0x54')])):path[_0xf089('0x61')](config['root'],_0x8a874,_[_0xf089('0x63')](_0xf089('0x64')));var _0x312b15='default'+_[_0xf089('0x65')](_0xf089('0x54'));if(_0x26c013[_0x312b15]||!_0x31b1e5[_0xf089('0x66')]){_0x2adbe0=path[_0xf089('0x61')](config['root'],_0x8a874,_[_0xf089('0x63')](_0xf089('0x64')));}if(!fs[_0xf089('0x60')](_0x2adbe0)){throw new db[(_0xf089('0x67'))][(_0xf089('0x68'))](_[_0xf089('0x65')]('logo')+'\x20not\x20found');}return _0x3197e3[_0xf089('0x69')](_0x2adbe0);}})[_0xf089('0x24')](handleError(_0x3197e3,null));};var utilLicense=require(_0xf089('0x17'));exports[_0xf089('0x6a')]=function(_0x56e22e,_0x30a01b,_0x5b1713){var _0x1e62d2=_0xf089('0x58');var _0x19d213={'custom':![]};return utilLicense[_0xf089('0x59')]()[_0xf089('0x1a')](function(_0x4f14f3){if(_0x4f14f3){_0x19d213=_0x4f14f3;}return db[_0xf089('0x47')]['find']({'where':{'id':_0x56e22e[_0xf089('0x4b')]['id']},'attributes':[_0xf089('0x54'),_0xf089('0x56'),'preferred',_0xf089('0x5b'),'defaultLogo',_0xf089('0x5d'),_0xf089('0x5e'),_0xf089('0x5f')],'raw':!![]});})[_0xf089('0x1a')](handleEntityNotFound(_0x30a01b,null))['then'](function(_0x1fe29b){if(_0x1fe29b){var _0x268635=_0x1fe29b['loginLogo']&&fs['existsSync'](path[_0xf089('0x61')](config[_0xf089('0x62')],_0x1e62d2,_['toLower'](_0x1fe29b[_0xf089('0x56')])))?path['join'](config['root'],_0x1e62d2,_[_0xf089('0x63')](_0x1fe29b[_0xf089('0x56')])):path[_0xf089('0x61')](config[_0xf089('0x62')],_0x1e62d2,_[_0xf089('0x63')](_0xf089('0x6b')));var _0x4e6e25='default'+_[_0xf089('0x65')]('loginLogo');if(_0x1fe29b[_0x4e6e25]||!_0x19d213[_0xf089('0x66')]){_0x268635=path['join'](config['root'],_0x1e62d2,_['toLower'](_0xf089('0x6b')));}if(!fs[_0xf089('0x60')](_0x268635)){throw new db['Sequelize'][(_0xf089('0x68'))](_['upperFirst'](_0xf089('0x56'))+_0xf089('0x6c'));}return _0x30a01b[_0xf089('0x69')](_0x268635);}})[_0xf089('0x24')](handleError(_0x30a01b,null));};exports[_0xf089('0x6d')]=function(_0x138d6b,_0x4bec3a){return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x138d6b[_0xf089('0x4b')]['id']},'attributes':['securePassword']})[_0xf089('0x1a')](respondWithResult(_0x4bec3a,null))['catch'](handleError(_0x4bec3a,null));};exports[_0xf089('0x6e')]=function(_0x4cd3c7,_0x21a44c,_0x46b771){if(_0x4cd3c7[_0xf089('0x52')]&&_0x4cd3c7[_0xf089('0x52')][_0xf089('0x53')]){_0x4cd3c7[_0xf089('0x50')][_0xf089('0x5a')]=_0x4cd3c7['file']['filename'];}return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x4cd3c7[_0xf089('0x4b')]['id']}})[_0xf089('0x1a')](handleEntityNotFound(_0x21a44c,null))[_0xf089('0x1a')](saveUpdates(_0x4cd3c7[_0xf089('0x50')],null))[_0xf089('0x1a')](respondWithResult(_0x21a44c,null))[_0xf089('0x24')](handleError(_0x21a44c,null));};var utilLicense=require(_0xf089('0x17'));exports[_0xf089('0x6f')]=function(_0x2b2a92,_0x7b1ea7,_0x6be0b7){var _0x3c271d=_0xf089('0x58');var _0x265522={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1a3c74){if(_0x1a3c74){_0x265522=_0x1a3c74;}return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x2b2a92[_0xf089('0x4b')]['id']},'attributes':[_0xf089('0x54'),'loginLogo',_0xf089('0x5a'),_0xf089('0x5b'),_0xf089('0x5c'),_0xf089('0x5d'),_0xf089('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x7b1ea7,null))[_0xf089('0x1a')](function(_0x532a63){if(_0x532a63){var _0x4c4e28=_0x532a63[_0xf089('0x5a')]&&fs[_0xf089('0x60')](path[_0xf089('0x61')](config[_0xf089('0x62')],_0x3c271d,_[_0xf089('0x63')](_0x532a63[_0xf089('0x5a')])))?path[_0xf089('0x61')](config[_0xf089('0x62')],_0x3c271d,_[_0xf089('0x63')](_0x532a63[_0xf089('0x5a')])):path[_0xf089('0x61')](config[_0xf089('0x62')],_0x3c271d,_[_0xf089('0x63')]('default_preferred.png'));var _0x11251a=_0xf089('0x70')+_[_0xf089('0x65')](_0xf089('0x5a'));if(_0x532a63[_0x11251a]||!_0x265522[_0xf089('0x66')]||!_0x265522['preferred']){_0x4c4e28=path[_0xf089('0x61')](config[_0xf089('0x62')],_0x3c271d,_[_0xf089('0x63')](_0xf089('0x71')));}if(!fs[_0xf089('0x60')](_0x4c4e28)){throw new db[(_0xf089('0x67'))][(_0xf089('0x68'))](_[_0xf089('0x65')](_0xf089('0x5a'))+_0xf089('0x6c'));}return _0x7b1ea7[_0xf089('0x69')](_0x4c4e28);}})['catch'](handleError(_0x7b1ea7,null));};exports[_0xf089('0x72')]=function(_0x463421,_0x3f4878,_0x39196a){if(_0x463421['file']&&_0x463421[_0xf089('0x52')][_0xf089('0x53')]){_0x463421['body'][_0xf089('0x5b')]=_0x463421['file'][_0xf089('0x53')];}return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x463421[_0xf089('0x4b')]['id']}})[_0xf089('0x1a')](handleEntityNotFound(_0x3f4878,null))[_0xf089('0x1a')](saveUpdates(_0x463421['body'],null))[_0xf089('0x1a')](respondWithResult(_0x3f4878,null))[_0xf089('0x24')](handleError(_0x3f4878,null));};var utilLicense=require(_0xf089('0x17'));exports[_0xf089('0x73')]=function(_0x1240ea,_0x1cc1a0,_0x5e5a10){var _0xa3d2b2=_0xf089('0x58');var _0x4e6d38={'custom':![]};return utilLicense[_0xf089('0x59')]()['then'](function(_0x262be0){if(_0x262be0){_0x4e6d38=_0x262be0;}return db['Setting'][_0xf089('0x4f')]({'where':{'id':_0x1240ea[_0xf089('0x4b')]['id']},'attributes':[_0xf089('0x54'),_0xf089('0x56'),'preferred',_0xf089('0x5b'),'defaultLogo',_0xf089('0x5d'),_0xf089('0x5e'),_0xf089('0x5f')],'raw':!![]});})[_0xf089('0x1a')](handleEntityNotFound(_0x1cc1a0,null))['then'](function(_0x27fcd4){if(_0x27fcd4){var _0x2c817d=_0x27fcd4[_0xf089('0x5b')]&&fs[_0xf089('0x60')](path[_0xf089('0x61')](config[_0xf089('0x62')],_0xa3d2b2,_['toLower'](_0x27fcd4[_0xf089('0x5b')])))?path[_0xf089('0x61')](config[_0xf089('0x62')],_0xa3d2b2,_[_0xf089('0x63')](_0x27fcd4[_0xf089('0x5b')])):path['join'](config[_0xf089('0x62')],_0xa3d2b2,_['toLower'](_0xf089('0x74')));var _0x3b0625=_0xf089('0x70')+_[_0xf089('0x65')](_0xf089('0x5b'));if(_0x27fcd4[_0x3b0625]||!_0x4e6d38['custom']){_0x2c817d=path[_0xf089('0x61')](config[_0xf089('0x62')],_0xa3d2b2,_['toLower'](_0xf089('0x74')));}if(!fs[_0xf089('0x60')](_0x2c817d)){throw new db[(_0xf089('0x67'))][(_0xf089('0x68'))](_['upperFirst'](_0xf089('0x5b'))+_0xf089('0x6c'));}return _0x1cc1a0[_0xf089('0x69')](_0x2c817d);}})[_0xf089('0x24')](handleError(_0x1cc1a0,null));};exports[_0xf089('0x75')]=function(_0x177ea6,_0x168e9b){var _0x4336f1={'offset':moment()['utcOffset']()};_0x4336f1[_0xf089('0x76')]=moment()[_0xf089('0x77')](_0x4336f1[_0xf089('0x29')])[_0xf089('0x78')](_0xf089('0x79'));return _0x168e9b['status'](0xc8)[_0xf089('0x7a')](_0x4336f1);};