Built motion from commit a9fb64cc6defd8fb3a5cc199221f878e91c0e969. Version 3.0.0...
[motion-next.git] / server / api / user / user.model.js
index f708655..b920b82 100644 (file)
@@ -1 +1 @@
-const a650_0x4a36=['makeSaltAsync','auth','Authenticate','ChanSpy','extensionMonitor','provider','priority','./user.attributes','exports','merge','define','_XCALLY_MIXMONITOR_FORMAT=%s','Invalid\x20password','format','options','utf8_bin','local','defaults','util','findAll','sha1','Hangup','prototype','randomBytes','CDR(type)=%s','base64','join','changed','internal','bulkCreate','concat','from-sip','length','function','google','then','MixMonitor','toString','Missing\x20Callback','chanspy','CDR(type)=internal','isEmpty','pbkdf2Sync','system','name','updateMd5Password','prefix','from','VoiceExtension','password','${UNIQUEID}.%s,ab','WAV','updatePassword','SIP/%s,%s','salt','gsm','%s%s','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','Set','push','indexOf','record','destroy','pbkdf2','utf8','catch','SIP/%s,,tTxXU(xcally-mixmonitor-context)','recordingFormat','User','context','encryptPassword',':asterisk:','sequelize','includes'];(function(_0x5cd217,_0x4a3603){const _0x72946f=function(_0x36831b){while(--_0x36831b){_0x5cd217['push'](_0x5cd217['shift']());}};_0x72946f(++_0x4a3603);}(a650_0x4a36,0x10a));const a650_0x7294=function(_0x5cd217,_0x4a3603){_0x5cd217=_0x5cd217-0x0;let _0x72946f=a650_0x4a36[_0x5cd217];return _0x72946f;};const _0x52ed09=a650_0x7294;'use strict';const _=require('lodash'),util=require(_0x52ed09('0x30')),crypto=require('crypto'),md5=require('md5'),sequelize=require(_0x52ed09('0x1c')),{Op}=sequelize,attributes=require(_0x52ed09('0x25')),addUserApplication=function(_0x36831b,_0x2b1382){const _0x4928dd=_0x52ed09,_0x43bb3a=['wav',_0x4928dd('0x7'),_0x4928dd('0xb')],_0x16ad58={'context':_0x36831b[_0x4928dd('0x19')]||_0x4928dd('0x3d'),'exten':_0x2b1382,'type':_0x4928dd('0x49'),'isApp':![],'UserId':_0x36831b['id']},_0x387b04=[{'app':_0x4928dd('0xe'),'appdata':_0x4928dd('0x46')}];_0x36831b[_0x4928dd('0x22')]&&_[_0x4928dd('0x1d')](_0x43bb3a,_0x36831b[_0x4928dd('0x22')])?(_0x387b04[_0x4928dd('0xf')]({'app':_0x4928dd('0xe'),'appdata':_0x4928dd('0xd')}),_0x387b04[_0x4928dd('0xf')]({'app':_0x4928dd('0xe'),'appdata':util[_0x4928dd('0x2b')](_0x4928dd('0x29'),_0x36831b[_0x4928dd('0x22')])}),_0x387b04[_0x4928dd('0xf')]({'app':'Dial','appdata':util[_0x4928dd('0x2b')](_0x4928dd('0x16'),_0x36831b['name'])})):_0x387b04[_0x4928dd('0xf')]({'app':'Dial','appdata':util[_0x4928dd('0x2b')]('SIP/%s,,tTxX',_0x36831b[_0x4928dd('0x0')])});_0x387b04[_0x4928dd('0xf')]({'app':_0x4928dd('0x33')});for(let _0x3a8603=0x0;_0x3a8603<_0x387b04['length'];_0x3a8603++){_0x387b04[_0x3a8603][_0x4928dd('0x24')]=_0x3a8603+0x1,_0x387b04[_0x3a8603]=_[_0x4928dd('0x2f')](_0x387b04[_0x3a8603],_0x16ad58);}return _0x387b04;},addChanSpyApplications=function(_0x4880a2,_0x354286,_0x1221b3){const _0x15c2f5=_0x52ed09,_0x523f60={'context':_0x4880a2[_0x15c2f5('0x19')]||'from-sip','type':_0x15c2f5('0x49'),'isApp':![],'UserId':_0x4880a2['id']},_0x7bd785=[];for(let _0x1d128a=0x0,_0x32b202=0x1;_0x1d128a<_0x1221b3[_0x15c2f5('0x3e')];_0x1d128a++,_0x32b202=0x1){const _0x3ea2c5={'exten':util['format'](_0x15c2f5('0xc'),_0x1221b3[_0x1d128a][_0x15c2f5('0x2')],_0x354286),'ChanSpyId':_0x1221b3[_0x1d128a]['id']};_0x7bd785[_0x15c2f5('0xf')](_[_0x15c2f5('0x27')]({'app':_0x15c2f5('0xe'),'appdata':util[_0x15c2f5('0x2b')](_0x15c2f5('0x36'),'chanspy'),'priority':_0x32b202++},_0x523f60,_0x3ea2c5)),_0x1221b3[_0x1d128a][_0x15c2f5('0x11')]&&_0x7bd785[_0x15c2f5('0xf')](_[_0x15c2f5('0x27')]({'app':_0x15c2f5('0x42'),'appdata':util[_0x15c2f5('0x2b')](_0x15c2f5('0x6'),_0x1221b3[_0x1d128a][_0x15c2f5('0x17')]),'priority':_0x32b202++},_0x523f60,_0x3ea2c5)),_0x1221b3[_0x1d128a][_0x15c2f5('0x1f')]&&_0x7bd785['push'](_[_0x15c2f5('0x27')]({'app':_0x15c2f5('0x20'),'appdata':_0x1221b3[_0x1d128a][_0x15c2f5('0x5')],'priority':_0x32b202++},_0x523f60,_0x3ea2c5)),_0x7bd785[_0x15c2f5('0xf')](_[_0x15c2f5('0x27')]({'app':_0x15c2f5('0x21'),'appdata':util[_0x15c2f5('0x2b')](_0x15c2f5('0x9'),_0x4880a2[_0x15c2f5('0x0')],_0x1221b3[_0x1d128a][_0x15c2f5('0x2c')]?_0x1221b3[_0x1d128a][_0x15c2f5('0x2c')][_0x15c2f5('0x38')](''):''),'priority':_0x32b202++},_0x523f60,_0x3ea2c5)),_0x1221b3[_0x1d128a]['record']&&_0x7bd785[_0x15c2f5('0xf')](_['merge']({'app':'StopMixMonitor','priority':_0x32b202++},_0x523f60,_0x3ea2c5));}return _0x7bd785;},getChanSpy=function(_0x49ed99,_0x3efdb9){return new Promise(function(_0x2c4422,_0x25a01d){const _0x4c298b=a650_0x7294;return _0x49ed99['VoiceChanSpy'][_0x4c298b('0x31')]()['then'](function(_0x11b329){const _0x573243=_0x4c298b;if(_0x11b329){let _0x39bfb8=addChanSpyApplications(_0x3efdb9,_0x3efdb9[_0x573243('0x3a')],_0x11b329);return _0x3efdb9['internal']!=_0x3efdb9[_0x573243('0x0')]&&(_0x39bfb8=_0x39bfb8[_0x573243('0x3c')](addChanSpyApplications(_0x3efdb9,_0x3efdb9[_0x573243('0x0')],_0x11b329))),_0x2c4422(_0x39bfb8);}return _0x2c4422([]);})[_0x4c298b('0x15')](function(_0x2096c2){_0x25a01d(_0x2096c2);});});},authTypes=[_0x52ed09('0x40'),_0x52ed09('0x2e')];module[_0x52ed09('0x26')]=function(_0x1570bb){const _0x229f52=_0x52ed09,_0x16090a=_0x1570bb['models'],_0x13a408=_0x1570bb[_0x229f52('0x28')](_0x229f52('0x18'),attributes,{'tableName':'users','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3b82d7){return _0x3b82d7['updateMd5Password'](),_0x3b82d7['updatePassword']();},'beforeUpdate':function(_0x2de75e){const _0x1040e3=_0x229f52;return _0x2de75e[_0x1040e3('0x39')]('password')?(_0x2de75e['updateMd5Password'](),_0x2de75e[_0x1040e3('0x8')]()):Promise['resolve']();},'afterCreate':function(_0x5bb219){const _0x153f4c=_0x229f52;let _0x116718=addUserApplication(_0x5bb219,_0x5bb219['internal']);return _0x5bb219[_0x153f4c('0x3a')]!=_0x5bb219[_0x153f4c('0x0')]&&(_0x116718=_0x116718[_0x153f4c('0x3c')](addUserApplication(_0x5bb219,_0x5bb219[_0x153f4c('0x0')]))),_0x16090a['VoiceExtension'][_0x153f4c('0x3b')](_0x116718)[_0x153f4c('0x41')](function(){const _0x37a2ad=_0x153f4c;if(_0x5bb219[_0x37a2ad('0x45')])return getChanSpy(_0x16090a,_0x5bb219);})[_0x153f4c('0x41')](function(_0x3c32ce){const _0x426d30=_0x153f4c;return _0x3c32ce&&_0x3c32ce['length']?_0x16090a[_0x426d30('0x4')][_0x426d30('0x3b')](_0x3c32ce):null;})[_0x153f4c('0x15')](function(_0x37a4e9){return _0x37a4e9;});},'afterUpdate':function(_0x1407cc){const _0x77e747=_0x229f52;return Promise['resolve']()[_0x77e747('0x41')](function(){const _0x31b1c5=_0x77e747;if(_0x1407cc['changed'](_0x31b1c5('0x45'))||_0x1407cc[_0x31b1c5('0x39')](_0x31b1c5('0x19')))return _0x16090a['VoiceExtension'][_0x31b1c5('0x12')]({'where':{'UserId':_0x1407cc['id'],'type':_0x31b1c5('0x49'),'ChanSpyId':{[Op['ne']]:null}}})[_0x31b1c5('0x41')](function(){const _0x5e5f45=_0x31b1c5;if(_0x1407cc['chanspy'])return getChanSpy(_0x16090a,_0x1407cc)[_0x5e5f45('0x41')](function(_0x267e70){const _0x3c8b71=_0x5e5f45;if(_0x267e70&&_0x267e70[_0x3c8b71('0x3e')])return _0x16090a['VoiceExtension'][_0x3c8b71('0x3b')](_0x267e70);});});})[_0x77e747('0x41')](function(){const _0x47fc5e=_0x77e747;return _0x1407cc[_0x47fc5e('0x39')](_0x47fc5e('0x22'))||_0x1407cc[_0x47fc5e('0x39')](_0x47fc5e('0x19'))?_0x16090a[_0x47fc5e('0x4')][_0x47fc5e('0x12')]({'where':{'UserId':_0x1407cc['id'],'type':'system','ChanSpyId':null}})['then'](function(){const _0x1fbbf8=_0x47fc5e;let _0x3bdf3d=addUserApplication(_0x1407cc,_0x1407cc[_0x1fbbf8('0x3a')]);return _0x1407cc[_0x1fbbf8('0x3a')]!=_0x1407cc[_0x1fbbf8('0x0')]&&(_0x3bdf3d=_0x3bdf3d[_0x1fbbf8('0x3c')](addUserApplication(_0x1407cc,_0x1407cc[_0x1fbbf8('0x0')]))),_0x16090a['VoiceExtension']['bulkCreate'](_0x3bdf3d);}):null;})[_0x77e747('0x15')](function(_0x1c72e2){return _0x1c72e2;});},'afterDestroy':function(_0x1ffb8e){const _0x18e12b=_0x229f52;return _0x16090a[_0x18e12b('0x4')]['destroy']({'where':{'UserId':_0x1ffb8e['id'],'type':_0x18e12b('0x49')}});}},'charset':_0x229f52('0x14'),'collate':_0x229f52('0x2d')});return _0x13a408[_0x229f52('0x34')]['authenticate']=function(_0x290ccd,_0x1a48f1){const _0x1f51a7=_0x229f52;if(!_0x1a48f1)return this['password']===this[_0x1f51a7('0x1a')](_0x290ccd);const _0x9b38f=this;this[_0x1f51a7('0x1a')](_0x290ccd,function(_0xf94a59,_0x421ef1){const _0xda72ef=_0x1f51a7;_0xf94a59&&_0x1a48f1(_0xf94a59),_0x9b38f[_0xda72ef('0x5')]===_0x421ef1?_0x1a48f1(null,!![]):_0x1a48f1(null,![]);});},_0x13a408[_0x229f52('0x34')]['makeSalt']=function(_0x5f5c06,_0x451223){const _0x33fa49=_0x229f52,_0x4fae41=0x10;if(typeof arguments[0x0]===_0x33fa49('0x3f'))_0x451223=arguments[0x0],_0x5f5c06=_0x4fae41;else{if(typeof arguments[0x1]===_0x33fa49('0x3f'))_0x451223=arguments[0x1];else throw new Error(_0x33fa49('0x44'));}return!_0x5f5c06&&(_0x5f5c06=_0x4fae41),crypto[_0x33fa49('0x35')](_0x5f5c06,function(_0x14d887,_0x5c2fad){const _0x3c14d6=_0x33fa49;return _0x14d887&&_0x451223(_0x14d887),_0x451223(null,_0x5c2fad[_0x3c14d6('0x43')](_0x3c14d6('0x37')));});},_0x13a408[_0x229f52('0x34')][_0x229f52('0x1e')]=async function(_0xf73f9b=0x10){return new Promise((_0xdd691d,_0x47aa0a)=>{const _0x315921=a650_0x7294;crypto[_0x315921('0x35')](_0xf73f9b,function(_0x2a1e43,_0x450077){const _0x55664b=_0x315921;return _0x2a1e43&&_0x47aa0a(_0x2a1e43),_0xdd691d(_0x450077[_0x55664b('0x43')](_0x55664b('0x37')));});});},_0x13a408[_0x229f52('0x34')][_0x229f52('0x1a')]=function(_0x50a4f6,_0x2add4a){const _0x6dd730=_0x229f52;if(!_0x50a4f6||!this[_0x6dd730('0xa')])return _0x2add4a?_0x2add4a(null):null;const _0x276c5a=0x2710,_0x316713=0x40,_0x3a6340=Buffer[_0x6dd730('0x3')](this['salt'],_0x6dd730('0x37'));if(!_0x2add4a)return crypto[_0x6dd730('0x48')](_0x50a4f6,_0x3a6340,_0x276c5a,_0x316713,_0x6dd730('0x32'))[_0x6dd730('0x43')]('base64');return crypto[_0x6dd730('0x13')](_0x50a4f6,_0x3a6340,_0x276c5a,_0x316713,_0x6dd730('0x32'),function(_0x26f70c,_0xfd70e7){const _0xf3ae81=_0x6dd730;return _0x26f70c&&_0x2add4a(_0x26f70c),_0x2add4a(null,_0xfd70e7[_0xf3ae81('0x43')](_0xf3ae81('0x37')));});},_0x13a408[_0x229f52('0x34')][_0x229f52('0x8')]=async function(){const _0x3dd7ed=_0x229f52;if(!this['password'])return null;if(!_[_0x3dd7ed('0x47')](this[_0x3dd7ed('0x5')])&&authTypes[_0x3dd7ed('0x10')](this[_0x3dd7ed('0x23')])===-0x1)throw new Error(_0x3dd7ed('0x2a'));return this[_0x3dd7ed('0xa')]=await this[_0x3dd7ed('0x1e')](),new Promise((_0x2dd0a0,_0x1ccb5d)=>{const _0x5e3d4e=_0x3dd7ed;this[_0x5e3d4e('0x1a')](this[_0x5e3d4e('0x5')],(_0x5896f4,_0x3f7e77)=>{const _0x363e97=_0x5e3d4e;_0x5896f4?_0x1ccb5d(_0x5896f4):(this[_0x363e97('0x5')]=_0x3f7e77,_0x2dd0a0());});});},_0x13a408['prototype'][_0x229f52('0x1')]=function(){const _0x454504=_0x229f52;this['md5secret']=md5(this[_0x454504('0x0')]+_0x454504('0x1b')+this[_0x454504('0x5')]);},_0x13a408;};
\ No newline at end of file
+const a650_0x40b7=[':asterisk:','from-sip','isEmpty','system','VoiceChanSpy','VoiceExtension','internal','SIP/%s,%s','StopMixMonitor','WAV','MixMonitor','users','sha1','defaults','md5secret','catch','crypto','concat','local','Hangup','define','prefix','from','base64','User','google','provider','options','then','wav','CDR(type)=%s','function','pbkdf2','merge','prototype','findAll','chanspy','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','exports','push','name','resolve','SIP/%s,,tTxX','extensionMonitor','changed','encryptPassword','pbkdf2Sync','lodash','indexOf','utf8_bin','format','context','sequelize','length','Missing\x20Callback','gsm','Invalid\x20password','_XCALLY_MIXMONITOR_FORMAT=%s','bulkCreate','priority','updateMd5Password','salt','join','randomBytes','models','record','password','${UNIQUEID}.%s,ab','makeSaltAsync','Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)','recordingFormat','auth','updatePassword','toString','authenticate','Set','destroy','%s%s'];(function(_0x3d0bc7,_0x40b741){const _0x5a3c0a=function(_0x4f01e5){while(--_0x4f01e5){_0x3d0bc7['push'](_0x3d0bc7['shift']());}};_0x5a3c0a(++_0x40b741);}(a650_0x40b7,0x164));const a650_0x5a3c=function(_0x3d0bc7,_0x40b741){_0x3d0bc7=_0x3d0bc7-0x0;let _0x5a3c0a=a650_0x40b7[_0x3d0bc7];return _0x5a3c0a;};const _0x4f110f=a650_0x5a3c;'use strict';const _=require(_0x4f110f('0x7')),util=require('util'),crypto=require(_0x4f110f('0x37')),md5=require('md5'),sequelize=require(_0x4f110f('0xc')),{Op}=sequelize,attributes=require('./user.attributes'),addUserApplication=function(_0x4f01e5,_0x4b702b){const _0x8a245=_0x4f110f,_0x4bb303=[_0x8a245('0x44'),_0x8a245('0x30'),_0x8a245('0xf')],_0x5c65f7={'context':_0x4f01e5[_0x8a245('0xb')]||_0x8a245('0x28'),'exten':_0x4b702b,'type':'system','isApp':![],'UserId':_0x4f01e5['id']},_0x1970fd=[{'app':_0x8a245('0x24'),'appdata':'CDR(type)=internal'}];_0x4f01e5['extensionMonitor']&&_['includes'](_0x4bb303,_0x4f01e5['extensionMonitor'])?(_0x1970fd[_0x8a245('0x4e')]({'app':'Set','appdata':_0x8a245('0x4c')}),_0x1970fd[_0x8a245('0x4e')]({'app':_0x8a245('0x24'),'appdata':util[_0x8a245('0xa')](_0x8a245('0x11'),_0x4f01e5[_0x8a245('0x3')])}),_0x1970fd[_0x8a245('0x4e')]({'app':_0x8a245('0x1d'),'appdata':util[_0x8a245('0xa')](_0x8a245('0x1e'),_0x4f01e5[_0x8a245('0x0')])})):_0x1970fd[_0x8a245('0x4e')]({'app':_0x8a245('0x1d'),'appdata':util[_0x8a245('0xa')](_0x8a245('0x2'),_0x4f01e5['name'])});_0x1970fd[_0x8a245('0x4e')]({'app':_0x8a245('0x3a')});for(let _0x396f70=0x0;_0x396f70<_0x1970fd[_0x8a245('0xd')];_0x396f70++){_0x1970fd[_0x396f70][_0x8a245('0x13')]=_0x396f70+0x1,_0x1970fd[_0x396f70]=_[_0x8a245('0x34')](_0x1970fd[_0x396f70],_0x5c65f7);}return _0x1970fd;},addChanSpyApplications=function(_0x3eb00f,_0x5d75bf,_0x3ecd87){const _0x3f3e04=_0x4f110f,_0xa62745={'context':_0x3eb00f[_0x3f3e04('0xb')]||_0x3f3e04('0x28'),'type':_0x3f3e04('0x2a'),'isApp':![],'UserId':_0x3eb00f['id']},_0x5d4b61=[];for(let _0x4c5c32=0x0,_0x5305b8=0x1;_0x4c5c32<_0x3ecd87['length'];_0x4c5c32++,_0x5305b8=0x1){const _0x563c2f={'exten':util[_0x3f3e04('0xa')](_0x3f3e04('0x26'),_0x3ecd87[_0x4c5c32][_0x3f3e04('0x3c')],_0x5d75bf),'ChanSpyId':_0x3ecd87[_0x4c5c32]['id']};_0x5d4b61[_0x3f3e04('0x4e')](_[_0x3f3e04('0x48')]({'app':'Set','appdata':util[_0x3f3e04('0xa')](_0x3f3e04('0x45'),_0x3f3e04('0x4b')),'priority':_0x5305b8++},_0xa62745,_0x563c2f)),_0x3ecd87[_0x4c5c32][_0x3f3e04('0x19')]&&_0x5d4b61[_0x3f3e04('0x4e')](_[_0x3f3e04('0x48')]({'app':_0x3f3e04('0x31'),'appdata':util['format'](_0x3f3e04('0x1b'),_0x3ecd87[_0x4c5c32][_0x3f3e04('0x1f')]),'priority':_0x5305b8++},_0xa62745,_0x563c2f)),_0x3ecd87[_0x4c5c32][_0x3f3e04('0x20')]&&_0x5d4b61[_0x3f3e04('0x4e')](_[_0x3f3e04('0x48')]({'app':'Authenticate','appdata':_0x3ecd87[_0x4c5c32]['password'],'priority':_0x5305b8++},_0xa62745,_0x563c2f)),_0x5d4b61[_0x3f3e04('0x4e')](_[_0x3f3e04('0x48')]({'app':'ChanSpy','appdata':util['format'](_0x3f3e04('0x2e'),_0x3eb00f[_0x3f3e04('0x0')],_0x3ecd87[_0x4c5c32][_0x3f3e04('0x42')]?_0x3ecd87[_0x4c5c32][_0x3f3e04('0x42')][_0x3f3e04('0x16')](''):''),'priority':_0x5305b8++},_0xa62745,_0x563c2f)),_0x3ecd87[_0x4c5c32][_0x3f3e04('0x19')]&&_0x5d4b61['push'](_[_0x3f3e04('0x48')]({'app':_0x3f3e04('0x2f'),'priority':_0x5305b8++},_0xa62745,_0x563c2f));}return _0x5d4b61;},getChanSpy=function(_0x5ac5bc,_0x313ae0){return new Promise(function(_0x284f6f,_0x26bd36){const _0x3a1d9a=a650_0x5a3c;return _0x5ac5bc[_0x3a1d9a('0x2b')][_0x3a1d9a('0x4a')]()[_0x3a1d9a('0x43')](function(_0x18dff3){const _0x30195e=_0x3a1d9a;if(_0x18dff3){let _0x17dc96=addChanSpyApplications(_0x313ae0,_0x313ae0[_0x30195e('0x2d')],_0x18dff3);return _0x313ae0[_0x30195e('0x2d')]!=_0x313ae0['name']&&(_0x17dc96=_0x17dc96[_0x30195e('0x38')](addChanSpyApplications(_0x313ae0,_0x313ae0[_0x30195e('0x0')],_0x18dff3))),_0x284f6f(_0x17dc96);}return _0x284f6f([]);})[_0x3a1d9a('0x36')](function(_0x57e93b){_0x26bd36(_0x57e93b);});});},authTypes=[_0x4f110f('0x40'),_0x4f110f('0x39')];module[_0x4f110f('0x4d')]=function(_0x20de08){const _0x5cfb7a=_0x4f110f,_0x583bec=_0x20de08[_0x5cfb7a('0x18')],_0x760d30=_0x20de08[_0x5cfb7a('0x3b')](_0x5cfb7a('0x3f'),attributes,{'tableName':_0x5cfb7a('0x32'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24e585){const _0x567361=_0x5cfb7a;return _0x24e585[_0x567361('0x14')](),_0x24e585[_0x567361('0x21')]();},'beforeUpdate':function(_0x403158){const _0x43f6df=_0x5cfb7a;return _0x403158[_0x43f6df('0x4')]('password')?(_0x403158['updateMd5Password'](),_0x403158[_0x43f6df('0x21')]()):Promise[_0x43f6df('0x1')]();},'afterCreate':function(_0x348a9d){const _0x4add0f=_0x5cfb7a;let _0x20c3d4=addUserApplication(_0x348a9d,_0x348a9d[_0x4add0f('0x2d')]);return _0x348a9d['internal']!=_0x348a9d[_0x4add0f('0x0')]&&(_0x20c3d4=_0x20c3d4[_0x4add0f('0x38')](addUserApplication(_0x348a9d,_0x348a9d['name']))),_0x583bec[_0x4add0f('0x2c')]['bulkCreate'](_0x20c3d4)[_0x4add0f('0x43')](function(){const _0x279c21=_0x4add0f;if(_0x348a9d[_0x279c21('0x4b')])return getChanSpy(_0x583bec,_0x348a9d);})['then'](function(_0x52bed2){const _0x4ca7d9=_0x4add0f;return _0x52bed2&&_0x52bed2[_0x4ca7d9('0xd')]?_0x583bec[_0x4ca7d9('0x2c')][_0x4ca7d9('0x12')](_0x52bed2):null;})[_0x4add0f('0x36')](function(_0xf21132){return _0xf21132;});},'afterUpdate':function(_0x4886d2){const _0x1c9aec=_0x5cfb7a;return Promise[_0x1c9aec('0x1')]()[_0x1c9aec('0x43')](function(){const _0x354c71=_0x1c9aec;if(_0x4886d2[_0x354c71('0x4')](_0x354c71('0x4b'))||_0x4886d2[_0x354c71('0x4')](_0x354c71('0xb')))return _0x583bec[_0x354c71('0x2c')][_0x354c71('0x25')]({'where':{'UserId':_0x4886d2['id'],'type':'system','ChanSpyId':{[Op['ne']]:null}}})['then'](function(){if(_0x4886d2['chanspy'])return getChanSpy(_0x583bec,_0x4886d2)['then'](function(_0x272a18){const _0x1633d0=a650_0x5a3c;if(_0x272a18&&_0x272a18[_0x1633d0('0xd')])return _0x583bec[_0x1633d0('0x2c')][_0x1633d0('0x12')](_0x272a18);});});})[_0x1c9aec('0x43')](function(){const _0x2bcc56=_0x1c9aec;return _0x4886d2[_0x2bcc56('0x4')](_0x2bcc56('0x3'))||_0x4886d2[_0x2bcc56('0x4')](_0x2bcc56('0xb'))?_0x583bec['VoiceExtension'][_0x2bcc56('0x25')]({'where':{'UserId':_0x4886d2['id'],'type':_0x2bcc56('0x2a'),'ChanSpyId':null}})[_0x2bcc56('0x43')](function(){const _0x2ee8a5=_0x2bcc56;let _0x40e90e=addUserApplication(_0x4886d2,_0x4886d2[_0x2ee8a5('0x2d')]);return _0x4886d2['internal']!=_0x4886d2['name']&&(_0x40e90e=_0x40e90e[_0x2ee8a5('0x38')](addUserApplication(_0x4886d2,_0x4886d2[_0x2ee8a5('0x0')]))),_0x583bec[_0x2ee8a5('0x2c')][_0x2ee8a5('0x12')](_0x40e90e);}):null;})[_0x1c9aec('0x36')](function(_0x53da83){return _0x53da83;});},'afterDestroy':function(_0x19290e){const _0x191980=_0x5cfb7a;return _0x583bec[_0x191980('0x2c')]['destroy']({'where':{'UserId':_0x19290e['id'],'type':_0x191980('0x2a')}});}},'charset':'utf8','collate':_0x5cfb7a('0x9')});return _0x760d30[_0x5cfb7a('0x49')][_0x5cfb7a('0x23')]=function(_0x4c32cb,_0x44372a){const _0x258caf=_0x5cfb7a;if(!_0x44372a)return this[_0x258caf('0x1a')]===this[_0x258caf('0x5')](_0x4c32cb);const _0x32f25d=this;this[_0x258caf('0x5')](_0x4c32cb,function(_0x2dfc79,_0x4327d3){const _0x2b7c35=_0x258caf;_0x2dfc79&&_0x44372a(_0x2dfc79),_0x32f25d[_0x2b7c35('0x1a')]===_0x4327d3?_0x44372a(null,!![]):_0x44372a(null,![]);});},_0x760d30[_0x5cfb7a('0x49')]['makeSalt']=function(_0x58608d,_0x2d1660){const _0x402bb7=_0x5cfb7a,_0x169561=0x10;if(typeof arguments[0x0]==='function')_0x2d1660=arguments[0x0],_0x58608d=_0x169561;else{if(typeof arguments[0x1]===_0x402bb7('0x46'))_0x2d1660=arguments[0x1];else throw new Error(_0x402bb7('0xe'));}return!_0x58608d&&(_0x58608d=_0x169561),crypto['randomBytes'](_0x58608d,function(_0x43c504,_0x17cb77){const _0x4f963b=_0x402bb7;return _0x43c504&&_0x2d1660(_0x43c504),_0x2d1660(null,_0x17cb77['toString'](_0x4f963b('0x3e')));});},_0x760d30[_0x5cfb7a('0x49')][_0x5cfb7a('0x1c')]=async function(_0x484e8c=0x10){return new Promise((_0x2424f3,_0x313ef0)=>{const _0x7ecede=a650_0x5a3c;crypto[_0x7ecede('0x17')](_0x484e8c,function(_0x54b2d5,_0x4779ba){const _0x256d9b=_0x7ecede;return _0x54b2d5&&_0x313ef0(_0x54b2d5),_0x2424f3(_0x4779ba[_0x256d9b('0x22')]('base64'));});});},_0x760d30['prototype'][_0x5cfb7a('0x5')]=function(_0x21daa4,_0x127c59){const _0x599dfb=_0x5cfb7a;if(!_0x21daa4||!this[_0x599dfb('0x15')])return _0x127c59?_0x127c59(null):null;const _0x107c9b=0x2710,_0x58429e=0x40,_0x4c9c49=Buffer[_0x599dfb('0x3d')](this['salt'],_0x599dfb('0x3e'));if(!_0x127c59)return crypto[_0x599dfb('0x6')](_0x21daa4,_0x4c9c49,_0x107c9b,_0x58429e,_0x599dfb('0x33'))['toString']('base64');return crypto[_0x599dfb('0x47')](_0x21daa4,_0x4c9c49,_0x107c9b,_0x58429e,'sha1',function(_0x13b171,_0x48ab40){const _0x59230e=_0x599dfb;return _0x13b171&&_0x127c59(_0x13b171),_0x127c59(null,_0x48ab40[_0x59230e('0x22')](_0x59230e('0x3e')));});},_0x760d30[_0x5cfb7a('0x49')][_0x5cfb7a('0x21')]=async function(){const _0x4af288=_0x5cfb7a;if(!this[_0x4af288('0x1a')])return null;if(!_[_0x4af288('0x29')](this['password'])&&authTypes[_0x4af288('0x8')](this[_0x4af288('0x41')])===-0x1)throw new Error(_0x4af288('0x10'));return this[_0x4af288('0x15')]=await this[_0x4af288('0x1c')](),new Promise((_0x2c44ad,_0x3f23ad)=>{const _0x20ae04=_0x4af288;this[_0x20ae04('0x5')](this['password'],(_0x18222b,_0x234bc7)=>{const _0x52d126=_0x20ae04;_0x18222b?_0x3f23ad(_0x18222b):(this[_0x52d126('0x1a')]=_0x234bc7,_0x2c44ad());});});},_0x760d30[_0x5cfb7a('0x49')][_0x5cfb7a('0x14')]=function(){const _0x36dec2=_0x5cfb7a;this[_0x36dec2('0x35')]=md5(this['name']+_0x36dec2('0x27')+this[_0x36dec2('0x1a')]);},_0x760d30;};
\ No newline at end of file