(()=>{"use strict";var t,e={156(t,e,n){n(336),n(249),n(512),n(618)},249(t,e,n){n.r(e)},512(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=="},618(t,e,n){n.r(e);var a=n(467),s=n(75),o=n(756),i=n.n(o),c=n(987),r=n(692);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){if("string"==typeof t)return u(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(t,e):void 0}}(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,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){c=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw o}}}}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=Array(e);n")}}),Object.assign(Date.prototype,{toLocalShort:function(){return this.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}});var v=1,g=17,b=2,S=18,_=4,y=20,w=8,A=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}]}],O=[{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"]}],k={MESSAGING_INFO:"badge-success",MESSAGING_WARNING:"badge-warning",MESSAGING_ERROR:"badge-danger"},x=0,N=1,R=3,C=4,I=5,G={0:"eRunning",1:"eReady",2:"eBlocked",3:"eSuspended",4:"eDeleted"},P={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(),r("#rTable tr.release").removeClass("table-success table-warning"),r(".flact").prop("disabled",!1),r("#flashfilename").value=null,r("#fw-url-input").value=null,this.isStateError()||(r("span#flash-status").html(""),r("#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,r("#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."),r.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.",U({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=r("#fw-url-input").val();var t=r("#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(),r(".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&&(r("span#flash-status").html(this.statusText),this.ShowDialog()),this},UpdateProgress:function(){return r(".progress-bar").css("width",this.statusPercent+"%").attr("aria-valuenow",this.statusPercent).text(this.statusPercent+"%"),r(".progress-bar").html((this.isStateDone()?100:this.statusPercent)+"%"),this},StartOTA:function(){return this.logEvent(this.StartOTA.name),r("#fwProgressLabel").parent().removeClass("bg-danger"),this.setOTATargets(),this.isStateError()||(Y?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 Y&&this.prevRecovery&&!this.isStateRebootRecovery()&&!this.isStateFlashing()?this:(this.logEvent(this.TargetReadyStartOTA.name),Y?(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){r(t).parent().parent().hide()};var j=!1,M=2500;function U(t){var e={timestamp:Date.now(),config:t};r.ajax({url:"/config.json",dataType:"text",method:"POST",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify(e),error:W})}function L(t){for(var e,n,a={},s="",o=t.match(/("[^"]+"|'[^']+'|\S+)/g),i=0;i0&&(e=e.substring(0,e.indexOf(" ")));return e}(a),n=function(t){var e;t.n&&(e=t.n.replace(/"/g,"").replace(/'/g,""));return e}(a);var u={btname:null,n:null};if(a.o&&"BT"===e.toUpperCase()){var d=L(a.o);d.name&&(u.btname=d.name),delete a.o}return a.n&&(u.n=a.n,delete a.n),{name:n,output:e,options:a,otherValues:s,otherOptions:u}}function F(){return ut.hasOwnProperty("ip")&&"0.0.0.0"!=ut.ip&&""!=ut.ip}function D(t){return F()?t.icon:t.label}function J(t){r("#o_type").children("span").css({display:"none"});var e=!1;"bt"===t?(e="bt"!==et&&""!==et,et="bt"):"spdif"===t?(e="spdif"!==et&&""!==et,et="spdif"):(e="i2s"!==et&&""!==et,et="i2s"),r("#"+et).prop("checked",!0),r("#o_"+et).css({display:"inline"}),e&&Object.keys(Z[et]).forEach(function(t){r("#cmd_opt_".concat(t)).val(Z[et][t])})}function W(t,e,n){console.log(t.status),console.log(n),""!==n&&Pt(n,"MESSAGING_ERROR")}function B(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"),r("#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=(r("#msg_"+t).html().length>0&&a?r("#msg_"+t).html()+"
":"")+o,r("#msg_"+t).html(o)}window.hFlash=function(){r("#flashfilename").value=null,P.StartOTA()},window.handleReboot=function(t){"reboot_ota"==t?(r("#reboot_ota_nav").removeClass("active").prop("disabled",!0),gt(500,"","reboot_ota")):(r("#reboot_nav").removeClass("active"),gt(500,"",t))};var H,q="https://api.github.com/repos/sle118/squeezelite-esp32/releases",Y=!1,z=!1,V="",Z={i2s:{b:"500:2000",C:"30",W:"",Z:"96000",o:"I2S"},spdif:{b:"500:2000",C:"30",W:"",Z:"48000",o:"SPDIF"},bt:{b:"500:2000",C:"30",W:"",Z:"44100",o:"BT"}},Q={codecs:["flac","pcm","mp3","ogg","aac","wma","alac","dsd","mad","mpg"]},X=0,K="MESSAGING_INFO",$={},tt=null,et="",nt="",at="Squeezelite-ESP32",st="",ot=at,it="",ct=at,rt="",lt="#cfg-audio-bt_source-sink_name",ut={},dt={},ht="",pt=0,ft=1,mt=2;function vt(t){var e={};r("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===v||s===g||s===b||s===S||s===_||s===y||s===w||s===A?parseInt(a.value):a.value,e[a.id].type=s)}});var n=r("#nvs-new-key").val(),a=r("#nvs-new-value").val();return""!==n&&(t?e[n]=a:(e[n]={},e[n].value=a,e[n].type=33)),e}function gt(t,e){var n="/"+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"reboot")+".json";r("tbody#tasks").empty(),r("#tasks_sect").css("visibility","collapse"),h.resolve({cmdname:e,url:n}).delay(t).then(function(t){t.cmdname.length>0?B(t.cmdname,"MESSAGING_WARNING","System is rebooting.\n",!0):Pt("System is rebooting.\n","MESSAGING_WARNING"),console.log("now triggering reboot"),r("button[onclick*='handleReboot']").addClass("rebooting"),r.ajax({url:t.url,dataType:"text",method:"POST",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify({timestamp:Date.now()}),error:W,complete:function(){console.log("reboot call completed"),h.resolve(t).delay(6e3).then(function(t){t.cmdname.length>0&&function(t){r("#toast_"+t).removeClass("table-success").removeClass("table-warning").removeClass("table-danger").addClass("table-success").removeClass("show"),r("#msg_"+t).html("")}(t.cmdname),It(),Gt()})}})})}function bt(t){return r(".upf").filter(function(){return r(this).text().toUpperCase()===t.toUpperCase()}).length>0&&(r("#splf").val(t).trigger("input"),!0)}function St(t,e){var n="cmd_opt_".concat(t),a="".concat(n,"-error"),s=r("#".concat(a)),o=r("#".concat(n));return s&&0!=s.length||(o.after('
')),s=r("#".concat(a))),0==e.length?(s.hide(),o.removeClass("is-invalid"),o.addClass("is-valid"),s.text("")):(s.show(),s.text(e),o.removeClass("is-valid"),o.addClass("is-invalid")),s}function _t(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 yt(){var t;(null===(t=ut)||void 0===t?void 0:t.urc)!==I&&(r.ajaxSetup({timeout:3e3}),r.getJSON("/scan.json",(0,a.A)(i().mark(function t(){return i().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=1,Ut(2e3);case 1:r.getJSON("/ap.json",function(t){t.length>0&&(t.sort(function(t,e){var n=t.rssi,a=e.rssi;return na?-1:0}),At(t))});case 2:case"end":return t.stop()}},t)}))))}function wt(t,e,n){var a=_t(e),s={label:0==n?"🔓":"🔒",icon:0==n?"no_encryption":"lock"};return''.concat(t,'\n ').concat(D(a),'\n \t\n ').concat(D(s),"\n ")}function At(t){var e,n="";if(r("#wifiTable tr td:first-of-type").text(""),r("#wifiTable tr").removeClass("table-success table-warning"),t&&(t.forEach(function(t){n+=wt(t.ssid,t.rssi,t.auth)}),r("#wifiTable").html(n)),0==r(".manual_add").length&&(r("#wifiTable").append(wt("Manual add",0,0)),r("#wifiTable tr:last").addClass("table-light text-dark").addClass("manual_add")),!ut.ssid||ut.urc!==x&&ut.urc!==C)(null===(e=ut)||void 0===e?void 0:e.urc)!==I&&r("span#foot-if").html("");else{var a,s='#wifiTable td:contains("'.concat(ut.ssid,'")');if(0==r(s).filter(function(){return r(this).text()===ut.ssid}).length)r("#wifiTable").prepend("".concat(wt(ut.ssid,null!==(a=ut.rssi)&&void 0!==a?a:0,0)));r(s).filter(function(){return r(this).text()===ut.ssid}).siblings().first().html("✓").parent().addClass(ut.urc===x?"table-success":"table-warning"),r("span#foot-if").html("SSID: ".concat(ut.ssid,", IP: ").concat(ut.ip,"")),r("#wifiStsIcon").html(_t(ut.rssi))}}function Tt(t){console.debug(this.toLocaleString()+"\t"+t.nme+"\t"+t.cpu+"\t"+G[t.st]+"\t"+t.minstk+"\t"+t.bprio+"\t"+t.cprio+"\t"+t.num),r("tbody#tasks").append(''+t.num+""+t.nme+""+t.cpu+""+G[t.st]+""+t.minstk+""+t.bprio+""+t.cprio+"")}function Et(t){return r("".concat(lt," option:contains('").concat(t,"')"))}function Ot(){r.ajaxSetup({timeout:M}),r.getJSON("/messages.json",function(){var t=(0,a.A)(i().mark(function t(e){var n,a,s,o,c,u,d,h,p,f,m;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,s;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),s=e.class,t.next="MESSAGING_CLASS_OTA"===s?1:"MESSAGING_CLASS_STATS"===s?2:"MESSAGING_CLASS_SYSTEM"===s?3:"MESSAGING_CLASS_CFGCMD"===s?4:"MESSAGING_CLASS_BT"===s?5:6;break;case 1:return P.EventOTAMessageClass(e.message),t.abrupt("continue",7);case 2:return c=JSON.parse(e.message),console.debug(o.toLocalShort()+" - Number of running tasks: "+c.ntasks),console.debug(o.toLocalShort()+"\tname\tcpu\tstate\tminstk\tbprio\tcprio\tnum"),c.tasks?("collapse"===r("#tasks_sect").css("visibility")&&r("#tasks_sect").css("visibility","visible"),r("tbody#tasks").html(""),c.tasks.sort(function(t,e){return e.cpu-t.cpu}).forEach(Tt,o)):"visible"===r("#tasks_sect").css("visibility")&&(r("tbody#tasks").empty(),r("#tasks_sect").css("visibility","collapse")),t.abrupt("continue",7);case 3:return jt(e,o),t.abrupt("continue",7);case 4:return B((u=e.message.split(/([^\n]*)\n([^]*)/g))[1],e.type,u[2],!0),t.abrupt("continue",7);case 5:if(r("#cfg-audio-bt_source-sink_name").is("input")){for(d=r("#cfg-audio-bt_source-sink_name")[0].attributes,h="",p=0;p "))}return JSON.parse(e.message).forEach(function(t){Et(t.name).length>0||(r("#cfg-audio-bt_source-sink_name").append("")),jt({type:e.type,message:"BT Audio device found: ".concat(t.name," RSSI: ").concat(t.rssi," ")},o)),Et(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")}),r(lt).append(r("".concat(lt," option")).remove().sort(function(t,e){return console.log("".concat(parseInt(r(t).attr("rssi"))," < ").concat(parseInt(r(e).attr("rssi"))," ? ")),parseInt(r(t).attr("rssi"))".concat(ut.ip,""))):(r(".if_wifi").show(),At())),kt(t)}function Rt(){r.ajaxSetup({timeout:2e3}),r.getJSON("/status.json",function(t){var e;if(function(t){var e;1===(null!==(e=t.recovery)&&void 0!==e?e:0)?(Y=!0,r(".recovery_element").show(),r(".ota_element").hide(),r("#boot-button").html("Reboot"),r("#boot-form").attr("action","/reboot_ota.json")):(!Y&&z&&(z=!1,setTimeout(Ot,M)),Y=!1,r(".recovery_element").hide(),r(".ota_element").show(),r("#boot-button").html("Recovery"),r("#boot-form").attr("action","/recovery.json"))}(t),f(),Nt(t),function(t){var e="",n="";if(void 0!==t.bt_status&&void 0!==t.bt_sub_status){var a=O[t.bt_status].sub[t.bt_sub_status];a?(e=T[a],n=O[t.bt_status].desc):(e=T.bt_connected,n="Output status")}r("#o_type").attr("title",n),r("#o_bt").html(F()?e.label:e.text)}(t),P.EventTargetStatus(t),t.depth&&(16==t.depth?r("#cmd_opt_R").show():r("#cmd_opt_R").hide()),t.project_name&&""!==t.project_name&&(ot=t.project_name),t.platform_name&&""!==t.platform_name&&(ct=t.platform_name),""===it&&(it=ot),""===it&&(it="Squeezelite-ESP32"),t.version&&""!==t.version?(at=t.version,r("#navtitle").html("".concat(it).concat(Y?"
[recovery]":"")),r("span#foot-fw").html("fw: ".concat(at,", mode: ").concat(Y?"Recovery":ot,""))):r("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=Ct(t,e.name,n.longopts),c="hasvalue="+n.hasvalue+" ";c+='longopts="'+n.longopts+'" ',c+='shortopts="'+n.shortopts+'" ',c+="checkbox="+n.checkbox+" ",c+='cmdname="'+e.name+'" ',c+='id="'+s+'" name="'+s+'" hasvalue="'+n.hasvalue+'" ';var r=n.mincount>0?"bg-success":"";"hidden"===n.glossary&&(c+=' style="visibility: hidden;"'),n.checkbox?o+='
"):(o+='
"),a.includes("|")?(r=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?r(s).append(o):r("#commands-list").append(o)}}),r(".sclk").off("click").on("click",function(){runCommand(this,!1)}),r(".cclk").off("click").on("click",function(){runCommand(this,!0)}),t.commands.forEach(function(e){r("[cmdname="+e.name+"]:input").val(""),r("[cmdname="+e.name+"]:checkbox").prop("checked",!1),e.argtable&&e.argtable.forEach(function(n){var a="#"+e.name+"-"+n.longopts,s=Ct(t,e.name,n.longopts);n.checkbox?r(a)[0].checked=s:(void 0!==s&&r(a).val(s).trigger("change"),0===r(a)[0].value.length&&(n.datatype||"").includes("|")&&(r(a)[0].value="--"))})}),0!=r("#cfg-hw-preset-model_config").length&&(j||(j=!0,r("#cfg-hw-preset-model_config").html(""),r.getJSON("https://gist.githubusercontent.com/sle118/dae585e157b733a639c12dc70f0910c5/raw/",{_:(new Date).getTime()},function(t){r.each(t,function(t,e){r("#cfg-hw-preset-model_config").append("")),""!==rt&&rt==e.name&&r("#cfg-hw-preset-model_config").val(rt)}),""!==rt&&"#prev_preset".show().val(rt)}).fail(function(t,e,n){var a=e+", "+n;console.log("Request Failed: "+a)})))}).fail(function(t,e,n){404==t.status?r(".orec").hide():W(t,0,n),r("#commands-list").empty()})}function Gt(){r.ajaxSetup({timeout:7e3}),r.getJSON("/config.json",function(t){r("#nvsTable tr").remove();var e=t.config?t.config:t;$=e,V="",Object.keys(e).sort().forEach(function(t){var n=e[t].value;"autoexec1"===t?function(t){var e=L(t);e.output.toUpperCase().startsWith("I2S")?J("i2s"):e.output.toUpperCase().startsWith("SPDIF")?J("spdif"):e.output.toUpperCase().startsWith("BT")&&(e.otherOptions.btname&&(V=e.otherOptions.btname),J("bt"));if(Object.keys(e.options).forEach(function(t){var n=e.options[t];r("#cmd_opt_".concat(t)).hasOwnProperty("checked")?r("#cmd_opt_".concat(t))[0].checked=n:r("#cmd_opt_".concat(t)).val(n)}),e.options.hasOwnProperty("u")){var n=e.options.u.split(":"),a=(0,s.A)(n,2),o=a[0],i=a[1];r("#resample_".concat(o)).prop("checked",!0),i&&r("#resample_i").prop("checked",!0)}e.options.hasOwnProperty("s")&&("-disable"===e.options.s?r("#disable-squeezelite")[0].checked=!0:r("#disable-squeezelite")[0].checked=!1)}(n):"host_name"===t?(n=n.replaceAll('"',""),r("input#dhcp-name1").val(n),r("input#dhcp-name2").val(n),0==r("#cmd_opt_n").length&&r("#cmd_opt_n").val(n),document.title=n,nt=n):"rel_api"===t?q=n:"enable_airplay"===t?r("#s_airplay").css({display:m(n)?"inline":"none"}):"enable_cspot"===t?r("#s_cspot").css({display:m(n)?"inline":"none"}):"preset_name"==t?rt=n:"board_model"==t&&(it=n),r("tbody#nvsTable").append(""+t+""),r("input#"+t).val(e[t].value)}),V.length>0&&r("#cfg-audio-bt_source-sink_name").val(V),r("tbody#nvsTable").append(""),t.gpio?(r("#pins").show(),r("tbody#gpiotable tr").remove(),t.gpio.forEach(function(t){r("tbody#gpiotable").append("'+t.group+""+t.name+""+t.gpio+""+(t.fixed?"Fixed":"Configuration")+"")})):r("#pins").hide()}).fail(function(t,e,n){W(t,0,n)})}function Pt(t,e){jt({message:t,type:e},new Date)}function jt(t,e){var n="table-success";"MESSAGING_WARNING"===t.type?(n="table-warning","MESSAGING_INFO"===K&&(K="MESSAGING_WARNING")):"MESSAGING_ERROR"===t.type&&("MESSAGING_INFO"!==K&&"MESSAGING_WARNING"!==K||(K="MESSAGING_ERROR"),n="table-danger"),++X>0&&(r("#msgcnt").removeClass("badge-success"),r("#msgcnt").removeClass("badge-warning"),r("#msgcnt").removeClass("badge-danger"),r("#msgcnt").addClass(k[K]),r("#msgcnt").text(X)),r("#syslogTable").append(""+e.toLocalShort()+""+t.message.encodeHTML()+"")}function Mt(t,e,n){return(t-e)*(t-n)<=0}function Ut(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){B("cfg-audio-tmpl","MESSAGING_INFO","Saving.\n",!1);var e="".concat("squeezelite "," -o ").concat(et," ");r(".sqcmd").each(function(){var t=p(r(this)),n=t.opt,a=t.val;if(n&&n.length>0&&"boolean"==typeof a||a.length>0){var s=":"===n?n:" -".concat(n," ");a="boolean"==typeof a?"":a,e+="".concat(s," ").concat(a)}});var n=r("#cmd_opt_R input[name=resample]:checked");n.length>0&&""!==n.attr("suffix")&&(e+=n.attr("suffix"),r("#resample_i").is(":checked")&&"true"==n.attr("aint")&&(e+=r("#resample_i").attr("suffix"))),"bt"===et&&B("cfg-audio-tmpl","MESSAGING_INFO","Remember to configure the Bluetooth audio device name.\n",!0),e+=function(t){for(var e=" ",n=0,a=Object.entries(t);n8&&(r(this).val().startsWith("http://")||r(this).val().startsWith("https://"))?r("#start-flash").show():r("#start-flash").hide()}),r(".upSrch").on("input",function(){var t=this.value;r("#rTable tr").removeClass(this.id+"_hide"),t.length>0&&r("#rTable td:nth-child(".concat(r(this).parent().index()+1,")")).filter(function(){return!r(this).text().toUpperCase().includes(t.toUpperCase())}).parent().addClass(this.id+"_hide"),r('[class*="_hide"]').hide(),r("#rTable tr").not('[class*="_hide"]').show()}),setTimeout(yt,1500),r("#options input").on("input",function(){var t=p(this),e=t.opt,n=t.val;if("c"===e||"e"===e){"cmd_opt_".concat(e,"_codec-error");var a=n.split(",").map(function(t){return t.trim()}).filter(function(t){return!Q.codecs.includes(t)});St(e,a.length>0?"Invalid codec(s) ".concat(a.join(", ")):"")}if("m"===e){St(e,/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(n)?"":"Invalid MAC address")}if("r"===e){St(e,/^(\d+\.?\d*|\.\d+)-(\d+\.?\d*|\.\d+)$|^(\d+\.?\d*)$|^(\d+\.?\d*,)+\d+\.?\d*$/.test(n)?"":"Invalid rate(s) ".concat(n,". Acceptable format: |-|,,"))}}),r("#WifiConnectDialog")[0].addEventListener("shown.bs.modal",function(t){r("*[class*='connecting']").hide(),null!=t&&t.relatedTarget&&(dt.Action=pt,r(t.relatedTarget).children("td:eq(1)").text()==ut.ssid?dt.Action=mt:r(t.relatedTarget).is(":last-child")?(dt.Action=ft,dt.ssid="",r("#manual_ssid").val(dt.ssid)):(dt.ssid=r(t.relatedTarget).children("td:eq(1)").text(),r("#manual_ssid").val(dt.ssid))),dt.Action!==mt?(r(".connecting-init").show(),r("#manual_ssid").trigger("focus")):kt()}),r("#WifiConnectDialog")[0].addEventListener("hidden.bs.modal",function(){r("#WifiConnectDialog input").val("")}),r("#uCnfrm")[0].addEventListener("shown.bs.modal",function(){r("#selectedFWURL").text(r("#fw-url-input").val())}),r("input#show-commands")[0].checked=1===tt,r('a[href^="#tab-commands"]').hide(),r("#load-nvs").on("click",function(){r("#nvsfilename").trigger("click")}),r("#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)}r("input.nvs").each(function(t,n){r(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]),r(this).parent().addClass("bg-warning"),r(this).val(e[n.id])):r(this).parent().addClass("bg-success"))}),r("input.nvs").children(".bg-warning")&&alert("Highlighted values were changed. Press Commit to change on the device")},e.readAsText(t),this.value=null}}),r("#clear-syslog").on("click",function(){X=0,K="MESSAGING_INFO",r("#msgcnt").text(""),r("#syslogTable").html("")}),r("#ok-credits").on("click",function(){r("#credits").slideUp("fast",function(){}),r("#app").slideDown("fast",function(){})}),r("#acredits").on("click",function(t){t.preventDefault(),r("#app").slideUp("fast",function(){}),r("#credits").slideDown("fast",function(){})}),r("input#show-commands").on("click",function(){this.checked=this.checked?1:0,this.checked?(r('a[href^="#tab-commands"]').show(),tt=1):(tt=0,r('a[href^="#tab-commands"]').hide())}),r("#disable-squeezelite").on("click",function(){if(this.checked){var t=r("#cmd_opt_s").val();r("#cmd_opt_s").data("originalValue",t),r("#cmd_opt_s").val("-disable")}else{var e=r("#cmd_opt_s").data("originalValue");r("#cmd_opt_s").val(e||"")}}),r("input#show-nvs").on("click",function(){this.checked=this.checked?1:0,c.A.set("show-nvs",this.checked?"Y":"N"),f()}),r("#btn_reboot_recovery").on("click",function(){handleReboot("recovery")}),r("#btn_reboot").on("click",function(){handleReboot("reboot")}),r("#btn_flash").on("click",function(){hFlash()}),r("#save-autoexec1").on("click",function(){saveAutoexec1(!1)}),r("#commit-autoexec1").on("click",function(){saveAutoexec1(!0)}),r("#btn_disconnect").on("click",function(){ut={},At(),r.ajax({url:"/connect.json",dataType:"text",method:"DELETE",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify({timestamp:Date.now()})})}),r("#btnJoin").on("click",function(){handleConnect()}),r("#reboot_nav").on("click",function(){handleReboot("reboot")}),r("#reboot_ota_nav").on("click",function(){handleReboot("reboot_ota")}),r("#save-as-nvs").on("click",function(){var t=vt(!0),e=document.createElement("a");e.href=URL.createObjectURL(new Blob([JSON.stringify(t,null,2)],{type:"text/plain"})),e.setAttribute("download","nvs_config_"+nt+"_"+Date.now()+"json"),document.body.appendChild(e),e.click(),document.body.removeChild(e)}),r("#save-nvs").on("click",function(){U(vt(!1))}),r("#fwUpload").on("click",function(){0===document.getElementById("flashfilename").files.length?alert("No file selected!"):(r("#fw-url-input").value=null,P.StartOTA())}),r("[name=output-tmpl]").on("click",function(){J(this.id)}),r("#chkUpdates").on("click",function(){r("#rTable").html(""),r.getJSON(q,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+='"}),r("#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 c=t.body;c=(c=(c=c.replace(/'/gi,'"')).replace(/[\s\S]+(### Revision Log[\s\S]+)### ESP-IDF Version Used[\s\S]+/,"$1")).replace(/- \(.+?\) /g,"- ").encodeHTML(),r("#rTable").append("\n ").concat(a,"").concat(new Date(t.created_at).toLocalShort(),"\n ").concat(s,"").concat(o,"").concat(i,""))}),r("#searchfw").css("display","inline"),bt(ct)||bt(ot),r("#rTable tr.release").on("click",function(){var t=this.attributes.fwurl.value;H&&(t=t.replace(/.*\/download\//,H+"/plugins/SqueezeESP32/firmware/")),r("#fw-url-input").val(t),r("#start-flash").show(),r("#rTable tr.release").removeClass("table-success table-warning"),r(this).addClass("table-success table-warning")})}).fail(function(){alert("failed to fetch release history!")})}),r("#fwcheck").on("click",function(){r("#releaseTable").html(""),r("#fwbranch").empty(),r.getJSON(q,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+='"}),r("#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],c=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":"";r("#releaseTable").append(""+s+""+new Date(t.created_at).toLocalShort()+""+i+""+o+""+c+"")}),n>7&&(r("#releaseTable").append(""),r("#showallbutton").on("click",function(){r("tr.hide").removeClass("hide"),r("tr#showall").addClass("hide")})),r("#searchfw").css("display","inline")}).fail(function(){alert("failed to fetch release history!")})}),r("#updateAP").on("click",function(){yt(),console.log("refresh AP")}),Gt(),It(),Ot(),Rt()}),window.setURL=function(t){var e=t.dataset.url;r('[data-bs-url^="http"]').addClass("btn-success").removeClass("btn-danger"),r('[data-bs-url="'+e+'"]').addClass("btn-danger").removeClass("btn-success"),H&&(e=e.replace(/.*\/download\//,H+"/plugins/SqueezeESP32/firmware/")),r("#fwurl").val(e)},window.runCommand=function(t,e){var n=t.attributes.cmdname.value;B(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,c=Object.entries(n.config);i{if(!n){var i=1/0;for(u=0;u=o)&&Object.keys(a.O).every(t=>a.O[t](n[r]))?n.splice(r--,1):(c=!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={57:0};a.O.j=e=>0===t[e];var e=(e,n)=>{var s,o,[i,c,r]=n,l=0;if(i.some(e=>0!==t[e])){for(s in c)a.o(c,s)&&(a.m[s]=c[s]);if(r)var u=r(a)}for(e&&e(n);la(156));s=a.O(s)})(); //# sourceMappingURL=index.3fded7.bundle.js.map