(()=>{"use strict";var t,e={322:(t,e,n)=>{n.r(e);var a=n(531),s=n(152),o=n(687),i=n.n(o),r=n(955),c=n(755);function l(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return u(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var a=0,s=function(){};return{s,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,r=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){r=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(r)throw o}}}}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n")}}),Object.assign(Date.prototype,{toLocalShort:function(){return this.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}});var m=1,b=17,g=2,v=18,S=4,y=20,_=8,w=24,T={bt_playing:{label:"",icon:"media_bluetooth_on"},bt_disconnected:{label:"",icon:"media_bluetooth_off"},bt_neutral:{label:"",icon:"bluetooth"},bt_connecting:{label:"",icon:"bluetooth_searching"},bt_connected:{label:"",icon:"bluetooth_connected"},bt_disabled:{label:"",icon:"bluetooth_disabled"},play_arrow:{label:"",icon:"play_circle_filled"},pause:{label:"",icon:"pause_circle"},stop:{label:"",icon:"stop_circle"},"":{label:"",icon:""}},E=[{icon:"battery_0_bar",label:"▪",ranges:[{f:5.8,t:6.8},{f:8.8,t:10.2}]},{icon:"battery_2_bar",label:"▪▪",ranges:[{f:6.8,t:7.4},{f:10.2,t:11.1}]},{icon:"battery_3_bar",label:"▪▪▪",ranges:[{f:7.4,t:7.5},{f:11.1,t:11.25}]},{icon:"battery_4_bar",label:"▪▪▪▪",ranges:[{f:7.5,t:7.8},{f:11.25,t:11.7}]}],A=[{desc:"Idle",sub:["bt_neutral"]},{desc:"Discovering",sub:["bt_connecting"]},{desc:"Discovered",sub:["bt_connecting"]},{desc:"Unconnected",sub:["bt_disconnected"]},{desc:"Connecting",sub:["bt_connecting"]},{desc:"Connected",sub:["bt_connected","play_arrow","bt_playing","pause","stop"]},{desc:"Disconnecting",sub:["bt_disconnected"]}],O={MESSAGING_INFO:"badge-success",MESSAGING_WARNING:"badge-warning",MESSAGING_ERROR:"badge-danger"},N={OK:0,FAIL:1,DISC:2,LOST:3,RESTORE:4,ETH:5},k={0:"eRunning",1:"eReady",2:"eBlocked",3:"eSuspended",4:"eDeleted"},x={NONE:0,REBOOT_TO_RECOVERY:2,SET_FWURL:5,FLASHING:6,DONE:7,UPLOADING:8,ERROR:9,UPLOADCOMPLETE:10,_state:-1,olderRecovery:!1,statusText:"",flashURL:"",flashFileName:"",statusPercent:0,Completed:!1,recovery:!1,prevRecovery:!1,updateModal:new bootstrap.Modal(document.getElementById("otadiv"),{}),reset:function(){return this.olderRecovery=!1,this.statusText="",this.statusPercent=-1,this.flashURL="",this.flashFileName=void 0,this.UpdateProgress(),c("#rTable tr.release").removeClass("table-success table-warning"),c(".flact").prop("disabled",!1),c("#flashfilename").value=null,c("#fw-url-input").value=null,this.isStateError()||(c("span#flash-status").html(""),c("#fwProgressLabel").parent().removeClass("bg-danger")),this._state=this.NONE,this},isStateUploadComplete:function(){return this._state==this.UPLOADCOMPLETE},isStateError:function(){return this._state==this.ERROR},isStateNone:function(){return this._state==this.NONE},isStateRebootRecovery:function(){return this._state==this.REBOOT_TO_RECOVERY},isStateSetUrl:function(){return this._state==this.SET_FWURL},isStateFlashing:function(){return this._state==this.FLASHING},isStateDone:function(){return this._state==this.DONE},isStateUploading:function(){return this._state==this.UPLOADING},init:function(){return this._state=this.NONE,this},SetStateError:function(){return this._state=this.ERROR,c("#fwProgressLabel").parent().addClass("bg-danger"),this},SetStateNone:function(){return this._state=this.NONE,this},SetStateRebootRecovery:function(){return this._state=this.REBOOT_TO_RECOVERY,this.SetStatusText("Starting recovery mode."),c.ajax({url:"/recovery.json",context:this,dataType:"text",method:"POST",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify({timestamp:Date.now()}),error:function(t,e,n){var a;this.setOTAError("Unexpected error while trying to restart to recovery. (status=".concat(null!==(a=t.status)&&void 0!==a?a:"",", error=").concat(null!=n?n:""," ) "))},complete:function(t){this.SetStatusText("Waiting for system to boot.")}}),this},SetStateSetUrl:function(){return this._state=this.SET_FWURL,this.statusText="Sending firmware download location.",I({fwurl:{value:this.flashURL,type:33}}),this},SetStateFlashing:function(){return this._state=this.FLASHING,this},SetStateDone:function(){return this._state=this.DONE,this.reset(),this},SetStateUploading:function(){return this._state=this.UPLOADING,this.SetStatusText("Sending file to device.")},SetStateUploadComplete:function(){return this._state=this.UPLOADCOMPLETE,this},isFlashExecuting:function(){return!0==(this._state!=this.UPLOADING&&(""!==this.statusText||this.statusPercent>=0))},toString:function(){var t=this;return Object.keys(this).find((function(e){return t[e]===t._state}))},setOTATargets:function(){this.flashURL="",this.flashFileName="",this.flashURL=c("#fw-url-input").val();var t=c("#flashfilename")[0].files;return t.length>0&&(this.flashFileName=t[0]),0==this.flashFileName.length&&0==this.flashURL.length&&this.setOTAError("Invalid url or file. Cannot start OTA"),this},setOTAError:function(t){return this.SetStateError().SetStatusPercent(0).SetStatusText(t).reset(),this},ShowDialog:function(){return this.isStateNone()||(this.updateModal.show(),c(".flact").prop("disabled",!0)),this},SetStatusPercent:function(t){var e=this.statusPercent!=t;return this.statusPercent=t,e&&(this.isStateUploading()||this.isStateFlashing()||this.SetStateFlashing(),100==t&&(this.isStateFlashing()?this.SetStateDone():this.isStateUploading()&&(this.statusPercent=0,this.SetStateFlashing())),this.UpdateProgress().ShowDialog()),this},SetStatusText:function(t){var e=this.statusText!=t;return this.statusText=t,e&&(c("span#flash-status").html(this.statusText),this.ShowDialog()),this},UpdateProgress:function(){return c(".progress-bar").css("width",this.statusPercent+"%").attr("aria-valuenow",this.statusPercent).text(this.statusPercent+"%"),c(".progress-bar").html((this.isStateDone()?100:this.statusPercent)+"%"),this},StartOTA:function(){return this.logEvent(this.StartOTA.name),c("#fwProgressLabel").parent().removeClass("bg-danger"),this.setOTATargets(),this.isStateError()||(F?this.SetStateFlashing().TargetReadyStartOTA():this.SetStateRebootRecovery()),this},UploadLocalFile:function(){this.SetStateUploading();var t=new XMLHttpRequest;t.context=this;var e=this.HandleUploadProgressEvent.bind(this),n=this.setOTAError.bind(this);t.upload.addEventListener("progress",e,!1),t.onreadystatechange=function(){4===t.readyState&&(0!==t.status&&404!==t.status||n("Upload Failed. Recovery version might not support uploading. Please use web update instead."))},t.open("POST","/flash.json",!0),t.send(this.flashFileName)},TargetReadyStartOTA:function(){return F&&this.prevRecovery&&!this.isStateRebootRecovery()&&!this.isStateFlashing()?this:(this.logEvent(this.TargetReadyStartOTA.name),F?(this.prevRecovery=!0,void(""!==this.flashFileName?this.UploadLocalFile():""!=this.flashURL?this.SetStateSetUrl():this.setOTAError("Invalid URL or file name while trying to start the OTa process"))):(console.error("Event TargetReadyStartOTA fired in the wrong mode "),this))},HandleUploadProgressEvent:function(t){this.logEvent(this.HandleUploadProgressEvent.name),this.SetStateUploading().SetStatusPercent(Math.round(t.loaded/t.total*100)).SetStatusText("Uploading file to device")},EventTargetStatus:function(t){var e,n;this.isStateNone()||this.logEvent(this.EventTargetStatus.name),null!==(e=t.ota_pct)&&void 0!==e&&e&&(this.olderRecovery=!0,this.SetStatusPercent(t.ota_pct)),""!=(null!==(n=t.ota_dsc)&&void 0!==n?n:"")&&(this.olderRecovery=!0,this.SetStatusText(t.ota_dsc)),null!=t.recovery&&(this.recovery=1===t.recovery),this.isStateRebootRecovery()&&this.recovery&&this.TargetReadyStartOTA()},EventOTAMessageClass:function(t){this.logEvent(this.EventOTAMessageClass.name);var e=JSON.parse(t);this.SetStatusPercent(e.ota_pct).SetStatusText(e.ota_dsc)},logEvent:function(t){console.log("".concat(t,", flash state ").concat(this.toString(),", recovery: ").concat(this.recovery,", ota pct: ").concat(this.statusPercent,", ota desc: ").concat(this.statusText))}};window.hideSurrounding=function(t){c(t).parent().parent().hide()};var R=!1,C=2500;function I(t){var e={timestamp:Date.now(),config:t};c.ajax({url:"/config.json",dataType:"text",method:"POST",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify(e),error:j})}function G(){return et.hasOwnProperty("ip")&&"0.0.0.0"!=et.ip&&""!=et.ip}function M(t){return G()?t.icon:t.label}function P(t){c("#o_type").children("span").css({display:"none"}),c("#"+(Y="bt"===t?"bt":"spdif"===t?"spdif":"i2s")).prop("checked",!0),c("#o_"+Y).css({display:"inline"})}function j(t,e,n){console.log(t.status),console.log(n),""!==n&&wt(n,"MESSAGING_ERROR")}function U(t,e,n){var a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s="table-success";"MESSAGING_WARNING"===e?s="table-warning":"MESSAGING_ERROR"===e&&(s="table-danger"),c("#toast_"+t).removeClass("table-success").removeClass("table-warning").removeClass("table-danger").addClass(s).addClass("show");var o=n.substring(0,n.length-1).encodeHTML().replace(/\n/g,"
");o=(c("#msg_"+t).html().length>0&&a?c("#msg_"+t).html()+"
":"")+o,c("#msg_"+t).html(o)}window.hFlash=function(){c("#flashfilename").value=null,x.StartOTA()},window.handleReboot=function(t){"reboot_ota"==t?(c("#reboot_ota_nav").removeClass("active").prop("disabled",!0),it(500,"","reboot_ota")):(c("#reboot_nav").removeClass("active"),it(500,"",t))};var L,D="https://api.github.com/repos/sle118/squeezelite-esp32/releases",F=!1,J=!1,W=0,H="MESSAGING_INFO",B={},q=null,Y="",z="",V="Squeezelite-ESP32",Z="",K=V,Q="",X=V,$="",tt="#cfg-audio-bt_source-sink_name",et={},nt={},at="",st={CONN:0,MAN:1,STS:2};function ot(t){var e={};c("input.nvs").each((function(n,a){if(t)e[a.id]=a.value;else{var s=parseInt(a.attributes.nvs_type.value,10);""!==a.id&&(e[a.id]={},e[a.id].value=s===m||s===b||s===g||s===v||s===S||s===y||s===_||s===w?parseInt(a.value):a.value,e[a.id].type=s)}}));var n=c("#nvs-new-key").val(),a=c("#nvs-new-value").val();return""!==n&&(t?e[n]=a:(e[n]={},e[n].value=a,e[n].type=33)),e}function it(t,e){var n="/"+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"reboot")+".json";c("tbody#tasks").empty(),c("#tasks_sect").css("visibility","collapse"),h.resolve({cmdname:e,url:n}).delay(t).then((function(t){t.cmdname.length>0?U(t.cmdname,"MESSAGING_WARNING","System is rebooting.\n",!0):wt("System is rebooting.\n","MESSAGING_WARNING"),console.log("now triggering reboot"),c("button[onclick*='handleReboot']").addClass("rebooting"),c.ajax({url:t.url,dataType:"text",method:"POST",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify({timestamp:Date.now()}),error:j,complete:function(){console.log("reboot call completed"),h.resolve(t).delay(6e3).then((function(t){t.cmdname.length>0&&function(t){c("#toast_"+t).removeClass("table-success").removeClass("table-warning").removeClass("table-danger").addClass("table-success").removeClass("show"),c("#msg_"+t).html("")}(t.cmdname),yt(),_t()}))}})}))}function rt(t){return c(".upf").filter((function(){return c(this).text().toUpperCase()===t.toUpperCase()})).length>0&&(c("#splf").val(t).trigger("input"),!0)}function ct(t){return t>=-55?{label:"****",icon:"signal_wifi_statusbar_4_bar"}:t>=-60?{label:"***",icon:"network_wifi_3_bar"}:t>=-65?{label:"**",icon:"network_wifi_2_bar"}:t>=-70?{label:"*",icon:"network_wifi_1_bar"}:{label:".",icon:"signal_wifi_statusbar_null"}}function lt(){var t;(null===(t=et)||void 0===t?void 0:t.urc)!==N.ETH&&(c.ajaxSetup({timeout:3e3}),c.getJSON("/scan.json",(0,a.Z)(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Et(2e3);case 2:c.getJSON("/ap.json",(function(t){t.length>0&&(t.sort((function(t,e){var n=t.rssi,a=e.rssi;return na?-1:0})),dt(t))}));case 3:case"end":return t.stop()}}),t)})))))}function ut(t,e,n){var a=ct(e),s={label:0==n?"🔓":"🔒",icon:0==n?"no_encryption":"lock"};return''.concat(t,'\n ').concat(M(a),'\n \t\n ').concat(M(s),"\n ")}function dt(t){var e,n="";if(c("#wifiTable tr td:first-of-type").text(""),c("#wifiTable tr").removeClass("table-success table-warning"),t&&(t.forEach((function(t){n+=ut(t.ssid,t.rssi,t.auth)})),c("#wifiTable").html(n)),0==c(".manual_add").length&&(c("#wifiTable").append(ut("Manual add",0,0)),c("#wifiTable tr:last").addClass("table-light text-dark").addClass("manual_add")),!et.ssid||et.urc!==N.OK&&et.urc!==N.RESTORE)(null===(e=et)||void 0===e?void 0:e.urc)!==N.ETH&&c("span#foot-if").html("");else{var a,s='#wifiTable td:contains("'.concat(et.ssid,'")');if(0==c(s).filter((function(){return c(this).text()===et.ssid})).length)c("#wifiTable").prepend("".concat(ut(et.ssid,null!==(a=et.rssi)&&void 0!==a?a:0,0)));c(s).filter((function(){return c(this).text()===et.ssid})).siblings().first().html("✓").parent().addClass(et.urc===N.OK?"table-success":"table-warning"),c("span#foot-if").html("SSID: ".concat(et.ssid,", IP: ").concat(et.ip,"")),c("#wifiStsIcon").html(ct(et.rssi))}}function ht(t){console.debug(this.toLocaleString()+"\t"+t.nme+"\t"+t.cpu+"\t"+k[t.st]+"\t"+t.minstk+"\t"+t.bprio+"\t"+t.cprio+"\t"+t.num),c("tbody#tasks").append(''+t.num+""+t.nme+""+t.cpu+""+k[t.st]+""+t.minstk+""+t.bprio+""+t.cprio+"")}function pt(t){return c("".concat(tt," option:contains('").concat(t,"')"))}function ft(){c.ajaxSetup({timeout:C}),c.getJSON("/messages.json",function(){var t=(0,a.Z)(i().mark((function t(e){var n,a,s,o,r,u,d,h,p,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=l(e),t.prev=1,s=i().mark((function t(){var e,n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=a.value,n=e.current_time-e.sent_time,(o=new Date).setTime(o.getTime()-n),t.t0=e.class,t.next="MESSAGING_CLASS_OTA"===t.t0?7:"MESSAGING_CLASS_STATS"===t.t0?9:"MESSAGING_CLASS_SYSTEM"===t.t0?14:"MESSAGING_CLASS_CFGCMD"===t.t0?16:"MESSAGING_CLASS_BT"===t.t0?19:23;break;case 7:return x.EventOTAMessageClass(e.message),t.abrupt("break",24);case 9:return r=JSON.parse(e.message),console.debug(o.toLocalShort()+" - Number of running tasks: "+r.ntasks),console.debug(o.toLocalShort()+"\tname\tcpu\tstate\tminstk\tbprio\tcprio\tnum"),r.tasks?("collapse"===c("#tasks_sect").css("visibility")&&c("#tasks_sect").css("visibility","visible"),c("tbody#tasks").html(""),r.tasks.sort((function(t,e){return e.cpu-t.cpu})).forEach(ht,o)):"visible"===c("#tasks_sect").css("visibility")&&(c("tbody#tasks").empty(),c("#tasks_sect").css("visibility","collapse")),t.abrupt("break",24);case 14:return Tt(e,o),t.abrupt("break",24);case 16:return U((u=e.message.split(/([^\n]*)\n([\s\S]*)/g))[1],e.type,u[2],!0),t.abrupt("break",24);case 19:if(c("#cfg-audio-bt_source-sink_name").is("input")){for(d=c("#cfg-audio-bt_source-sink_name")[0].attributes,h="",p=0;p "))}return JSON.parse(e.message).forEach((function(t){pt(t.name).length>0||(c("#cfg-audio-bt_source-sink_name").append("")),Tt({type:e.type,message:"BT Audio device found: ".concat(t.name," RSSI: ").concat(t.rssi," ")},o)),pt(t.name).attr("data-bs-description","".concat(t.name," (").concat(t.rssi,"dB)")).attr("rssi",t.rssi).attr("value",t.name).text("".concat(t.name," [").concat(t.rssi,"dB]")).trigger("change")})),c(tt).append(c("".concat(tt," option")).remove().sort((function(t,e){return console.log("".concat(parseInt(c(t).attr("rssi"))," < ").concat(parseInt(c(e).attr("rssi"))," ? ")),parseInt(c(t).attr("rssi"))".concat(et.ip,""))):(c(".if_wifi").show(),dt())),mt(t)}function vt(){c.ajaxSetup({timeout:2e3}),c.getJSON("/status.json",(function(t){var e;if(function(t){var e;1===(null!==(e=t.recovery)&&void 0!==e?e:0)?(F=!0,c(".recovery_element").show(),c(".ota_element").hide(),c("#boot-button").html("Reboot"),c("#boot-form").attr("action","/reboot_ota.json")):(!F&&J&&(J=!1,setTimeout(ft,C)),F=!1,c(".recovery_element").hide(),c(".ota_element").show(),c("#boot-button").html("Recovery"),c("#boot-form").attr("action","/recovery.json"))}(t),p(),gt(t),function(t){var e="",n="";if(void 0!==t.bt_status&&void 0!==t.bt_sub_status){var a=A[t.bt_status].sub[t.bt_sub_status];a?(e=T[a],n=A[t.bt_status].desc):(e=T.bt_connected,n="Output status")}c("#o_type").attr("title",n),c("#o_bt").html(G()?e.label:e.text)}(t),x.EventTargetStatus(t),t.project_name&&""!==t.project_name&&(K=t.project_name),t.platform_name&&""!==t.platform_name&&(X=t.platform_name),""===Q&&(Q=K),""===Q&&(Q="Squeezelite-ESP32"),t.version&&""!==t.version?(V=t.version,c("#navtitle").html("".concat(Q).concat(F?"
[recovery]":"")),c("span#foot-fw").html("fw: ".concat(V,", mode: ").concat(F?"Recovery":K,""))):c("span#flash-status").html(""),t.Voltage){var n=function(t){for(var e=0,n=E;e
'.concat(e.help.encodeHTML().replace(/\n/g,"
"),'
'),e.argtable&&e.argtable.forEach((function(n){var a=n.datatype||"",s=e.name+"-"+n.longopts,i=St(t,e.name,n.longopts),r="hasvalue="+n.hasvalue+" ";r+='longopts="'+n.longopts+'" ',r+='shortopts="'+n.shortopts+'" ',r+="checkbox="+n.checkbox+" ",r+='cmdname="'+e.name+'" ',r+='id="'+s+'" name="'+s+'" hasvalue="'+n.hasvalue+'" ';var c=n.mincount>0?"bg-success":"";"hidden"===n.glossary&&(r+=' style="visibility: hidden;"'),n.checkbox?o+='
"):(o+='
"),a.includes("|")?(c=a.startsWith("+")?" multiple ":"",a=a.replace("<","").replace("=","").replace(">",""),o+=""):o+='")),o+="".concat(n.checkbox?"
":"",'Previous value: ').concat(n.checkbox?i?"Checked":"Unchecked":i||"","").concat(n.checkbox?"":"
")})),o+='
\n '),o+=a?'\n'):''),o+="
",a?c(s).append(o):c("#commands-list").append(o)}})),c(".sclk").off("click").on("click",(function(){runCommand(this,!1)})),c(".cclk").off("click").on("click",(function(){runCommand(this,!0)})),t.commands.forEach((function(e){c("[cmdname="+e.name+"]:input").val(""),c("[cmdname="+e.name+"]:checkbox").prop("checked",!1),e.argtable&&e.argtable.forEach((function(n){var a="#"+e.name+"-"+n.longopts,s=St(t,e.name,n.longopts);n.checkbox?c(a)[0].checked=s:(void 0!==s&&c(a).val(s).trigger("change"),0===c(a)[0].value.length&&(n.datatype||"").includes("|")&&(c(a)[0].value="--"))}))})),0!=c("#cfg-hw-preset-model_config").length&&(R||(R=!0,c("#cfg-hw-preset-model_config").html(""),c.getJSON("https://gist.githubusercontent.com/sle118/dae585e157b733a639c12dc70f0910c5/raw/",{_:(new Date).getTime()},(function(t){c.each(t,(function(t,e){c("#cfg-hw-preset-model_config").append("")),""!==$&&$==e.name&&c("#cfg-hw-preset-model_config").val($)})),""!==$&&"#prev_preset".show().val($)})).fail((function(t,e,n){var a=e+", "+n;console.log("Request Failed: "+a)}))))})).fail((function(t,e,n){404==t.status?c(".orec").hide():j(t,0,n),c("#commands-list").empty()}))}function _t(){c.ajaxSetup({timeout:7e3}),c.getJSON("/config.json",(function(t){c("#nvsTable tr").remove();var e=t.config?t.config:t;B=e,Object.keys(e).sort().forEach((function(t){var n=e[t].value;if("autoexec"===t)"0"===e.autoexec.value?c("#disable-squeezelite")[0].checked=!0:c("#disable-squeezelite")[0].checked=!1;else if("autoexec1"===t){var a=/-o\s?(["][^"]*["]|[^-]+)/g.exec(n);a[1].toUpperCase().startsWith("I2S")?P("i2s"):a[1].toUpperCase().startsWith("SPDIF")?P("spdif"):a[1].toUpperCase().startsWith('"BT')&&P("bt")}else"host_name"===t?(n=n.replaceAll('"',""),c("input#dhcp-name1").val(n),c("input#dhcp-name2").val(n),c("#player").val(n),document.title=n,z=n):"rel_api"===t?D=n:"enable_airplay"===t?c("#s_airplay").css({display:f(n)?"inline":"none"}):"enable_cspot"===t?c("#s_cspot").css({display:f(n)?"inline":"none"}):"preset_name"==t?$=n:"board_model"==t&&(Q=n);c("tbody#nvsTable").append(""+t+""),c("input#"+t).val(e[t].value)})),c("tbody#nvsTable").append(""),t.gpio?(c("#pins").show(),c("tbody#gpiotable tr").remove(),t.gpio.forEach((function(t){c("tbody#gpiotable").append("'+t.group+""+t.name+""+t.gpio+""+(t.fixed?"Fixed":"Configuration")+"")}))):c("#pins").hide()})).fail((function(t,e,n){j(t,0,n)}))}function wt(t,e){Tt({message:t,type:e},new Date)}function Tt(t,e){var n="table-success";"MESSAGING_WARNING"===t.type?(n="table-warning","MESSAGING_INFO"===H&&(H="MESSAGING_WARNING")):"MESSAGING_ERROR"===t.type&&("MESSAGING_INFO"!==H&&"MESSAGING_WARNING"!==H||(H="MESSAGING_ERROR"),n="table-danger"),++W>0&&(c("#msgcnt").removeClass("badge-success"),c("#msgcnt").removeClass("badge-warning"),c("#msgcnt").removeClass("badge-danger"),c("#msgcnt").addClass(O[H]),c("#msgcnt").text(W)),c("#syslogTable").append(""+e.toLocalShort()+""+t.message.encodeHTML()+"")}function Et(t){return new h((function(e){return setTimeout(e,t)}))}h.prototype.delay=function(t){return this.then((function(e){return new h((function(n){setTimeout((function(){n(e)}),t)}))}),(function(e){return new h((function(n,a){setTimeout((function(){a(e)}),t)}))}))},window.saveAutoexec1=function(t){U("cfg-audio-tmpl","MESSAGING_INFO","Saving.\n",!1);var e='squeezelite -b 500:2000 -d all=info -C 30 -W -n "'+c("#player").val()+'"';"bt"===Y?(e+=' -o "BT" -R -Z 192000',U("cfg-audio-tmpl","MESSAGING_INFO","Remember to configure the Bluetooth audio device name.\n",!0)):e+="spdif"===Y?" -o SPDIF -Z 192000":" -o I2S",""!==c("#optional").val()&&(e+=" "+c("#optional").val());var n={timestamp:Date.now()};n.config={autoexec1:{value:e,type:33},autoexec:{value:c("#disable-squeezelite").prop("checked")?"0":"1",type:33}},c.ajax({url:"/config.json",dataType:"text",method:"POST",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify(n),error:j,complete:function(e){e.responseText&&"OK"===JSON.parse(e.responseText).result?(U("cfg-audio-tmpl","MESSAGING_INFO","Done.\n",!0),t&&it(1500,"cfg-audio-tmpl")):JSON.parse(e.responseText).result?U("cfg-audio-tmpl","MESSAGING_WARNING",JSON.parse(e.responseText).Result+"\n",!0):U("cfg-audio-tmpl","MESSAGING_ERROR",e.statusText+"\n"),console.log(e.responseText)}}),console.log("sent data:",JSON.stringify(n))},window.handleDisconnect=function(){c.ajax({url:"/connect.json",dataType:"text",method:"DELETE",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify({timestamp:Date.now()})})},window.handleConnect=function(){nt.ssid=c("#manual_ssid").val(),nt.pwd=c("#manual_pwd").val(),nt.dhcpname=c("#dhcp-name2").val(),c("*[class*='connecting']").hide(),c("#ssid-wait").text(nt.ssid),c(".connecting").show(),c.ajax({url:"/connect.json",dataType:"text",method:"POST",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify({timestamp:Date.now(),ssid:nt.ssid,pwd:nt.pwd}),error:j})},c(document).ready((function(){c(".material-icons").each((function(t,e){e.attributes.icon=e.textContent})),bt(!0),p(),x.init(),c("#fw-url-input").on("input",(function(){c(this).val().length>8&&(c(this).val().startsWith("http://")||c(this).val().startsWith("https://"))?c("#start-flash").show():c("#start-flash").hide()})),c(".upSrch").on("input",(function(){var t=this.value;c("#rTable tr").removeClass(this.id+"_hide"),t.length>0&&c("#rTable td:nth-child(".concat(c(this).parent().index()+1,")")).filter((function(){return!c(this).text().toUpperCase().includes(t.toUpperCase())})).parent().addClass(this.id+"_hide"),c('[class*="_hide"]').hide(),c("#rTable tr").not('[class*="_hide"]').show()})),setTimeout(lt,1500),c("#WifiConnectDialog")[0].addEventListener("shown.bs.modal",(function(t){c("*[class*='connecting']").hide(),null!=t&&t.relatedTarget&&(nt.Action=st.CONN,c(t.relatedTarget).children("td:eq(1)").text()==et.ssid?nt.Action=st.STS:c(t.relatedTarget).is(":last-child")?(nt.Action=st.MAN,nt.ssid="",c("#manual_ssid").val(nt.ssid)):(nt.ssid=c(t.relatedTarget).children("td:eq(1)").text(),c("#manual_ssid").val(nt.ssid))),nt.Action!==st.STS?(c(".connecting-init").show(),c("#manual_ssid").trigger("focus")):mt()})),c("#WifiConnectDialog")[0].addEventListener("hidden.bs.modal",(function(){c("#WifiConnectDialog input").val("")})),c("#uCnfrm")[0].addEventListener("shown.bs.modal",(function(){c("#selectedFWURL").text(c("#fw-url-input").val())})),c("input#show-commands")[0].checked=1===q,c('a[href^="#tab-commands"]').hide(),c("#load-nvs").on("click",(function(){c("#nvsfilename").trigger("click")})),c("#nvsfilename").on("change",(function(){if("function"!=typeof window.FileReader)throw"The file API isn't supported on this browser.";if(!this.files)throw"This browser does not support the `files` property of the file input.";if(this.files[0]){var t=this.files[0],e=new FileReader;e.onload=function(t){var e={};try{e=JSON.parse(t.target.result)}catch(t){alert("Parsing failed!\r\n "+t)}c("input.nvs").each((function(t,n){c(this).parent().removeClass("bg-warning").removeClass("bg-success"),e[n.id]&&(e[n.id]!==n.value?(console.log("Changed "+n.id+" "+n.value+"==>"+e[n.id]),c(this).parent().addClass("bg-warning"),c(this).val(e[n.id])):c(this).parent().addClass("bg-success"))})),c("input.nvs").children(".bg-warning")&&alert("Highlighted values were changed. Press Commit to change on the device")},e.readAsText(t),this.value=null}})),c("#clear-syslog").on("click",(function(){W=0,H="MESSAGING_INFO",c("#msgcnt").text(""),c("#syslogTable").html("")})),c("#ok-credits").on("click",(function(){c("#credits").slideUp("fast",(function(){})),c("#app").slideDown("fast",(function(){}))})),c("#acredits").on("click",(function(t){t.preventDefault(),c("#app").slideUp("fast",(function(){})),c("#credits").slideDown("fast",(function(){}))})),c("input#show-commands").on("click",(function(){this.checked=this.checked?1:0,this.checked?(c('a[href^="#tab-commands"]').show(),q=1):(q=0,c('a[href^="#tab-commands"]').hide())})),c("input#show-nvs").on("click",(function(){this.checked=this.checked?1:0,r.Z.set("show-nvs",this.checked?"Y":"N"),p()})),c("#btn_reboot_recovery").on("click",(function(){handleReboot("recovery")})),c("#btn_reboot").on("click",(function(){handleReboot("reboot")})),c("#btn_flash").on("click",(function(){hFlash()})),c("#save-autoexec1").on("click",(function(){saveAutoexec1(!1)})),c("#commit-autoexec1").on("click",(function(){saveAutoexec1(!0)})),c("#btn_disconnect").on("click",(function(){et={},dt(),c.ajax({url:"/connect.json",dataType:"text",method:"DELETE",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify({timestamp:Date.now()})})})),c("#btnJoin").on("click",(function(){handleConnect()})),c("#reboot_nav").on("click",(function(){handleReboot("reboot")})),c("#reboot_ota_nav").on("click",(function(){handleReboot("reboot_ota")})),c("#save-as-nvs").on("click",(function(){var t=ot(!0),e=document.createElement("a");e.href=URL.createObjectURL(new Blob([JSON.stringify(t,null,2)],{type:"text/plain"})),e.setAttribute("download","nvs_config_"+z+"_"+Date.now()+"json"),document.body.appendChild(e),e.click(),document.body.removeChild(e)})),c("#save-nvs").on("click",(function(){I(ot(!1))})),c("#fwUpload").on("click",(function(){0===document.getElementById("flashfilename").files.length?alert("No file selected!"):(c("#fw-url-input").value=null,x.StartOTA())})),c("[name=output-tmpl]").on("click",(function(){P(this.id)})),c("#chkUpdates").on("click",(function(){c("#rTable").html(""),c.getJSON(D,(function(t){var e=[];t.forEach((function(t){var n=t.name.split("#")[3];e.includes(n)||e.push(n)}));var n="";e.forEach((function(t){n+='"})),c("#fwbranch").append(n),t.forEach((function(t){var e="";t.assets.forEach((function(t){t.name.match(/\.bin$/)&&(e=t.browser_download_url)}));var n=t.name.split("#"),a=n[0],s=n[2],o=n[3],i=a.substr(a.lastIndexOf("-")+1);i="32"==i||"16"==i?i:"";var r=t.body;r=(r=(r=r.replace(/'/gi,'"')).replace(/[\s\S]+(### Revision Log[\s\S]+)### ESP-IDF Version Used[\s\S]+/,"$1")).replace(/- \(.+?\) /g,"- ").encodeHTML(),c("#rTable").append("\n ").concat(a,"").concat(new Date(t.created_at).toLocalShort(),"\n ").concat(s,"").concat(o,"").concat(i,""))})),c("#searchfw").css("display","inline"),rt(X)||rt(K),c("#rTable tr.release").on("click",(function(){var t=this.attributes.fwurl.value;L&&(t=t.replace(/.*\/download\//,L+"/plugins/SqueezeESP32/firmware/")),c("#fw-url-input").val(t),c("#start-flash").show(),c("#rTable tr.release").removeClass("table-success table-warning"),c(this).addClass("table-success table-warning")}))})).fail((function(){alert("failed to fetch release history!")}))})),c("#fwcheck").on("click",(function(){c("#releaseTable").html(""),c("#fwbranch").empty(),c.getJSON(D,(function(t){var e,n=0,a=[];t.forEach((function(t){var e=t.name.split("#")[3];a.includes(e)||a.push(e)})),a.forEach((function(t){e+='"})),c("#fwbranch").append(e),t.forEach((function(t){var e="";t.assets.forEach((function(t){t.name.match(/\.bin$/)&&(e=t.browser_download_url)}));var a=t.name.split("#"),s=a[0],o=a[1],i=a[2],r=a[3],l=t.body;l=(l=(l=l.replace(/'/gi,'"')).replace(/[\s\S]+(### Revision Log[\s\S]+)### ESP-IDF Version Used[\s\S]+/,"$1")).replace(/- \(.+?\) /g,"- ");var u=n++>6?" hide":"";c("#releaseTable").append(""+s+""+new Date(t.created_at).toLocalShort()+""+i+""+o+""+r+"")})),n>7&&(c("#releaseTable").append(""),c("#showallbutton").on("click",(function(){c("tr.hide").removeClass("hide"),c("tr#showall").addClass("hide")}))),c("#searchfw").css("display","inline")})).fail((function(){alert("failed to fetch release history!")}))})),c("#updateAP").on("click",(function(){lt(),console.log("refresh AP")})),_t(),yt(),ft(),vt()})),window.setURL=function(t){var e=t.dataset.url;c('[data-bs-url^="http"]').addClass("btn-success").removeClass("btn-danger"),c('[data-bs-url="'+e+'"]').addClass("btn-danger").removeClass("btn-success"),L&&(e=e.replace(/.*\/download\//,L+"/plugins/SqueezeESP32/firmware/")),c("#fwurl").val(e)},window.runCommand=function(t,e){var n=t.attributes.cmdname.value;U(t.attributes.cmdname.value,"MESSAGING_INFO","Executing.",!1);var a=document.getElementById("flds-"+n),o=null==a?void 0:a.querySelectorAll("select,input");if("cfg-hw-preset"===n)return function(t,e){var n=JSON.parse(t[0].value),a=t[0].attributes.cmdname.value;console.log("selected model: ".concat(n.name));for(var o={timestamp:Date.now(),config:{model_config:{value:n.name,type:33}}},i=0,r=Object.entries(n.config);i{n.r(e)},607:(t,e,n)=>{n(138),n(393),n(861),n(322)},861:t=>{t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAb1BMVEXIycuswsKMjI4rqqZyc3RQlpQ6jIEmJifW2dq5ursppJ8Om4zC0NAFdGYmmpb///8Hg3O4x8cHkoEggX0jko5Ks6/P0dM5r6ocoZb3+PgiiYVevrp/y8bg4uOS09FtxMDs7+7M6um529qoysik2tiNn72gAAAAF3RSTlP94Fr/Wf39BP26/////////////////kibhL0AAAGjSURBVDjLbZMJkoMgEEWtmETEJWpkiSC45P5nnF4wk7HmW2jLfzYIdFYUxbXUYp5nIbTOUFoLAR2ivIKZFQXYuu6TahSHmdAlAqWub0/QNI1jSxrHacKeWw9EdtH1xHbbyiRgCJn67JqVAr9nO2fJnBDMoUuYEvsfmxnJBM66Zj8/iYmaAPKlOvRNJAC/fz8OefINEAngAbYPEMiHTJCCAZrACciVMpCCgDEBKwsAowymMO3IAP3Btqa5vYJx0ZlcOSUZaE/AWznvnTHOyfZ/wMUQvAIg/wb27QNEH94BgGj+APsZiF8AXAhQQEMwkIYYLW7xvsENoyUoF0I0ysf0F2O743kDQNXzXM8+j8Eb6byzDEz7gtpsO1PgrXG5Nd6btNTP+YXarKTny1uQ9JiAN6vbqT9au+BzMQjAWtlq6BiYttdjiVVVqfXxWFWFkk6Cz0DTdYOFPmpHAAK/YQCJoTppQJ8A3TAxVAAhR439Bg5tKe7NgSDEje3mDsf+ovuGCUbYZb/BwoHS6ykHMYfo/U6lx8Xb/+qo3U/x/lf+VP9c/j9c3zy20WEMxgAAAABJRU5ErkJggg=="}},n={};function a(t){var s=n[t];if(void 0!==s)return s.exports;var o=n[t]={id:t,loaded:!1,exports:{}};return e[t].call(o.exports,o,o.exports,a),o.loaded=!0,o.exports}a.m=e,t=[],a.O=(e,n,s,o)=>{if(!n){var i=1/0;for(u=0;u=o)&&Object.keys(a.O).every((t=>a.O[t](n[c])))?n.splice(c--,1):(r=!1,o0&&t[u-1][2]>o;u--)t[u]=t[u-1];t[u]=[n,s,o]},a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{var t={826:0};a.O.j=e=>0===t[e];var e=(e,n)=>{var s,o,[i,r,c]=n,l=0;if(i.some((e=>0!==t[e]))){for(s in r)a.o(r,s)&&(a.m[s]=r[s]);if(c)var u=c(a)}for(e&&e(n);la(607)));s=a.O(s)})(); //# sourceMappingURL=index.392dfa.bundle.js.map