";let n;return e?n=JD.prepareCustomDialog(ll("Edit Parameter")+" 'sys_param'",t,ll("Send...")):(n=JD.prepareCustomDialog(ll("Edit Parameter")+" 'iparam'",t,ll("Send..."),`
`)).querySelector("#editBtnAddChannel").addEventListener("click",()=>{try{blxEditedParamGet(0),blx.IparamAddChannel(blxDevice.iparam,!0),blxParametersCopy(!1,0);var e=document.getElementById("blxParameterEdit");e.innerHTML=blxParametersGetHtml(0),e.scrollTop=e.scrollHeight,JD.joPing()}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+" [BaC]")}}),document.getElementById("blxParameterEdit").innerHTML=blxParametersGetHtml(e),await JD.doCustomDialog(0)}function blxParCancel(e){e?blxDevice.sys_param=original_par:blxDevice.iparam=original_par,blxCmdRes&&(blxCmdRes.textContent=ll("Edit Parameters cancelled"))}function blxEditedParamGet(n){var e=(n?blxDevice.sys_param:blxDevice.iparam).length;for(let t=0;t
${e}
`,null),t=e}else try{blxEditedParamGet(0),blx.CompactIparam(blxDevice.iparam),blxParametersCopy(!1,0);var o=blx.IparamValidate(blxDevice.iparam);if(o)throw"ERROR: Iparam-Check(3):\n"+o;var r=(new TextEncoder).encode(blxDevice.iparam.join("\n")+"\n"),s=blx.getCrc32(r);await blStore.get(blxDevice.deviceMAC+"_iparam.lxp");let e=blStore.result();if(void 0!==e&&s===e.v.crc32&&r.length===e.v.akt_len&&!1===blxDevice.iparam_dirtyflag)return blxCmdRes&&(blxCmdRes.textContent=ll("(No Changes)")),JD.spinnerClose(),t;void 0===e&&(e={v:{}}),blxEditedParamGet(0),blxDevice.iparam[4]=(Date.now()/1e3).toFixed(0),blxDevice.iparam_dirtyflag=!0;var d=new TextEncoder;if(e.v.bytebuf=d.encode(blxDevice.iparam.join("\n")+"\n"),e.v.crc32=blx.getCrc32(e.v.bytebuf),e.v.total_len=e.v.bytebuf.length,e.v.akt_len=e.v.total_len,e.v.ctime=new Date(1e3*blxDevice.iparam[4]),e.v.esync_flag=!0,e.v.tssync=void 0,await blStore.set(blxDevice.deviceMAC+"_iparam.lxp",e.v),await _blxCmdSend(".fput "+blxDevice.deviceMAC+"_iparam.lxp"),_blxCmdResult)throw _blxCmdResult;if(await _blxCmdSend("X"),_blxCmdResult)throw _blxCmdResult;blxDevice.iparam_dirtyflag=!1,await blStore.set(blxDevice.deviceMAC+"_#BAK_iparam.lxp",e.v)}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+"[BPa]"),await JD.doDialogOK(ll("ERROR"),ll("Parameter Check")+` 'iparam'
${e}
`,null),t=e}return await updateDeviceList(),JD.spinnerClose(),t}function blxParametersCopy(e,t){var n=t?blxDevice.sys_param:blxDevice.iparam;if(!0===e)if(original_par=[],void 0===n)JD.doDialogOK(ll("ERROR")+": Iparam-Check(1)","No Parameters found!",null);else{for(let e=0;e"):i++;var s,d=void 0!==a[i]?a[i]:"(unknown)";let e,t=(d.indexOf("Timestamp.32")&&1e9[${n}+(+${i})]
+import*as JD from"./jodash.js";import*as QRS from"./qrscanner.js";import*as I18 from"./intmain_i18n.js";import"./blx.js";import"./blStore.js";import"./FileSaver.js";let VERSION="V0.24 / 16.12.2024",COPYRIGHT="(C)JoEmbedded.de",connectionLevel=0,lastAdvertisingName,blxDevice,uplStatus={totalsize:0,mode:"",sumsize:0,filesize:0,filename:"",fproc:0,ndata:!1},deviceListDB=[],defLang=I18.i18_availLang[0],setupOptions={dtheme:!1,font:100,lang:defLang,server:"../sync/blxremote.php",accesstoken:"123456"},isUrlGit,sidebuttonMaincontent=(document.getElementById("bd-version").textContent=VERSION+(0sectionMain.scrollIntoView(!0)),sidebuttonTerminal.addEventListener("click",()=>sectionTerminal.scrollIntoView(!1)),document.getElementById("bd-online")),bdOffline=document.getElementById("bd-offline"),lastOnlineState,blxInfoLine=(sidebuttonBluetooth.addEventListener("click",blxConnect),sidebuttonSetup.addEventListener("click",doSetupDialog),sidebuttonServersync.addEventListener("click",runServerSync),sidebuttonQRscan.addEventListener("click",bdRunQRscanner),document.getElementById("blxInfoLine")),blxGraph=document.getElementById("blxGraph");const blxCmdRes=document.getElementById("blxCmdRes");let blxConnectButtonText=document.getElementById("blxConnectButtonText"),blxMemory=document.getElementById("blxMemory"),blxSync=document.getElementById("blxSync"),blxSignal=document.getElementById("blxSignal"),blxMeasureData=document.getElementById("blxMeasureData"),blxDeviceName=document.getElementById("blxDeviceName"),blxMAC=document.getElementById("blxMAC"),blxType=document.getElementById("blxType"),blxFW=document.getElementById("blxFW"),blxPIN=document.getElementById("blxPIN"),blxBadgeButton=document.getElementById("blxBadgeButton"),blxPinEnter=document.getElementById("blxPinEnter"),blxSyncButton=document.getElementById("blxSyncButton"),blxMeasureButton=document.getElementById("blxMeasureButton"),blxEcholotCheck=document.getElementById("blxEcholot"),blxUploadButton=document.getElementById("blxUploadButton"),blxInfoButton=document.getElementById("blxInfoButton"),blxClearButton=document.getElementById("blxClearButton"),blxParametersButton=document.getElementById("blxParametersButton"),blxSysParButton=document.getElementById("blxSysParButton"),blxSyncButtonSpan=document.getElementById("blxSyncButtonSpan"),blxUploadButtonSpan=document.getElementById("blxUploadButtonSpan"),blxInfoButtonSpan=document.getElementById("blxInfoButtonSpan"),blxClearButtonSpan=document.getElementById("blxClearButtonSpan"),blxParametersSpan=document.getElementById("blxParametersSpan"),blxSetPinButton=document.getElementById("blxSetPinButton"),blxScanPinButton=document.getElementById("blxScanPinButton"),navDevicelist=(blxBadgeButton.addEventListener("click",blxPrintBadge),blxSetPinButton.addEventListener("click",blxSetPin),blxPIN.addEventListener("keyup",blxPinKeyUpEvent),blxScanPinButton.addEventListener("click",blxScanPin),blxInfoButton.addEventListener("click",blxMemoryInfo),blxSyncButton.addEventListener("click",blxSyncTime),blxUploadButton.addEventListener("click",blxUpload),blxMeasureButton.addEventListener("click",blxMeasure),blxEcholotCheck.addEventListener("click",blxEcholotClick),blxClearButton.addEventListener("click",blxClearDevice),blxParametersButton.addEventListener("click",blxEditIparam),blxSysParButton.addEventListener("click",blxEditSysparam),document.getElementById("nav-devicelist")),blxDashBadgeURL,blxAutoPINURL,bdurl=new URL(location),cbSpinner=(isUrlGit=bdurl.host.includes("github."),!1);function ll(e){return I18.ll(e)}async function blxConnect(){let e=!1,t=(blxCmdRes&&(blxCmdRes.textContent="-"),disabler(!0),!1);try{2<=connectionLevel?(JD.spinnerShow("Bluetooth",""+ll("Disconnect"),10,!0),await _blxCmdSend(".d")):(void 0!==lastAdvertisingName&&(t=await JD.doDialogOK(""+ll("Reconnect?"),`${ll("Reconnect to Device?")}
${ll("Name")}: '${lastAdvertisingName}'
`+ll("OK to Reconnect (or close)"))),e=!0,t?await _blxCmdSend(".r"):await _blxCmdSend(".c"),await showLoggerDetails())}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+" [BCo]")}cbSpinner=!1,JD.spinnerClose(),disabler(!1),e&&JD.sidebarMax(.3)}async function disabler(e){var t=blx.getPinOK();e?sidebuttonBluetooth.classList.add("jo-disabled"):sidebuttonBluetooth.classList.remove("jo-disabled");let n="none";if(!0!==t&&!1===e&&3<=connectionLevel&&(n="block"),blxPinEnter&&"block"===(blxPinEnter.style.display=n)&&void 0!==blxAutoPINURL)try{var l=blxAutoPINURL+"&mac="+blxDevice.deviceMAC;console.log("PIN-Fetch: ",l);var a=await(await fetch(l,{method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}})).json();if(parseInt(a.status))throw a.status;blxPIN.value=a.pin,blx.chordsound(1e3),await blxSetPin()}catch(e){JD.joPingError(),JD.doDialogOK(ll("ERROR"),"AutoPIN: "+e)}let i=e;void 0!==blxDevice&&void 0!==blxDevice.devicePIN||(i=!0),blxBadgeButton&&(blxBadgeButton.disabled=i),0!=connectionLevel&&!0===t||(e=!0),blxSyncButton&&(blxSyncButton.disabled=e),blxMeasureButton&&(blxMeasureButton.disabled=e),blxEcholotCheck&&(blxEcholotCheck.disabled=e),blxUploadButton&&(blxUploadButton.disabled=e),blxInfoButton&&(blxInfoButton.disabled=e),blxClearButton&&(blxClearButton.disabled=e),blxParametersButton&&(blxParametersButton.disabled=e),blxSysParButton&&(blxSysParButton.disabled=e),n=void 0!==blxDevice&&1e3<=blxDevice.deviceType?"block":"none",blxSyncButtonSpan&&(blxSyncButtonSpan.style.display=n),blxUploadButtonSpan&&(blxUploadButtonSpan.style.display=n),blxInfoButtonSpan&&(blxInfoButtonSpan.style.display=n),blxClearButtonSpan&&(blxClearButtonSpan.style.display=n),blxParametersSpan&&(blxParametersSpan.style.display=n)}async function showLoggerDetails(){if(3<=connectionLevel){blxDevice=blx.getDevice(),blxMAC&&(blxMAC.textContent=blxDevice.deviceMAC),blxType&&(blxType.textContent=blxDevice.deviceType),blxFW&&(blxFW.textContent=blxDevice.firmwareVersion),4==connectionLevel&&1e3<=blxDevice.deviceType&&(await calculateMemory(!0),await showLink());var t=blxDevice.deltaToApp;let e=t+" "+ll("sec");864e5${ll("Time lost!")}`:86400",e),_blxCmdBusyFlag=!1,_blxCmdRBCnt=0}catch(e){console.log("ERROR:",e),_blxCmdBusyFlag=!1,_blxCmdRBCnt=0,_blxCmdResult=e,connectionLevel<=2&&bleCallback("CON",0)}return n}async function calculateMemory(n){let l="???";try{n&&await _blxCmdSend(".m");var a=blx.getMemory();let e,t=(e=0New: "+a.incnew),l+="] Byte"}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+"[BcM]")}blxMemory.innerHTML=l}async function showLink(){let e=ll("(No Data)");try{await blStore.get(blxDevice.deviceMAC+"_xtract.edt");var t=blStore.result();void 0!==t&&(e=" ${ll("Show Graph")}
(`+t.v.akt_len+" Byte, "+t.v.ctime.toLocaleString()+")")}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+" [BsL]")}blxGraph.innerHTML=e}async function blxMemoryInfo(){disabler(!0),JD.spinnerShow(ll("Memory Info"),null,60,!0);try{await _blxCmdSend("v"),await calculateMemory(!0)}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+" [BMI]")}JD.spinnerClose(),disabler(!1)}async function blxClearDevice(){if(disabler(!0),await JD.doDialogOK(ll("Clear Device?"),ll("OK to clear Device Memory?"),null,!0)){JD.spinnerShow(ll("Clear Device"),null,250);try{void 0!==blxDevice.diskCheckOK&&!0===blxDevice.diskCheckOK?(blxInfoLine&&(blxInfoLine.textContent=ll("Start new Measure, Clear all Data")),await _blxCmdSend("n")):(blxInfoLine&&(blxInfoLine.textContent=ll("Start new Measure, Clear all Data (Clean FlashDisk, may need up to 240 sec)")),await _blxCmdSend("n1",24e4)),document.getElementById("blxMemory").textContent="-",await blStore.remove(blxDevice.deviceMAC+"_xtract.edt"),await showLink()}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+" [BCD]")}JD.spinnerClose()}disabler(!1)}async function blxPinKeyUpEvent(e){13!==e.keyCode&&10!==e.keycode||(e.preventDefault(),blxSetPin())}async function blxSetPin(){blxCmdRes&&(blxCmdRes.textContent="-");var e=blxPIN.value;disabler(!0),JD.spinnerShow(ll("Set PIN"),null,300);try{if(e.length<1)throw"ERROR: PIN EMPTY";await _blxCmdSend(".i "+e),blxPIN.value="",await showLoggerDetails()}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+" [BSP]")}JD.spinnerClose(),disabler(!1)}async function blxScanPin(){await bdRunQRscanner(blxDevice.deviceMAC)}async function blxSyncTime(){disabler(!0),JD.spinnerShow(ll("Sync Device Time"),null,30,!0);try{await _blxCmdSend(".t set"),blxSync.textContent=0}catch(e){JD.joPingError(),blxCmdRes=blxCmdRes&&e+" [BST]"}JD.spinnerClose(),disabler(!1)}async function blxUpload(){disabler(!0),JD.spinnerShow(ll("Upload Data"),null,600,!1);try{await _blxCmdSend(".u"),await calculateMemory(!1),await _blxCmdSend(".x"),await showLink()}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+" [BUp]")}await updateDeviceList(),JD.spinnerClose(),disabler(!1)}async function blxEcholotClick(){await _blxCmdSend(blxEcholotCheck.checked?".a 1":".a 0")}let measureData="???";async function blxMeasure(){disabler(!0),JD.spinnerShow(ll("Measure"),null,30,!0),blxMeasureData.innerHTML=ll("Wait...");try{await _blxCmdSend("e 1")}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+" [BMe]")}JD.spinnerClose(),disabler(!1)}let p100_beschr=["*@100_System","*DEVICE_TYP","*MAX_CHANNELS","*HK_FLAGS","*NewCookie [Parameter 10-digit Timestamp.32]","Device_Name[BLE:$11/total:$41]","Period_sec[10..86400]","Period_Offset_sec[0..(Period_sec-1)]","Period_Alarm_sec[0..Period_sec]","Period_Internet_sec[0..604799]","Period_Internet_Alarm_sec[0..Period_Internet_sec]","UTC_Offset_sec[-43200..43200]","Flags (B0:Rec B1:Ring) (0: RecOff) B2:Compress","HK_flags (B0:Bat B1:Temp B2.Hum B3.Perc B4.Baro)","HK_reload[0..255]","Net_Mode (0:Off 1:OnOff 2:On_5min 3:Online)","ErrorPolicy (O:None 1:RetriesForAlarms, 2:RetriesForAll)","MinTemp_oC[-40..10]","Config0_U31 (B0:OffPer.Inet:On/Off B1,2:BLE:On/Mo/Li/MoLi B3:EnDS B4:CE:Off/On B5:Live:Off/On)","Configuration_Command[$79]","Internet_Starttime[Timestamp.32]"],pkan_beschr=["*@ChanNo","Action[0..65535] (B0:Meas B1:Cache B2:Alarms)","Physkan_no[0..65535]","Kan_caps_str[$8]","Src_index[0..255]","Unit[$8]","Mem_format[0..255]","DB_id[0..2e31]","Offset[float]","Factor[float]","Alarm_hi[float]","Alarm_lo[float]","Messbits[0..65535]","Xbytes[$32]"],p200_beschr=["*@200_Sys_Param","APN[$41]","Server/VPN[$41]","Script/Id[$41]","API Key[$41]","ConFlags[0..255] (B0:Verbose B1:RoamAllow B4:LOG_FILE (B5:LOG_UART) B7:Debug)","SIM Pin[0..65535] (opt)","APN User[$41]","APN Password[$41]","Max_creg[10..255]","Port[1..65535]","Server_timeout_0[1000..65535]","Server_timeout_run[1000..65535]","Modem Check Reload[60..3600]","Bat. Capacity (mAh)[0..100000]","Bat. Volts 0%[float]","Bat. Volts 100%[float]","Max Ringsize (Bytes)[1000..2e31]","mAmsec/Measure[0..1e9]","Mobile Protocol[0..255] B0:0/1:HTTP/HTTPS B1:PUSH B2,3:TCP/UDPSetup"],original_par;async function editParamDialogDo(e){var t="";let n;return e?n=JD.prepareCustomDialog(ll("Edit Parameter")+" 'sys_param'",t,ll("Send...")):(n=JD.prepareCustomDialog(ll("Edit Parameter")+" 'iparam'",t,ll("Send..."),`
`)).querySelector("#editBtnAddChannel").addEventListener("click",()=>{try{blxEditedParamGet(0),blx.IparamAddChannel(blxDevice.iparam,!0),blxParametersCopy(!1,0);var e=document.getElementById("blxParameterEdit");e.innerHTML=blxParametersGetHtml(0),e.scrollTop=e.scrollHeight,JD.joPing()}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+" [BaC]")}}),document.getElementById("blxParameterEdit").innerHTML=blxParametersGetHtml(e),await JD.doCustomDialog(0)}function blxParCancel(e){e?blxDevice.sys_param=original_par:blxDevice.iparam=original_par,blxCmdRes&&(blxCmdRes.textContent=ll("Edit Parameters cancelled"))}function blxEditedParamGet(n){var e=(n?blxDevice.sys_param:blxDevice.iparam).length;for(let t=0;t
${e}
`,null),t=e}else try{blxEditedParamGet(0),blx.CompactIparam(blxDevice.iparam),blxParametersCopy(!1,0);var o=blx.IparamValidate(blxDevice.iparam);if(o)throw"ERROR: Iparam-Check(3):\n"+o;var r=(new TextEncoder).encode(blxDevice.iparam.join("\n")+"\n"),s=blx.getCrc32(r);await blStore.get(blxDevice.deviceMAC+"_iparam.lxp");let e=blStore.result();if(void 0!==e&&s===e.v.crc32&&r.length===e.v.akt_len&&!1===blxDevice.iparam_dirtyflag)return blxCmdRes&&(blxCmdRes.textContent=ll("(No Changes)")),JD.spinnerClose(),t;void 0===e&&(e={v:{}}),blxEditedParamGet(0),blxDevice.iparam[4]=(Date.now()/1e3).toFixed(0),blxDevice.iparam_dirtyflag=!0;var d=new TextEncoder;if(e.v.bytebuf=d.encode(blxDevice.iparam.join("\n")+"\n"),e.v.crc32=blx.getCrc32(e.v.bytebuf),e.v.total_len=e.v.bytebuf.length,e.v.akt_len=e.v.total_len,e.v.ctime=new Date(1e3*blxDevice.iparam[4]),e.v.esync_flag=!0,e.v.tssync=void 0,await blStore.set(blxDevice.deviceMAC+"_iparam.lxp",e.v),await _blxCmdSend(".fput "+blxDevice.deviceMAC+"_iparam.lxp"),_blxCmdResult)throw _blxCmdResult;if(await _blxCmdSend("X"),_blxCmdResult)throw _blxCmdResult;blxDevice.iparam_dirtyflag=!1,await blStore.set(blxDevice.deviceMAC+"_#BAK_iparam.lxp",e.v)}catch(e){JD.joPingError(),blxCmdRes&&(blxCmdRes.textContent=e+"[BPa]"),await JD.doDialogOK(ll("ERROR"),ll("Parameter Check")+` 'iparam'
${e}
`,null),t=e}return await updateDeviceList(),JD.spinnerClose(),t}function blxParametersCopy(e,t){var n=t?blxDevice.sys_param:blxDevice.iparam;if(!0===e)if(original_par=[],void 0===n)JD.doDialogOK(ll("ERROR")+": Iparam-Check(1)","No Parameters found!",null);else{for(let e=0;e"):i++;var s,d=void 0!==a[i]?a[i]:"(unknown)";let e,t=(d.indexOf("Timestamp.32")&&1e9[${n}+(+${i})]
",e&&(t+=` ${e} `),t+=` '${a[i]}'
`,o+=t}return o}async function blxEditIparam(){for(blxParametersCopy(!0,0);;){if("OK"!==await editParamDialogDo(0)){blxParCancel(0);break}if(!await blxParSend(0))break}}async function blxEditSysparam(){for(blxParametersCopy(!0,1);;){if("OK"!==await editParamDialogDo(1)){blxParCancel(1);break}if(!await blxParSend(1))break}}function bleCallback(l,a,i){switch(l){case"CON":switch(connectionLevel=a,console.log("CON-Level: "+a),a){case 0:case 1:blxConnectButtonText&&(blxConnectButtonText.textContent=ll("Connect")),blxInfoLine&&(blxInfoLine.textContent=ll("Disconnect")),blxMemory&&(blxMemory.textContent="-"),blxSync&&(blxSync.textContent="-"),blxSignal&&(blxSignal.hidden=!0),blxMeasureData&&(blxMeasureData.innerHTML="-"),sidebuttonBluetooth.querySelector("i").classList.remove("jo-icon-ani-beat"),disabler(!1);break;case 2:lastAdvertisingName=blx.getDevice().advertisingName,blxDeviceName&&(blxDeviceName.textContent=lastAdvertisingName),blxMAC&&(blxMAC.textContent="-"),blxType&&(blxType.textContent="-"),blxFW&&(blxFW.textContent="-"),sidebuttonBluetooth.querySelector("i").classList.add("jo-icon-ani-beat"),blxSignal&&(blxSignal.textContent="... dBm"),blxSignal&&(blxSignal.style.backgroundColor="gray");var o=`${ll("Connecting")} '${lastAdvertisingName}'...`;blxConnectButtonText&&(blxConnectButtonText.textContent=o),blxInfoLine&&(blxInfoLine.textContent=o),blxGraph&&(blxGraph.innerHTML=""),JD.spinnerGetBusy()||(cbSpinner=!0,JD.spinnerShow("Bluetooth",o,30,!0));break;case 3:JD.spinnerGetBusy()&&JD.spinnerSetInfo(ll("Reading IDs...")),blxInfoLine&&(blxInfoLine.textContent=ll("Reading IDs...")),blxConnectButtonText&&(blxConnectButtonText.textContent=`'${lastAdvertisingName}'`);break;case 4:blxSignal&&(blxSignal.hidden=!1),disabler(!1),cbSpinner&&(cbSpinner=!1,JD.spinnerClose())}break;case"UPLOAD":uplStatus={totalsize:a,mode:i,sumsize:0,filesize:0,filename:"",fproc:0,ndata:!0};break;case"GET":uplStatus.filesize=a,uplStatus.filename=i,uplStatus.ndata=!0,blxInfoLine&&(blxInfoLine.textContent=ll("File")+`:'${i}' ${a} Byte`);break;case"PROG":uplStatus.fproc=a,uplStatus.ndata=!0;let e,t;t=uplStatus.totalsize?(r=uplStatus.sumsize/uplStatus.totalsize*100,d=uplStatus.filesize/uplStatus.totalsize*uplStatus.fproc,`${e=(r+d).toFixed(0)}% of ${(uplStatus.totalsize/1024).toFixed(0)} kB`):(e=a)+"%",JD.spinnerGetBusy()&&(JD.spinnerSetProgress(e),JD.spinnerSetInfo(t)),blxInfoLine&&(blxInfoLine.textContent=e+"%");break;case"GET_OK":uplStatus.sumsize+=a,uplStatus.ndata=!0,blxInfoLine&&(blxInfoLine.textContent=`OK (${a} ${i} )`);break;case"RSSI":var r=.273*a+28;let n="limegreen";0<=r&&(r<4?n="gray":r<8&&(n="orange")),blxSignal&&(blxSignal.textContent=a+" dBm"),blxSignal&&(blxSignal.style.backgroundColor=n),l=void 0;break;case"VSENS":blxInfoLine&&(blxInfoLine.textContent="VSENS "+i+": "+a),l=void 0;break;case"INFO":blxInfoLine&&(blxInfoLine.textContent=i);break;case"MSG":blxInfoLine&&(blxInfoLine.textContent="MSG "+a+":"+i);break;case"WARN":blxCmdRes&&(blxCmdRes.textContent="WARNING "+a+":"+i);break;case"ERR":blxCmdRes&&(blxCmdRes.textContent="ERROR "+a+":"+i);break;case"BZY":var s=parseInt(i);if(blxInfoLine)switch(a){case 1:blxInfoLine.textContent=2...");break;case"MEAS_V":if("*"==i[0]&&(i=`(${ll("ALARM")}) `+i.substring(1)),90==a&&void 0!==blxDevice.sys_param&&void 0!==blxDevice.sys_param[16]){var r=parseFloat(blxDevice.sys_param[15]),d=parseFloat(blxDevice.sys_param[16]);if(r("+a+") "+i,blxMeasureData&&(blxMeasureData.innerHTML=measureData)}void 0!==l&&console.log("BLX: ",l,a,i)}async function getSetupOptions(){await blStore.get("#blxDash_#SETUP");var e=blStore.result(),e=(void 0!==e&&((setupOptions=e.v).dtheme&&JD.dashToggleTheme(),setupOptions.font&&JD.dashSetFont(setupOptions.font/100),setupOptions.lang)&&I18.i18localize(setupOptions.lang),await blStore.get("#blxDash_#badgeURL"),blStore.result());void 0!==e&&void 0!==e.v&&(blxDashBadgeURL=e.v,document.getElementById("blxBadge").style.display="block")}async function doSetupDialog(){var e=await blStore.quotaget(),e=`
+${ll("Measure")}...`;break;case"MEAS_T":0
...");break;case"MEAS_V":if("*"==i[0]&&(i=`(${ll("ALARM")}) `+i.substring(1)),90==a&&void 0!==blxDevice.sys_param&&void 0!==blxDevice.sys_param[16]){var r=parseFloat(blxDevice.sys_param[15]),d=parseFloat(blxDevice.sys_param[16]);if(r("+a+") "+i,blxMeasureData&&(blxMeasureData.innerHTML=measureData)}void 0!==l&&console.log("BLX: ",l,a,i)}async function getSetupOptions(){await blStore.get("#blxDash_#SETUP");var e=blStore.result(),e=(void 0!==e&&((setupOptions=e.v).dtheme&&JD.dashToggleTheme(),setupOptions.font&&JD.dashSetFont(setupOptions.font/100),setupOptions.lang)&&I18.i18localize(setupOptions.lang),await blStore.get("#blxDash_#badgeURL"),blStore.result()),e=(void 0!==e&&void 0!==e.v&&(blxDashBadgeURL=e.v,document.getElementById("blxBadge").style.display="block"),await blStore.get("#blxDash_#AutoPINURL"),blStore.result());void 0!==e&&void 0!==e.v&&(blxAutoPINURL=e.v,document.getElementById("blxAutoPIN").style.display="block")}async function doSetupDialog(){var e=await blStore.quotaget(),e=``;let n=JD.prepareCustomDialog("Dashboard Setup",e,null);n.querySelector("#jd-theme").checked=setupOptions.dtheme,n.querySelector("#jd-fontsize").value=setupOptions.font+"%";e=n.querySelector("#jd-lang");let t="";I18.i18_availLang.forEach(e=>{t+=``}),e.innerHTML=t,n.querySelector("#jd-lang").value=setupOptions.lang,n.querySelector("#jd-server").value=setupOptions.server,n.querySelector("#jd-accesstoken").value=setupOptions.accesstoken,e.addEventListener("change",e=>{var t=n.querySelector("#jd-lang").value;setupOptions.lang=t,I18.i18localize(t),JD.joSagmal(ll("Greeting"),t)}),n.querySelector("#jd-fontsize").addEventListener("change",e=>{var t=n.querySelector("#jd-fontsize").value;setupOptions.font=parseInt(t),JD.dashSetFont(setupOptions.font/100)}),n.querySelector("#jd-theme").addEventListener("click",e=>{JD.dashToggleTheme(),setupOptions.dtheme=!setupOptions.dtheme}),n.querySelector("#jd-servertest").addEventListener("click",e=>{isUrlGit?JD.doDialogOK(ll("ERROR"),`${ll("Can't Open Server on GITs")}
(Host: '${location.hostname}')`):window.open(n.querySelector("#jd-server").value+"?k="+n.querySelector("#jd-accesstoken").value)}),"OK"===await JD.doCustomDialog()&&(setupOptions.server=n.querySelector("#jd-server").value,setupOptions.accesstoken=n.querySelector("#jd-accesstoken").value),await blStore.set("#blxDash_#SETUP",setupOptions)}async function runServerSync(){if(blx.terminalPrint(ll("Server-Synchronize")+"..."),isUrlGit)JD.doDialogOK(ll("ERROR"),`${ll("Can't Open Server on GITs")}
(Host: '${location.hostname}')`);else{disabler(!0),JD.spinnerShow(ll("Server-Synchronize"),null,300,!1);try{var n=setupOptions.server,l=setupOptions.accesstoken;for(let t=0;t",null,` `);e.querySelector("#removeDeviceBtn").addEventListener("click",async()=>{await JD.doDialogOK(ll("Remove Device?"),`${ll("Name")}: '${t.advname}'
MAC: ${t.mac}
`," "+ll("Remove"),!0)&&(await removeDevice(t.mac),JD.closeCustomDialog("REMOVED"))});let n=`${ll("Name")}: '${t.advname}'
MAC: ${t.mac}
`;n=n+("
PIN: "+(0
";var l=t.files.length;if(l){n+=`${ll("File")} | Byte | ↻ | ${ll("Age")} |
`;for(let e=0;e':n+="","xtract.edt"==r.fname?(a=" Show Graph ",n+=`${a} | `):n+=`'${r.fname}' | `,n=(n+=`${r.aktlen} | `)+` ${r.syncflag?"✔":"-"} | `,void 0!==r.tssync?(a=(Date.now()-r.tssync)/1e3,a=(a=(a-=86400*(r=Math.floor(a/86400)))-3600*(i=Math.floor(a/3600)))-60*(o=Math.floor(a/60)),n+=`${r}d ${i}h ${o}min ${Math.floor(a)}sec`):n+="-",n+=" |
"}n+="
"}else n+=ll("No Files!");e.querySelector("#deviceDialog-content").innerHTML=n,await JD.doCustomDialog()}async function updateDeviceList(){deviceListDB=[];let i=0,o=0,r=0,n=(navDevicelist.innerHTML="",await blStore.iterate(function(l){var t=l.k.substr(0,16);if(16===t.length&&"_"===l.k.charAt(16)){let n;for(let e=0;e
+ `;let n=JD.prepareCustomDialog("Dashboard Setup",e,null);n.querySelector("#jd-theme").checked=setupOptions.dtheme,n.querySelector("#jd-fontsize").value=setupOptions.font+"%";e=n.querySelector("#jd-lang");let t="";I18.i18_availLang.forEach(e=>{t+=``}),e.innerHTML=t,n.querySelector("#jd-lang").value=setupOptions.lang,n.querySelector("#jd-server").value=setupOptions.server,n.querySelector("#jd-accesstoken").value=setupOptions.accesstoken,e.addEventListener("change",e=>{var t=n.querySelector("#jd-lang").value;setupOptions.lang=t,I18.i18localize(t),JD.joSagmal(ll("Greeting"),t)}),n.querySelector("#jd-fontsize").addEventListener("change",e=>{var t=n.querySelector("#jd-fontsize").value;setupOptions.font=parseInt(t),JD.dashSetFont(setupOptions.font/100)}),n.querySelector("#jd-theme").addEventListener("click",e=>{JD.dashToggleTheme(),setupOptions.dtheme=!setupOptions.dtheme}),n.querySelector("#jd-servertest").addEventListener("click",e=>{isUrlGit?JD.doDialogOK(ll("ERROR"),`${ll("Can't Open Server on GITs")}
(Host: '${location.hostname}')`):window.open(n.querySelector("#jd-server").value+"?k="+n.querySelector("#jd-accesstoken").value,"_blank")}),"OK"===await JD.doCustomDialog()&&(setupOptions.server=n.querySelector("#jd-server").value,setupOptions.accesstoken=n.querySelector("#jd-accesstoken").value),await blStore.set("#blxDash_#SETUP",setupOptions)}async function runServerSync(){if(blx.terminalPrint(ll("Server-Synchronize")+"..."),isUrlGit)JD.doDialogOK(ll("ERROR"),`${ll("Can't Open Server on GITs")}
(Host: '${location.hostname}')`);else{disabler(!0),JD.spinnerShow(ll("Server-Synchronize"),null,300,!1);try{var n=setupOptions.server,l=setupOptions.accesstoken;for(let t=0;t",null,` `);e.querySelector("#removeDeviceBtn").addEventListener("click",async()=>{await JD.doDialogOK(ll("Remove Device?"),`${ll("Name")}: '${t.advname}'
MAC: ${t.mac}
`," "+ll("Remove"),!0)&&(await removeDevice(t.mac),JD.closeCustomDialog("REMOVED"))});let n=`${ll("Name")}: '${t.advname}'
MAC: ${t.mac}
`;n=n+("
PIN: "+(0
";var l=t.files.length;if(l){n+=`${ll("File")} | Byte | ↻ | ${ll("Age")} |
`;for(let e=0;e':n+="","xtract.edt"==r.fname?(a=" Show Graph ",n+=`${a} | `):n+=`'${r.fname}' | `,n=(n+=`${r.aktlen} | `)+` ${r.syncflag?"✔":"-"} | `,void 0!==r.tssync?(a=(Date.now()-r.tssync)/1e3,a=(a=(a-=86400*(r=Math.floor(a/86400)))-3600*(i=Math.floor(a/3600)))-60*(o=Math.floor(a/60)),n+=`${r}d ${i}h ${o}min ${Math.floor(a)}sec`):n+="-",n+=" |
"}n+="
"}else n+=ll("No Files!");e.querySelector("#deviceDialog-content").innerHTML=n,await JD.doCustomDialog()}async function updateDeviceList(){deviceListDB=[];let i=0,o=0,r=0,n=(navDevicelist.innerHTML="",await blStore.iterate(function(l){var t=l.k.substr(0,16);if(16===t.length&&"_"===l.k.charAt(16)){let n;for(let e=0;e
'${l.advname}'`,l.synccnt?e+=`▴${l.synccnt}/${a.length} `:e+=`${a.length} `):e=`