18 var _0x8df6=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x1fc628,_0xf851bf){var _0x166624=function(_0x532586){while(--_0x532586){_0x1fc628['push'](_0x1fc628['shift']());}};_0x166624(++_0xf851bf);}(_0x8df6,0x140));var _0x68df=function(_0x77323,_0x51115e){_0x77323=_0x77323-0x0;var _0x47e4ea=_0x8df6[_0x77323];return _0x47e4ea;};'use strict';var emlformat=require(_0x68df('0x0'));var rimraf=require(_0x68df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68df('0x2'));var rp=require(_0x68df('0x3'));var moment=require(_0x68df('0x4'));var BPromise=require(_0x68df('0x5'));var Mustache=require(_0x68df('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x68df('0x7'));var ejs=require(_0x68df('0x8'));var fs=require('fs');var fs_extra=require(_0x68df('0x9'));var _=require('lodash');var squel=require(_0x68df('0xa'));var crypto=require(_0x68df('0xb'));var jsforce=require(_0x68df('0xc'));var deskjs=require(_0x68df('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x68df('0xe'));var Redis=require(_0x68df('0xf'));var authService=require(_0x68df('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x68df('0x11'));var hardwareService=require(_0x68df('0x12'));var logger=require(_0x68df('0x13'))('api');var utils=require(_0x68df('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x68df('0x15'));var db=require(_0x68df('0x16'))['db'];function respondWithStatusCode(_0x11499c,_0x5cedf9){_0x5cedf9=_0x5cedf9||0xcc;return function(_0x375d1e){if(_0x375d1e){return _0x11499c['sendStatus'](_0x5cedf9);}return _0x11499c[_0x68df('0x17')](_0x5cedf9)[_0x68df('0x18')]();};}function respondWithResult(_0x253c1a,_0x181dc8){_0x181dc8=_0x181dc8||0xc8;return function(_0x3c45ff){if(_0x3c45ff){return _0x253c1a[_0x68df('0x17')](_0x181dc8)[_0x68df('0x19')](_0x3c45ff);}};}function respondWithFilteredResult(_0xf031cc,_0x4d483f){return function(_0x58864e){if(_0x58864e){var _0x40a091=typeof _0x4d483f['offset']===_0x68df('0x1a')&&typeof _0x4d483f[_0x68df('0x1b')]===_0x68df('0x1a');var _0x1c35f1=_0x58864e[_0x68df('0x1c')];var _0x171ee5=_0x40a091?0x0:_0x4d483f[_0x68df('0x1d')];var _0x4247ed=_0x40a091?_0x58864e[_0x68df('0x1c')]:_0x4d483f[_0x68df('0x1d')]+_0x4d483f[_0x68df('0x1b')];var _0x524fc7;if(_0x4247ed>=_0x1c35f1){_0x4247ed=_0x1c35f1;_0x524fc7=0xc8;}else{_0x524fc7=0xce;}_0xf031cc['status'](_0x524fc7);return _0xf031cc[_0x68df('0x1e')](_0x68df('0x1f'),_0x171ee5+'-'+_0x4247ed+'/'+_0x1c35f1)[_0x68df('0x19')](_0x58864e);}return null;};}function patchUpdates(_0x199fc5){return function(_0xdf258f){try{jsonpatch['apply'](_0xdf258f,_0x199fc5,!![]);}catch(_0x277a4b){return BPromise[_0x68df('0x20')](_0x277a4b);}return _0xdf258f[_0x68df('0x21')]();};}function saveUpdates(_0x288a12,_0x86fa4b){return function(_0x19f8ba){if(_0x19f8ba){return _0x19f8ba[_0x68df('0x22')](_0x288a12)[_0x68df('0x23')](function(_0x24469d){return _0x24469d;});}return null;};}function removeEntity(_0x453651,_0x11d51b){return function(_0xfd5e6){if(_0xfd5e6){return _0xfd5e6[_0x68df('0x24')]()[_0x68df('0x23')](function(){_0x453651[_0x68df('0x17')](0xcc)[_0x68df('0x18')]();});}};}function handleEntityNotFound(_0xed6a11,_0x209555){return function(_0x3e7268){if(!_0x3e7268){_0xed6a11[_0x68df('0x25')](0x194);}return _0x3e7268;};}function handleError(_0x16f09d,_0x313164){_0x313164=_0x313164||0x1f4;return function(_0x4608f6){logger[_0x68df('0x26')](_0x4608f6[_0x68df('0x27')]);if(_0x4608f6[_0x68df('0x28')]){delete _0x4608f6[_0x68df('0x28')];}_0x16f09d[_0x68df('0x17')](_0x313164)[_0x68df('0x29')](_0x4608f6);};}exports[_0x68df('0x2a')]=function(_0x227f94,_0x1586f6){var _0x192951={},_0x10adb3={},_0x6b1cd8={'count':0x0,'rows':[]};var _0xc46cd=_[_0x68df('0x2b')](db[_0x68df('0x2c')][_0x68df('0x2d')],function(_0x1dda00){return{'name':_0x1dda00['fieldName'],'type':_0x1dda00[_0x68df('0x2e')][_0x68df('0x2f')]};});_0x10adb3['model']=_[_0x68df('0x2b')](_0xc46cd,'name');_0x10adb3[_0x68df('0x30')]=_['keys'](_0x227f94[_0x68df('0x30')]);_0x10adb3[_0x68df('0x31')]=_[_0x68df('0x32')](_0x10adb3[_0x68df('0x33')],_0x10adb3['query']);_0x192951[_0x68df('0x34')]=_[_0x68df('0x32')](_0x10adb3['model'],qs['fields'](_0x227f94[_0x68df('0x30')][_0x68df('0x35')]));_0x192951[_0x68df('0x34')]=_0x192951['attributes'][_0x68df('0x36')]?_0x192951[_0x68df('0x34')]:_0x10adb3[_0x68df('0x33')];if(!_0x227f94['query'][_0x68df('0x37')](_0x68df('0x38'))){_0x192951['limit']=qs[_0x68df('0x1b')](_0x227f94['query'][_0x68df('0x1b')]);_0x192951[_0x68df('0x1d')]=qs['offset'](_0x227f94['query']['offset']);}_0x192951[_0x68df('0x39')]=qs[_0x68df('0x3a')](_0x227f94[_0x68df('0x30')][_0x68df('0x3a')]);_0x192951[_0x68df('0x3b')]=qs['filters'](_[_0x68df('0x3c')](_0x227f94[_0x68df('0x30')],_0x10adb3[_0x68df('0x31')]),_0xc46cd);if(_0x227f94[_0x68df('0x30')][_0x68df('0x3d')]){_0x192951[_0x68df('0x3b')]=_[_0x68df('0x3e')](_0x192951['where'],{'$or':_[_0x68df('0x2b')](_0xc46cd,function(_0x538016){if(_0x538016[_0x68df('0x2e')]!==_0x68df('0x3f')){var _0x46e0be={};_0x46e0be[_0x538016[_0x68df('0x28')]]={'$like':'%'+_0x227f94[_0x68df('0x30')][_0x68df('0x3d')]+'%'};return _0x46e0be;}})});}_0x192951=_[_0x68df('0x3e')]({},_0x192951,_0x227f94[_0x68df('0x40')]);var _0x560ae0={'where':_0x192951[_0x68df('0x3b')]};return db[_0x68df('0x2c')]['count'](_0x560ae0)[_0x68df('0x23')](function(_0x2e4910){_0x6b1cd8[_0x68df('0x1c')]=_0x2e4910;if(_0x227f94['query'][_0x68df('0x41')]){_0x192951[_0x68df('0x42')]=[{'all':!![]}];}return db[_0x68df('0x2c')]['findAll'](_0x192951);})[_0x68df('0x23')](function(_0x2edc62){_0x6b1cd8[_0x68df('0x43')]=_0x2edc62;return _0x6b1cd8;})[_0x68df('0x23')](respondWithFilteredResult(_0x1586f6,_0x192951))[_0x68df('0x44')](handleError(_0x1586f6,null));};exports['show']=function(_0x1cef9d,_0xd0f01c){var _0x25f54a={'raw':![],'where':{'id':_0x1cef9d[_0x68df('0x45')]['id']}},_0x5a5dd2={};_0x5a5dd2[_0x68df('0x33')]=_[_0x68df('0x46')](db[_0x68df('0x2c')][_0x68df('0x2d')]);_0x5a5dd2[_0x68df('0x30')]=_[_0x68df('0x46')](_0x1cef9d[_0x68df('0x30')]);_0x5a5dd2[_0x68df('0x31')]=_[_0x68df('0x32')](_0x5a5dd2[_0x68df('0x33')],_0x5a5dd2[_0x68df('0x30')]);_0x25f54a[_0x68df('0x34')]=_[_0x68df('0x32')](_0x5a5dd2[_0x68df('0x33')],qs[_0x68df('0x35')](_0x1cef9d[_0x68df('0x30')][_0x68df('0x35')]));_0x25f54a[_0x68df('0x34')]=_0x25f54a[_0x68df('0x34')][_0x68df('0x36')]?_0x25f54a['attributes']:_0x5a5dd2[_0x68df('0x33')];if(_0x1cef9d[_0x68df('0x30')][_0x68df('0x41')]){_0x25f54a[_0x68df('0x42')]=[{'all':!![]}];}_0x25f54a=_[_0x68df('0x3e')]({},_0x25f54a,_0x1cef9d[_0x68df('0x40')]);return db[_0x68df('0x2c')][_0x68df('0x47')](_0x25f54a)[_0x68df('0x23')](handleEntityNotFound(_0xd0f01c,null))[_0x68df('0x23')](respondWithResult(_0xd0f01c,null))[_0x68df('0x44')](handleError(_0xd0f01c,null));};exports[_0x68df('0x48')]=function(_0x210bf9,_0x4e89d6){return db[_0x68df('0x2c')][_0x68df('0x48')](_0x210bf9[_0x68df('0x49')],{})['then'](respondWithResult(_0x4e89d6,0xc9))[_0x68df('0x44')](handleError(_0x4e89d6,null));};exports[_0x68df('0x22')]=function(_0x2ba2a9,_0x42257b){if(_0x2ba2a9[_0x68df('0x49')]['id']){delete _0x2ba2a9[_0x68df('0x49')]['id'];}return db[_0x68df('0x2c')][_0x68df('0x47')]({'where':{'id':_0x2ba2a9['params']['id']}})[_0x68df('0x23')](handleEntityNotFound(_0x42257b,null))[_0x68df('0x23')](saveUpdates(_0x2ba2a9[_0x68df('0x49')],null))[_0x68df('0x23')](respondWithResult(_0x42257b,null))[_0x68df('0x44')](handleError(_0x42257b,null));};exports['destroy']=function(_0x409eb2,_0x1a5873){return db[_0x68df('0x2c')][_0x68df('0x47')]({'where':{'id':_0x409eb2[_0x68df('0x45')]['id']}})[_0x68df('0x23')](handleEntityNotFound(_0x1a5873,null))['then'](removeEntity(_0x1a5873,null))[_0x68df('0x44')](handleError(_0x1a5873,null));};exports[_0x68df('0x4a')]=function(_0x555442,_0x542922,_0x3f61cd){var _0x30bc9b={};var _0x1f4913={};var _0x4e3562;var _0x395320;return db[_0x68df('0x2c')][_0x68df('0x4b')]({'where':{'id':_0x555442[_0x68df('0x45')]['id']}})[_0x68df('0x23')](handleEntityNotFound(_0x542922,null))[_0x68df('0x23')](function(_0x1639dd){if(_0x1639dd){_0x4e3562=_0x1639dd;_0x1f4913['model']=_[_0x68df('0x46')](db[_0x68df('0x4c')][_0x68df('0x2d')]);_0x1f4913['query']=_[_0x68df('0x46')](_0x555442['query']);_0x1f4913[_0x68df('0x31')]=_['intersection'](_0x1f4913[_0x68df('0x33')],_0x1f4913[_0x68df('0x30')]);_0x30bc9b['attributes']=_['intersection'](_0x1f4913[_0x68df('0x33')],qs[_0x68df('0x35')](_0x555442[_0x68df('0x30')][_0x68df('0x35')]));_0x30bc9b[_0x68df('0x34')]=_0x30bc9b[_0x68df('0x34')]['length']?_0x30bc9b[_0x68df('0x34')]:_0x1f4913[_0x68df('0x33')];_0x30bc9b[_0x68df('0x39')]=qs[_0x68df('0x3a')](_0x555442[_0x68df('0x30')]['sort']);_0x30bc9b['where']=qs[_0x68df('0x31')](_[_0x68df('0x3c')](_0x555442[_0x68df('0x30')],_0x1f4913['filters']));if(_0x555442[_0x68df('0x30')]['filter']){_0x30bc9b[_0x68df('0x3b')]=_[_0x68df('0x3e')](_0x30bc9b[_0x68df('0x3b')],{'$or':_[_0x68df('0x2b')](_0x30bc9b[_0x68df('0x34')],function(_0x5570c9){var _0x1bdbb1={};_0x1bdbb1[_0x5570c9]={'$like':'%'+_0x555442[_0x68df('0x30')][_0x68df('0x3d')]+'%'};return _0x1bdbb1;})});}_0x30bc9b=_['merge']({},_0x30bc9b,_0x555442[_0x68df('0x40')]);return _0x4e3562['getFields'](_0x30bc9b);}})[_0x68df('0x23')](function(_0x1b93c3){if(_0x1b93c3){_0x395320=_0x1b93c3[_0x68df('0x36')];if(!_0x555442[_0x68df('0x30')][_0x68df('0x37')](_0x68df('0x38'))){_0x30bc9b[_0x68df('0x1b')]=qs[_0x68df('0x1b')](_0x555442['query']['limit']);_0x30bc9b['offset']=qs[_0x68df('0x1d')](_0x555442['query'][_0x68df('0x1d')]);}return _0x4e3562[_0x68df('0x4a')](_0x30bc9b);}})[_0x68df('0x23')](function(_0xb80459){if(_0xb80459){return _0xb80459?{'count':_0x395320,'rows':_0xb80459}:null;}})[_0x68df('0x23')](respondWithResult(_0x542922,null))[_0x68df('0x44')](handleError(_0x542922,null));};exports[_0x68df('0x4d')]=function(_0x14170d,_0x4a670a,_0x3c5a66){var _0x46c6ac={};var _0x211af4={};var _0x5371ea;var _0x591f30;return db[_0x68df('0x2c')]['findOne']({'where':{'id':_0x14170d[_0x68df('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a670a,null))['then'](function(_0x179c85){if(_0x179c85){_0x5371ea=_0x179c85;_0x211af4[_0x68df('0x33')]=_[_0x68df('0x46')](db[_0x68df('0x4c')][_0x68df('0x2d')]);_0x211af4[_0x68df('0x30')]=_[_0x68df('0x46')](_0x14170d[_0x68df('0x30')]);_0x211af4['filters']=_['intersection'](_0x211af4[_0x68df('0x33')],_0x211af4[_0x68df('0x30')]);_0x46c6ac[_0x68df('0x34')]=_[_0x68df('0x32')](_0x211af4[_0x68df('0x33')],qs['fields'](_0x14170d['query'][_0x68df('0x35')]));_0x46c6ac['attributes']=_0x46c6ac[_0x68df('0x34')][_0x68df('0x36')]?_0x46c6ac[_0x68df('0x34')]:_0x211af4[_0x68df('0x33')];_0x46c6ac[_0x68df('0x39')]=qs[_0x68df('0x3a')](_0x14170d['query'][_0x68df('0x3a')]);_0x46c6ac[_0x68df('0x3b')]=qs['filters'](_['pick'](_0x14170d[_0x68df('0x30')],_0x211af4['filters']));if(_0x14170d[_0x68df('0x30')]['filter']){_0x46c6ac[_0x68df('0x3b')]=_[_0x68df('0x3e')](_0x46c6ac['where'],{'$or':_[_0x68df('0x2b')](_0x46c6ac[_0x68df('0x34')],function(_0x2bd5c4){var _0x4b1041={};_0x4b1041[_0x2bd5c4]={'$like':'%'+_0x14170d[_0x68df('0x30')][_0x68df('0x3d')]+'%'};return _0x4b1041;})});}_0x46c6ac=_[_0x68df('0x3e')]({},_0x46c6ac,_0x14170d[_0x68df('0x40')]);return _0x5371ea[_0x68df('0x4d')](_0x46c6ac);}})[_0x68df('0x23')](function(_0x1b09ed){if(_0x1b09ed){_0x591f30=_0x1b09ed[_0x68df('0x36')];if(!_0x14170d['query'][_0x68df('0x37')](_0x68df('0x38'))){_0x46c6ac['limit']=qs['limit'](_0x14170d['query']['limit']);_0x46c6ac['offset']=qs['offset'](_0x14170d[_0x68df('0x30')][_0x68df('0x1d')]);}return _0x5371ea[_0x68df('0x4d')](_0x46c6ac);}})[_0x68df('0x23')](function(_0x599279){if(_0x599279){return _0x599279?{'count':_0x591f30,'rows':_0x599279}:null;}})['then'](respondWithResult(_0x4a670a,null))[_0x68df('0x44')](handleError(_0x4a670a,null));};exports[_0x68df('0x4e')]=function(_0x2783fa,_0x1fe525,_0x56e37d){var _0x197b2b={};var _0x180bff={};var _0x434101;var _0x43d8ae;return db[_0x68df('0x2c')][_0x68df('0x4b')]({'where':{'id':_0x2783fa[_0x68df('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fe525,null))[_0x68df('0x23')](function(_0x31367c){if(_0x31367c){_0x434101=_0x31367c;_0x180bff[_0x68df('0x33')]=_[_0x68df('0x46')](db[_0x68df('0x4c')]['rawAttributes']);_0x180bff[_0x68df('0x30')]=_[_0x68df('0x46')](_0x2783fa[_0x68df('0x30')]);_0x180bff['filters']=_[_0x68df('0x32')](_0x180bff[_0x68df('0x33')],_0x180bff['query']);_0x197b2b[_0x68df('0x34')]=_[_0x68df('0x32')](_0x180bff[_0x68df('0x33')],qs[_0x68df('0x35')](_0x2783fa['query'][_0x68df('0x35')]));_0x197b2b[_0x68df('0x34')]=_0x197b2b[_0x68df('0x34')][_0x68df('0x36')]?_0x197b2b[_0x68df('0x34')]:_0x180bff['model'];_0x197b2b[_0x68df('0x39')]=qs['sort'](_0x2783fa[_0x68df('0x30')][_0x68df('0x3a')]);_0x197b2b[_0x68df('0x3b')]=qs[_0x68df('0x31')](_[_0x68df('0x3c')](_0x2783fa[_0x68df('0x30')],_0x180bff[_0x68df('0x31')]));if(_0x2783fa[_0x68df('0x30')][_0x68df('0x3d')]){_0x197b2b['where']=_[_0x68df('0x3e')](_0x197b2b[_0x68df('0x3b')],{'$or':_[_0x68df('0x2b')](_0x197b2b[_0x68df('0x34')],function(_0x4e5c14){var _0xf64f7d={};_0xf64f7d[_0x4e5c14]={'$like':'%'+_0x2783fa[_0x68df('0x30')][_0x68df('0x3d')]+'%'};return _0xf64f7d;})});}_0x197b2b=_[_0x68df('0x3e')]({},_0x197b2b,_0x2783fa[_0x68df('0x40')]);return _0x434101[_0x68df('0x4e')](_0x197b2b);}})['then'](function(_0x3da1e3){if(_0x3da1e3){_0x43d8ae=_0x3da1e3['length'];if(!_0x2783fa[_0x68df('0x30')]['hasOwnProperty'](_0x68df('0x38'))){_0x197b2b[_0x68df('0x1b')]=qs['limit'](_0x2783fa[_0x68df('0x30')]['limit']);_0x197b2b['offset']=qs[_0x68df('0x1d')](_0x2783fa[_0x68df('0x30')][_0x68df('0x1d')]);}return _0x434101[_0x68df('0x4e')](_0x197b2b);}})[_0x68df('0x23')](function(_0x35b586){if(_0x35b586){return _0x35b586?{'count':_0x43d8ae,'rows':_0x35b586}:null;}})[_0x68df('0x23')](respondWithResult(_0x1fe525,null))[_0x68df('0x44')](handleError(_0x1fe525,null));};exports[_0x68df('0x4f')]=function(_0x27c0e5,_0x1c20b7,_0x332ca8){var _0x14b059={};var _0x29492b={};var _0x40589e;var _0x14a070;return db[_0x68df('0x2c')][_0x68df('0x4b')]({'where':{'id':_0x27c0e5['params']['id']}})[_0x68df('0x23')](handleEntityNotFound(_0x1c20b7,null))[_0x68df('0x23')](function(_0xaf1e16){if(_0xaf1e16){_0x40589e=_0xaf1e16;_0x29492b['model']=_['keys'](db[_0x68df('0x50')][_0x68df('0x2d')]);_0x29492b['query']=_[_0x68df('0x46')](_0x27c0e5[_0x68df('0x30')]);_0x29492b[_0x68df('0x31')]=_[_0x68df('0x32')](_0x29492b[_0x68df('0x33')],_0x29492b[_0x68df('0x30')]);_0x14b059[_0x68df('0x34')]=_['intersection'](_0x29492b['model'],qs[_0x68df('0x35')](_0x27c0e5[_0x68df('0x30')][_0x68df('0x35')]));_0x14b059[_0x68df('0x34')]=_0x14b059[_0x68df('0x34')][_0x68df('0x36')]?_0x14b059['attributes']:_0x29492b[_0x68df('0x33')];_0x14b059[_0x68df('0x39')]=qs[_0x68df('0x3a')](_0x27c0e5[_0x68df('0x30')][_0x68df('0x3a')]);_0x14b059[_0x68df('0x3b')]=qs[_0x68df('0x31')](_[_0x68df('0x3c')](_0x27c0e5[_0x68df('0x30')],_0x29492b[_0x68df('0x31')]));if(_0x27c0e5[_0x68df('0x30')][_0x68df('0x3d')]){_0x14b059[_0x68df('0x3b')]=_[_0x68df('0x3e')](_0x14b059[_0x68df('0x3b')],{'$or':_[_0x68df('0x2b')](_0x14b059[_0x68df('0x34')],function(_0x3832a6){var _0xba6161={};_0xba6161[_0x3832a6]={'$like':'%'+_0x27c0e5['query'][_0x68df('0x3d')]+'%'};return _0xba6161;})});}_0x14b059=_['merge']({},_0x14b059,_0x27c0e5[_0x68df('0x40')]);return _0x40589e['getTags'](_0x14b059);}})[_0x68df('0x23')](function(_0x2b2980){if(_0x2b2980){_0x14a070=_0x2b2980[_0x68df('0x36')];if(!_0x27c0e5[_0x68df('0x30')][_0x68df('0x37')](_0x68df('0x38'))){_0x14b059[_0x68df('0x1b')]=qs['limit'](_0x27c0e5[_0x68df('0x30')][_0x68df('0x1b')]);_0x14b059[_0x68df('0x1d')]=qs['offset'](_0x27c0e5[_0x68df('0x30')][_0x68df('0x1d')]);}return _0x40589e[_0x68df('0x4f')](_0x14b059);}})['then'](function(_0x115d0a){if(_0x115d0a){return _0x115d0a?{'count':_0x14a070,'rows':_0x115d0a}:null;}})[_0x68df('0x23')](respondWithResult(_0x1c20b7,null))[_0x68df('0x44')](handleError(_0x1c20b7,null));};exports[_0x68df('0x51')]=function(_0x540fb0,_0x1f3e21,_0x3fc22e){if(_0x540fb0[_0x68df('0x49')]['id']){delete _0x540fb0['body']['id'];}return db[_0x68df('0x2c')][_0x68df('0x4b')]({'where':{'id':_0x540fb0[_0x68df('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f3e21,null))['then'](function(_0x4652f2){if(_0x4652f2){return _0x4652f2['setTags'](_0x540fb0[_0x68df('0x49')][_0x68df('0x52')]||[]);}return null;})[_0x68df('0x23')](respondWithResult(_0x1f3e21,null))['catch'](handleError(_0x1f3e21,null));};