2
0

index.29cc48.bundle.js 45 KB

12
  1. (()=>{"use strict";var t,e={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)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,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=new Array(e);n<e;n++)a[n]=t[n];return a}var d=n(67),h=n(964).Promise;function p(t){var e,n,a,s;return"string"==typeof t?e=r("#".concat(n=t)):(n=r(t).attr("id"),e=r(t)),"checkbox"===e.attr("type")?(s=r(t).checked?n.replace("cmd_opt_",""):"",a=!0):(s=n.replace("cmd_opt_",""),a=r(t).val(),a="".concat(a.includes(" ")?'"':"").concat(a).concat(a.includes(" ")?'"':"")),{opt:s,val:a}}function f(){var t=m(c.A.get("show-nvs"));r("input#show-nvs")[0].checked=t,r("input#show-nvs")[0].checked||W?r('*[href*="-nvs"]').show():r('*[href*="-nvs"]').hide()}function m(t){return null!=t&&"string"==typeof t&&t.match("[Yy1]")}window.bootstrap=n(336),String.prototype.format||Object.assign(String.prototype,{format:function(){var t=arguments;return this.replace(/{(\d+)}/g,(function(e,n){return void 0!==t[n]?t[n]:e}))}}),String.prototype.encodeHTML||Object.assign(String.prototype,{encodeHTML:function(){return d.encode(this).replace(/\n/g,"<br />")}}),Object.assign(Date.prototype,{toLocalShort:function(){return this.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}});var v=1,b=17,g=2,S=18,_=4,y=20,w=8,T=24,A={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"},N={OK:0,FAIL:1,DISC:2,LOST:3,RESTORE:4,ETH:5},x={0:"eRunning",1:"eReady",2:"eBlocked",3:"eSuspended",4:"eDeleted"},R={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.",G({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()||(W?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 W&&this.prevRecovery&&!this.isStateRebootRecovery()&&!this.isStateFlashing()?this:(this.logEvent(this.TargetReadyStartOTA.name),W?(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 C=!1,I=2500;function G(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:L})}function j(t){for(var e,n,a={},s="",o=t.match(/("[^"]+"|'[^']+'|\S+)/g),i=0;i<o.length;){var c=o[i];if(c.startsWith("-")){var r=c.slice(1);if(""===r){s+=o.slice(i).join(" ");break}var l=!0;i+1<o.length&&!o[i+1].startsWith("-")&&(l=o[i+1].replace(/"/g,"").replace(/'/g,""),i++),a[r]=l}else s+=c+" ";i++}s=s.trim(),e=function(t){var e;t.o&&(e=t.o.replace(/"/g,"").replace(/'/g,"")).indexOf(" ")>0&&(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=j(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 P(){return it.hasOwnProperty("ip")&&"0.0.0.0"!=it.ip&&""!=it.ip}function M(t){return P()?t.icon:t.label}function U(t){r("#o_type").children("span").css({display:"none"});var e=!1;"bt"===t?(e="bt"!==Q&&""!==Q,Q="bt"):"spdif"===t?(e="spdif"!==Q&&""!==Q,Q="spdif"):(e="i2s"!==Q&&""!==Q,Q="i2s"),r("#"+Q).prop("checked",!0),r("#o_"+Q).css({display:"inline"}),e&&Object.keys(q[Q]).forEach((function(t){r("#cmd_opt_".concat(t)).val(q[Q][t])}))}function L(t,e,n){console.log(t.status),console.log(n),""!==n&&Nt(n,"MESSAGING_ERROR")}function F(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,"<br />");o=(r("#msg_"+t).html().length>0&&a?r("#msg_"+t).html()+"<br/>":"")+o,r("#msg_"+t).html(o)}window.hFlash=function(){r("#flashfilename").value=null,R.StartOTA()},window.handleReboot=function(t){"reboot_ota"==t?(r("#reboot_ota_nav").removeClass("active").prop("disabled",!0),dt(500,"","reboot_ota")):(r("#reboot_nav").removeClass("active"),dt(500,"",t))};var D,J="https://api.github.com/repos/sle118/squeezelite-esp32/releases",W=!1,H=!1,B="",q={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"}},Y={codecs:["flac","pcm","mp3","ogg","aac","wma","alac","dsd","mad","mpg"]},z=0,V="MESSAGING_INFO",K={},Z=null,Q="",X="",$="Squeezelite-ESP32",tt="",et=$,nt="",at=$,st="",ot="#cfg-audio-bt_source-sink_name",it={},ct={},rt="",lt={CONN:0,MAN:1,STS:2};function ut(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===b||s===g||s===S||s===_||s===y||s===w||s===T?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 dt(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?F(t.cmdname,"MESSAGING_WARNING","System is rebooting.\n",!0):Nt("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:L,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),Ot(),kt()}))}})}))}function ht(t){return r(".upf").filter((function(){return r(this).text().toUpperCase()===t.toUpperCase()})).length>0&&(r("#splf").val(t).trigger("input"),!0)}function pt(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('<div id="'.concat(a,'" class="invalid-feedback"></div>')),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 ft(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 mt(){var t;(null===(t=it)||void 0===t?void 0:t.urc)!==N.ETH&&(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=2,Rt(2e3);case 2:r.getJSON("/ap.json",(function(t){t.length>0&&(t.sort((function(t,e){var n=t.rssi,a=e.rssi;return n<a?1:n>a?-1:0})),bt(t))}));case 3:case"end":return t.stop()}}),t)})))))}function vt(t,e,n){var a=ft(e),s={label:0==n?"🔓":"🔒",icon:0==n?"no_encryption":"lock"};return'<tr data-bs-toggle="modal" data-bs-target="#WifiConnectDialog"><td></td><td>'.concat(t,'</td><td>\n <span class="material-icons" style="fill:white; display: inline" aria-label="').concat(a.label,'" icon="').concat(a.icon,'" >').concat(M(a),'</span>\n \t</td><td>\n <span class="material-icons" aria-label="').concat(s.label,'" icon="').concat(s.icon,'">').concat(M(s),"</span>\n </td></tr>")}function bt(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+=vt(t.ssid,t.rssi,t.auth)})),r("#wifiTable").html(n)),0==r(".manual_add").length&&(r("#wifiTable").append(vt("Manual add",0,0)),r("#wifiTable tr:last").addClass("table-light text-dark").addClass("manual_add")),!it.ssid||it.urc!==N.OK&&it.urc!==N.RESTORE)(null===(e=it)||void 0===e?void 0:e.urc)!==N.ETH&&r("span#foot-if").html("");else{var a,s='#wifiTable td:contains("'.concat(it.ssid,'")');if(0==r(s).filter((function(){return r(this).text()===it.ssid})).length)r("#wifiTable").prepend("".concat(vt(it.ssid,null!==(a=it.rssi)&&void 0!==a?a:0,0)));r(s).filter((function(){return r(this).text()===it.ssid})).siblings().first().html("&check;").parent().addClass(it.urc===N.OK?"table-success":"table-warning"),r("span#foot-if").html("SSID: <strong>".concat(it.ssid,"</strong>, IP: <strong>").concat(it.ip,"</strong>")),r("#wifiStsIcon").html(ft(it.rssi))}}function gt(t){console.debug(this.toLocaleString()+"\t"+t.nme+"\t"+t.cpu+"\t"+x[t.st]+"\t"+t.minstk+"\t"+t.bprio+"\t"+t.cprio+"\t"+t.num),r("tbody#tasks").append('<tr class="table-primary"><th scope="row">'+t.num+"</th><td>"+t.nme+"</td><td>"+t.cpu+"</td><td>"+x[t.st]+"</td><td>"+t.minstk+"</td><td>"+t.bprio+"</td><td>"+t.cprio+"</td></tr>")}function St(t){return r("".concat(ot," option:contains('").concat(t,"')"))}function _t(){r.ajaxSetup({timeout:I}),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;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 R.EventOTAMessageClass(e.message),t.abrupt("break",24);case 9: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(gt,o)):"visible"===r("#tasks_sect").css("visibility")&&(r("tbody#tasks").empty(),r("#tasks_sect").css("visibility","collapse")),t.abrupt("break",24);case 14:return xt(e,o),t.abrupt("break",24);case 16:return F((u=e.message.split(/([^\n]*)\n([\s\S]*)/g))[1],e.type,u[2],!0),t.abrupt("break",24);case 19: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<d.length;p++)"type"!=d.item(p).name&&(h+="".concat(d.item(p).name,' = "').concat(d.item(p).value,'" '));f=r("#cfg-audio-bt_source-sink_name")[0].value,r("#cfg-audio-bt_source-sink_name").replaceWith('<select id="cfg-audio-bt_source-sink_name" '.concat(h,'><option value="').concat(f,'" data-bs-description="').concat(f,'">').concat(f,"</option></select> "))}return JSON.parse(e.message).forEach((function(t){St(t.name).length>0||(r("#cfg-audio-bt_source-sink_name").append("<option>".concat(t.name,"</option>")),xt({type:e.type,message:"BT Audio device found: ".concat(t.name," RSSI: ").concat(t.rssi," ")},o)),St(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(ot).append(r("".concat(ot," 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"))<parseInt(r(e).attr("rssi"))?1:-1}))),t.abrupt("break",24);case 23:return t.abrupt("break",24);case 24:case"end":return t.stop()}}),t)})),n.s();case 4:if((a=n.n()).done){t.next=8;break}return t.delegateYield(s(),"t0",6);case 6:t.next=4;break;case 8:t.next=13;break;case 10:t.prev=10,t.t1=t.catch(1),n.e(t.t1);case 13:return t.prev=13,n.f(),t.finish(13);case 16:setTimeout(_t,I);case 17:case"end":return t.stop()}}),t,null,[[1,10,13,16]])})));return function(e){return t.apply(this,arguments)}}()).fail((function(t,e,n){404==t.status?(r(".orec").hide(),H=!0):L(t,0,n),0==t.status&&0==t.readyState?setTimeout(_t,2*I):H||setTimeout(_t,I)}))}function yt(t){if(r("#WifiConnectDialog").is(":visible")){if(it.ip&&r("#ipAddress").text(it.ip),it.ssid&&r("#connectedToSSID").text(it.ssid),it.gw&&r("#gateway").text(it.gw),it.netmask&&r("#netmask").text(it.netmask),(void 0===ct.Action||ct.Action&&ct.Action==lt.STS)&&(r("*[class*='connecting']").hide(),r(".connecting-status").show()),K.ap_ssid&&r("#apName").text(K.ap_ssid.value),K.ap_pwd&&r("#apPass").text(K.ap_pwd.value),!t)return;switch(t.urc){case N.OK:t.ssid&&t.ssid===ct.ssid&&(r("*[class*='connecting']").hide(),r(".connecting-success").show(),ct.Action=lt.STS);break;case N.FAIL:ct.Action!=lt.STS&&ct.ssid==t.ssid&&(r("*[class*='connecting']").hide(),r(".connecting-fail").show());break;case N.LOST:break;case N.RESTORE:ct.Action!=lt.STS&&ct.ssid!=t.ssid&&(r("*[class*='connecting']").hide(),r(".connecting-fail").show());case N.DISC:}}}function wt(t){r(".material-icons").each((function(e,n){n.textContent=n.attributes[t?"aria-label":"icon"].value}))}function Tt(t){wt(!P()),!function(t){return t.urc!==it.urc||t.ssid!==it.ssid||t.gw!==it.gw||t.netmask!==it.netmask||t.ip!==it.ip||t.rssi!==it.rssi}(t)&&t.urc||(it=t,r(".if_eth").hide(),r(".if_wifi").hide(),t.urc&&it.urc==N.ETH?(r(".if_eth").show(),it.urc===N.ETH&&r("span#foot-if").html("Network: Ethernet, IP: <strong>".concat(it.ip,"</strong>"))):(r(".if_wifi").show(),bt())),yt(t)}function At(){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)?(W=!0,r(".recovery_element").show(),r(".ota_element").hide(),r("#boot-button").html("Reboot"),r("#boot-form").attr("action","/reboot_ota.json")):(!W&&H&&(H=!1,setTimeout(_t,I)),W=!1,r(".recovery_element").hide(),r(".ota_element").show(),r("#boot-button").html("Recovery"),r("#boot-form").attr("action","/recovery.json"))}(t),f(),Tt(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=A[a],n=O[t.bt_status].desc):(e=A.bt_connected,n="Output status")}r("#o_type").attr("title",n),r("#o_bt").html(P()?e.label:e.text)}(t),R.EventTargetStatus(t),t.depth&&(16==t.depth?r("#cmd_opt_R").show():r("#cmd_opt_R").hide()),t.project_name&&""!==t.project_name&&(et=t.project_name),t.platform_name&&""!==t.platform_name&&(at=t.platform_name),""===nt&&(nt=et),""===nt&&(nt="Squeezelite-ESP32"),t.version&&""!==t.version?($=t.version,r("#navtitle").html("".concat(nt).concat(W?"<br>[recovery]":"")),r("span#foot-fw").html("fw: <strong>".concat($,"</strong>, mode: <strong>").concat(W?"Recovery":et,"</strong>"))):r("span#flash-status").html(""),t.Voltage){var n=function(t){for(var e=0,n=E;e<n.length;e++){var a,s=n[e],o=l(s.ranges);try{for(o.s();!(a=o.n()).done;){var i=a.value;if(((c=t)-i.f)*(c-i.t)<=0)return{label:s.label,icon:s.icon}}}catch(t){o.e(t)}finally{o.f()}}var c;return{label:"▪▪▪▪",icon:"battery_full"}}(t.Voltage);r("#battery").html("".concat(M(n))),r("#battery").attr("aria-label",n.label),r("#battery").attr("icon",n.icon),r("#battery").show()}else r("#battery").hide();if(""!=(null!==(e=t.message)&&void 0!==e?e:"")&&tt!=t.message&&(tt=t.message,Nt(t.message,"MESSAGING_INFO")),t.is_i2c_locked?r("flds-cfg-hw-preset").hide():r("flds-cfg-hw-preset").show(),r("button[onclick*='handleReboot']").removeClass("rebooting"),void 0===D||t.lms_ip!=rt&&t.lms_ip&&t.lms_port){var a="http://"+t.lms_ip+":"+t.lms_port;rt=t.lms_ip,r.ajax({url:a+"/plugins/SqueezeESP32/firmware/-check.bin",type:"HEAD",dataType:"text",cache:!1,error:function(){D=""},success:function(){D=a}})}r("#o_jack").css({display:Number(t.Jack)?"inline":"none"}),setTimeout(At,2e3)})).fail((function(t,e,n){L(t,0,n),0==t.status&&0==t.readyState?setTimeout(At,2*I):setTimeout(At,I)}))}function Et(t,e,n){return void 0!==t.values[e]?t.values[e][n]:""}function Ot(){r.ajaxSetup({timeout:7e3}),r.getJSON("/commands.json",(function(t){console.log(t),r(".orec").show(),t.commands.forEach((function(e){if(0===r("#flds-"+e.name).length){var n=e.name.split("-"),a="cfg"===n[0],s="#tab-"+n[0]+"-"+n[1],o="";o+='<div class="card mb-3"><div class="card-header">'.concat(e.help.encodeHTML().replace(/\n/g,"<br />"),'</div><div class="card-body"><fieldset id="flds-').concat(e.name,'">'),e.argtable&&e.argtable.forEach((function(n){var a=n.datatype||"",s=e.name+"-"+n.longopts,i=Et(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+='<div class="form-check"><label class="form-check-label"><input type="checkbox" '.concat(c,' class="form-check-input ').concat(r,'" value="" >').concat(n.glossary.encodeHTML(),"</label>"):(o+='<div class="form-group" ><label for="'.concat(s,'">').concat(n.glossary.encodeHTML(),"</label>"),a.includes("|")?(r=a.startsWith("+")?" multiple ":"",a=a.replace("<","").replace("=","").replace(">",""),o+="<select ".concat(c,' class="form-control ').concat(r,'" >'),(a="--|"+a).split("|").forEach((function(t){o+="<option >"+t+"</option>"})),o+="</select>"):o+='<input type="text" class="form-control '.concat(r,'" placeholder="').concat(a,'" ').concat(c,">")),o+="".concat(n.checkbox?"</div>":"",'<small class="form-text text-muted">Previous value: ').concat(n.checkbox?i?"Checked":"Unchecked":i||"","</small>").concat(n.checkbox?"":"</div>")})),o+='<div style="margin-top: 16px;">\n <div class="toast hide" role="alert" aria-live="assertive" aria-atomic="true" id="toast_'.concat(e.name,'">\n <div class="toast-header">\n <strong class="mr-auto">Result</strong\n <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>\n </div>\n <div class="toast-body" id="msg_').concat(e.name,'"></div>\n </div>'),o+=a?'<button type="submit" class="btn btn-info sclk" id="btn-save-'.concat(e.name,'" cmdname="').concat(e.name,'">Save</button>\n<button type="submit" class="btn btn-warning cclk" id="btn-commit-').concat(e.name,'" cmdname="').concat(e.name,'">Apply</button>'):'<button type="submit" class="btn btn-success sclk" id="btn-run-'.concat(e.name,'" cmdname="').concat(e.name,'">Execute</button>'),o+="</div></fieldset></div></div>",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=Et(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&&(C||(C=!0,r("#cfg-hw-preset-model_config").html("<option>--</option>"),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("<option value='".concat(JSON.stringify(e).replace(/"/g,'"').replace(/\'/g,'"'),"'>").concat(e.name,"</option>")),""!==st&&st==e.name&&r("#cfg-hw-preset-model_config").val(st)})),""!==st&&"#prev_preset".show().val(st)})).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():L(t,0,n),r("#commands-list").empty()}))}function kt(){r.ajaxSetup({timeout:7e3}),r.getJSON("/config.json",(function(t){r("#nvsTable tr").remove();var e=t.config?t.config:t;K=e,B="",Object.keys(e).sort().forEach((function(t){var n=e[t].value;"autoexec1"===t?function(t){var e=j(t);e.output.toUpperCase().startsWith("I2S")?U("i2s"):e.output.toUpperCase().startsWith("SPDIF")?U("spdif"):e.output.toUpperCase().startsWith("BT")&&(e.otherOptions.btname&&(B=e.otherOptions.btname),U("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,X=n):"rel_api"===t?J=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?st=n:"board_model"==t&&(nt=n),r("tbody#nvsTable").append("<tr><td>"+t+"</td><td class='value'><input type='text' class='form-control nvs' id='"+t+"' nvs_type="+e[t].type+" ></td></tr>"),r("input#"+t).val(e[t].value)})),B.length>0&&r("#cfg-audio-bt_source-sink_name").val(B),r("tbody#nvsTable").append("<tr><td><input type='text' class='form-control' id='nvs-new-key' placeholder='new key'></td><td><input type='text' class='form-control' id='nvs-new-value' placeholder='new value' nvs_type=33 ></td></tr>"),t.gpio?(r("#pins").show(),r("tbody#gpiotable tr").remove(),t.gpio.forEach((function(t){r("tbody#gpiotable").append("<tr class="+(t.fixed?"table-secondary":"table-primary")+'><th scope="row">'+t.group+"</th><td>"+t.name+"</td><td>"+t.gpio+"</td><td>"+(t.fixed?"Fixed":"Configuration")+"</td></tr>")}))):r("#pins").hide()})).fail((function(t,e,n){L(t,0,n)}))}function Nt(t,e){xt({message:t,type:e},new Date)}function xt(t,e){var n="table-success";"MESSAGING_WARNING"===t.type?(n="table-warning","MESSAGING_INFO"===V&&(V="MESSAGING_WARNING")):"MESSAGING_ERROR"===t.type&&("MESSAGING_INFO"!==V&&"MESSAGING_WARNING"!==V||(V="MESSAGING_ERROR"),n="table-danger"),++z>0&&(r("#msgcnt").removeClass("badge-success"),r("#msgcnt").removeClass("badge-warning"),r("#msgcnt").removeClass("badge-danger"),r("#msgcnt").addClass(k[V]),r("#msgcnt").text(z)),r("#syslogTable").append("<tr class='"+n+"'><td>"+e.toLocalShort()+"</td><td>"+t.message.encodeHTML()+"</td></tr>")}function Rt(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){F("cfg-audio-tmpl","MESSAGING_INFO","Saving.\n",!1);var e="".concat("squeezelite "," -o ").concat(Q," ");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"===Q&&F("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);n<a.length;n++){var o=(0,s.A)(a[n],2),i=o[0],c=o[1];"n"!==i&&"o"!==i&&(e+="-".concat(i," "),!0!==c&&(e+="".concat(c," ")))}return e}(options);var a={timestamp:Date.now()};a.config={autoexec1:{value:e,type:33}},r.ajax({url:"/config.json",dataType:"text",method:"POST",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify(a),error:L,complete:function(e){e.responseText&&"OK"===JSON.parse(e.responseText).result?(F("cfg-audio-tmpl","MESSAGING_INFO","Done.\n",!0),t&&dt(1500,"cfg-audio-tmpl")):JSON.parse(e.responseText).result?F("cfg-audio-tmpl","MESSAGING_WARNING",JSON.parse(e.responseText).Result+"\n",!0):F("cfg-audio-tmpl","MESSAGING_ERROR",e.statusText+"\n"),console.log(e.responseText)}}),console.log("sent data:",JSON.stringify(a))},window.handleDisconnect=function(){r.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(){ct.ssid=r("#manual_ssid").val(),ct.pwd=r("#manual_pwd").val(),ct.dhcpname=r("#dhcp-name2").val(),r("*[class*='connecting']").hide(),r("#ssid-wait").text(ct.ssid),r(".connecting").show(),r.ajax({url:"/connect.json",dataType:"text",method:"POST",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify({timestamp:Date.now(),ssid:ct.ssid,pwd:ct.pwd}),error:L})},r(document).ready((function(){r(".material-icons").each((function(t,e){e.attributes.icon=e.textContent})),wt(!0),f(),R.init(),r("#fw-url-input").on("input",(function(){r(this).val().length>8&&(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(mt,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!Y.codecs.includes(t)}));pt(e,a.length>0?"Invalid codec(s) ".concat(a.join(", ")):"")}if("m"===e){pt(e,/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(n)?"":"Invalid MAC address")}if("r"===e){pt(e,/^(\d+\.?\d*|\.\d+)-(\d+\.?\d*|\.\d+)$|^(\d+\.?\d*)$|^(\d+\.?\d*,)+\d+\.?\d*$/.test(n)?"":"Invalid rate(s) ".concat(n,". Acceptable format: <maxrate>|<minrate>-<maxrate>|<rate1>,<rate2>,<rate3>"))}})),r("#WifiConnectDialog")[0].addEventListener("shown.bs.modal",(function(t){r("*[class*='connecting']").hide(),null!=t&&t.relatedTarget&&(ct.Action=lt.CONN,r(t.relatedTarget).children("td:eq(1)").text()==it.ssid?ct.Action=lt.STS:r(t.relatedTarget).is(":last-child")?(ct.Action=lt.MAN,ct.ssid="",r("#manual_ssid").val(ct.ssid)):(ct.ssid=r(t.relatedTarget).children("td:eq(1)").text(),r("#manual_ssid").val(ct.ssid))),ct.Action!==lt.STS?(r(".connecting-init").show(),r("#manual_ssid").trigger("focus")):yt()})),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===Z,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(){z=0,V="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(),Z=1):(Z=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(){it={},bt(),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=ut(!0),e=document.createElement("a");e.href=URL.createObjectURL(new Blob([JSON.stringify(t,null,2)],{type:"text/plain"})),e.setAttribute("download","nvs_config_"+X+"_"+Date.now()+"json"),document.body.appendChild(e),e.click(),document.body.removeChild(e)})),r("#save-nvs").on("click",(function(){G(ut(!1))})),r("#fwUpload").on("click",(function(){0===document.getElementById("flashfilename").files.length?alert("No file selected!"):(r("#fw-url-input").value=null,R.StartOTA())})),r("[name=output-tmpl]").on("click",(function(){U(this.id)})),r("#chkUpdates").on("click",(function(){r("#rTable").html(""),r.getJSON(J,(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+='<option value="'+t+'">'+t+"</option>"})),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("<tr class='release ' fwurl='".concat(e,"'>\n <td data-bs-toggle='tooltip' title='").concat(c,"'>").concat(a,"</td><td>").concat(new Date(t.created_at).toLocalShort(),"\n </td><td class='upf'>").concat(s,"</td><td>").concat(o,"</td><td>").concat(i,"</td></tr>"))})),r("#searchfw").css("display","inline"),ht(at)||ht(et),r("#rTable tr.release").on("click",(function(){var t=this.attributes.fwurl.value;D&&(t=t.replace(/.*\/download\//,D+"/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(J,(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+='<option value="'+t+'">'+t+"</option>"})),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("<tr class='release"+u+"'><td data-bs-toggle='tooltip' title='"+l+"'>"+s+"</td><td>"+new Date(t.created_at).toLocalShort()+"</td><td>"+i+"</td><td>"+o+"</td><td>"+c+"</td><td><input type='button' class='btn btn-success' value='Select' data-bs-url='"+e+"' onclick='setURL(this);' /></td></tr>")})),n>7&&(r("#releaseTable").append("<tr id='showall'><td colspan='6'><input type='button' id='showallbutton' class='btn btn-info' value='Show older releases' /></td></tr>"),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(){mt(),console.log("refresh AP")})),kt(),Ot(),_t(),At()})),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"),D&&(e=e.replace(/.*\/download\//,D+"/plugins/SqueezeESP32/firmware/")),r("#fwurl").val(e)},window.runCommand=function(t,e){var n=t.attributes.cmdname.value;F(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<c.length;i++){var l=(0,s.A)(c[i],2),u=l[0],d=l[1],h="string"==typeof d||d instanceof String?d:JSON.stringify(d);o.config[u]={value:h,type:33},F(a,"MESSAGING_INFO","Setting ".concat(u,"=").concat(h," "),!0)}F(a,"MESSAGING_INFO","Committing ",!0),r.ajax({url:"/config.json",dataType:"text",method:"POST",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify(o),error:function(t,e,n){L(t,0,n),F(a,"MESSAGING_ERROR","Unexpected error ".concat(""!==n?n:"with return status = "+t.status," "),!0)},success:function(t){F(a,"MESSAGING_INFO","Saving complete ",!0),console.log(t),e&&dt(2500,a)}})}(o,e);if(n+=" ",a){var i,c=l(o);try{for(c.s();!(i=c.n()).done;){var u,d=i.value,h="",p="",f=d.attributes,m=r(d).is("select"),v="true"===(null==f||null===(u=f.hasvalue)||void 0===u?void 0:u.value),b=m&&"--"!==d.value||!m&&""!==d.value;if(!v||v&&b){var g,S,_,y;if("undefined"!==(null==f||null===(g=f.longopts)||void 0===g?void 0:g.value))p+="--"+(null==f||null===(y=f.longopts)||void 0===y?void 0:y.value);else"undefined"!==(null==f||null===(S=f.shortopts)||void 0===S?void 0:S.value)&&(p="-"+f.shortopts.value);"true"===(null==f||null===(_=f.hasvalue)||void 0===_?void 0:_.value)?""!==(null==f?void 0:f.value)&&(n+=p+" "+(h=/\s/.test(d.value)?'"':"")+d.value+h+" "):null!=d&&d.checked&&(n+=p+" ")}}}catch(t){c.e(t)}finally{c.f()}}console.log(n);var w={timestamp:Date.now()};w.command=n,r.ajax({url:"/commands.json",dataType:"text",method:"POST",cache:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify(w),error:function(t,e,n){var a=JSON.parse(this.data).command;404==t.status?F(a.substr(0,a.indexOf(" ")),"MESSAGING_ERROR","".concat(W?"Limited recovery mode active. Unsupported action ":"Unexpected error while processing command"),!0):(L(t,0,n),F(a.substr(0,a.indexOf(" ")-1),"MESSAGING_ERROR","Unexpected error ".concat(""!==n?n:"with return status = "+t.status),!0))},success:function(n){r(".orec").show(),console.log(n),"Success"===JSON.parse(n).Result&&e&&dt(2500,t.attributes.cmdname.value)}})}},249:(t,e,n)=>{n.r(e)},156:(t,e,n)=>{n(336),n(249),n(512),n(618)},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=="}},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<t.length;u++){for(var[n,s,o]=t[u],c=!0,r=0;r<n.length;r++)(!1&o||i>=o)&&Object.keys(a.O).every((t=>a.O[t](n[r])))?n.splice(r--,1):(c=!1,o<i&&(i=o));if(c){t.splice(u--,1);var l=s();void 0!==l&&(e=l)}}return e}o=o||0;for(var u=t.length;u>0&&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);l<i.length;l++)o=i[l],a.o(t,o)&&t[o]&&t[o][0](),t[o]=0;return a.O(u)},n=self.webpackChunksqueezelite_esp32=self.webpackChunksqueezelite_esp32||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var s=a.O(void 0,[255],(()=>a(156)));s=a.O(s)})();
  2. //# sourceMappingURL=index.29cc48.bundle.js.map