var _0xb67ef2=_0x1302;function _0x1e55(){var _0x23d90e=['pid','toUpperCase','ModelType','toString','DeviceApi','nedbObj','defaultProfile','stringify','1203540wPwpNR','events','devicename','begin','GetDeviceBatteryStats','Battery','pow','Device-','Get\x20exist\x20Device()\x20INSTANCE','then','Device','411832YWyYyP','log','shell','length','Begin','SetImportProfileData','4316082JnUwKc','StartBatteryTimeout','5792778OsgBlL','instance','7bpyoCs','DeleteBatteryTimeout','ChangeProfile','ImportProfile','Error:','GetBatteryStats','BuiltType','profile','RunApplication','SaveProfileToDevice','OnTimerGetBattery','hexToRgb','padLeft','/bin/bash','AddDevice','SleepTime','810664LVlzll','1963644DGgdgj','New\x20Device()\x20INSTANCE','substr','vid','SetSleepTimetoDevice','exec','emit','ChangeProfileID','max','profileid','DeviceApi\x20RunApplication','Status','deviceData','Device\x20class','m_TimerGetBattery','GetBatteryStats-','getInstance','setProfileToDevice','613556xzqVyU','img','3vCFmYA','findIndex','battery','openExternal','electron','ProtocolMessage','BaseInfo'];_0x1e55=function(){return _0x23d90e;};return _0x1e55();}(function(_0x1234df,_0x273046){var _0x3fceff=_0x1302,_0x533cc7=_0x1234df();while(!![]){try{var _0x53e022=parseInt(_0x3fceff(0x1c2))/0x1+-parseInt(_0x3fceff(0x1a6))/0x2*(parseInt(_0x3fceff(0x1a8))/0x3)+parseInt(_0x3fceff(0x194))/0x4+-parseInt(_0x3fceff(0x1b7))/0x5+parseInt(_0x3fceff(0x1c8))/0x6*(-parseInt(_0x3fceff(0x1cc))/0x7)+parseInt(_0x3fceff(0x193))/0x8+parseInt(_0x3fceff(0x1ca))/0x9;if(_0x53e022===_0x273046)break;else _0x533cc7['push'](_0x533cc7['shift']());}catch(_0x5a0fcc){_0x533cc7['push'](_0x533cc7['shift']());}}}(_0x1e55,0x5cfd5));const EventEmitter=require(_0xb67ef2(0x1b8)),env=require('../../others/env');var openurl=require(_0xb67ef2(0x1ac))[_0xb67ef2(0x1c4)],evtType=require('../../others/EventVariable')['EventTypes'];class Device extends EventEmitter{constructor(){var _0x5a7f17=_0xb67ef2;env[_0x5a7f17(0x1c3)](_0x5a7f17(0x1c1),_0x5a7f17(0x1a1),_0x5a7f17(0x1ba)),super();}static[_0xb67ef2(0x1a4)](){var _0x25e3e7=_0xb67ef2;return this[_0x25e3e7(0x1cb)]?(env[_0x25e3e7(0x1c3)]('Device',_0x25e3e7(0x1a4),_0x25e3e7(0x1bf)),this[_0x25e3e7(0x1cb)]):(env[_0x25e3e7(0x1c3)]('Device',_0x25e3e7(0x1a4),_0x25e3e7(0x195)),this[_0x25e3e7(0x1cb)]=new Device(),this[_0x25e3e7(0x1cb)]);}['SaveProfileToDevice'](_0x1e6331,_0xc3c51e){var _0x31f397=_0xb67ef2;env[_0x31f397(0x1c3)](_0x1e6331[_0x31f397(0x1ae)]['devicename'],_0x31f397(0x18c),_0x31f397(0x18c));var _0x472fbb=_0x1e6331[_0x31f397(0x1ae)],_0x12b2f0=_0x472fbb[_0x31f397(0x1b5)],_0x1ff490={'vid':_0x472fbb[_0x31f397(0x197)],'pid':_0x472fbb[_0x31f397(0x1af)],'SN':_0x472fbb['SN'],'devicename':_0x472fbb[_0x31f397(0x1b9)],'ModelType':_0x472fbb[_0x31f397(0x1b1)],'image':_0x472fbb[_0x31f397(0x1a7)],'battery':_0x472fbb[_0x31f397(0x1aa)],'profile':_0x12b2f0,'profileindex':0x1};this[_0x31f397(0x1b4)][_0x31f397(0x191)](_0x1ff490)[_0x31f397(0x1c0)](()=>{_0xc3c51e(_0x1ff490);});}['setProfileToDevice'](_0xe193ab,_0x364285){var _0x5ed5e8=_0xb67ef2;env[_0x5ed5e8(0x1c3)](_0xe193ab[_0x5ed5e8(0x1ae)]['devicename'],_0x5ed5e8(0x1a5),_0x5ed5e8(0x1c6)),(this[_0x5ed5e8(0x1b4)]['updateDevice'](_0xe193ab[_0x5ed5e8(0x1ae)]['SN'],_0xe193ab['deviceData']),_0x364285());}[_0xb67ef2(0x1ce)](_0x2ef3e8,_0x4f67a2,_0x4acc1c){var _0x1cb4d5=_0xb67ef2;try{this[_0x1cb4d5(0x19b)](_0x2ef3e8,_0x4f67a2,function(_0x285ad3){_0x4acc1c(_0x4f67a2);});}catch(_0x48007a){env[_0x1cb4d5(0x1c3)](_0x2ef3e8[_0x1cb4d5(0x1ae)]['devicename'],_0x1cb4d5(0x1ce),''+_0x48007a),_0x4acc1c();}}[_0xb67ef2(0x18e)](_0x133b4b){var _0x20d825=_0xb67ef2;try{var _0x2dcef6=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i[_0x20d825(0x199)](_0x133b4b);return _0x2dcef6?{'color':{'R':parseInt(_0x2dcef6[0x1],0x10),'G':parseInt(_0x2dcef6[0x2],0x10),'B':parseInt(_0x2dcef6[0x3],0x10)}}:null;}catch{return 0x1;}}[_0xb67ef2(0x18f)](_0x456f76,_0x40e432){var _0x3a38ce=_0xb67ef2,_0xb4b9f=Math['abs'](_0x456f76),_0x571b79=Math[_0x3a38ce(0x19c)](0x0,_0x40e432-Math['floor'](_0xb4b9f)['toString']()[_0x3a38ce(0x1c5)]),_0x4a6c04=Math[_0x3a38ce(0x1bd)](0xa,_0x571b79)['toString']()[_0x3a38ce(0x196)](0x1);return _0x456f76<0x0&&(_0x4a6c04='-'+_0x4a6c04),_0x4a6c04+_0xb4b9f;}[_0xb67ef2(0x18b)](_0x4e04c2,_0x5a7f3a){var _0x4b7766=_0xb67ef2;env[_0x4b7766(0x1c3)](_0x4b7766(0x19e),'RunApplication',JSON[_0x4b7766(0x1b6)](_0x4e04c2)),env['isWindows']?openurl[_0x4b7766(0x1ab)](_0x4e04c2):(_0x4e04c2='open\x20-nF\x20'+_0x4e04c2,exec(_0x4e04c2,{'shell':_0x4b7766(0x190)},function(_0x384137,_0x323bb1){}));}[_0xb67ef2(0x1cf)](_0x510bfa,_0x1f1357,_0x1a9caa){var _0x46882a=_0xb67ef2;env[_0x46882a(0x1c3)]('DeviceApi\x20ImportProfile','ImportProfile',JSON[_0x46882a(0x1b6)](_0x1f1357));let _0x5d033a=_0x510bfa[_0x46882a(0x1a0)][_0x46882a(0x18a)][_0x46882a(0x1a9)](_0x46a14e=>_0x46a14e[_0x46882a(0x19d)]==_0x1f1357[_0x46882a(0x19d)]);-0x1!=_0x5d033a&&(_0x510bfa[_0x46882a(0x1a0)][_0x46882a(0x18a)][_0x5d033a]=_0x1f1357,this[_0x46882a(0x1c7)](_0x510bfa,0x0,function(){_0x1a9caa();}));}[_0xb67ef2(0x192)](_0x1fa28e,_0x1694c4,_0x26bdf9){var _0x5bc619=_0xb67ef2;env[_0x5bc619(0x1c3)](_0x5bc619(0x1b3),'SleepTime',JSON[_0x5bc619(0x1b6)](_0x1694c4)),this[_0x5bc619(0x198)](_0x1fa28e,_0x1694c4,function(){_0x26bdf9();});}['NumTo16Decimal'](_0x4e496b){var _0x708260=_0xb67ef2;for(var _0x5196f4=Number(_0x4e496b)[_0x708260(0x1b2)](0x10)[_0x708260(0x1b0)]();_0x5196f4['length']<0x4;)_0x5196f4='0'+_0x5196f4;return _0x5196f4;}[_0xb67ef2(0x18d)](_0x4bdcac){var _0xef0653=_0xb67ef2,_0x1dea0e=this;try{if(0x1==env[_0xef0653(0x189)])return;_0x4bdcac[_0xef0653(0x1ae)][_0xef0653(0x1aa)]&&_0x1dea0e[_0xef0653(0x1bb)](_0x4bdcac,0x0,function(_0x13f5a7){var _0x3db9de=_0xef0653;if(0x0!=_0x13f5a7){var _0x315855={'Func':evtType[_0x3db9de(0x1d1)],'SN':_0x4bdcac[_0x3db9de(0x1ae)]['SN'],'Param':_0x13f5a7};0x0==_0x13f5a7[_0x3db9de(0x19f)]&&_0x1dea0e['emit'](evtType['ProtocolMessage'],_0x315855);}});}catch(_0x36019e){env[_0xef0653(0x1c3)]('Device:'+_0x4bdcac[_0xef0653(0x1ae)]['devicename'],_0xef0653(0x18d),_0xef0653(0x1d0)+_0x36019e);}}[_0xb67ef2(0x1cd)](_0x2557df,_0x27cd3b,_0x485506){var _0xb865bc=_0xb67ef2;null!=_0x2557df[_0xb865bc(0x1a2)]&&(clearInterval(_0x2557df[_0xb865bc(0x1a2)]),delete _0x2557df['m_TimerGetBattery']),_0x485506();}[_0xb67ef2(0x1c9)](_0x48ad35,_0x205712,_0x3898f9){var _0xf0d961=_0xb67ef2;if(_0x48ad35['BaseInfo'][_0xf0d961(0x1aa)]&&null==_0x48ad35['m_TimerGetBattery']){var _0x5ad754=this;_0x48ad35['m_TimerGetBattery']=setInterval(()=>_0x5ad754['OnTimerGetBattery'](_0x48ad35),0x1388);}_0x3898f9();}[_0xb67ef2(0x1d1)](_0x5f1353,_0x4f7882,_0x3a4c55){var _0xde28e7=_0xb67ef2,_0x20facc=this;0x1!=env['BuiltType']&&_0x5f1353[_0xde28e7(0x1ae)]['battery']?_0x20facc[_0xde28e7(0x1bb)](_0x5f1353,0x0,function(_0x32c844){var _0x7a2aea=_0xde28e7;if(0x0!=_0x32c844){0x1==_0x32c844[_0x7a2aea(0x19f)]&&(_0x32c844[_0x7a2aea(0x19f)]=0x0,_0x32c844['Battery']='Device\x20Not\x20Detected');var _0x208c6d={'Func':'GetBatteryStats','SN':_0x5f1353['BaseInfo']['SN'],'Param':_0x32c844};_0x20facc[_0x7a2aea(0x19a)](evtType[_0x7a2aea(0x1ad)],_0x208c6d),env[_0x7a2aea(0x1c3)](_0x7a2aea(0x1be)+_0x5f1353[_0x7a2aea(0x1ae)][_0x7a2aea(0x1b9)],_0x7a2aea(0x1a3)+JSON[_0x7a2aea(0x1b6)](_0x32c844['Status'])+':',JSON[_0x7a2aea(0x1b6)](_0x32c844[_0x7a2aea(0x1bc)])),_0x3a4c55(_0x32c844);}else _0x3a4c55(0x0);}):_0x3a4c55(0x0);}}function _0x1302(_0x2bbe56,_0x26d456){var _0x1e551e=_0x1e55();return _0x1302=function(_0x130275,_0x48165f){_0x130275=_0x130275-0x189;var _0x573717=_0x1e551e[_0x130275];return _0x573717;},_0x1302(_0x2bbe56,_0x26d456);}module['exports']=Device;