zwave-js-ui
Version:
Z-Wave Control Panel and MQTT Gateway
3 lines • 96.4 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ColorScheme-CGw-vqaA.js","./index-DwzE-W2i.js","./index-B2zoqM3Y.css","./DialogGatewayValue-T-Nx_UJB.js","./DialogGatewayValue-Di_CgaZB.css","./file-input-Cw4QkG-_.js","./InvertedCheckbox-zBbp5FaW.js"])))=>i.map(i=>d[i]);
import{A as Ce,_ as Oe,m as Le,a as be,d as ue,I as De,e as S,w as r,b as l,V as D,f as u,k as c,i as R,o as I,l as A,s as de,B as T,D as U,E as _,F as J,G as Y,H as L,h as k,J as te,K as N,M as ne,N as z,t as X,O as Ke,c as qe,P as Ae,Q as Re,R as Pe,T as ze,U as Ie,W as Xe,u as Ne,C as le,x as re,L as Be,X as B,Y as Ge,Z as Fe,$ as We,a0 as _e,a1 as je,a2 as Q,y as fe,z as V}from"./index-DwzE-W2i.js";import{V as Ve,a as G,b as F,c as W}from"./VExpansionPanels-DapzAmhb.js";import{V as Se}from"./VDataTable-D8DZXD9Y.js";import"./sort-C8HQTCiq.js";import"./VTable-Cxuwit5L.js";var $={},pe,ke;function He(){if(ke)return pe;ke=1;function o(e,v){return Object.prototype.hasOwnProperty.call(e,v)}return pe=function(e,v,x,t){v=v||"&",x=x||"=";var a={};if(typeof e!="string"||e.length===0)return a;var Z=/\+/g;e=e.split(v);var y=1e3;t&&typeof t.maxKeys=="number"&&(y=t.maxKeys);var M=e.length;y>0&&M>y&&(M=y);for(var d=0;d<M;++d){var n=e[d].replace(Z,"%20"),b=n.indexOf(x),s,i,p,f;b>=0?(s=n.substr(0,b),i=n.substr(b+1)):(s=n,i=""),p=decodeURIComponent(s),f=decodeURIComponent(i),o(a,p)?Array.isArray(a[p])?a[p].push(f):a[p]=[a[p],f]:a[p]=f}return a},pe}var me,xe;function Je(){if(xe)return me;xe=1;var o=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};return me=function(e,v,x,t){return v=v||"&",x=x||"=",e===null&&(e=void 0),typeof e=="object"?Object.keys(e).map(function(a){var Z=encodeURIComponent(o(a))+x;return Array.isArray(e[a])?e[a].map(function(y){return Z+encodeURIComponent(o(y))}).join(v):Z+encodeURIComponent(o(e[a]))}).filter(Boolean).join(v):t?encodeURIComponent(o(t))+x+encodeURIComponent(o(e)):""},me}var Me;function Ye(){return Me||(Me=1,$.decode=$.parse=He(),$.encode=$.stringify=Je()),$}var Qe=Ye();const Ee=Ce(Qe);var $e=/https?|ftp|gopher|file/;function ge(o){typeof o=="string"&&(o=ie(o));var e=(function(v,x,t){var a=v.auth,Z=v.hostname,y=v.protocol||"",M=v.pathname||"",d=v.hash||"",n=v.query||"",b=!1;a=a?encodeURIComponent(a).replace(/%3A/i,":")+"@":"",v.host?b=a+v.host:Z&&(b=a+(~Z.indexOf(":")?"["+Z+"]":Z),v.port&&(b+=":"+v.port)),n&&typeof n=="object"&&(n=x.encode(n));var s=v.search||n&&"?"+n||"";return y&&y.substr(-1)!==":"&&(y+=":"),v.slashes||(!y||t.test(y))&&b!==!1?(b="//"+(b||""),M&&M[0]!=="/"&&(M="/"+M)):b||(b=""),d&&d[0]!=="#"&&(d="#"+d),s&&s[0]!=="?"&&(s="?"+s),{protocol:y,host:b,pathname:M=M.replace(/[?#]/g,encodeURIComponent),search:s=s.replace("#","%23"),hash:d}})(o,Ee,$e);return""+e.protocol+e.host+e.pathname+e.search+e.hash}var we="http://",he="w.w",ve=we+he,et=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,tt=/https?|ftp|gopher|file/;function Ze(o,e){var v=typeof o=="string"?ie(o):o;o=typeof o=="object"?ge(o):o;var x=ie(e),t="";v.protocol&&!v.slashes&&(t=v.protocol,o=o.replace(v.protocol,""),t+=e[0]==="/"||o[0]==="/"?"/":""),t&&x.protocol&&(t="",x.slashes||(t=x.protocol,e=e.replace(x.protocol,"")));var a=o.match(et);a&&!x.protocol&&(o=o.substr((t=a[1]+(a[2]||"")).length),/^\/\/[^/]/.test(e)&&(t=t.slice(0,-1)));var Z=new URL(o,ve+"/"),y=new URL(e,Z).toString().replace(ve,""),M=x.protocol||v.protocol;return M+=v.slashes||x.slashes?"//":"",!t&&M?y=y.replace(we,M):t&&(y=y.replace(we,"")),tt.test(y)||~e.indexOf(".")||o.slice(-1)==="/"||e.slice(-1)==="/"||y.slice(-1)!=="/"||(y=y.slice(0,-1)),t&&(y=t+(y[0]==="/"?y.substr(1):y)),y}function ee(){}ee.prototype.parse=ie,ee.prototype.format=ge,ee.prototype.resolve=Ze,ee.prototype.resolveObject=Ze;var ye=/^https?|ftp|gopher|file/,nt=/^(.*?)([#?].*)/,lt=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,rt=/^([a-z0-9.+-]*:)?\/\/\/*/i,ot=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function ie(o,e,v){if(e===void 0&&(e=!1),v===void 0&&(v=!1),o&&typeof o=="object"&&o instanceof ee)return o;var x=(o=o.trim()).match(nt);o=x?x[1].replace(/\\/g,"/")+x[2]:o.replace(/\\/g,"/"),ot.test(o)&&o.slice(-1)!=="/"&&(o+="/");var t=!/(^javascript)/.test(o)&&o.match(lt),a=rt.test(o),Z="";t&&(ye.test(t[1])||(Z=t[1].toLowerCase(),o=""+t[2]+t[3]),t[2]||(a=!1,ye.test(t[1])?(Z=t[1],o=""+t[3]):o="//"+t[3]),t[2].length!==3&&t[2].length!==1||(Z=t[1],o="/"+t[3]));var y,M=(x?x[1]:o).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),d=M&&M[1],n=new ee,b="",s="";try{y=new URL(o)}catch(f){b=f,Z||v||!/^\/\//.test(o)||/^\/\/.+[@.]/.test(o)||(s="/",o=o.substr(1));try{y=new URL(o,ve)}catch{return n.protocol=Z,n.href=Z,n}}n.slashes=a&&!s,n.host=y.host===he?"":y.host,n.hostname=y.hostname===he?"":y.hostname.replace(/(\[|\])/g,""),n.protocol=b?Z||null:y.protocol,n.search=y.search.replace(/\\/g,"%5C"),n.hash=y.hash.replace(/\\/g,"%5C");var i=o.split("#");!n.search&&~i[0].indexOf("?")&&(n.search="?"),n.hash||i[1]!==""||(n.hash="#"),n.query=e?Ee.decode(y.search.substr(1)):n.search.substr(1),n.pathname=s+(t?(function(f){return f.replace(/['^|`]/g,function(m){return"%"+m.charCodeAt().toString(16).toUpperCase()}).replace(/((?:%[0-9A-F]{2})+)/g,function(m,w){try{return decodeURIComponent(w).split("").map(function(h){var g=h.charCodeAt();return g>256||/^[a-z0-9]$/i.test(h)?h:"%"+g.toString(16).toUpperCase()}).join("")}catch{return w}})})(y.pathname):y.pathname),n.protocol==="about:"&&n.pathname==="blank"&&(n.protocol="",n.pathname=""),b&&o[0]!=="/"&&(n.pathname=n.pathname.substr(1)),Z&&!ye.test(Z)&&o.slice(-1)!=="/"&&n.pathname==="/"&&(n.pathname=""),n.path=n.pathname+n.search,n.auth=[y.username,y.password].map(decodeURIComponent).filter(Boolean).join(":"),n.port=y.port,d&&!n.host.endsWith(d)&&(n.host+=d,n.port=d.slice(1)),n.href=s?""+n.pathname+n.search+n.hash:ge(n);var p=/^(file)/.test(n.href)?["host","hostname"]:[];return Object.keys(n).forEach(function(f){~p.indexOf(f)||(n[f]=n[f]||null)}),n}var ce={exports:{}},Te;function it(){return Te||(Te=1,(function(o,e){(function(x,t){o.exports=t()})(globalThis,()=>(()=>{var v={949:((Z,y,M)=>{Object.defineProperty(y,"__esModule",{value:!0}),y.CronParser=void 0;var d=M(515),n=(function(){function b(s,i,p){i===void 0&&(i=!0),p===void 0&&(p=!1),this.expression=s,this.dayOfWeekStartIndexZero=i,this.monthStartIndexZero=p}return b.prototype.parse=function(){var s,i,p=(s=this.expression)!==null&&s!==void 0?s:"";if(p.startsWith("@")){var f=this.parseSpecial(this.expression);i=this.extractParts(f)}else i=this.extractParts(this.expression);return this.normalize(i),this.validate(i),i},b.prototype.parseSpecial=function(s){var i={"@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *"},p=i[s];if(!p)throw new Error("Unknown special expression.");return p},b.prototype.extractParts=function(s){if(!this.expression)throw new Error("cron expression is empty");for(var i=s.trim().split(/[ ]+/),p=0;p<i.length;p++)if(i[p].includes(",")){var f=i[p].split(",").map(function(w){return w.trim()}).filter(function(w){return w!==""}).map(function(w){return isNaN(Number(w))?w:Number(w)}).filter(function(w){return w!==null&&w!==""});f.length===0&&f.push("*"),f.sort(function(w,h){return w!==null&&h!==null?w-h:0}),i[p]=f.map(function(w){return w!==null?w.toString():""}).join(",")}if(i.length<5)throw new Error("Expression has only ".concat(i.length," part").concat(i.length==1?"":"s",". At least 5 parts are required."));if(i.length==5)i.unshift(""),i.push("");else if(i.length==6){var m=/\d{4}$/.test(i[5])||i[4]=="?"||i[2]=="?";m?i.unshift(""):i.push("")}else if(i.length>7)throw new Error("Expression has ".concat(i.length," parts; too many!"));return i},b.prototype.normalize=function(s){var i=this;if(s[3]=s[3].replace("?","*"),s[5]=s[5].replace("?","*"),s[2]=s[2].replace("?","*"),s[0].indexOf("0/")==0&&(s[0]=s[0].replace("0/","*/")),s[1].indexOf("0/")==0&&(s[1]=s[1].replace("0/","*/")),s[2].indexOf("0/")==0&&(s[2]=s[2].replace("0/","*/")),s[3].indexOf("1/")==0&&(s[3]=s[3].replace("1/","*/")),s[4].indexOf("1/")==0&&(s[4]=s[4].replace("1/","*/")),s[6].indexOf("1/")==0&&(s[6]=s[6].replace("1/","*/")),s[5]=s[5].replace(/(^\d)|([^#/\s]\d)/g,function(C){var K=C.replace(/\D/,""),E=K;return i.dayOfWeekStartIndexZero?K=="7"&&(E="0"):E=(parseInt(K)-1).toString(),C.replace(K,E)}),s[5]=="L"&&(s[5]="6"),s[3]=="?"&&(s[3]="*"),s[3].indexOf("W")>-1&&(s[3].indexOf(",")>-1||s[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var p={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var f in p)s[5]=s[5].replace(new RegExp(f,"gi"),p[f].toString());s[4]=s[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(C){var K=C.replace(/\D/,""),E=K;return i.monthStartIndexZero&&(E=(parseInt(K)+1).toString()),C.replace(K,E)});var m={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var w in m)s[4]=s[4].replace(new RegExp(w,"gi"),m[w].toString());s[0]=="0"&&(s[0]=""),!/\*|\-|\,|\//.test(s[2])&&(/\*|\//.test(s[1])||/\*|\//.test(s[0]))&&(s[2]+="-".concat(s[2]));for(var h=0;h<s.length;h++)if(s[h].indexOf(",")!=-1&&(s[h]=s[h].split(",").filter(function(C){return C!==""}).join(",")||"*"),s[h]=="*/1"&&(s[h]="*"),s[h].indexOf("/")>-1&&!/^\*|\-|\,/.test(s[h])){var g=null;switch(h){case 4:g="12";break;case 5:g="6";break;case 6:g="9999";break;default:g=null;break}if(g!==null){var O=s[h].split("/");s[h]="".concat(O[0],"-").concat(g,"/").concat(O[1])}}},b.prototype.validate=function(s){var i="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(s[0],i),this.validateOnlyExpectedCharactersFound(s[1],i),this.validateOnlyExpectedCharactersFound(s[2],i),this.validateOnlyExpectedCharactersFound(s[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(s[4],i),this.validateOnlyExpectedCharactersFound(s[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(s[6],i),this.validateAnyRanges(s)},b.prototype.validateAnyRanges=function(s){d.default.secondRange(s[0]),d.default.minuteRange(s[1]),d.default.hourRange(s[2]),d.default.dayOfMonthRange(s[3]),d.default.monthRange(s[4],this.monthStartIndexZero),d.default.dayOfWeekRange(s[5],this.dayOfWeekStartIndexZero)},b.prototype.validateOnlyExpectedCharactersFound=function(s,i){var p=s.match(new RegExp("[^".concat(i,"]+"),"gi"));if(p&&p.length)throw new Error("Expression contains invalid values: '".concat(p.toString(),"'"))},b})();y.CronParser=n}),333:((Z,y,M)=>{Object.defineProperty(y,"__esModule",{value:!0}),y.ExpressionDescriptor=void 0;var d=M(823),n=M(949),b=(function(){function s(i,p){if(this.expression=i,this.options=p,this.expressionParts=new Array(5),!this.options.locale&&s.defaultLocale&&(this.options.locale=s.defaultLocale),!s.locales[this.options.locale]){var f=Object.keys(s.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(f,"'.")),this.options.locale=f}this.i18n=s.locales[this.options.locale],p.use24HourTimeFormat===void 0&&(p.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return s.toString=function(i,p){var f=p===void 0?{}:p,m=f.throwExceptionOnParseError,w=m===void 0?!0:m,h=f.verbose,g=h===void 0?!1:h,O=f.dayOfWeekStartIndexZero,C=O===void 0?!0:O,K=f.monthStartIndexZero,E=K===void 0?!1:K,P=f.use24HourTimeFormat,q=f.locale,se=q===void 0?null:q,j=f.tzOffset,ae=j===void 0?0:j,H={throwExceptionOnParseError:w,verbose:g,dayOfWeekStartIndexZero:C,monthStartIndexZero:E,use24HourTimeFormat:P,locale:se,tzOffset:ae};H.tzOffset&&console.warn("'tzOffset' option has been deprecated and will be removed in a future release.");var Ue=new s(i,H);return Ue.getFullDescription()},s.initialize=function(i,p){p===void 0&&(p="en"),s.specialCharacters=["/","-",",","*"],s.defaultLocale=p,i.load(s.locales)},s.prototype.getFullDescription=function(){var i="";try{var p=new n.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);this.expressionParts=p.parse();var f=this.getTimeOfDayDescription(),m=this.getDayOfMonthDescription(),w=this.getMonthDescription(),h=this.getDayOfWeekDescription(),g=this.getYearDescription();i+=f+m+h+w+g,i=this.transformVerbosity(i,!!this.options.verbose),i=i.charAt(0).toLocaleUpperCase()+i.substr(1)}catch(O){if(!this.options.throwExceptionOnParseError)i=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(O)}return i},s.prototype.getTimeOfDayDescription=function(){var i=this.expressionParts[0],p=this.expressionParts[1],f=this.expressionParts[2],m="";if(!d.StringUtilities.containsAny(p,s.specialCharacters)&&!d.StringUtilities.containsAny(f,s.specialCharacters)&&!d.StringUtilities.containsAny(i,s.specialCharacters))m+=this.i18n.atSpace()+this.formatTime(f,p,i);else if(!i&&p.indexOf("-")>-1&&!(p.indexOf(",")>-1)&&!(p.indexOf("/")>-1)&&!d.StringUtilities.containsAny(f,s.specialCharacters)){var w=p.split("-");m+=d.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(f,w[0],""),this.formatTime(f,w[1],""))}else if(!i&&f.indexOf(",")>-1&&f.indexOf("-")==-1&&f.indexOf("/")==-1&&!d.StringUtilities.containsAny(p,s.specialCharacters)){var h=f.split(",");m+=this.i18n.at();for(var g=0;g<h.length;g++)m+=" ",m+=this.formatTime(h[g],p,""),g<h.length-2&&(m+=","),g==h.length-2&&(m+=this.i18n.spaceAnd())}else{var O=this.getSecondsDescription(),C=this.getMinutesDescription(),K=this.getHoursDescription();if(m+=O,m&&C&&(m+=", "),m+=C,C===K)return m;m&&K&&(m+=", "),m+=K}return m},s.prototype.getSecondsDescription=function(){var i=this,p=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(f){return f},function(f){return d.StringUtilities.format(i.i18n.everyX0Seconds(f),f)},function(f){return i.i18n.secondsX0ThroughX1PastTheMinute()},function(f){return f=="0"?"":parseInt(f)<20?i.i18n.atX0SecondsPastTheMinute(f):i.i18n.atX0SecondsPastTheMinuteGt20()||i.i18n.atX0SecondsPastTheMinute(f)});return p},s.prototype.getMinutesDescription=function(){var i=this,p=this.expressionParts[0],f=this.expressionParts[2],m=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(w){return w},function(w){return d.StringUtilities.format(i.i18n.everyX0Minutes(w),w)},function(w){return i.i18n.minutesX0ThroughX1PastTheHour()},function(w){try{return w=="0"&&f.indexOf("/")==-1&&p==""?i.i18n.everyHour():parseInt(w)<20?i.i18n.atX0MinutesPastTheHour(w):i.i18n.atX0MinutesPastTheHourGt20()||i.i18n.atX0MinutesPastTheHour(w)}catch{return i.i18n.atX0MinutesPastTheHour(w)}});return m},s.prototype.getHoursDescription=function(){var i=this,p=this.expressionParts[2],f=0,m=[];p.split("/")[0].split(",").forEach(function(g){var O=g.split("-");O.length===2&&m.push({value:O[1],index:f+1}),f+=O.length});var w=0,h=this.getSegmentDescription(p,this.i18n.everyHour(),function(g){var O=m.find(function(K){return K.value===g&&K.index===w}),C=O&&i.expressionParts[1]!=="0";return w++,C?i.formatTime(g,"59",""):i.formatTime(g,"0","")},function(g){return d.StringUtilities.format(i.i18n.everyX0Hours(g),g)},function(g){return i.i18n.betweenX0AndX1()},function(g){return i.i18n.atX0()});return h},s.prototype.getDayOfWeekDescription=function(){var i=this,p=this.i18n.daysOfTheWeek(),f=null;return this.expressionParts[5]=="*"?f="":f=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(m,w){var h=m;m.indexOf("#")>-1?h=m.substring(0,m.indexOf("#")):m.indexOf("L")>-1&&(h=h.replace("L",""));var g=parseInt(h);if(i.options.tzOffset){var O=i.expressionParts[2],C=parseInt(O)+(i.options.tzOffset?i.options.tzOffset:0);C>=24?g++:C<0&&g--,g>6?g=0:g<0&&(g=6)}var K=i.i18n.daysOfTheWeekInCase?i.i18n.daysOfTheWeekInCase(w)[g]:p[g];if(m.indexOf("#")>-1){var E=null,P=m.substring(m.indexOf("#")+1),q=m.substring(0,m.indexOf("#"));switch(P){case"1":E=i.i18n.first(q);break;case"2":E=i.i18n.second(q);break;case"3":E=i.i18n.third(q);break;case"4":E=i.i18n.fourth(q);break;case"5":E=i.i18n.fifth(q);break}K=E+" "+K}return K},function(m){return parseInt(m)==1?"":d.StringUtilities.format(i.i18n.commaEveryX0DaysOfTheWeek(m),m)},function(m){var w=m.substring(0,m.indexOf("-")),h=i.expressionParts[3]!="*";return h?i.i18n.commaAndX0ThroughX1(w):i.i18n.commaX0ThroughX1(w)},function(m){var w=null;if(m.indexOf("#")>-1){var h=m.substring(m.indexOf("#")+1),g=m.substring(0,m.indexOf("#"));w=i.i18n.commaOnThe(h,g).trim()+i.i18n.spaceX0OfTheMonth()}else if(m.indexOf("L")>-1)w=i.i18n.commaOnTheLastX0OfTheMonth(m.replace("L",""));else{var O=i.expressionParts[3]!="*";w=O?i.i18n.commaAndOnX0():i.i18n.commaOnlyOnX0(m)}return w}),f},s.prototype.getMonthDescription=function(){var i=this,p=this.i18n.monthsOfTheYear(),f=this.getSegmentDescription(this.expressionParts[4],"",function(m,w){return w&&i.i18n.monthsOfTheYearInCase?i.i18n.monthsOfTheYearInCase(w)[parseInt(m)-1]:p[parseInt(m)-1]},function(m){return parseInt(m)==1?"":d.StringUtilities.format(i.i18n.commaEveryX0Months(m),m)},function(m){return i.i18n.commaMonthX0ThroughMonthX1()||i.i18n.commaX0ThroughX1()},function(m){return i.i18n.commaOnlyInMonthX0?i.i18n.commaOnlyInMonthX0():i.i18n.commaOnlyInX0()});return f},s.prototype.getDayOfMonthDescription=function(){var i=this,p=null,f=this.expressionParts[3];switch(f){case"L":p=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":p=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var m=f.match(/(\d{1,2}W)|(W\d{1,2})/);if(m){var w=parseInt(m[0].replace("W","")),h=w==1?this.i18n.firstWeekday():d.StringUtilities.format(this.i18n.weekdayNearestDayX0(),w.toString());p=d.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),h);break}else{var g=f.match(/L-(\d{1,2})/);if(g){var O=g[1];p=d.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(O),O);break}else{if(f=="*"&&this.expressionParts[5]!="*")return"";p=this.getSegmentDescription(f,this.i18n.commaEveryDay(),function(C){return C=="L"?i.i18n.lastDay():i.i18n.dayX0?d.StringUtilities.format(i.i18n.dayX0(),C):C},function(C){return C=="1"?i.i18n.commaEveryDay():i.i18n.commaEveryX0Days(C)},function(C){return i.i18n.commaBetweenDayX0AndX1OfTheMonth(C)},function(C){return i.i18n.commaOnDayX0OfTheMonth(C)})}break}}return p},s.prototype.getYearDescription=function(){var i=this,p=this.getSegmentDescription(this.expressionParts[6],"",function(f){return/^\d+$/.test(f)?new Date(parseInt(f),1).getFullYear().toString():f},function(f){return d.StringUtilities.format(i.i18n.commaEveryX0Years(f),f)},function(f){return i.i18n.commaYearX0ThroughYearX1()||i.i18n.commaX0ThroughX1()},function(f){return i.i18n.commaOnlyInYearX0?i.i18n.commaOnlyInYearX0():i.i18n.commaOnlyInX0()});return p},s.prototype.getSegmentDescription=function(i,p,f,m,w,h){var g=null,O=i.indexOf("/")>-1,C=i.indexOf("-")>-1,K=i.indexOf(",")>-1;if(!i)g="";else if(i==="*")g=p;else if(!O&&!C&&!K)g=d.StringUtilities.format(h(i),f(i));else if(K){for(var E=i.split(","),P="",q=0;q<E.length;q++)if(q>0&&E.length>2&&(P+=",",q<E.length-1&&(P+=" ")),q>0&&E.length>1&&(q==E.length-1||E.length==2)&&(P+="".concat(this.i18n.spaceAnd()," ")),E[q].indexOf("/")>-1||E[q].indexOf("-")>-1){var se=E[q].indexOf("-")>-1&&E[q].indexOf("/")==-1,j=this.getSegmentDescription(E[q],p,f,m,se?this.i18n.commaX0ThroughX1:w,h);se&&(j=j.replace(", ","")),P+=j}else O?P+=this.getSegmentDescription(E[q],p,f,m,w,h):P+=f(E[q]);O?g=P:g=d.StringUtilities.format(h(i),P)}else if(O){var E=i.split("/");if(g=d.StringUtilities.format(m(E[1]),E[1]),E[0].indexOf("-")>-1){var ae=this.generateRangeSegmentDescription(E[0],w,f);ae.indexOf(", ")!=0&&(g+=", "),g+=ae}else if(E[0].indexOf("*")==-1){var H=d.StringUtilities.format(h(E[0]),f(E[0]));H=H.replace(", ",""),g+=d.StringUtilities.format(this.i18n.commaStartingX0(),H)}}else C&&(g=this.generateRangeSegmentDescription(i,w,f));return g},s.prototype.generateRangeSegmentDescription=function(i,p,f){var m="",w=i.split("-"),h=f(w[0],1),g=f(w[1],2),O=p(i);return m+=d.StringUtilities.format(O,h,g),m},s.prototype.formatTime=function(i,p,f){var m=0,w=0;this.options.tzOffset&&(m=this.options.tzOffset>0?Math.floor(this.options.tzOffset):Math.ceil(this.options.tzOffset),w=parseFloat((this.options.tzOffset%1).toFixed(2)),w!=0&&(w*=60));var h=parseInt(i)+m,g=parseInt(p)+w;g>=60?(g-=60,h+=1):g<0&&(g+=60,h-=1),h>=24?h=h-24:h<0&&(h=24+h);var O="",C=!1;this.options.use24HourTimeFormat||(C=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),O=C?"".concat(this.getPeriod(h)," "):" ".concat(this.getPeriod(h)),h>12&&(h-=12),h===0&&(h=12));var K="";return f&&(K=":".concat(("00"+f).substring(f.length))),"".concat(C?O:"").concat(("00"+h.toString()).substring(h.toString().length),":").concat(("00"+g.toString()).substring(g.toString().length)).concat(K).concat(C?"":O)},s.prototype.transformVerbosity=function(i,p){if(!p&&(i=i.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),i=i.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),i=i.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),i=i.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var f=0,m=Object.entries(this.i18n.conciseVerbosityReplacements());f<m.length;f++){var w=m[f],h=w[0],g=w[1];i=i.replace(new RegExp(h,"g"),g)}return i},s.prototype.getPeriod=function(i){return i>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},s.locales={},s})();y.ExpressionDescriptor=b}),747:((Z,y,M)=>{Object.defineProperty(y,"__esModule",{value:!0}),y.enLocaleLoader=void 0;var d=M(486),n=(function(){function b(){}return b.prototype.load=function(s){s.en=new d.en},b})();y.enLocaleLoader=n}),486:((Z,y)=>{Object.defineProperty(y,"__esModule",{value:!0}),y.en=void 0;var M=(function(){function d(){}return d.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},d.prototype.atX0MinutesPastTheHourGt20=function(){return null},d.prototype.commaMonthX0ThroughMonthX1=function(){return null},d.prototype.commaYearX0ThroughYearX1=function(){return null},d.prototype.use24HourTimeFormatByDefault=function(){return!1},d.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},d.prototype.everyMinute=function(){return"every minute"},d.prototype.everyHour=function(){return"every hour"},d.prototype.atSpace=function(){return"At "},d.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},d.prototype.at=function(){return"At"},d.prototype.spaceAnd=function(){return" and"},d.prototype.everySecond=function(){return"every second"},d.prototype.everyX0Seconds=function(){return"every %s seconds"},d.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},d.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},d.prototype.everyX0Minutes=function(){return"every %s minutes"},d.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},d.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},d.prototype.everyX0Hours=function(){return"every %s hours"},d.prototype.betweenX0AndX1=function(){return"between %s and %s"},d.prototype.atX0=function(){return"at %s"},d.prototype.commaEveryDay=function(){return", every day"},d.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},d.prototype.commaX0ThroughX1=function(){return", %s through %s"},d.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},d.prototype.first=function(){return"first"},d.prototype.second=function(){return"second"},d.prototype.third=function(){return"third"},d.prototype.fourth=function(){return"fourth"},d.prototype.fifth=function(){return"fifth"},d.prototype.commaOnThe=function(){return", on the "},d.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},d.prototype.lastDay=function(){return"the last day"},d.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},d.prototype.commaOnlyOnX0=function(){return", only on %s"},d.prototype.commaAndOnX0=function(){return", and on %s"},d.prototype.commaEveryX0Months=function(){return", every %s months"},d.prototype.commaOnlyInX0=function(){return", only in %s"},d.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},d.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},d.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},d.prototype.firstWeekday=function(){return"first weekday"},d.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},d.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},d.prototype.commaEveryX0Days=function(){return", every %s days"},d.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},d.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},d.prototype.commaEveryHour=function(){return", every hour"},d.prototype.commaEveryX0Years=function(){return", every %s years"},d.prototype.commaStartingX0=function(){return", starting %s"},d.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},d.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},d})();y.en=M}),515:((Z,y)=>{Object.defineProperty(y,"__esModule",{value:!0});function M(n,b){if(!n)throw new Error(b)}var d=(function(){function n(){}return n.secondRange=function(b){for(var s=b.split(","),i=0;i<s.length;i++)if(!isNaN(parseInt(s[i],10))){var p=parseInt(s[i],10);M(p>=0&&p<=59,"seconds part must be >= 0 and <= 59")}},n.minuteRange=function(b){for(var s=b.split(","),i=0;i<s.length;i++)if(!isNaN(parseInt(s[i],10))){var p=parseInt(s[i],10);M(p>=0&&p<=59,"minutes part must be >= 0 and <= 59")}},n.hourRange=function(b){for(var s=b.split(","),i=0;i<s.length;i++)if(!isNaN(parseInt(s[i],10))){var p=parseInt(s[i],10);M(p>=0&&p<=23,"hours part must be >= 0 and <= 23")}},n.dayOfMonthRange=function(b){for(var s=b.split(","),i=0;i<s.length;i++)if(!isNaN(parseInt(s[i],10))){var p=parseInt(s[i],10);M(p>=1&&p<=31,"DOM part must be >= 1 and <= 31")}},n.monthRange=function(b,s){for(var i=b.split(","),p=0;p<i.length;p++)if(!isNaN(parseInt(i[p],10))){var f=parseInt(i[p],10);M(f>=1&&f<=12,s?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},n.dayOfWeekRange=function(b,s){for(var i=b.split(","),p=0;p<i.length;p++)if(!isNaN(parseInt(i[p],10))){var f=parseInt(i[p],10);M(f>=0&&f<=6,s?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},n})();y.default=d}),823:((Z,y)=>{Object.defineProperty(y,"__esModule",{value:!0}),y.StringUtilities=void 0;var M=(function(){function d(){}return d.format=function(n){for(var b=[],s=1;s<arguments.length;s++)b[s-1]=arguments[s];return n.replace(/%s/g,function(i){return b.shift()})},d.containsAny=function(n,b){return b.some(function(s){return n.indexOf(s)>-1})},d})();y.StringUtilities=M})},x={};function t(Z){var y=x[Z];if(y!==void 0)return y.exports;var M=x[Z]={exports:{}};return v[Z](M,M.exports,t),M.exports}var a={};return(()=>{var Z=a;Object.defineProperty(Z,"__esModule",{value:!0}),Z.toString=void 0;var y=t(333),M=t(747);y.ExpressionDescriptor.initialize(new M.enLocaleLoader),Z.default=y.ExpressionDescriptor;var d=y.ExpressionDescriptor.toString;Z.toString=d})(),a})())})(ce)),ce.exports}var st=it();const at=Ce(st),oe=Be.get("Settings"),ut={name:"Settings",mixins:[De],components:{ColorScheme:ue(()=>fe(()=>import("./ColorScheme-CGw-vqaA.js"),__vite__mapDeps([0,1,2]),import.meta.url)),DialogGatewayValue:ue(()=>fe(()=>import("./DialogGatewayValue-T-Nx_UJB.js"),__vite__mapDeps([3,1,2,4]),import.meta.url)),fileInput:ue(()=>fe(()=>import("./file-input-Cw4QkG-_.js"),__vite__mapDeps([5,1,2]),import.meta.url)),invertedCheckbox:ue(()=>fe(()=>import("./InvertedCheckbox-zBbp5FaW.js"),__vite__mapDeps([6,1,2]),import.meta.url))},props:{socket:{type:Object,required:!0}},computed:{internalColorScheme:{get(){return this.colorScheme},set(o){this.setColorScheme(o)}},internalNavTabs:{get(){return this.navTabs},set(o){this.setNavTabs(o)}},internalShowTabLabels:{get(){return this.showTabLabels},set(o){this.setShowTabLabels(o)}},internalStreamerMode:{get(){return this.streamerMode},set(o){this.setStreamerMode(o)}},internalCompactMode:{get(){return this.compactMode},set(o){this.setCompactMode(o)}},internalBrowserTitle:{get(){return this.ui.browserTitle||"Z-Wave JS UI"},set(o){this.setBrowserTitle(o)}},settingsChanged(){return!Q(this.newMqtt,this.mqtt)||!Q(this.newGateway,this.gateway)||!Q(this.newZwave,this.zwave)||!Q(this.newBackup,this.backup)||!Q(this.newZniffer,this.zniffer)||!Q(this.ui,this.prevUi)},filteredScales(){return this.newZwave.scales&&this.newZwave.scales.length>0?this.scales.filter(o=>!this.newZwave.scales.find(e=>e.key===o.key&&o.label!==e.label)):this.scales},visibleHeaders(){if(this.newMqtt.disabled){const o=[...this.headers];return o.splice(2,1),o}else return this.headers},secure(){if(!this.newMqtt.host)return!1;const o=ie(this.newMqtt.host),e=["mqtts:","tls:"].indexOf(o.protocol)>=0;return e||(this.newMqtt.key=this.newMqtt._key=this.newMqtt.cert=this.newMqtt._cert=this.newMqtt.ca=this.newMqtt._ca=""),e},dialogTitle(){return this.editedIndex===-1?"New Item":"Edit Item"},requiredUser(){return this.newMqtt.auth&&!!this.newMqtt.username||"This field is required."},differentPorts(){return!this.newZwave.enabled||!this.newZniffer.enabled||this.newZwave.port!==this.newZniffer.port||"Zniffer and Z-Wave ports must be different."},validPayload(){return!this.newGateway.hassDiscovery||this.newGateway.payloadType!==2||"Hass discovery doesn't work with this payload type"},requiredPassword(){return this.newMqtt.auth&&!!this.newMqtt.password||"This field is required."},...be(re,["zwave","zniffer","mqtt","gateway","backup","devices","serial_ports","scales","ui","isSettingManagedExternally"]),allClassicSecurityKeysManagedExternally(){return this.isSettingManagedExternally("zwave.securityKeys.S0_Legacy")&&this.isSettingManagedExternally("zwave.securityKeys.S2_Unauthenticated")&&this.isSettingManagedExternally("zwave.securityKeys.S2_Authenticated")&&this.isSettingManagedExternally("zwave.securityKeys.S2_AccessControl")},allLRSecurityKeysManagedExternally(){return this.isSettingManagedExternally("zwave.securityKeysLongRange.S2_Authenticated")&&this.isSettingManagedExternally("zwave.securityKeysLongRange.S2_AccessControl")},allRfSettingsManagedExternally(){return this.isSettingManagedExternally("zwave.rf.region")&&this.isSettingManagedExternally("zwave.rf.autoPowerlevels")},allLogSettingsManagedExternally(){return this.isSettingManagedExternally("zwave.logEnabled")&&this.isSettingManagedExternally("zwave.logLevel")&&this.isSettingManagedExternally("zwave.logToFile")&&this.isSettingManagedExternally("zwave.maxFiles")},allHassSettingsManagedExternally(){return this.isSettingManagedExternally("zwave.serverEnabled")&&this.isSettingManagedExternally("zwave.serverPort")&&this.isSettingManagedExternally("zwave.serverHost")&&this.isSettingManagedExternally("zwave.serverServiceDiscoveryDisabled")},isPortManagedExternally(){return this.isSettingManagedExternally("zwave.port")},...be(re,{colorScheme:o=>o.ui.colorScheme,darkMode:o=>o.uiState.darkMode,navTabs:o=>o.ui.navTabs,showTabLabels:o=>o.ui.showTabLabels,streamerMode:o=>o.ui.streamerMode,compactMode:o=>o.ui.compactMode})},watch:{dialogValue(o){o||this.closeDialog()}},data(){return{rfRegions:je,znifferRegions:_e,maxLRPowerLevels:We,valid_zwave:!0,dialogValue:!1,sslDisabled:!1,saving:!1,loadingSerialPorts:!1,serialPortsFetched:!1,prevUi:null,newGateway:{},newMqtt:{},newZwave:{rf:{txPower:{}}},newZniffer:{},newBackup:{},editedValue:{},editedIndex:-1,defaultValue:{},logLevels:[{title:"Error",value:"error"},{title:"Warn",value:"warn"},{title:"Info",value:"info"},{title:"Verbose",value:"verbose"},{title:"Debug",value:"debug"},{title:"Silly",value:"silly"}],headers:[{title:"Device",key:"device"},{title:"Value",key:"value",sortable:!1},{title:"Topic",key:"topic"},{title:"Post Operation",key:"postOperation"},{title:"Poll",key:"enablePoll"},{title:"Actions",key:"actions",sortable:!1}],headersJobs:[{title:"Name",key:"name"},{title:"Enabled",key:"enabled"},{title:"On Init",key:"runOnInit"},{title:"Code",key:"code"},{title:"Cron",key:"cron"},{title:"Actions",key:"actions",sortable:!1}],e1:!0,gw_types:[{title:"ValueID topics",value:0},{title:"Named topics",value:1},{title:"Configured Manually",value:2}],py_types:[{title:"JSON Time-Value",value:0},{title:"Entire Z-Wave value Object",value:1},{title:"Just value",value:2}],rules:{required:o=>{let e=!1;return o instanceof Array?e=o.length>0:e=!!o||o===0,e||"This field is required."},positive:o=>o>0||"Value must be positive.",uniqueSensorType(o){return!o||o.length<2?!0:!o.some((e,v)=>o.findIndex((x,t)=>t>v&&e.key===x.key)>=0)||"Duplicated sensor type scale"},validNodeLog:o=>!o||o.every(e=>e>0&&e<4e3)||"Nodes must be between 1-4000",validName:o=>!/[!@#$%^&*)(+=:,;"'\\|?{}£°§<>[\]/.\s]/g.test(o)||'Name is not valid, only "a-z" "A-Z" "0-9" chars and "_" are allowed',validPrefix:o=>!/[!@#$%^&*)(+=:,;"'\\|?{}£°§<>[\].\s]/g.test(o)||'Prefix is not valid, only "a-z" "A-Z" "0-9", "_", "/" chars are allowed',validLength:o=>!o||o.length===32||"Key must be 32 characters length",validKey:o=>!o||!/[^A-F0-9]+/gi.test(o)||"Key not valid. Must contain only hex chars",validCron:o=>!o||!!this.parseCron(o)||"Not a valid cron string"}}},methods:{...Le(re,["setColorScheme","setNavTabs","setShowTabLabels","setStreamerMode","setCompactMode","setBrowserTitle","initSettings","init"]),copyKeysZniffer(){this.newZniffer.securityKeys=B(this.newZwave.securityKeys),this.newZniffer.securityKeysLongRange=B(this.newZwave.securityKeysLongRange)},validTxPower(){const{powerlevel:o,measured0dBm:e}=this.newZwave.rf?.txPower??{};if(typeof e=="number"&&(e<-10||e>10))return"Measured @ 0dBm must be between -10 and 10";if(!(Fe(o)||o==="auto")&&(typeof o!="number"||o<-10||o>20))return"Powerlevel must be between -10 and 20"},parseCron(o){let e;try{e=at.toString(o,{use24HourTimeFormat:!0})}catch{}return e},differentKeys(o){return()=>{const e=Object.values(o);return e.length===new Set(e).size||"Keys must be different"}},fixKey(o,e,v){let x=o.clipboardData?.getData("Text");x&&(x=x.replace(/0x|,|\s/gi,""),v[e]=x.toUpperCase(),o.preventDefault())},openDocs(o){this.openUrl(`https://zwave-js.github.io/zwave-js-ui/#/usage/setup?id=${o}`)},openUrl(o){window.open(o,"_blank")},scaleName(o){return typeof o=="object"&&o?`${o.sensor}: ${o.label?" "+o.label+" ":""}${o.unit&&o.unit!==o.label?`(${o.unit})`:""}`:o},randomKey(o,e){let v="";for(;v.length<32;){const x=Math.round(Math.random()*255).toString(16).toUpperCase();v+=x.length===2?x:"0"+x}e[o]=v},readFile(o,e){const v=new FileReader;v.onload=x=>e(x.target.result),v.readAsText(o)},onFileSelect(o){const e=o.files[0];e?this.readFile(e,v=>this.newMqtt[o.key]=v):this.newMqtt[o.key]=""},async importSettings(){try{const{data:o}=await this.app.importFile("json");o.zwave&&o.mqtt&&o.gateway?(this.resetConfig(o),this.showSnackbar("Configuration imported successfully","success")):this.showSnackbar("Imported settings not valid","error")}catch{}},exportSettings(){const o=this.getSettingsJSON();this.app.exportConfiguration(o,"settings")},getSettingsJSON(){return{mqtt:this.newMqtt,gateway:this.newGateway,zwave:this.newZwave,backup:this.newBackup,zniffer:this.newZniffer,ui:this.ui}},async editJob(o){const{data:e}=await le.getSnippets(),v=await this.app.confirm(o?"Edit job":"New Job","","info",{width:900,inputs:[{type:"text",key:"name",label:"Name",default:o?o.name:"",rules:[this.rules.required]},{type:"boolean",key:"enabled",label:"Enabled",default:o?o.enabled:!0},{type:"boolean",key:"runOnInit",label:"Run on init",hint:"Run the job on gateway init",default:o?o.runOnInit:!1},{type:"text",key:"cron",label:"Cron string",default:o?o.cron:"0 0 * * *",hint:"Cron string. Default is '0 0 * * *' that means every day at midnight.",rules:[this.rules.validCron]},{type:"list",key:"snippet",label:"Snippets",default:"",items:e,itemText:"name",itemValue:"name",hint:"Select a snippet from library",onChange(x,t){const a=t?e.find(Z=>Z.name===t)?.content:"";t&&(x.code=a)}},{type:"code",key:"code",label:"Code",default:o?o.code:"// Example:\n// const { logger, zwaveClient, require } = this\n// const node = driver.controller.nodes.get(35);\n// await node.refreshInfo();\n// logger.info(`Node ${node.id} is ready: ${node.ready}`);",rules:[this.rules.required],hint:`Write the function here. The only arg is:
<code>driver</code>. The function is <code>async</code>.`}],confirmText:o?"Edit":"Add"});v.code&&(delete v.snippet,o?Object.assign(o,v):this.newGateway.jobs.push(v))},async deleteJob(o){const e=this.newGateway.jobs.indexOf(o);e>=0&&await this.app.confirm("Attention","Are you sure you want to delete this item?","alert")&&this.newGateway.jobs.splice(e,1)},editItem(o){this.editedIndex=this.newGateway.values.indexOf(o),this.editedValue=Object.assign({},o),this.dialogValue=!0},async deleteItem(o){const e=this.newGateway.values.indexOf(o);await this.app.confirm("Attention","Are you sure you want to delete this item?","alert")&&this.newGateway.values.splice(e,1)},closeDialog(){this.dialogValue=!1,setTimeout(()=>{this.editedValue=Object.assign({},this.defaultValue),this.editedIndex=-1},300)},deviceName(o){const e=this.devices.find(v=>v.value===o);return e?e.name:o},saveValue(){this.editedIndex>-1?this.newGateway.values.splice(this.editedIndex,1,this.editedValue):this.newGateway.values.push(this.editedValue),this.closeDialog()},async update(){if(await Ge(200),(await this.$refs.form_settings.validate()).valid)try{this.saving=!0,re().resetNodes();const e=await le.updateConfig(this.getSettingsJSON());if(this.saving=!1,this.showSnackbar(e.message,e.success?"success":"error"),this.initSettings(e.data),this.prevUi=B(this.ui),this.resetConfig(),e.success&&e.shouldRestart&&(await this.app.confirm("Restart Required","Do you want to restart the Z-Wave JS driver to apply the changes?","info",{width:500,inputs:[{type:"checkbox",key:"restart",label:"Restart Z-Wave JS driver",default:!0,hint:"Changes require a restart to take effect. Uncheck to restart manually later."}]}))?.restart)try{this.saving=!0;const x=await le.restartGateway();this.saving=!1,this.showSnackbar(x.message,x.success?"success":"error")}catch(x){this.saving=!1,this.showSnackbar("Failed to restart gateway","error"),oe.error(x)}}catch(e){this.saving=!1,oe.error(e)}else this.showSnackbar("Your configuration contains errors, fix it","error")},resetConfig(o){const e={mqtt:this.mqtt,gateway:this.gateway,zwave:this.zwave,zniffer:this.zniffer,backup:this.backup,ui:this.ui,...o||{}};this.newGateway=B(e.gateway),this.newZwave=B(e.zwave),this.newZniffer=B(e.zniffer),this.newMqtt=B(e.mqtt),this.newBackup=B(e.backup),this.prevUi===null&&(this.prevUi=B(e.ui));const v=o?.ui||this.prevUi;this.internalColorScheme=v.colorScheme,this.internalNavTabs=v.navTabs,this.internalStreamerMode=v.streamerMode,this.internalCompactMode=v.compactMode,this.internalBrowserTitle=v.browserTitle},async getConfig(){try{const o=await le.getConfig();if(!o.success){this.showSnackbar("Error while retrieving configuration, check console","error"),oe.error(o);return}this.init(o),this.sslDisabled=o.sslDisabled,this.resetConfig()}catch(o){this.showSnackbar(o.message,"error"),oe.error(o)}},async loadSerialPorts(){this.serialPortsFetched||this.loadingSerialPorts||await this.fetchSerialPorts()},async refreshSerialPorts(){this.loadingSerialPorts||(this.serialPortsFetched=!1,await this.fetchSerialPorts())},async fetchSerialPorts(){this.loadingSerialPorts=!0;try{const o=await le.getSerialPorts();o.success&&o.serial_ports&&re().initPorts(o.serial_ports),this.serialPortsFetched=!0}catch(o){oe.error("Failed to load serial ports:",o)}finally{this.loadingSerialPorts=!1}}},beforeRouteLeave(o,e,v){this.settingsChanged?this.app.confirm("Attention","You have unsaved changes. Do you really want to leave?","alert").then(x=>{x&&v()}):v()},mounted(){this.$emit("updateStatus"),this.resetConfig(),this.getConfig()}},dt=["modelValue"],ft=["modelValue"],pt=["modelValue"];function mt(o,e,v,x,t,a){const Z=de("color-scheme"),y=de("inverted-checkbox"),M=de("file-input"),d=de("DialogGatewayValue");return V(),S(Ne,{fluid:"","grid-list-md":"",class:"pt-8 px-0"},{default:r(()=>[l(Ie,{id:"form_settings",onSubmit:I(a.update,["prevent"]),modelValue:t.valid_zwave,"onUpdate:modelValue":e[143]||(e[143]=n=>t.valid_zwave=n),ref:"form_settings",class:"pb-6 mx-2"},{default:r(()=>[l(Ve,{variant:"accordion",multiple:"",flat:"",class:"expansion-panels-outlined"},{default:r(()=>[l(G,{key:"UI"},{default:r(()=>[l(F,null,{default:r(()=>[l(D,{"no-gutters":""},{default:r(()=>[l(u,{"align-self":"center"},{default:r(()=>[...e[145]||(e[145]=[c(" UI ",-1)])]),_:1}),l(u,{class:"text-right pr-5"},{default:r(()=>[l(R,{onClick:e[0]||(e[0]=I(n=>a.openDocs("general"),["stop"])),color:"primary",variant:"outlined",size:"x-small"},{default:r(()=>[e[147]||(e[147]=c(" Docs ",-1)),l(A,{size:"x-small",end:""},{default:r(()=>[...e[146]||(e[146]=[c("launch",-1)])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),l(W,null,{default:r(()=>[l(D,{class:"mb-5"},{default:r(()=>[l(u,{cols:"12",sm:"6"},{default:r(()=>[l(Z)]),_:1}),l(u,{cols:"12",sm:"6"},{default:r(()=>[l(T,{hint:"Enable this to use Tabs in the top bar instead of a left menu for navigation (useful when integrated in Home Assistant)","persistent-hint":"",label:"Use tabs for navigation",modelValue:a.internalNavTabs,"onUpdate:modelValue":e[1]||(e[1]=n=>a.internalNavTabs=n)},null,8,["modelValue"])]),_:1}),l(u,{cols:"12",sm:"6"},{default:r(()=>[l(T,{hint:"Show labels under all navigation tabs (only when tabs for navigation is enabled)","persistent-hint":"",label:"Show labels on all tabs",disabled:!a.internalNavTabs,modelValue:a.internalShowTabLabels,"onUpdate:modelValue":e[2]||(e[2]=n=>a.internalShowTabLabels=n)},null,8,["disabled","modelValue"])]),_:1}),l(u,{cols:"12",sm:"6"},{default:r(()=>[l(T,{hint:"Enable this to hide sensitive informations from the UI","persistent-hint":"",label:"Streamer mode",modelValue:a.internalStreamerMode,"onUpdate:modelValue":e[3]||(e[3]=n=>a.internalStreamerMode=n)},null,8,["modelValue"])]),_:1}),l(u,{cols:"12",sm:"6"},{default:r(()=>[l(T,{hint:"Enable this to use compact view by default in the Control Panel (can be toggled with the Compact button)","persistent-hint":"",label:"Compact view by default",modelValue:a.internalCompactMode,"onUpdate:modelValue":e[4]||(e[4]=n=>a.internalCompactMode=n)},null,8,["modelValue"])]),_:1}),l(u,{cols:"12",sm:"6"},{default:r(()=>[l(U,{hint:"Customize the browser tab title (useful when managing multiple hubs)","persistent-hint":"",label:"Browser title",modelValue:a.internalBrowserTitle,"onUpdate:modelValue":e[5]||(e[5]=n=>a.internalBrowserTitle=n)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l(_)]),_:1}),l(G,{key:"General"},{default:r(()=>[l(F,null,{default:r(()=>[l(D,{"no-gutters":""},{default:r(()=>[l(u,{"align-self":"center"},{default:r(()=>[...e[148]||(e[148]=[c(" General ",-1)])]),_:1}),l(u,{class:"text-right pr-5"},{default:r(()=>[l(R,{onClick:e[6]||(e[6]=I(n=>a.openDocs("general"),["stop"])),color:"primary",variant:"outlined",size:"x-small"},{default:r(()=>[e[150]||(e[150]=c(" Docs ",-1)),l(A,{size:"x-small",end:""},{default:r(()=>[...e[149]||(e[149]=[c("launch",-1)])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),l(W,null,{default:r(()=>[l(J,{flat:""},{default:r(()=>[l(Y,null,{default:r(()=>[l(D,{class:"mb-5"},{default:r(()=>[l(u,{cols:"12",sm:"6",md:"4"},{default:r(()=>[l(T,{hint:"Enable this to password protect your application. Default username is `admin`, password is `zwave`","persistent-hint":"",label:"Auth",modelValue:t.newGateway.authEnabled,"onUpdate:modelValue":e[7]||(e[7]=n=>t.newGateway.authEnabled=n)},null,8,["modelValue"])]),_:1}),t.sslDisabled?k("",!0):(V(),S(u,{key:0,cols:"12",sm:"6",md:"4"},{default:r(()=>[l(T,{hint:"Enable this to serve page using HTTPS. REQUIRES APP RELOAD","persistent-hint":"",label:"HTTPS",modelValue:t.newGateway.https,"onUpdate:modelValue":e[8]||(e[8]=n=>t.newGateway.https=n)},null,8,["modelValue"])]),_:1})),l(u,{cols:"12",sm:"6",md:"4"},{default:r(()=>[l(te,{hint:"You can select a plugin from the list or write the path to your custom plugin and press enter","persistent-hint":"",label:"Plugins",items:["@varet/zj2m-prom-exporter","@kvaster/zwavejs-prom"],multiple:"",chips:"","closable-chips":"",modelValue:t.newGateway.plugins,"onUpdate:modelValue":e[9]||(e[9]=n=>t.newGateway.plugins=n)},null,8,["modelValue"])]),_:1}),l(u,{cols:"12",sm:"6",md:"4"},{default:r(()=>[l(T,{hint:"Enable logging","persistent-hint":"",label:"Log enabled",modelValue:t.newGateway.logEnabled,"onUpdate:modelValue":e[10]||(e[10]=n=>t.newGateway.logEnabled=n)},null,8,["modelValue"])]),_:1}),t.newGateway.logEnabled?(V(),S(u,{key:1,cols:"12",sm:"6",md:"4"},{default:r(()=>[l(N,{items:t.logLevels,modelValue:t.newGateway.logLevel,"onUpdate:modelValue":e[11]||(e[11]=n=>t.newGateway.logLevel=n),label:"Log Level"},null,8,["items","modelValue"])]),_:1})):k("",!0),t.newGateway.logEnabled?(V(),S(u,{key:2,cols:"12",sm:"6",md:"4"},{default:r(()=>[l(T,{hint:"Store logs in a file. Default: store/log/z-ui_%DATE%.log","persistent-hint":"",label:"Log to file",modelValue:t.newGateway.logToFile,"onUpdate:modelValue":e[12]||(e[12]=n=>t.newGateway.logToFile=n)},null,8,["modelValue"])]),_:1})):k("",!0),l(u,{cols:"12",sm:"6",md:"4"},{default:r(()=>[l(ne,{"persistent-hint":"",label:"Disable changelogs",hint:"Check this to disable changelogs dialogs on new versions",modelValue:t.newGateway.disableChangelog,"onUpdate:modelValue":e[13]||(e[13]=n=>t.newGateway.disableChangelog=n)},null,8,["modelValue"])]),_:1}),l(u,{cols:"12",sm:"6",md:"4"},{default:r(()=>[l(ne,{"persistent-hint":"",label:"Notify new versions",hint:"Check this to show a notification when a new version is available",modelValue:t.newGateway.notifyNewVersions,"onUpdate:modelValue":e[14]||(e[14]=n=>t.newGateway.notifyNewVersions=n)},null,8,["modelValue"])]),_:1})]),_:1}),l(z,{class:"font-weight-bold"},{default:r(()=>[...e[151]||(e[151]=[c(" Devices values configuration ",-1)])]),_:1}),e[161]||(e[161]=L("div",{class:"mb-5 text-caption"}," Add here valueIds specific configurations for each device. This means that if you create an entry here this configuration will be applied to each valueId of each device of the same type in your Network. ",-1)),l(Se,{headers:a.visibleHeaders,items:t.newGateway.values,"items-per-page-options":[10,20,{title:"All",value:-1}],class:"elevation-1"},{top:r(()=>[l(R,{color:"primary",variant:"text",onClick:e[15]||(e[15]=n=>t.dialogValue=!0)},{default:r(()=>[l(A,null,{default:r(()=>[...e[152]||(e[152]=[c("add",-1)])]),_:1}),e[153]||(e[153]=c(" New Value ",-1))]),_:1})]),"item.device":r(({item:n})=>[c(X(a.deviceName(n.device)),1)]),"item.value":r(({item:n})=>[c(X(n.value.label+" ("+n.value.id+")"),1)]),"item.topic":r(({item:n})=>[c(X(n.topic),1)]),"item.postOperation":r(({item:n})=>[c(X(n.postOperation||"No operation"),1)]),"item.enablePoll":r(({item:n})=>[c(X(n.enablePoll?"Interval: "+n.pollInterval+"s":"No"),1)]),"item.actions":r(({item:n})=>[l(A,{size:"small",class:"mr-2",color:"success",onClick:b=>a.editItem(n)},{default:r(()=>[...e[154]||(e[154]=[c(" edit ",-1)])]),_:1},8,["onClick"]),l(A,{size:"small",color:"error",onClick:b=>a.deleteItem(n)},{default:r(()=>[...e[155]||(e[155]=[c(" delete ",-1)])]),_:1},8,["onClick"])]),_:2},1032,["headers","items"]),l(z,{class:"font-weight-bold"},{default:r(()=>[...e[156]||(e[156]=[c(" Scheduled Jobs ",-1)])]),_:1}),e[162]||(e[162]=L("div",{class:"mb-5 text-caption"}," Add here a list of scheduled jobs that will run specified driver function based on a cron expression. ",-1)),l(Se,{headers:t.headersJobs,items:t.newGateway.jobs,"items-per-page-options":[10,20,{title:"All",value:-1}],class:"elevation-1"},{top:r(()=>[l(R,{color:"primary",variant:"text",onClick:e[16]||(e[16]=n=>a.editJob())},{default:r(()=>[l(A,null,{default:r(()=>[...e[157]||(e[157]=[c("add",-1)])]),_:1}),e[158]||(e[158]=c(" New Value ",-1))]),_:1})]),"item.code":r(({item:n})=>[L("code",null,X(n.code.substring(0,30)),1)]),"item.enabled":r(({item:n})=>[l(A,{color:n.enabled?"success":"error"},{default:r(()=>[c(X(n.enabled?"check_circle":"cancel"),1)]),_:2},1032,["color"])]),"item.runOnInit":r(({item:n})=>[l(A,{color:n.runOnInit?"success":"error"},{default:r(()=>[c(X(n.runOnInit?"check_circle":"cancel"),1)]),_:2},1032,["color"])]),"item.actions":r(({item:n})=>[l(A,{size:"small",class:"mr-2",color:"warning",onClick:b=>a.editJob(n)},{default:r(()=>[...e[159]||(e[159]=[c(" edit ",-1)])]),_:1},8,["onClick"]),l(A,{size:"small",color:"error",onClick:b=>a.deleteJob(n)},{default:r(()=>[...e[160]||(e[160]=[c(" delete ",-1)])]),_:1},8,["onClick"])]),_:2},1032,["headers","items"])]),_:1})]),_:1})]),_:1}),l(_)]),_:1}),l(G,{key:"Backup"},{default:r(()=>[l(F,null,{default:r(()=>[l(D,{"no-gutters":""},{default:r(()=>[l(u,{"align-self":"center"},{default:r(()=>[...e[163]||(e[163]=[c(" Backup ",-1)])]),_:1}),l(u,{class:"text-right pr-5"},{default:r(()=>[l(R,{onClick:e[17]||(e[17]=I(n=>a.openDocs("backup"),["stop"])),color:"primary",variant:"outlined",size:"x-small"},{default:r(()=>[e[165]||(e[165]=c(" Docs ",-1)),l(A,{size:"x-small",end:""},{default:r(()=>[...e[164]||(e[164]=[c("launch",-1)])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),l(W,null,{default:r(()=>[l(z,null,{default:r(()=>[...e[166]||(e[166]=[L("strong",null,"STORE",-1)])]),_:1}),l(D,{class:"mb-5"},{default:r(()=>[l(u,{cols:"12",sm:"6"},{default:r(()=>[l(T,{hint:"Enable/Disable backup","persistent-hint":"",label:"Backup",modelValue:t.newBackup.storeBackup,"onUpdate:modelValue":e[18]||(e[18]=n=>t.newBackup.storeBack