184 files
This commit is contained in:
1 parent
7b47edbf8d
commit
0c64e47969
184 files changed
+9608
-11572
No files matched your search
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.68.0 */
|
||||
import{a as m,b as f}from"./chunk-KZELY5AU.js";import{a as u,b as l,d as h,e as b,f as y,g as o,h as g,i as a,j as _,l as v,u as p}from"./chunk-IX76Z563.js";import{a as n}from"./chunk-2QUB5MLN.js";var k=80,s=class extends b{constructor(){super(...arguments);this._config={type:""};this._status=null;this._busy=!1;this._error="";this._localMonthly="";this._localYearly="";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return _(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),v(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"});this._status=t,this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1}catch(t){this._error=p(t,this._lang)}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=this._localMonthly.trim()===""?0:parseFloat(this._localMonthly),r=this._localYearly.trim()===""?0:parseFloat(this._localYearly),i={};!isNaN(t)&&t>=0&&(i.budget_monthly=t),!isNaN(r)&&r>=0&&(i.budget_yearly=r),await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:i}),await this._load()}catch(t){this._error=p(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_budget"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,r=this._status;if(!r)return l`<ha-card><div class="loading">${a("loading",t)||"Loading\u2026"}</div></ha-card>`;let i=r.currency_symbol||g,x=r.alert_threshold_pct??k,$=[{label:a("budget_monthly",t)||"Monthly",spent:r.monthly_spent||0,budget:r.monthly_budget||0},{label:a("budget_yearly",t)||"Yearly",spent:r.yearly_spent||0,budget:r.yearly_budget||0}];return l`
|
||||
/*! maintenance_supporter frontend 2.71.0 */
|
||||
import{a as m,b as f}from"./chunk-3OUB5IHO.js";import{a as u,b as l,d as h,e as b,f as y,g as o,h as g,i as a,j as _,l as v,u as p}from"./chunk-MKETKKBB.js";import{a as n}from"./chunk-DEN57ILL.js";var k=80,s=class extends b{constructor(){super(...arguments);this._config={type:""};this._status=null;this._busy=!1;this._error="";this._localMonthly="";this._localYearly="";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return _(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),v(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"});this._status=t,this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1}catch(t){this._error=p(t,this._lang)}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=this._localMonthly.trim()===""?0:parseFloat(this._localMonthly),r=this._localYearly.trim()===""?0:parseFloat(this._localYearly),i={};!isNaN(t)&&t>=0&&(i.budget_monthly=t),!isNaN(r)&&r>=0&&(i.budget_yearly=r),await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:i}),await this._load()}catch(t){this._error=p(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_budget"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,r=this._status;if(!r)return l`<ha-card><div class="loading">${a("loading",t)||"Loading\u2026"}</div></ha-card>`;let i=r.currency_symbol||g,x=r.alert_threshold_pct??k,$=[{label:a("budget_monthly",t)||"Monthly",spent:r.monthly_spent||0,budget:r.monthly_budget||0},{label:a("budget_yearly",t)||"Yearly",spent:r.yearly_spent||0,budget:r.yearly_budget||0}];return l`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
-125
@@ -1,125 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.70.0 */
|
||||
import{a as m,b as f}from"./chunk-ER5MID6O.js";import{a as u,b as l,d as h,e as b,f as y,g as o,h as g,i as a,j as _,l as v,u as p}from"./chunk-JMXXW5KM.js";import{a as n}from"./chunk-CAQJ66HF.js";var k=80,s=class extends b{constructor(){super(...arguments);this._config={type:""};this._status=null;this._busy=!1;this._error="";this._localMonthly="";this._localYearly="";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return _(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),v(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"});this._status=t,this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1}catch(t){this._error=p(t,this._lang)}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=this._localMonthly.trim()===""?0:parseFloat(this._localMonthly),r=this._localYearly.trim()===""?0:parseFloat(this._localYearly),i={};!isNaN(t)&&t>=0&&(i.budget_monthly=t),!isNaN(r)&&r>=0&&(i.budget_yearly=r),await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:i}),await this._load()}catch(t){this._error=p(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_budget"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,r=this._status;if(!r)return l`<ha-card><div class="loading">${a("loading",t)||"Loading\u2026"}</div></ha-card>`;let i=r.currency_symbol||g,x=r.alert_threshold_pct??k,$=[{label:a("budget_monthly",t)||"Monthly",spent:r.monthly_spent||0,budget:r.monthly_budget||0},{label:a("budget_yearly",t)||"Yearly",spent:r.yearly_spent||0,budget:r.yearly_budget||0}];return l`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">💰</span>
|
||||
<span>${this._config.title||a("settings_budget",t)||"Budget"}</span>
|
||||
</div>
|
||||
<span class="currency">${i}</span>
|
||||
</div>
|
||||
|
||||
${this._error?l`<div class="error">${this._error}</div>`:h}
|
||||
|
||||
${$.map(e=>{if(!(e.budget>0))return l`
|
||||
<div class="track spent-only">
|
||||
<div class="track-label-row">
|
||||
<label>${e.label}</label>
|
||||
<span class="track-numbers ok">${e.spent.toFixed(0)} ${i}</span>
|
||||
</div>
|
||||
</div>
|
||||
`;let d=Math.min(100,Math.max(0,e.spent/e.budget*100)),c=d>=100?"danger":d>=x?"warning":"ok";return l`
|
||||
<div class="track">
|
||||
<div class="track-label-row">
|
||||
<label>${e.label}</label>
|
||||
<span class="track-numbers ${c}">
|
||||
${e.spent.toFixed(0)} / ${e.budget.toFixed(0)} ${i}
|
||||
</span>
|
||||
</div>
|
||||
<div class="bar"><div class="bar-fill ${c}" style="width:${d}%"></div></div>
|
||||
</div>
|
||||
`})}
|
||||
|
||||
${this._isAdmin?l`
|
||||
<div class="inputs-row">
|
||||
<div class="input-field">
|
||||
<label>${a("budget_monthly_set",t)||"Set monthly"}</label>
|
||||
<div class="input-wrap">
|
||||
<input type="number" min="0" step="1"
|
||||
.value=${this._localMonthly}
|
||||
?disabled=${this._busy}
|
||||
@input=${e=>{this._localMonthly=e.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${i}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<label>${a("budget_yearly_set",t)||"Set yearly"}</label>
|
||||
<div class="input-wrap">
|
||||
<input type="number" min="0" step="1"
|
||||
.value=${this._localYearly}
|
||||
?disabled=${this._busy}
|
||||
@input=${e=>{this._localYearly=e.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${i}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
||||
@click=${this._save}
|
||||
?disabled=${this._busy||!this._dirty}>
|
||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
||||
${this._dirty?a("save",t)||"Save":a("saved",t)||"Saved"}
|
||||
</button>
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${a("budget_advanced",t)||"Currency, alerts\u2026"}
|
||||
</button>
|
||||
</div>
|
||||
`:l`
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${a("budget_open_panel",t)||"Open in panel"}
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};s.styles=[f,u`
|
||||
.currency {
|
||||
font-size: 14px; font-weight: 600;
|
||||
color: var(--secondary-text-color);
|
||||
background: var(--secondary-background-color);
|
||||
padding: 2px 10px; border-radius: 999px;
|
||||
}
|
||||
.track { display: flex; flex-direction: column; gap: 4px; }
|
||||
.track-label-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
}
|
||||
.track-label-row label {
|
||||
font-size: 12px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.5px;
|
||||
}
|
||||
.track-numbers { font-size: 13px; font-weight: 600; }
|
||||
.track-numbers.ok { color: var(--primary-text-color); }
|
||||
.track-numbers.warning { color: #ff9800; }
|
||||
.track-numbers.danger { color: var(--error-color, #f44336); }
|
||||
.bar {
|
||||
height: 6px; background: var(--secondary-background-color);
|
||||
border-radius: 3px; overflow: hidden;
|
||||
}
|
||||
.bar-fill { height: 100%; transition: width 0.3s; border-radius: 3px; }
|
||||
.bar-fill.ok { background: var(--primary-color); }
|
||||
.bar-fill.warning { background: #ff9800; }
|
||||
.bar-fill.danger { background: var(--error-color, #f44336); }
|
||||
.inputs-row {
|
||||
display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
|
||||
padding-top: 4px; border-top: 1px solid var(--divider-color);
|
||||
}
|
||||
.input-field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.input-field label {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.3px;
|
||||
}
|
||||
.input-wrap { position: relative; display: flex; align-items: center; }
|
||||
.input-wrap input {
|
||||
flex: 1; padding: 6px 32px 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.input-suffix {
|
||||
position: absolute; right: 8px;
|
||||
color: var(--secondary-text-color); font-size: 13px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.actions { display: flex; gap: 8px; align-items: center; }
|
||||
`],n([y({attribute:!1})],s.prototype,"hass",2),n([o()],s.prototype,"_config",2),n([o()],s.prototype,"_status",2),n([o()],s.prototype,"_busy",2),n([o()],s.prototype,"_error",2),n([o()],s.prototype,"_localMonthly",2),n([o()],s.prototype,"_localYearly",2),n([o()],s.prototype,"_dirty",2);customElements.get("maintenance-budget-section-card")||customElements.define("maintenance-budget-section-card",s);m({type:"maintenance-budget-section-card",name:"Maintenance Supporter \u2014 Budget",description:"Inline monthly + yearly budget editor",preview:!1});export{s as MaintenanceBudgetSectionCard};
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.70.0 */
|
||||
import{a as t}from"./chunk-JMXXW5KM.js";function e(o){let r=window;r.customCards=r.customCards||[],r.customCards.some(a=>a.type===o.type)||r.customCards.push(o)}var d=t`
|
||||
/*! maintenance_supporter frontend 2.71.0 */
|
||||
import{a as t}from"./chunk-MKETKKBB.js";function e(o){let r=window;r.customCards=r.customCards||[],r.customCards.some(a=>a.type===o.type)||r.customCards.push(o)}var d=t`
|
||||
ha-card { overflow: hidden; }
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.70.0 */
|
||||
var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var t=(a,r,c,o)=>{for(var e=o>1?void 0:o?l(r,c):r,i=a.length-1,d;i>=0;i--)(d=a[i])&&(e=(o?d(r,c,e):d(e))||e);return o&&e&&s(r,c,e),e};var m={ok:"var(--success-color, #4caf50)",due_soon:"var(--warning-color, #ff9800)",overdue:"var(--error-color, #f44336)",triggered:"var(--deep-orange-color, #ff5722)",archived:"var(--disabled-color, #9e9e9e)",paused:"var(--info-color, #2196f3)"},v={ok:"mdi:check-circle",due_soon:"mdi:alert-circle",overdue:"mdi:alert-octagon",triggered:"mdi:bell-alert",archived:"mdi:archive-outline",paused:"mdi:pause-circle-outline",completed:"mdi:check-circle",skipped:"mdi:skip-next",missed:"mdi:calendar-remove",reset:"mdi:refresh"};export{t as a,m as b,v as c};
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! maintenance_supporter frontend 2.68.0 */
|
||||
/*! maintenance_supporter frontend 2.71.0 */
|
||||
var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var t=(a,r,c,o)=>{for(var e=o>1?void 0:o?l(r,c):r,i=a.length-1,d;i>=0;i--)(d=a[i])&&(e=(o?d(r,c,e):d(e))||e);return o&&e&&s(r,c,e),e};var m={ok:"var(--success-color, #4caf50)",due_soon:"var(--warning-color, #ff9800)",overdue:"var(--error-color, #f44336)",triggered:"var(--deep-orange-color, #ff5722)",archived:"var(--disabled-color, #9e9e9e)",paused:"var(--info-color, #2196f3)"},v={ok:"mdi:check-circle",due_soon:"mdi:alert-circle",overdue:"mdi:alert-octagon",triggered:"mdi:bell-alert",archived:"mdi:archive-outline",paused:"mdi:pause-circle-outline",completed:"mdi:check-circle",skipped:"mdi:skip-next",missed:"mdi:calendar-remove",reset:"mdi:refresh"};export{t as a,m as b,v as c};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,60 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.68.0 */
|
||||
import{a as t}from"./chunk-IX76Z563.js";function e(o){let r=window;r.customCards=r.customCards||[],r.customCards.some(a=>a.type===o.type)||r.customCards.push(o)}var d=t`
|
||||
ha-card { overflow: hidden; }
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
display: flex; flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.header {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.title {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
font-size: 16px; font-weight: 500;
|
||||
}
|
||||
.emoji { font-size: 20px; }
|
||||
|
||||
/* Button family — primary action / muted-saved-state / link / icon-with-text */
|
||||
.btn {
|
||||
padding: 6px 12px; font-size: 13px;
|
||||
border-radius: 6px; cursor: pointer;
|
||||
border: 1px solid var(--divider-color);
|
||||
background: var(--secondary-background-color, transparent);
|
||||
color: var(--primary-text-color);
|
||||
font-weight: 500;
|
||||
display: inline-flex; align-items: center; gap: 4px;
|
||||
}
|
||||
.btn:hover { background: var(--state-icon-color, rgba(255,255,255,0.06)); }
|
||||
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
|
||||
.btn.primary {
|
||||
background: var(--primary-color);
|
||||
color: var(--text-primary-color, white);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
.btn.primary[disabled] { opacity: 0.6; }
|
||||
.btn.muted {
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
border-style: dashed;
|
||||
}
|
||||
.btn.muted[disabled] { opacity: 1; cursor: default; }
|
||||
.btn.muted ha-icon, .btn.primary ha-icon { --mdc-icon-size: 14px; }
|
||||
.btn.link {
|
||||
background: transparent; border: none; padding: 6px 4px;
|
||||
color: var(--primary-color); margin-left: auto;
|
||||
}
|
||||
.btn.link:hover { background: transparent; text-decoration: underline; }
|
||||
|
||||
/* Error + loading states */
|
||||
.error {
|
||||
padding: 8px; border-radius: 6px;
|
||||
background: rgba(211, 47, 47, 0.1);
|
||||
color: var(--error-color, #d32f2f); font-size: 13px;
|
||||
}
|
||||
.loading {
|
||||
padding: 24px; text-align: center;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
`;export{e as a,d as b};
|
||||
+35
-6
@@ -1,9 +1,9 @@
|
||||
/*! maintenance_supporter frontend 2.70.0 */
|
||||
var L=globalThis,M=L.ShadowRoot&&(L.ShadyCSS===void 0||L.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,W=Symbol(),ne=new WeakMap,$=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==W)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(M&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ne.set(t,e))}return e}toString(){return this.cssText}},ie=o=>new $(typeof o=="string"?o:o+"",void 0,W),U=(o,...e)=>{let t=o.length===1?o[0]:e.reduce((r,a,n)=>r+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(a)+o[n+1],o[0]);return new $(t,o,W)},se=(o,e)=>{if(M)o.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),a=L.litNonce;a!==void 0&&r.setAttribute("nonce",a),r.textContent=t.cssText,o.appendChild(r)}},V=M?o=>o:o=>o instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return ie(t)})(o):o;var{is:je,defineProperty:Pe,getOwnPropertyDescriptor:Re,getOwnPropertyNames:De,getOwnPropertySymbols:Oe,getPrototypeOf:ze}=Object,q=globalThis,le=q.trustedTypes,Le=le?le.emptyScript:"",Me=q.reactiveElementPolyfillSupport,E=(o,e)=>o,C={toAttribute(o,e){switch(e){case Boolean:o=o?Le:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,e){let t=o;switch(e){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o)}catch{t=null}}return t}},I=(o,e)=>!je(o,e),ce={attribute:!0,type:String,converter:C,reflect:!1,useDefault:!1,hasChanged:I};Symbol.metadata??=Symbol("metadata"),q.litPropertyMetadata??=new WeakMap;var g=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ce){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),a=this.getPropertyDescriptor(e,r,t);a!==void 0&&Pe(this.prototype,e,a)}}static getPropertyDescriptor(e,t,r){let{get:a,set:n}=Re(this.prototype,e)??{get(){return this[t]},set(i){this[t]=i}};return{get:a,set(i){let l=a?.call(this);n?.call(this,i),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ce}static _$Ei(){if(this.hasOwnProperty(E("elementProperties")))return;let e=ze(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(E("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(E("properties"))){let t=this.properties,r=[...De(t),...Oe(t)];for(let a of r)this.createProperty(a,t[a])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,a]of t)this.elementProperties.set(r,a)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let a=this._$Eu(t,r);a!==void 0&&this._$Eh.set(a,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let a of r)t.unshift(V(a))}else e!==void 0&&t.push(V(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return se(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,r);if(a!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:C).toAttribute(t,r.type);this._$Em=e,n==null?this.removeAttribute(a):this.setAttribute(a,n),thLine truncated
|
||||
/*! maintenance_supporter frontend 2.71.0 */
|
||||
var L=globalThis,M=L.ShadowRoot&&(L.ShadyCSS===void 0||L.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,W=Symbol(),ne=new WeakMap,$=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==W)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(M&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ne.set(t,e))}return e}toString(){return this.cssText}},ie=o=>new $(typeof o=="string"?o:o+"",void 0,W),U=(o,...e)=>{let t=o.length===1?o[0]:e.reduce((r,a,n)=>r+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(a)+o[n+1],o[0]);return new $(t,o,W)},se=(o,e)=>{if(M)o.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),a=L.litNonce;a!==void 0&&r.setAttribute("nonce",a),r.textContent=t.cssText,o.appendChild(r)}},V=M?o=>o:o=>o instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return ie(t)})(o):o;var{is:Ne,defineProperty:Pe,getOwnPropertyDescriptor:Re,getOwnPropertyNames:De,getOwnPropertySymbols:Oe,getPrototypeOf:ze}=Object,q=globalThis,le=q.trustedTypes,Le=le?le.emptyScript:"",Me=q.reactiveElementPolyfillSupport,E=(o,e)=>o,C={toAttribute(o,e){switch(e){case Boolean:o=o?Le:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,e){let t=o;switch(e){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o)}catch{t=null}}return t}},I=(o,e)=>!Ne(o,e),ce={attribute:!0,type:String,converter:C,reflect:!1,useDefault:!1,hasChanged:I};Symbol.metadata??=Symbol("metadata"),q.litPropertyMetadata??=new WeakMap;var g=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ce){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),a=this.getPropertyDescriptor(e,r,t);a!==void 0&&Pe(this.prototype,e,a)}}static getPropertyDescriptor(e,t,r){let{get:a,set:n}=Re(this.prototype,e)??{get(){return this[t]},set(i){this[t]=i}};return{get:a,set(i){let l=a?.call(this);n?.call(this,i),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ce}static _$Ei(){if(this.hasOwnProperty(E("elementProperties")))return;let e=ze(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(E("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(E("properties"))){let t=this.properties,r=[...De(t),...Oe(t)];for(let a of r)this.createProperty(a,t[a])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,a]of t)this.elementProperties.set(r,a)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let a=this._$Eu(t,r);a!==void 0&&this._$Eh.set(a,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let a of r)t.unshift(V(a))}else e!==void 0&&t.push(V(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return se(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,r);if(a!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:C).toAttribute(t,r.type);this._$Em=e,n==null?this.removeAttribute(a):this.setAttribute(a,n),thLine truncated
|
||||
\f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_e=/-->/g,ue=/>/g,b=RegExp(`>|${G}(?:([^\\s"'>=/]+)(${G}*=${G}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),he=/'/g,ge=/"/g,ye=/^(?:script|style|textarea|title)$/i,te=o=>(e,...t)=>({_$litType$:o,strings:e,values:t}),nt=te(1),it=te(2),st=te(3),x=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),me=new WeakMap,y=v.createTreeWalker(v,129);function ve(o,e){if(!ee(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return pe!==void 0?pe.createHTML(e):e}var Ie=(o,e)=>{let t=o.length-1,r=[],a,n=e===2?"<svg>":e===3?"<math>":"",i=T;for(let l=0;l<t;l++){let s=o[l],d,_,c=-1,h=0;for(;h<s.length&&(i.lastIndex=h,_=i.exec(s),_!==null);)h=i.lastIndex,i===T?_[1]==="!--"?i=_e:_[1]!==void 0?i=ue:_[2]!==void 0?(ye.test(_[2])&&(a=RegExp("</"+_[2],"g")),i=b):_[3]!==void 0&&(i=b):i===b?_[0]===">"?(i=a??T,c=-1):_[1]===void 0?c=-2:(c=i.lastIndex-_[2].length,d=_[1],i=_[3]===void 0?b:_[3]==='"'?ge:he):i===ge||i===he?i=b:i===_e||i===ue?i=T:(i=b,a=void 0);let m=i===b&&o[l+1].startsWith("/>")?" ":"";n+=i===T?s+Ue:c>=0?(r.push(d),s.slice(0,c)+fe+s.slice(c)+f+m):s+f+(c===-2?l:m)}return[ve(o,n+(o[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},P=class o{constructor({strings:e,_$litType$:t},r){let a;this.parts=[];let n=0,i=0,l=e.length-1,s=this.parts,[d,_]=Ie(e,t);if(this.el=o.createElement(d,r),y.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(a=y.nextNode())!==null&&s.length<l;){if(a.nodeType===1){if(a.hasAttributes())for(let c of a.getAttributeNames())if(c.endsWith(fe)){let h=_[i++],m=a.getAttribute(c).split(f),z=/([.?@])?(.*)/.exec(h);s.push({type:1,index:n,name:z[2],strings:m,ctor:z[1]==="."?Q:z[1]==="?"?Y:z[1]==="@"?J:S}),a.removeAttribute(c)}else c.startsWith(f)&&(s.push({type:6,index:n}),a.removeAttribute(c));if(ye.test(a.tagName)){let c=a.textContent.split(f),h=c.length-1;if(h>0){a.textContent=H?H.emptyScript:"";for(let m=0;m<h;m++)a.append(c[m],N()),y.nextNode(),s.push({type:2,index:++n});a.append(c[h],N())}}}else if(a.nodeType===8)if(a.data===be)s.push({type:2,index:n});else{let c=-1;for(;(c=a.data.indexOf(f,c+1))!==-1;)s.push({type:7,index:n}),c+=f.length-1}n++}}static createElement(e,t){let r=v.createElement("template");return r.innerHTML=e,r}};function k(o,e,t=o,r){if(e===x)return e;let a=r!==void 0?t._$Co?.[r]:t._$Cl,n=j(e)?void 0:e._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),n===void 0?a=void 0:(a=new n(o),a._$AT(o,t,r)),r!==void 0?(t._$Co??=[])[r]=a:t._$Cl=a),a!==void 0&&(e=k(o,a._$AS(o,e.values),a,r)),e}var K=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,a=(e?.creationScope??v).importNode(t,!0);y.currentNode=a;let n=y.nextNode(),i=0,l=0,s=r[0];for(;s!==void 0;){if(i===s.index){let d;s.type===2?d=new R(n,n.nextSibling,this,e):s.type===1?d=new s.ctor(n,s.name,s.strings,this,e):s.type===6&&(d=new Z(n,this,e)),this._$AV.push(d),s=r[++l]}i!==s?.index&&(n=y.nextNode(),i++)}return y.currentNode=v,a}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},R=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,a){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=k(this,e,t),j(e)?e===p||e==null||e===""?(this._$AH!==p&&this._$AR(),this._$AH=p):e!==this._$AH&&e!==x&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):qe(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==p&&j(this._$AH)?this._$AA.nextSibling.data=e:this.T(v.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,a=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=P.createElement(ve(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===a)this._$AH.p(t);else{let n=new K(a,this),i=n.u(this.options);n.p(t),this.T(i),this._$AH=n}}_$AC(e){let t=me.get(e.strings);return t===void 0&&me.set(e.strings,t=new P(e)),t}k(e){ee(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,a=0;for(let n of e)a===t.length?t.push(r=new o(this.O(N()),this.O(N()),this,this.options)):r=t[a],r._$AI(n),a++;a<t.length&&(this._$AR(r&&r._$AB.nextSibling,a),t.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=de(e).nextSibling;de(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},S=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,a,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=a,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):thisLine truncated
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),he=/'/g,ge=/"/g,ye=/^(?:script|style|textarea|title)$/i,te=o=>(e,...t)=>({_$litType$:o,strings:e,values:t}),nt=te(1),it=te(2),st=te(3),w=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),me=new WeakMap,y=v.createTreeWalker(v,129);function ve(o,e){if(!ee(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return pe!==void 0?pe.createHTML(e):e}var Ie=(o,e)=>{let t=o.length-1,r=[],a,n=e===2?"<svg>":e===3?"<math>":"",i=T;for(let l=0;l<t;l++){let s=o[l],d,_,c=-1,h=0;for(;h<s.length&&(i.lastIndex=h,_=i.exec(s),_!==null);)h=i.lastIndex,i===T?_[1]==="!--"?i=_e:_[1]!==void 0?i=ue:_[2]!==void 0?(ye.test(_[2])&&(a=RegExp("</"+_[2],"g")),i=b):_[3]!==void 0&&(i=b):i===b?_[0]===">"?(i=a??T,c=-1):_[1]===void 0?c=-2:(c=i.lastIndex-_[2].length,d=_[1],i=_[3]===void 0?b:_[3]==='"'?ge:he):i===ge||i===he?i=b:i===_e||i===ue?i=T:(i=b,a=void 0);let m=i===b&&o[l+1].startsWith("/>")?" ":"";n+=i===T?s+Ue:c>=0?(r.push(d),s.slice(0,c)+fe+s.slice(c)+f+m):s+f+(c===-2?l:m)}return[ve(o,n+(o[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},P=class o{constructor({strings:e,_$litType$:t},r){let a;this.parts=[];let n=0,i=0,l=e.length-1,s=this.parts,[d,_]=Ie(e,t);if(this.el=o.createElement(d,r),y.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(a=y.nextNode())!==null&&s.length<l;){if(a.nodeType===1){if(a.hasAttributes())for(let c of a.getAttributeNames())if(c.endsWith(fe)){let h=_[i++],m=a.getAttribute(c).split(f),z=/([.?@])?(.*)/.exec(h);s.push({type:1,index:n,name:z[2],strings:m,ctor:z[1]==="."?Q:z[1]==="?"?Y:z[1]==="@"?J:S}),a.removeAttribute(c)}else c.startsWith(f)&&(s.push({type:6,index:n}),a.removeAttribute(c));if(ye.test(a.tagName)){let c=a.textContent.split(f),h=c.length-1;if(h>0){a.textContent=H?H.emptyScript:"";for(let m=0;m<h;m++)a.append(c[m],j()),y.nextNode(),s.push({type:2,index:++n});a.append(c[h],j())}}}else if(a.nodeType===8)if(a.data===be)s.push({type:2,index:n});else{let c=-1;for(;(c=a.data.indexOf(f,c+1))!==-1;)s.push({type:7,index:n}),c+=f.length-1}n++}}static createElement(e,t){let r=v.createElement("template");return r.innerHTML=e,r}};function k(o,e,t=o,r){if(e===w)return e;let a=r!==void 0?t._$Co?.[r]:t._$Cl,n=N(e)?void 0:e._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),n===void 0?a=void 0:(a=new n(o),a._$AT(o,t,r)),r!==void 0?(t._$Co??=[])[r]=a:t._$Cl=a),a!==void 0&&(e=k(o,a._$AS(o,e.values),a,r)),e}var K=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,a=(e?.creationScope??v).importNode(t,!0);y.currentNode=a;let n=y.nextNode(),i=0,l=0,s=r[0];for(;s!==void 0;){if(i===s.index){let d;s.type===2?d=new R(n,n.nextSibling,this,e):s.type===1?d=new s.ctor(n,s.name,s.strings,this,e):s.type===6&&(d=new Z(n,this,e)),this._$AV.push(d),s=r[++l]}i!==s?.index&&(n=y.nextNode(),i++)}return y.currentNode=v,a}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},R=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,a){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=k(this,e,t),N(e)?e===p||e==null||e===""?(this._$AH!==p&&this._$AR(),this._$AH=p):e!==this._$AH&&e!==w&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):qe(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==p&&N(this._$AH)?this._$AA.nextSibling.data=e:this.T(v.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,a=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=P.createElement(ve(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===a)this._$AH.p(t);else{let n=new K(a,this),i=n.u(this.options);n.p(t),this.T(i),this._$AH=n}}_$AC(e){let t=me.get(e.strings);return t===void 0&&me.set(e.strings,t=new P(e)),t}k(e){ee(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,a=0;for(let n of e)a===t.length?t.push(r=new o(this.O(j()),this.O(j()),this,this.options)):r=t[a],r._$AI(n),a++;a<t.length&&(this._$AR(r&&r._$AB.nextSibling,a),t.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=de(e).nextSibling;de(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},S=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,a,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=a,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):thisLine truncated
|
||||
Replace seal
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",notes_markdown_hint:"Markdown is supported \u2014 **bold**, lists, [links](\u2026)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",completed_at_optional:"Completed at (optional, empty = now)",completed_at_future_error:"The completion date cannot be in the future.",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",all_priorities:"All priorities",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",all_parts:"All parts",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",trigger_equals:"Trigger when equal to (=)",trigger_not_equals:"Trigger when different from (\u2260)",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",trigger_combinator:"Combine trigger and interval",trigger_combinator_any:"Trigger or interval (whichever first)",trigger_combinator_all:"Trigger and interval (both required)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",adaptive_prediction_enabled:"Enable sensor-driven predictions",adaptive_seasonal_enabled:"Enable seasonal awareness",adaptive_max_interval:"Maximum interval (days)",adaptive_min_interval:"Minimum interval (days)",adaptive_ewa_alpha:"Learning rate (alpha)",adaptive_enabled:"Enable adaptive scheduling",adaptive_section_title:"Adaptive Scheduling",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",ro
Line truncated
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",notes_markdown_hint:"Markdown is supported \u2014 **bold**, lists, [links](\u2026)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",completed_at_optional:"Completed at (optional, empty = now)",completed_at_future_error:"The completion date cannot be in the future.",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",all_priorities:"All priorities",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",all_parts:"All parts",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",trigger_equals:"Trigger when equal to (=)",trigger_not_equals:"Trigger when different from (\u2260)",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",trigger_combinator:"Combine trigger and interval",trigger_combinator_any:"Trigger or interval (whichever first)",trigger_combinator_all:"Trigger and interval (both required)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",adaptive_prediction_enabled:"Enable sensor-driven predictions",adaptive_seasonal_enabled:"Enable seasonal awareness",adaptive_max_interval:"Maximum interval (days)",adaptive_min_interval:"Minimum interval (days)",adaptive_ewa_alpha:"Learning rate (alpha)",adaptive_enabled:"Enable adaptive scheduling",adaptive_section_title:"Adaptive Scheduling",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",ro
Line truncated
|
||||
.field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.field-label { font-size: 12px; color: var(--secondary-text-color); }
|
||||
.field-input {
|
||||
@@ -531,8 +531,15 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
/* #150 follow-up (2026-08-31, maisun's mobile screenshot): the box used
|
||||
to carry min-width: 90px — in the narrow grid the due column is
|
||||
fit-content(100px) and right-aligned, so on cells narrower than 90px
|
||||
the box overhung LEFT across the object name. It now tracks the cell
|
||||
with no floor, and the label ellipsizes inside. */
|
||||
align-self: stretch;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
min-width: 90px;
|
||||
}
|
||||
|
||||
.trigger-progress-bar {
|
||||
@@ -553,8 +560,25 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color);
|
||||
text-align: right;
|
||||
max-width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* #150 follow-up: 3-state trend arrow — replaces the sparkline on
|
||||
narrow/tight rows (panel-styles toggles visibility per regime). */
|
||||
.trend-arrow {
|
||||
display: none;
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
margin-left: 2px;
|
||||
}
|
||||
.trend-approaching { color: var(--warning-color, #ff9800); }
|
||||
.trend-stable { color: var(--secondary-text-color); }
|
||||
.trend-easing { color: var(--success-color, #4caf50); }
|
||||
|
||||
|
||||
/* Days progress bar (detail view) */
|
||||
.days-progress {
|
||||
margin: 8px 0 16px;
|
||||
@@ -597,6 +621,11 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
/* Mini-sparkline in overview rows */
|
||||
.mini-sparkline {
|
||||
width: 60px;
|
||||
/* Same class of bug as the trigger-progress floor (#150 follow-up): in
|
||||
due cells narrower than the fixed width the right-aligned SVG used to
|
||||
overhang LEFT (phone-360 sweep). preserveAspectRatio="none" lets it
|
||||
just squeeze. */
|
||||
max-width: 100%;
|
||||
height: 20px;
|
||||
display: block;
|
||||
margin-top: 2px;
|
||||
@@ -1149,7 +1178,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; }
|
||||
.stat-value { font-size: 20px; }
|
||||
}
|
||||
`;var Ze={entry_id:"object",name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_equals:"trigger_equals",trigger_not_equals:"trigger_not_equals",trigger_for_minutes:"trigger_for_minutes"};function Xe(o,e){let t=Ze[o];if(!t)return o;let r=u(t,e);return r&&r!==t?r:o}function et(o){let t=o.match(/data\['([^']+)'\]/)?.[1],r;return(r=o.match(/length of value must be at most (\d+)/))?{field:t,rule:"too_long",param:r[1]}:(r=o.match(/length of value must be at least (\d+)/))?{field:t,rule:"too_short",param:r[1]}:(r=o.match(/value must be at most (\S+)/))?{field:t,rule:"value_too_high",param:r[1]}:(r=o.match(/value must be at least (\S+)/))?{field:t,rule:"value_too_low",param:r[1]}:/required key not provided/.test(o)?{field:t,rule:"required"}:(r=o.match(/expected (\w+)/))?{field:t,rule:"wrong_type",param:r[1]}:/value must be one of/.test(o)?{field:t,rule:"invalid_choice"}:/not a valid value/.test(o)?{field:t,rule:"invalid_value"}:{field:t,rule:"unknown"}}function ho(o,e,t){if(t=t??u("action_error",e),typeof o=="string")return o;if(typeof o!="object"||o===null)return t;let r=o,a=r.message||r.error?.message||"";if(!a)return t;let n=et(a),i=n.field?Xe(n.field,e):"",l=s=>u(s,e).replace("{field}",i).replace("{n}",n.param??"");switch(n.rule){case"too_long":return l("err_too_long");case"too_short":return l("err_too_short");case"value_too_high":return l("err_value_too_high");case"value_too_low":return l("err_value_too_low");case"required":return l("err_required");case"wrong_type":return l("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return l("err_invalid_choice");case"invalid_value":return l("err_invalid_value");default:return a||t}}export{U as a,nt as b,it as c,p as d,A as e,we as f,kt as g,to as h,u as i,oo as j,ro as k,ao as l,Ae as m,no as n,$e as o,Ee as p,io as q,so as r,lo as s,co as t,ho as u};
|
||||
`;var Ze={entry_id:"object",name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_equals:"trigger_equals",trigger_not_equals:"trigger_not_equals",trigger_for_minutes:"trigger_for_minutes"};function Xe(o,e){let t=Ze[o];if(!t)return o;let r=u(t,e);return r&&r!==t?r:o}function et(o){let t=o.match(/data\['([^']+)'\]/)?.[1],r;return(r=o.match(/length of value must be at most (\d+)/))?{field:t,rule:"too_long",param:r[1]}:(r=o.match(/length of value must be at least (\d+)/))?{field:t,rule:"too_short",param:r[1]}:(r=o.match(/value must be at most (\S+)/))?{field:t,rule:"value_too_high",param:r[1]}:(r=o.match(/value must be at least (\S+)/))?{field:t,rule:"value_too_low",param:r[1]}:/required key not provided/.test(o)?{field:t,rule:"required"}:(r=o.match(/expected (\w+)/))?{field:t,rule:"wrong_type",param:r[1]}:/value must be one of/.test(o)?{field:t,rule:"invalid_choice"}:/not a valid value/.test(o)?{field:t,rule:"invalid_value"}:{field:t,rule:"unknown"}}function ho(o,e,t){if(t=t??u("action_error",e),typeof o=="string")return o;if(typeof o!="object"||o===null)return t;let r=o,a=r.message||r.error?.message||"";if(!a)return t;let n=et(a),i=n.field?Xe(n.field,e):"",l=s=>u(s,e).replace("{field}",i).replace("{n}",n.param??"");switch(n.rule){case"too_long":return l("err_too_long");case"too_short":return l("err_too_short");case"value_too_high":return l("err_value_too_high");case"value_too_low":return l("err_value_too_low");case"required":return l("err_required");case"wrong_type":return l("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return l("err_invalid_choice");case"invalid_value":return l("err_invalid_value");default:return a||t}}export{U as a,nt as b,it as c,p as d,A as e,xe as f,kt as g,to as h,u as i,oo as j,ro as k,ao as l,Ae as m,no as n,$e as o,Ee as p,io as q,so as r,lo as s,co as t,ho as u};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
+60
-41
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.70.0 */
|
||||
import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l as ct,m as V,n as pt,o as ht,p as tt,q as ut,r as _t,s as mt,t as gt,u as T}from"./chunk-JMXXW5KM.js";import{a as o,b as Z}from"./chunk-CAQJ66HF.js";var w=class extends I{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1;this.multiline=!1;this.rows=3}_onInput(t){let i=t.target.value;this.value=i,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:i}}))}render(){return a`
|
||||
/*! maintenance_supporter frontend 2.71.0 */
|
||||
import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as T,k as dt,l as ct,m as V,n as pt,o as ht,p as tt,q as ut,r as _t,s as mt,t as gt,u as S}from"./chunk-MKETKKBB.js";import{a as o,b as Z}from"./chunk-DEN57ILL.js";var w=class extends I{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1;this.multiline=!1;this.rows=3}_onInput(t){let i=t.target.value;this.value=i,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:i}}))}render(){return a`
|
||||
<label class="field">
|
||||
${this.label?a`<span class="label">${this.label}${this.required?a`<span class="req">*</span>`:_}</span>`:_}
|
||||
${this.multiline?a`
|
||||
@@ -76,7 +76,7 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
color: var(--secondary-text-color);
|
||||
font-style: italic;
|
||||
}
|
||||
`,o([v()],w.prototype,"label",2),o([v()],w.prototype,"value",2),o([v()],w.prototype,"placeholder",2),o([v()],w.prototype,"type",2),o([v({type:Boolean})],w.prototype,"required",2),o([v({type:Boolean})],w.prototype,"disabled",2),o([v()],w.prototype,"step",2),o([v()],w.prototype,"min",2),o([v()],w.prototype,"max",2),o([v()],w.prototype,"pattern",2),o([v()],w.prototype,"helper",2),o([v({type:Boolean})],w.prototype,"multiline",2),o([v({type:Number})],w.prototype,"rows",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",w);var x=class extends I{constructor(){super(...arguments);this.objects=[];this._open=!1;this._loading=!1;this._error="";this._name="";this._manufacturer="";this._model="";this._serialNumber="";this._areaId="";this._installationDate="";this._warrantyExpiry="";this._documentationUrl="";this._notes="";this._haDeviceId="";this._parentEntryId="";this._entryId=null}get _lang(){return S(this.hass)}openCreate(){this._entryId=null,this._name="",this._manufacturer="",this._model="",this._serialNumber="",this._areaId="",this._installationDate="",this._warrantyExpiry="",this._documentationUrl="",this._notes="",this._haDeviceId="",this._parentEntryId="",this._error="",this._open=!0}openEdit(t,i){this._entryId=t,this._name=i.name||"",this._manufacturer=i.manufacturer||"",this._model=i.model||"",this._serialNumber=i.serial_number||"",this._areaId=i.area_id||"",this._installationDate=i.installation_date||"",this._warrantyExpiry=i.warranty_expiry||"",this._documentationUrl=i.documentation_url||"",this._notes=i.notes||"",this._haDeviceId=i.ha_device_id||"",this._parentEntryId=i.parent_entry_id||"",this._error="",this._open=!0}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{this._entryId?await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/update",entry_id:this._entryId,name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}):await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/create",name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}),this._open=!1,this.dispatchEvent(new CustomEvent("object-saved"))}catch(t){this._error=T(t,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(t=>t.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return a``;let t=this._lang,i=this._entryId?s("edit_object",t):s("new_object",t);return a`
|
||||
`,o([v()],w.prototype,"label",2),o([v()],w.prototype,"value",2),o([v()],w.prototype,"placeholder",2),o([v()],w.prototype,"type",2),o([v({type:Boolean})],w.prototype,"required",2),o([v({type:Boolean})],w.prototype,"disabled",2),o([v()],w.prototype,"step",2),o([v()],w.prototype,"min",2),o([v()],w.prototype,"max",2),o([v()],w.prototype,"pattern",2),o([v()],w.prototype,"helper",2),o([v({type:Boolean})],w.prototype,"multiline",2),o([v({type:Number})],w.prototype,"rows",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",w);var $=class extends I{constructor(){super(...arguments);this.objects=[];this._open=!1;this._loading=!1;this._error="";this._name="";this._manufacturer="";this._model="";this._serialNumber="";this._areaId="";this._installationDate="";this._warrantyExpiry="";this._documentationUrl="";this._notes="";this._haDeviceId="";this._parentEntryId="";this._entryId=null}get _lang(){return T(this.hass)}openCreate(){this._entryId=null,this._name="",this._manufacturer="",this._model="",this._serialNumber="",this._areaId="",this._installationDate="",this._warrantyExpiry="",this._documentationUrl="",this._notes="",this._haDeviceId="",this._parentEntryId="",this._error="",this._open=!0}openEdit(t,i){this._entryId=t,this._name=i.name||"",this._manufacturer=i.manufacturer||"",this._model=i.model||"",this._serialNumber=i.serial_number||"",this._areaId=i.area_id||"",this._installationDate=i.installation_date||"",this._warrantyExpiry=i.warranty_expiry||"",this._documentationUrl=i.documentation_url||"",this._notes=i.notes||"",this._haDeviceId=i.ha_device_id||"",this._parentEntryId=i.parent_entry_id||"",this._error="",this._open=!0}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{this._entryId?await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/update",entry_id:this._entryId,name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}):await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/create",name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}),this._open=!1,this.dispatchEvent(new CustomEvent("object-saved"))}catch(t){this._error=S(t,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(t=>t.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return a``;let t=this._lang,i=this._entryId?s("edit_object",t):s("new_object",t);return a`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${i}</div>
|
||||
<div class="content">
|
||||
@@ -171,7 +171,7 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};x.styles=E`
|
||||
`}};$.styles=E`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -221,9 +221,9 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
color: var(--error-color, #f44336);
|
||||
font-size: 13px;
|
||||
}
|
||||
`,o([v({attribute:!1})],x.prototype,"hass",2),o([v({attribute:!1})],x.prototype,"objects",2),o([d()],x.prototype,"_open",2),o([d()],x.prototype,"_loading",2),o([d()],x.prototype,"_error",2),o([d()],x.prototype,"_name",2),o([d()],x.prototype,"_manufacturer",2),o([d()],x.prototype,"_model",2),o([d()],x.prototype,"_serialNumber",2),o([d()],x.prototype,"_areaId",2),o([d()],x.prototype,"_installationDate",2),o([d()],x.prototype,"_warrantyExpiry",2),o([d()],x.prototype,"_documentationUrl",2),o([d()],x.prototype,"_notes",2),o([d()],x.prototype,"_haDeviceId",2),o([d()],x.prototype,"_parentEntryId",2),o([d()],x.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",x);var J=class{constructor(l){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=l}updateHass(l){this.hass=l}async getUsers(l=!1){let t=Date.now();if(!l&&this.usersCache&&t-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=i.users,this.cacheTimestamp=t,this.usersCache}catch(i){return console.error("Failed to fetch users:",i),this.usersCache||[]}}async assignUser(l,t,i){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:l,task_id:t,user_id:i})}async getTasksByUser(l){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:l})).tasks}getUserName(l){return!l||!this.usersCache?null:this.usersCache.find(i=>i.id===l)?.name||null}getUser(l){return!l||!this.usersCache?null:this.usersCache.find(t=>t.id===l)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(l){return l?l===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}};function N(r){return`${r.entry_id??""}\0${r.part_id}`}function vt(r,l,t,i){let e=!!r.entry_id&&r.entry_id!==l,n=e?r.entry_id:l,c=t.find(g=>g.entry_id===n),p=(c?.parts||[]).find(g=>g.id===r.part_id)||null,u=e&&c?.object?.name||"",h=p?.name||s("shared_part_unknown",i);return{part:p,foreign:e,ownerName:u,label:u?`${h} (${u})`:h}}function ft(r,l,t,i){let{part:e,label:n}=vt(r,l,t,i),c=e&&e.stock!==null&&e.stock!==void 0?` (${e.stock}${e.unit?" "+e.unit:""})`:"",p=e?.storage_location?` \u2014 ${e.storage_location}`:"";return`${r.quantity}\xD7 ${n}${c}${p}`}function yt(r,l,t,i){let n=(t.find(p=>p.entry_id===l)?.parts||[]).map(p=>({...p})),c=new Set(n.map(p=>N({part_id:p.id})));for(let p of r?.consumes_parts||[]){if(!p.entry_id||p.entry_id===l)continue;let u=N(p);if(c.has(u))continue;c.add(u);let{part:h,ownerName:g}=vt(p,l,t,i);n.push({id:p.part_id,name:h?.name||s("shared_part_unknown",i),unit:h?.unit,stock:h?.stock??null,storage_location:h?.storage_location,entry_id:p.entry_id,owner_name:g})}return n}var et=["sensor","binary_sensor","number","input_number","input_boolean","switch","climate","vacuum","cover","fan","light","water_heater","humidifier","media_player","weather","air_quality","valve","lawn_mower","lock"],bt=["sensor"],$t=["temperature","humidity","pressure"];var it=["notes","cost","duration","photo","user"],Q={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"};var Ut=["cleaning","inspection","replacement","calibration","service","reading","custom"],Vt=["low","normal","high"],Bt=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],st=["weekdays","nth_weekday","day_of_month"],xt=["threshold","counter","state_change","runtime"],Wt=[...xt,"compound"],O={alpha:"0.3",min:"7",max:"365"};function Kt(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}var Qt=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_equals","trigger_not_equals","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states"]);function Yt(r){return{entityIds:(r.entity_ids||(r.entity_id?[r.entity_id]:[])).join(", "),type:r.type||"threshold",attribute:r.attribute||"",above:r.trigger_above?.toString()??"",below:r.trigger_below?.toString()??"",equals:r.trigger_equals?.toString()??"",notEquals:r.trigger_not_equals?.toString()??"",forMinutes:r.trigger_for_minutes?.toString()??"0",targetValue:r.trigger_target_value?.toString()??"",deltaMode:r.trigger_delta_mode||!1,fromState:r.trigger_from_state||"",toState:r.trigger_to_state||"",targetChanges:r.trigger_target_changes?.toString()??"",runtimeHours:r.trigger_runtime_hours?.toString()??"",onStates:(r.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(r).filter(([t])=>!Qt.has(t)&&!t.startsWith("_")))}}function Gt(r){let l=r.entityIds.split(",").map(i=>i
Line truncated
|
||||
`),this._phaseDefs=Object.entries(i.phases||{}).map(([h,g])=>{let{name:$,checklist:y,consumes_parts:b,required_completion_fields:C,...P}=g,z=g.consumes_parts||[],U=z.findIndex(F=>!F.entry_id),H=U>=0?z[U]:void 0;return{id:h,name:g.name||h,checklistText:(g.checklist||[]).join(`
|
||||
`),partId:H?.part_id||"",partQty:H?.quantity!=null?String(H.quantity):"",reqOverride:g.required_completion_fields!==void 0,reqFields:[...g.required_completion_fields||[]],extraParts:z.filter((F,B)=>B!==U).map(F=>({...F})),carry:P}}),this._phaseSeq=[...i.phase_sequence||[]],this._requiredCompletion=[...i.required_completion_fields||[]],this._scheduleTime=i.schedule_time||"";let c=i.on_complete_action;if(c&&c.service){this._actionService=c.service;let h=c.target?.entity_id;this._actionTargetEntity=Array.isArray(h)?h[0]||"":h||"",this._actionData=c.data&&typeof c.data=="object"?{...c.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let p=i.quick_complete_defaults;this._qcNotes=p?.notes||"",this._qcCost=p?.cost!=null?String(p.cost):"",this._qcDuration=p?.duration!=null?String(p.duration):"",this._qcFeedback=p?.feedback||"";let u=i.adaptive_config||{};if(this._environmentalEntity=u.environmental_entity||"",this._environmentalAttribute=u.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!u.enabled,this._adaptiveAlpha=u.ewa_alpha?.toString()??O.alpha,this._adaptiveMin=u.min_interval_days?.toString()??O.min,this._adaptiveMax=u.max_interval_days?.toString()??O.max,this._adaptiveSeasonal=u.seasonal_enabled!==!1,this._adaptivePrediction=u.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),i.trigger_config){let h=i.trigger_config;this._triggerEntityId=h.entity_id||h.entity_ids&&h.entity_ids[0]||"",this._triggerEntityIds=h.entity_ids||(h.entity_id?[h.entity_id]:[]),this._triggerEntityLogic=h.entity_logic||"any",this._triggerAttribute=h.attribute||"",this._triggerType=h.type||"threshold",this._triggerAbove=h.trigger_above?.toString()||"",this._triggerBelow=h.trigger_below?.toString()||"",this._triggerEquals=h.trigger_equals?.toString()||"",this._triggerNotEquals=h.trigger_not_equals?.toString()||"",this._triggerForMinutes=h.trigger_for_minutes?.toString()||"0",this._triggerCombinator=h.trigger_combinator==="all"?"all":"any",this._triggerTargetValue=h.trigger_target_value?.toString()||"",this._triggerDeltaMode=h.trigger_delta_mode||!1,this._triggerBaselineValue=h.trigger_baseline_value?.toString()||"",this._liveBaselineValue=i.trigger_baseline_value??null,this._autoCompleteOnRecovery=h.auto_complete_on_recovery||!1,this._triggerFromState=h.trigger_from_state||"",this._triggerToState=h.trigger_to_state||"",this._triggerTargetChanges=h.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=h.trigger_runtime_hours?.toString()||"",this._triggerOnStates=(h.trigger_on_states||[]).join(", "),h.type==="compound"?(this._compoundLogic=h.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(h.conditions||[]).map(Yt)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._requireTagScan=!1,this._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._phaseDefs=[],this._phaseSeq=[],this._requiredCompletion=[],this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=O.alpha,this._adaptiveMin=O.min,this._adaptiveMax=O.max,this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this._triggerAbove="",this._triggerBelow="",this._triggerEquals="",this._triggerNotEquals="",this._triggerFo
Line truncated
|
||||
`,o([v({attribute:!1})],$.prototype,"hass",2),o([v({attribute:!1})],$.prototype,"objects",2),o([d()],$.prototype,"_open",2),o([d()],$.prototype,"_loading",2),o([d()],$.prototype,"_error",2),o([d()],$.prototype,"_name",2),o([d()],$.prototype,"_manufacturer",2),o([d()],$.prototype,"_model",2),o([d()],$.prototype,"_serialNumber",2),o([d()],$.prototype,"_areaId",2),o([d()],$.prototype,"_installationDate",2),o([d()],$.prototype,"_warrantyExpiry",2),o([d()],$.prototype,"_documentationUrl",2),o([d()],$.prototype,"_notes",2),o([d()],$.prototype,"_haDeviceId",2),o([d()],$.prototype,"_parentEntryId",2),o([d()],$.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",$);var J=class{constructor(l){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=l}updateHass(l){this.hass=l}async getUsers(l=!1){let t=Date.now();if(!l&&this.usersCache&&t-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=i.users,this.cacheTimestamp=t,this.usersCache}catch(i){return console.error("Failed to fetch users:",i),this.usersCache||[]}}async assignUser(l,t,i){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:l,task_id:t,user_id:i})}async getTasksByUser(l){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:l})).tasks}getUserName(l){return!l||!this.usersCache?null:this.usersCache.find(i=>i.id===l)?.name||null}getUser(l){return!l||!this.usersCache?null:this.usersCache.find(t=>t.id===l)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(l){return l?l===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}};function N(r){return`${r.entry_id??""}\0${r.part_id}`}function vt(r,l,t,i){let e=!!r.entry_id&&r.entry_id!==l,n=e?r.entry_id:l,c=t.find(g=>g.entry_id===n),p=(c?.parts||[]).find(g=>g.id===r.part_id)||null,u=e&&c?.object?.name||"",h=p?.name||s("shared_part_unknown",i);return{part:p,foreign:e,ownerName:u,label:u?`${h} (${u})`:h}}function ft(r,l,t,i){let{part:e,label:n}=vt(r,l,t,i),c=e&&e.stock!==null&&e.stock!==void 0?` (${e.stock}${e.unit?" "+e.unit:""})`:"",p=e?.storage_location?` \u2014 ${e.storage_location}`:"";return`${r.quantity}\xD7 ${n}${c}${p}`}function yt(r,l,t,i){let n=(t.find(p=>p.entry_id===l)?.parts||[]).map(p=>({...p})),c=new Set(n.map(p=>N({part_id:p.id})));for(let p of r?.consumes_parts||[]){if(!p.entry_id||p.entry_id===l)continue;let u=N(p);if(c.has(u))continue;c.add(u);let{part:h,ownerName:g}=vt(p,l,t,i);n.push({id:p.part_id,name:h?.name||s("shared_part_unknown",i),unit:h?.unit,stock:h?.stock??null,storage_location:h?.storage_location,entry_id:p.entry_id,owner_name:g})}return n}var et=["sensor","binary_sensor","number","input_number","input_boolean","switch","climate","vacuum","cover","fan","light","water_heater","humidifier","media_player","weather","air_quality","valve","lawn_mower","lock"],bt=["sensor"],xt=["temperature","humidity","pressure"];var it=["notes","cost","duration","photo","user"],Q={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"};var Ut=["cleaning","inspection","replacement","calibration","service","reading","custom"],Vt=["low","normal","high"],Bt=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],st=["weekdays","nth_weekday","day_of_month"],$t=["threshold","counter","state_change","runtime"],Wt=[...$t,"compound"],O={alpha:"0.3",min:"7",max:"365"};function Kt(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}var Qt=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_equals","trigger_not_equals","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states"]);function Yt(r){return{entityIds:(r.entity_ids||(r.entity_id?[r.entity_id]:[])).join(", "),type:r.type||"threshold",attribute:r.attribute||"",above:r.trigger_above?.toString()??"",below:r.trigger_below?.toString()??"",equals:r.trigger_equals?.toString()??"",notEquals:r.trigger_not_equals?.toString()??"",forMinutes:r.trigger_for_minutes?.toString()??"0",targetValue:r.trigger_target_value?.toString()??"",deltaMode:r.trigger_delta_mode||!1,fromState:r.trigger_from_state||"",toState:r.trigger_to_state||"",targetChanges:r.trigger_target_changes?.toString()??"",runtimeHours:r.trigger_runtime_hours?.toString()??"",onStates:(r.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(r).filter(([t])=>!Qt.has(t)&&!t.startsWith("_")))}}function Gt(r){let l=r.entityIds.split(",").map(i=>i
Line truncated
|
||||
`),this._phaseDefs=Object.entries(i.phases||{}).map(([h,g])=>{let{name:x,checklist:y,consumes_parts:b,required_completion_fields:C,...L}=g,z=g.consumes_parts||[],U=z.findIndex(F=>!F.entry_id),H=U>=0?z[U]:void 0;return{id:h,name:g.name||h,checklistText:(g.checklist||[]).join(`
|
||||
`),partId:H?.part_id||"",partQty:H?.quantity!=null?String(H.quantity):"",reqOverride:g.required_completion_fields!==void 0,reqFields:[...g.required_completion_fields||[]],extraParts:z.filter((F,B)=>B!==U).map(F=>({...F})),carry:L}}),this._phaseSeq=[...i.phase_sequence||[]],this._requiredCompletion=[...i.required_completion_fields||[]],this._scheduleTime=i.schedule_time||"";let c=i.on_complete_action;if(c&&c.service){this._actionService=c.service;let h=c.target?.entity_id;this._actionTargetEntity=Array.isArray(h)?h[0]||"":h||"",this._actionData=c.data&&typeof c.data=="object"?{...c.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let p=i.quick_complete_defaults;this._qcNotes=p?.notes||"",this._qcCost=p?.cost!=null?String(p.cost):"",this._qcDuration=p?.duration!=null?String(p.duration):"",this._qcFeedback=p?.feedback||"";let u=i.adaptive_config||{};if(this._environmentalEntity=u.environmental_entity||"",this._environmentalAttribute=u.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!u.enabled,this._adaptiveAlpha=u.ewa_alpha?.toString()??O.alpha,this._adaptiveMin=u.min_interval_days?.toString()??O.min,this._adaptiveMax=u.max_interval_days?.toString()??O.max,this._adaptiveSeasonal=u.seasonal_enabled!==!1,this._adaptivePrediction=u.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),i.trigger_config){let h=i.trigger_config;this._triggerEntityId=h.entity_id||h.entity_ids&&h.entity_ids[0]||"",this._triggerEntityIds=h.entity_ids||(h.entity_id?[h.entity_id]:[]),this._triggerEntityLogic=h.entity_logic||"any",this._triggerAttribute=h.attribute||"",this._triggerType=h.type||"threshold",this._triggerAbove=h.trigger_above?.toString()||"",this._triggerBelow=h.trigger_below?.toString()||"",this._triggerEquals=h.trigger_equals?.toString()||"",this._triggerNotEquals=h.trigger_not_equals?.toString()||"",this._triggerForMinutes=h.trigger_for_minutes?.toString()||"0",this._triggerCombinator=h.trigger_combinator==="all"?"all":"any",this._triggerTargetValue=h.trigger_target_value?.toString()||"",this._triggerDeltaMode=h.trigger_delta_mode||!1,this._triggerBaselineValue=h.trigger_baseline_value?.toString()||"",this._liveBaselineValue=i.trigger_baseline_value??null,this._autoCompleteOnRecovery=h.auto_complete_on_recovery||!1,this._triggerFromState=h.trigger_from_state||"",this._triggerToState=h.trigger_to_state||"",this._triggerTargetChanges=h.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=h.trigger_runtime_hours?.toString()||"",this._triggerRuntimeMaxSession=h.trigger_runtime_max_session_seconds?.toString()||"",this._triggerOnStates=(h.trigger_on_states||[]).join(", "),h.type==="compound"?(this._compoundLogic=h.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(h.conditions||[]).map(Yt)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._requireTagScan=!1,this._allowSkip=!0,this._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._phaseDefs=[],this._phaseSeq=[],this._requiredCompletion=[],this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=O.alpha,this._adaptiveMin=O.min,this._adaptiveMax=O.max,this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this
Line truncated
|
||||
<details class="ca-section">
|
||||
<summary>${s("on_complete_action_title",t)}</summary>
|
||||
<p class="field-help">${s("on_complete_action_desc",t)}</p>
|
||||
@@ -403,9 +403,9 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
</select>
|
||||
</div>
|
||||
`:_}
|
||||
`}async _save(){if(!this._loading&&this._name.trim()){if(this._adaptiveSnapshot()!==this._adaptiveInitial){let t=parseInt(this._adaptiveMin,10),i=parseInt(this._adaptiveMax,10);if(!isNaN(t)&&!isNaN(i)&&t>i){this._error=`${s("adaptive_min_interval",this._lang)} > ${s("adaptive_max_interval",this._lang)}`;return}}this._loading=!0,this._error="";try{let t={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:Number.isNaN(parseInt(this._warningDays,10))?this.defaultWarningDays:Math.max(0,parseInt(this._warningDays,10))},i=this._earliestCompletionDays.trim();t.earliest_completion_days=i===""?null:Math.max(0,parseInt(i,10)||0),this._taskId&&(t.task_id=this._taskId),this._scheduleType==="one_time"?(t.due_date=this._dueDate||null,t.interval_days=null):st.includes(this._scheduleType)?(t.schedule={...this._buildSchedule(),...this._recurrenceExtras()},t.interval_days=null,this._taskId&&(t.due_date=null)):(this._taskId&&(t.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(t.interval_days=parseInt(this._intervalDays,10),t.interval_unit=this._intervalUnit,t.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(t.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(t.interval_days=null,t.interval_anchor="completion")),t.notes=this._notes||null,t.documentation_url=this._documentationUrl||null,t.custom_icon=this._customIcon||null,t.priority=this._priority,t.labels=this._labels.split(",").map(p=>p.trim()).filter(Boolean),t.enabled=this._enabled,t.last_performed=this._lastPerformed||null,t.nfc_tag_id=this._nfcTagId||null,t.require_tag_scan=this._requireTagScan,t.reading_unit=this._readingUnit.trim()||null;{let p={};for(let h of this._phaseDefs){if(!h.name.trim())continue;let g={...h.carry,name:h.name.trim()},$=h.checklistText.split(`
|
||||
`).map(b=>b.trim()).filter(Boolean);$.length&&(g.checklist=$);let y=[];if(h.partId){let b=parseFloat(h.partQty);y.push({part_id:h.partId,quantity:Number.isFinite(b)&&b>0?b:1})}for(let b of h.extraParts)y.push(b.entry_id?{part_id:b.part_id,quantity:b.quantity,entry_id:b.entry_id}:{part_id:b.part_id,quantity:b.quantity});y.length&&(g.consumes_parts=y),h.reqOverride&&(g.required_completion_fields=[...h.reqFields]),p[h.id]=g}let u=this._phaseSeq.filter(h=>h in p);t.phases=Object.keys(p).length&&u.length?p:null,t.phase_sequence=t.phases?u:null}if((this.parts.length||this._foreignOwners.length)&&(t.consumes_parts=Object.values(this._consumesParts).map(p=>p.entry_id?{part_id:p.part_id,quantity:p.quantity,entry_id:p.entry_id}:{part_id:p.part_id,quantity:p.quantity})),t.responsible_user_id=this._responsibleUserId,t.assignee_pool=this._assigneePool,t.required_completion_fields=this._requiredCompletion,t.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let p=this._compoundConditions.map(Gt).filter(u=>u!==null);if(p.length>0){let u={type:"compound",compound_logic:this._compoundLogic,conditions:p};this._autoCompleteOnRecovery&&(u.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(u.trigger_combinator="all"),t.trigger_config=u}else this._taskId&&(t.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let p=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],u={entity_id:p[0],entity_ids:p,type:this._triggerType};if(this._triggerAttribute&&(u.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(u.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(u.trigger_combinator="all"),p.length>1&&(u.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let h=parseFloat(this._triggerAbove);isNaN(h)||(u.trigger_above=h)}if(this._triggerBelow){let h=parseFloat(this._triggerBelow);isNaN(h)||(u.trigger_below=h)}if(this._triggerEquals){let h=parseFloat(this._triggerEquals);isNaN(h)||(u.trigger_equals=h)}if(this._triggerNotEquals){let h=parseFloat(this._triggerNotEquals);isNaN(h)||(u.trigger_not_equals=h)}if(this._triggerForMinutes){let h=parseInt(this._triggerForMinutes,10);isNaN(h)||(u.trigger_for_minutes=h)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let h=parseFloat(this._triggerTargetValue);isNaN(h)||(u.trigger_target_value=h)}if(u.trigger_delta_mode=this._triggerDeltaMode,this._triggerDeltaMode&&this._triggerBaselineValue){let h=parseFloat(this._triggerBaselineValue);!isNaN(h)&&h>=0&&(u.trigger_baseline_value=h)}}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(u.trigger_from_state=this._triggerFromState),this._triggerToState&&(u.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let h=parseInt(this._triggerTargetChanges,10);isNaN(h)||(u.trigger_target_changes=h)}if(this._triggerForMinutes){let h=parseInt(this._triggerForMinutes,10);isNaN(h)||(u.trigger_for_minutes=h)}}else if(this._triggerType==="runtime"){if(this._triggerRuntimeHours){let g=parseFloat(this._triggerRuntimeHours);isNaN(g)||(u.trigger_runtime_hours=g)}let h=this._triggerOnStates.split(",").map(g=>g.trim()).filter(Boolean);h.length>0&&(u.trigger_on_states=h)}t.trigger_config=u}else this._taskId&&(t.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let p=this._scheduleTime.trim();t.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(p)?p:null}if(this.checklistsEnabled){let p=this._checklistText.split(`
|
||||
`).map(u=>u.trim()).filter(Boolean).slice(0,100);t.checklist=p.length?p:null}if(this.completionActionsEnabled){let p=this._actionService.trim();if(p&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(p)){let $={service:p},y=this._actionTargetEntity.trim();y&&($.target={entity_id:y});let b=this._buildActionData();Object.keys(b).length>0&&($.data=b),t.on_complete_action=$}else t.on_complete_action=null;let u={};this._qcNotes.trim()&&(u.notes=this._qcNotes.trim());let h=parseFloat(this._qcCost);!isNaN(h)&&h>=0&&(u.cost=h);let g=parseInt(this._qcDuration,10);!isNaN(g)&&g>=0&&(u.duration=g),this._qcFeedback&&(u.feedback=this._qcFeedback),t.quick_complete_defaults=Object.keys(u).length?u:null}let e=await this.hass.connection.sendMessagePromise(t),n=this._taskId||e?.task_id,c=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(n&&this._scheduleType==="sensor_based"&&c)try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:n,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null}),this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute}catch{}if(n&&this._adaptiveSnapshot()!==this._adaptiveInitial){let p=parseFloat(this._adaptiveAlpha),u=parseInt(this._adaptiveMin,10),h=parseInt(this._adaptiveMax,10);try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_adaptive",entry_id:this._entryId,task_id:n,enabled:this._adaptiveEnabled,...p>=.1&&p<=.9?{ewa_alpha:p}:{},...!isNaN(u)&&u>=1?{min_interval_days:u}:{},...!isNaN(h)&&h>=1?{max_interval_days:h}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction}),this._adaptiveInitial=this._adaptiveSnapshot()}catch{}}this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}catch(t){this._error=T(t,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}_close(){this._open=!1,this._pickerProbeTimer!==void 0&&(clearTimeout(this._pickerProbeTimer),this._pickerProbeTimer=void 0),this._pickerProbeStrikes=0}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return _;let t=this._lang,i=this._triggerType==="compound";return a`
|
||||
`}async _save(){if(!this._loading&&this._name.trim()){if(this._adaptiveSnapshot()!==this._adaptiveInitial){let t=parseInt(this._adaptiveMin,10),i=parseInt(this._adaptiveMax,10);if(!isNaN(t)&&!isNaN(i)&&t>i){this._error=`${s("adaptive_min_interval",this._lang)} > ${s("adaptive_max_interval",this._lang)}`;return}}this._loading=!0,this._error="";try{let t={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:Number.isNaN(parseInt(this._warningDays,10))?this.defaultWarningDays:Math.max(0,parseInt(this._warningDays,10))},i=this._earliestCompletionDays.trim();t.earliest_completion_days=i===""?null:Math.max(0,parseInt(i,10)||0),this._taskId&&(t.task_id=this._taskId),this._scheduleType==="one_time"?(t.due_date=this._dueDate||null,t.interval_days=null):st.includes(this._scheduleType)?(t.schedule={...this._buildSchedule(),...this._recurrenceExtras()},t.interval_days=null,this._taskId&&(t.due_date=null)):(this._taskId&&(t.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(t.interval_days=parseInt(this._intervalDays,10),t.interval_unit=this._intervalUnit,t.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(t.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(t.interval_days=null,t.interval_anchor="completion")),t.notes=this._notes||null,t.documentation_url=this._documentationUrl||null,t.custom_icon=this._customIcon||null,t.priority=this._priority,t.labels=this._labels.split(",").map(p=>p.trim()).filter(Boolean),t.enabled=this._enabled,t.last_performed=this._lastPerformed||null,t.nfc_tag_id=this._nfcTagId||null,t.require_tag_scan=this._requireTagScan,t.allow_skip=this._allowSkip,t.reading_unit=this._readingUnit.trim()||null;{let p={};for(let h of this._phaseDefs){if(!h.name.trim())continue;let g={...h.carry,name:h.name.trim()},x=h.checklistText.split(`
|
||||
`).map(b=>b.trim()).filter(Boolean);x.length&&(g.checklist=x);let y=[];if(h.partId){let b=parseFloat(h.partQty);y.push({part_id:h.partId,quantity:Number.isFinite(b)&&b>0?b:1})}for(let b of h.extraParts)y.push(b.entry_id?{part_id:b.part_id,quantity:b.quantity,entry_id:b.entry_id}:{part_id:b.part_id,quantity:b.quantity});y.length&&(g.consumes_parts=y),h.reqOverride&&(g.required_completion_fields=[...h.reqFields]),p[h.id]=g}let u=this._phaseSeq.filter(h=>h in p);t.phases=Object.keys(p).length&&u.length?p:null,t.phase_sequence=t.phases?u:null}if((this.parts.length||this._foreignOwners.length)&&(t.consumes_parts=Object.values(this._consumesParts).map(p=>p.entry_id?{part_id:p.part_id,quantity:p.quantity,entry_id:p.entry_id}:{part_id:p.part_id,quantity:p.quantity})),t.responsible_user_id=this._responsibleUserId,t.assignee_pool=this._assigneePool,t.required_completion_fields=this._requiredCompletion,t.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let p=this._compoundConditions.map(Gt).filter(u=>u!==null);if(p.length>0){let u={type:"compound",compound_logic:this._compoundLogic,conditions:p};this._autoCompleteOnRecovery&&(u.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(u.trigger_combinator="all"),t.trigger_config=u}else this._taskId&&(t.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let p=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],u={entity_id:p[0],entity_ids:p,type:this._triggerType};if(this._triggerAttribute&&(u.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(u.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(u.trigger_combinator="all"),p.length>1&&(u.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let h=parseFloat(this._triggerAbove);isNaN(h)||(u.trigger_above=h)}if(this._triggerBelow){let h=parseFloat(this._triggerBelow);isNaN(h)||(u.trigger_below=h)}if(this._triggerEquals){let h=parseFloat(this._triggerEquals);isNaN(h)||(u.trigger_equals=h)}if(this._triggerNotEquals){let h=parseFloat(this._triggerNotEquals);isNaN(h)||(u.trigger_not_equals=h)}if(this._triggerForMinutes){let h=parseInt(this._triggerForMinutes,10);isNaN(h)||(u.trigger_for_minutes=h)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let h=parseFloat(this._triggerTargetValue);isNaN(h)||(u.trigger_target_value=h)}if(u.trigger_delta_mode=this._triggerDeltaMode,this._triggerDeltaMode&&this._triggerBaselineValue){let h=parseFloat(this._triggerBaselineValue);!isNaN(h)&&h>=0&&(u.trigger_baseline_value=h)}}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(u.trigger_from_state=this._triggerFromState),this._triggerToState&&(u.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let h=parseInt(this._triggerTargetChanges,10);isNaN(h)||(u.trigger_target_changes=h)}if(this._triggerForMinutes){let h=parseInt(this._triggerForMinutes,10);isNaN(h)||(u.trigger_for_minutes=h)}}else if(this._triggerType==="runtime"){if(this._triggerRuntimeHours){let g=parseFloat(this._triggerRuntimeHours);isNaN(g)||(u.trigger_runtime_hours=g)}if(this._triggerRuntimeMaxSession){let g=parseInt(this._triggerRuntimeMaxSession,10);!isNaN(g)&&g>0&&(u.trigger_runtime_max_session_seconds=g)}let h=this._triggerOnStates.split(",").map(g=>g.trim()).filter(Boolean);h.length>0&&(u.trigger_on_states=h)}t.trigger_config=u}else this._taskId&&(t.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let p=this._scheduleTime.trim();t.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(p)?p:null}if(this.checklistsEnabled){let p=this._checklistText.split(`
|
||||
`).map(u=>u.trim()).filter(Boolean).slice(0,100);t.checklist=p.length?p:null}if(this.completionActionsEnabled){let p=this._actionService.trim();if(p&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(p)){let x={service:p},y=this._actionTargetEntity.trim();y&&(x.target={entity_id:y});let b=this._buildActionData();Object.keys(b).length>0&&(x.data=b),t.on_complete_action=x}else t.on_complete_action=null;let u={};this._qcNotes.trim()&&(u.notes=this._qcNotes.trim());let h=parseFloat(this._qcCost);!isNaN(h)&&h>=0&&(u.cost=h);let g=parseInt(this._qcDuration,10);!isNaN(g)&&g>=0&&(u.duration=g),this._qcFeedback&&(u.feedback=this._qcFeedback),t.quick_complete_defaults=Object.keys(u).length?u:null}let e=await this.hass.connection.sendMessagePromise(t),n=this._taskId||e?.task_id,c=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(n&&this._scheduleType==="sensor_based"&&c)try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:n,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null}),this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute}catch{}if(n&&this._adaptiveSnapshot()!==this._adaptiveInitial){let p=parseFloat(this._adaptiveAlpha),u=parseInt(this._adaptiveMin,10),h=parseInt(this._adaptiveMax,10);try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_adaptive",entry_id:this._entryId,task_id:n,enabled:this._adaptiveEnabled,...p>=.1&&p<=.9?{ewa_alpha:p}:{},...!isNaN(u)&&u>=1?{min_interval_days:u}:{},...!isNaN(h)&&h>=1?{max_interval_days:h}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction}),this._adaptiveInitial=this._adaptiveSnapshot()}catch{}}this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}catch(t){this._error=S(t,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}_close(){this._open=!1,this._pickerProbeTimer!==void 0&&(clearTimeout(this._pickerProbeTimer),this._pickerProbeTimer=void 0),this._pickerProbeStrikes=0}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return _;let t=this._lang,i=this._triggerType==="compound";return a`
|
||||
<h3>${s("trigger_configuration",t)}</h3>
|
||||
<div class="select-row">
|
||||
<label>${s("trigger_type",t)}</label>
|
||||
@@ -524,7 +524,7 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
.value=${t.type}
|
||||
@change=${c=>this._patchCondition(i,{type:c.target.value})}
|
||||
>
|
||||
${xt.map(c=>a`<option value=${c} ?selected=${c===t.type}>${s(c,e)}</option>`)}
|
||||
${$t.map(c=>a`<option value=${c} ?selected=${c===t.type}>${s(c,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._renderConditionTypeFields(t,i)}
|
||||
@@ -668,7 +668,7 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
>
|
||||
${["days","weeks","months","years"].map(i=>a`<option value=${i} ?selected=${i===this._intervalUnit}>${s("unit_"+i,t)}</option>`)}
|
||||
</select>
|
||||
</div>`}_toggleWeekday(t){this._weekdays=this._weekdays.includes(t)?this._weekdays.filter(i=>i!==t):[...this._weekdays,t]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(st.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let t=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!t||t<=0?null:{kind:"interval",every:t,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(t){super.updated?.(t),this._scheduleEntityPickerProbe();for(let i of t.keys())if(m._PREVIEW_RELEVANT.has(String(i))){this._schedulePreviewRefresh();return}}_scheduleEntityPickerProbe(){this._entityPickerFallback||this._pickerProbeTimer!==void 0||!this._open||this._scheduleType!=="sensor_based"||(this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),1500))}_probeEntityPickers(){if(this._pickerProbeTimer=void 0,this._entityPickerFallback||!this._open)return;let t=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),i=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!t||!i){this._pickerProbeStrikes=0;return}let e=(u,h,g=0)=>{if(!(!u||g>10)){(u.tagName?.toLowerCase()??"")==="ha-entity-picker"&&h.push(u);for(let $ of[u.shadowRoot,u])if($)for(let y of Array.from($.children??[]))e(y,h,g+1)}},n=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],c=[];for(let u of n)e(u,c);let p=c.length===0||c.some(u=>u.offsetHeight===0);if(t.offsetHeight===0||p){if(this._pickerProbeStrikes+=1,this._pickerProbeStrikes>=2){this._entityPickerFallback=!0;return}this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),700)}else this._pickerProbeStrikes=0}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let t=this._open?this._previewScheduleDict():null;if(!t){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let i=++this._previewSeq;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:t,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(i!==this._previewSeq)return;this._schedulePreview=e.occurrences||[],this._schedulePreviewEnded=!!e.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return _;let t=this._lang,i=this.scheduleTimeEnabled&&this._scheduleTime?` ${this._scheduleTime}`:"",e=this._schedulePreview.map((c,p)=>{let u=new Date(`${c}T12:00:00`).getDay();return`${tt(u===0?6:u-1,t,"short")} ${V(c,t)}${p===0?i:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?a`<div class="field-help">${s("schedule_preview_ontime",t)}</div>`:_;return a`
|
||||
</div>`}_toggleWeekday(t){this._weekdays=this._weekdays.includes(t)?this._weekdays.filter(i=>i!==t):[...this._weekdays,t]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(st.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let t=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!t||t<=0?null:{kind:"interval",every:t,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(t){super.updated?.(t),this._scheduleEntityPickerProbe();for(let i of t.keys())if(m._PREVIEW_RELEVANT.has(String(i))){this._schedulePreviewRefresh();return}}_scheduleEntityPickerProbe(){this._entityPickerFallback||this._pickerProbeTimer!==void 0||!this._open||this._scheduleType!=="sensor_based"||(this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),1500))}_probeEntityPickers(){if(this._pickerProbeTimer=void 0,this._entityPickerFallback||!this._open)return;let t=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),i=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!t||!i){this._pickerProbeStrikes=0;return}let e=(u,h,g=0)=>{if(!(!u||g>10)){(u.tagName?.toLowerCase()??"")==="ha-entity-picker"&&h.push(u);for(let x of[u.shadowRoot,u])if(x)for(let y of Array.from(x.children??[]))e(y,h,g+1)}},n=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],c=[];for(let u of n)e(u,c);let p=c.length===0||c.some(u=>u.offsetHeight===0);if(t.offsetHeight===0||p){if(this._pickerProbeStrikes+=1,this._pickerProbeStrikes>=2){this._entityPickerFallback=!0;return}this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),700)}else this._pickerProbeStrikes=0}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let t=this._open?this._previewScheduleDict():null;if(!t){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let i=++this._previewSeq;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:t,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(i!==this._previewSeq)return;this._schedulePreview=e.occurrences||[],this._schedulePreviewEnded=!!e.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return _;let t=this._lang,i=this.scheduleTimeEnabled&&this._scheduleTime?` ${this._scheduleTime}`:"",e=this._schedulePreview.map((c,p)=>{let u=new Date(`${c}T12:00:00`).getDay();return`${tt(u===0?6:u-1,t,"short")} ${V(c,t)}${p===0?i:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?a`<div class="field-help">${s("schedule_preview_ontime",t)}</div>`:_;return a`
|
||||
<div class="trigger-live-hint schedule-preview">
|
||||
${s("schedule_preview_title",t)}: ${e}${this._schedulePreviewEnded?a` <span class="field-help">${s("schedule_preview_ends",t)}</span>`:_}
|
||||
${n}
|
||||
@@ -760,7 +760,7 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
max="15"
|
||||
.value=${this._calOffset}
|
||||
@input=${i=>this._calOffset=i.target.value}
|
||||
></ms-textfield>`}_renderTriggerLiveHint(){if(this._triggerType==="compound")return _;let t=this._triggerEntityId||this._triggerEntityIds[0];if(!t||!this.hass?.states)return _;let i=this.hass.states[t];if(!i)return _;let e=this._lang,n=i.attributes?.unit_of_measurement,c=typeof n=="string"&&n?` ${n}`:"",p=this._triggerAttribute?i.attributes?.[this._triggerAttribute]:i.state,u=typeof p=="number"?p:parseFloat(String(p)),h=p!=="unknown"&&p!=="unavailable"&&p!=null&&!isNaN(u),g=y=>Number.isInteger(y)?String(y):String(Math.round(y*10)/10),$=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),b=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN(b))return _;h&&$.push(s("trigger_hint_now",e).replace("{value}",g(u)+c)),isNaN(y)||$.push(s("trigger_hint_above",e).replace("{target}",g(y)+c)),isNaN(b)||$.push(s("trigger_hint_below",e).replace("{target}",g(b)+c))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return _;this._triggerDeltaMode?this._taskId?$.push(s("trigger_hint_counter_delta_edit",e).replace("{target}",g(y)+c)):h?$.push(s("trigger_hint_counter_delta",e).replace("{value}",g(u)+c).replace("{due}",g(u+y)+c).replace("{target}",g(y)+c)):$.push(s("trigger_hint_counter_delta_edit",e).replace("{target}",g(y)+c)):(h&&$.push(s("trigger_hint_now",e).replace("{value}",g(u)+c)),$.push(s("trigger_hint_counter_abs",e).replace("{target}",g(y)+c)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return _;$.push(s("trigger_hint_runtime",e).replace("{hours}",g(y))),$.push(s("trigger_hint_state_now",e).replace("{value}",String(i.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,b=this._triggerToState.trim();$.push((b?s("trigger_hint_state_change_to",e).replace("{state}",b):s("trigger_hint_state_change",e)).replace("{count}",String(y))),$.push(s("trigger_hint_state_now",e).replace("{value}",String(i.state)))}return $.length?a`<div class="trigger-live-hint">${$.join(" ")}</div>`:_}_renderTriggerTypeFields(){let t=this._lang;return this._triggerType==="threshold"?a`
|
||||
></ms-textfield>`}_renderTriggerLiveHint(){if(this._triggerType==="compound")return _;let t=this._triggerEntityId||this._triggerEntityIds[0];if(!t||!this.hass?.states)return _;let i=this.hass.states[t];if(!i)return _;let e=this._lang,n=i.attributes?.unit_of_measurement,c=typeof n=="string"&&n?` ${n}`:"",p=this._triggerAttribute?i.attributes?.[this._triggerAttribute]:i.state,u=typeof p=="number"?p:parseFloat(String(p)),h=p!=="unknown"&&p!=="unavailable"&&p!=null&&!isNaN(u),g=y=>Number.isInteger(y)?String(y):String(Math.round(y*10)/10),x=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),b=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN(b))return _;h&&x.push(s("trigger_hint_now",e).replace("{value}",g(u)+c)),isNaN(y)||x.push(s("trigger_hint_above",e).replace("{target}",g(y)+c)),isNaN(b)||x.push(s("trigger_hint_below",e).replace("{target}",g(b)+c))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return _;this._triggerDeltaMode?this._taskId?x.push(s("trigger_hint_counter_delta_edit",e).replace("{target}",g(y)+c)):h?x.push(s("trigger_hint_counter_delta",e).replace("{value}",g(u)+c).replace("{due}",g(u+y)+c).replace("{target}",g(y)+c)):x.push(s("trigger_hint_counter_delta_edit",e).replace("{target}",g(y)+c)):(h&&x.push(s("trigger_hint_now",e).replace("{value}",g(u)+c)),x.push(s("trigger_hint_counter_abs",e).replace("{target}",g(y)+c)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return _;x.push(s("trigger_hint_runtime",e).replace("{hours}",g(y))),x.push(s("trigger_hint_state_now",e).replace("{value}",String(i.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,b=this._triggerToState.trim();x.push((b?s("trigger_hint_state_change_to",e).replace("{state}",b):s("trigger_hint_state_change",e)).replace("{count}",String(y))),x.push(s("trigger_hint_state_now",e).replace("{value}",String(i.state)))}return x.length?a`<div class="trigger-live-hint">${x.join(" ")}</div>`:_}_renderTriggerTypeFields(){let t=this._lang;return this._triggerType==="threshold"?a`
|
||||
<ms-textfield
|
||||
label="${s("trigger_above",t)}"
|
||||
type="number"
|
||||
@@ -854,6 +854,14 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
.value=${this._triggerRuntimeHours}
|
||||
@input=${i=>this._triggerRuntimeHours=i.target.value}
|
||||
></ms-textfield>
|
||||
<ms-textfield
|
||||
label="${s("runtime_max_session",t)}"
|
||||
type="number"
|
||||
step="1"
|
||||
.value=${this._triggerRuntimeMaxSession}
|
||||
@input=${i=>this._triggerRuntimeMaxSession=i.target.value}
|
||||
></ms-textfield>
|
||||
<div class="field-help">${s("runtime_max_session_help",t)}</div>
|
||||
${this._renderOnStatesField({value:this._triggerOnStates,entityId:this._triggerEntityId,onInput:i=>this._triggerOnStates=i})}
|
||||
<div class="field-help">${s("runtime_on_states_help",t)}</div>
|
||||
`:_}render(){if(!this._open)return a``;let t=this._lang,i=this._taskId?s("edit_task",t):s("new_task",t);return a`
|
||||
@@ -1075,7 +1083,7 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
<ha-form
|
||||
class="entity-picker-form"
|
||||
.hass=${this.hass}
|
||||
.schema=${[{name:"environmental_entity",selector:{entity:{domain:bt,device_class:$t}}}]}
|
||||
.schema=${[{name:"environmental_entity",selector:{entity:{domain:bt,device_class:xt}}}]}
|
||||
.data=${{environmental_entity:this._environmentalEntity}}
|
||||
.computeLabel=${()=>s("environmental_entity_optional",t)}
|
||||
.computeHelper=${()=>s("environmental_entity_helper",t)}
|
||||
@@ -1140,6 +1148,15 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
<span>${s("require_tag_scan",t)}</span>
|
||||
</label>
|
||||
${this._requireTagScan?a`<div class="field-help">${s("require_tag_scan_help",t)}</div>`:_}
|
||||
<label class="req-option">
|
||||
<input
|
||||
type="checkbox"
|
||||
.checked=${!this._allowSkip}
|
||||
@change=${e=>this._allowSkip=!e.target.checked}
|
||||
/>
|
||||
<span>${s("disallow_skip",t)}</span>
|
||||
</label>
|
||||
${this._allowSkip?_:a`<div class="field-help">${s("disallow_skip_help",t)}</div>`}
|
||||
<label class="toggle-row">
|
||||
<input
|
||||
type="checkbox"
|
||||
@@ -1536,7 +1553,7 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
`,o([v({attribute:!1})],m.prototype,"hass",2),o([v({type:Boolean,attribute:"checklists-enabled"})],m.prototype,"checklistsEnabled",2),o([v({type:Boolean,attribute:"schedule-time-enabled"})],m.prototype,"scheduleTimeEnabled",2),o([v({type:Boolean,attribute:"completion-actions-enabled"})],m.prototype,"completionActionsEnabled",2),o([v({type:Number,attribute:"default-warning-days"})],m.prototype,"defaultWarningDays",2),o([d()],m.prototype,"parts",2),o([d()],m.prototype,"_foreignOwners",2),o([d()],m.prototype,"_open",2),o([d()],m.prototype,"_entityPickerFallback",2),o([d()],m.prototype,"_loading",2),o([d()],m.prototype,"_error",2),o([d()],m.prototype,"_entryId",2),o([d()],m.prototype,"_taskId",2),o([d()],m.prototype,"_objectChoices",2),o([d()],m.prototype,"_name",2),o([d()],m.prototype,"_type",2),o([d()],m.prototype,"_scheduleType",2),o([d()],m.prototype,"_intervalDays",2),o([d()],m.prototype,"_intervalUnit",2),o([d()],m.prototype,"_dueDate",2),o([d()],m.prototype,"_warningDays",2),o([d()],m.prototype,"_earliestCompletionDays",2),o([d()],m.prototype,"_intervalAnchor",2),o([d()],m.prototype,"_weekdays",2),o([d()],m.prototype,"_nth",2),o([d()],m.prototype,"_nthWeekday",2),o([d()],m.prototype,"_domDay",2),o([d()],m.prototype,"_domLastDay",2),o([d()],m.prototype,"_domBusiness",2),o([d()],m.prototype,"_calOffset",2),o([d()],m.prototype,"_seasonMonths",2),o([d()],m.prototype,"_endsMode",2),o([d()],m.prototype,"_endsCount",2),o([d()],m.prototype,"_endsUntil",2),o([d()],m.prototype,"_schedulePreview",2),o([d()],m.prototype,"_schedulePreviewEnded",2),o([d()],m.prototype,"_notes",2),o([d()],m.prototype,"_documentationUrl",2),o([d()],m.prototype,"_customIcon",2),o([d()],m.prototype,"_priority",2),o([d()],m.prototype,"_labels",2),o([d()],m.prototype,"_enabled",2),o([d()],m.prototype,"_triggerEntityId",2),o([d()],m.prototype,"_triggerEntityIds",2),o([d()],m.prototype,"_triggerEntityLogic",2),o([d()],m.prototype,"_triggerAttribute",2),o([d()],m.prototype,"_triggerType",2),o([d()],m.prototype,"_triggerAbove",2),o([d()],m.prototype,"_triggerBelow",2),o([d()],m.prototype,"_triggerEquals",2),o([d()],m.prototype,"_triggerNotEquals",2),o([d()],m.prototype,"_triggerForMinutes",2),o([d()],m.prototype,"_triggerCombinator",2),o([d()],m.prototype,"_triggerTargetValue",2),o([d()],m.prototype,"_triggerDeltaMode",2),o([d()],m.prototype,"_triggerBaselineValue",2),o([d()],m.prototype,"_liveBaselineValue",2),o([d()],m.prototype,"_autoCompleteOnRecovery",2),o([d()],m.prototype,"_triggerFromState",2),o([d()],m.prototype,"_triggerToState",2),o([d()],m.prototype,"_triggerTargetChanges",2),o([d()],m.prototype,"_triggerRuntimeHours",2),o([d()],m.prototype,"_triggerOnStates",2),o([d()],m.prototype,"_compoundLogic",2),o([d()],m.prototype,"_compoundConditions",2),o([d()],m.prototype,"_suggestedAttributes",2),o([d()],m.prototype,"_availableAttributes",2),o([d()],m.prototype,"_entityDomain",2),o([d()],m.prototype,"_lastPerformed",2),o([d()],m.prototype,"_nfcTagId",2),o([d()],m.prototype,"_requireTagScan",2),o([d()],m.prototype,"_readingUnit",2),o([d()],m.prototype,"_consumesParts",2),o([d()],m.prototype,"_partsLoadFailed",2),o([d()],m.prototype,"_availableTags",2),o([d()],m.prototype,"_responsibleUserId",2),o([d()],m.prototype,"_assigneePool",2),o([d()],m.prototype,"_rotationStrategy",2),o([d()],m.prototype,"_availableUsers",2),o([d()],m.prototype,"_checklistText",2),o([d()],m.prototype,"_phaseDefs",2),o([d()],m.prototype,"_phaseSeq",2),o([d()],m.prototype,"_requiredCompletion",2),o([d()],m.prototype,"_scheduleTime",2),o([d()],m.prototype,"_actionService",2),o([d()],m.prototype,"_actionTargetEntity",2),o([d()],m.prototype,"_actionData",2),o([d()],m.prototype,"_actionDataJsonFallback",2),o([d()],m.prototype,"_actionTesting",2),o([d()],m.prototype,"_actionTestResult",2),o([d()],m.prototype,"_actionTestError",2),o([d()],m.prototype,"_qcNotes",2),o([d()],m.prototype,"_qcCost",2),o([d()],m.prototype,"_qcDuration",2),o([d()],m.prototype,"_qcFeedback",2),o([d()],m.prototype,"_environmentalEntity",2),o([d()],m.prototype,"_environmentalAttribute",2),o([d()],m.prototype,"_adaptiveEnabled",2),o([d()],m.prototype,"_adaptiveAlpha",2),o([d()],m.prototype,"_adaptiveMin",2),o([d()],m.prototype,"_adaptiveMax",2),o([d()],m.prototype,"_adaptiveSeasonal",2),o([d()],m.prototype,"_adaptivePrediction",2),o([d()],m.prototype,"_conditionAttrOptions",2);var rt=m;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",rt);var f=class extends I{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.restockDefault=null;this.restockUnitCost=null;this.currencySymbol="";this.parts=[];this.consumesParts=[];this.consumesInfo=[];this.requiredFields=[];this.phaseLabel="";this.requireTagScan=!1;this.viaTagScan=!1;this._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistStat
Line truncated
|
||||
`,o([v({attribute:!1})],m.prototype,"hass",2),o([v({type:Boolean,attribute:"checklists-enabled"})],m.prototype,"checklistsEnabled",2),o([v({type:Boolean,attribute:"schedule-time-enabled"})],m.prototype,"scheduleTimeEnabled",2),o([v({type:Boolean,attribute:"completion-actions-enabled"})],m.prototype,"completionActionsEnabled",2),o([v({type:Number,attribute:"default-warning-days"})],m.prototype,"defaultWarningDays",2),o([d()],m.prototype,"parts",2),o([d()],m.prototype,"_foreignOwners",2),o([d()],m.prototype,"_open",2),o([d()],m.prototype,"_entityPickerFallback",2),o([d()],m.prototype,"_loading",2),o([d()],m.prototype,"_error",2),o([d()],m.prototype,"_entryId",2),o([d()],m.prototype,"_taskId",2),o([d()],m.prototype,"_objectChoices",2),o([d()],m.prototype,"_name",2),o([d()],m.prototype,"_type",2),o([d()],m.prototype,"_scheduleType",2),o([d()],m.prototype,"_intervalDays",2),o([d()],m.prototype,"_intervalUnit",2),o([d()],m.prototype,"_dueDate",2),o([d()],m.prototype,"_warningDays",2),o([d()],m.prototype,"_earliestCompletionDays",2),o([d()],m.prototype,"_intervalAnchor",2),o([d()],m.prototype,"_weekdays",2),o([d()],m.prototype,"_nth",2),o([d()],m.prototype,"_nthWeekday",2),o([d()],m.prototype,"_domDay",2),o([d()],m.prototype,"_domLastDay",2),o([d()],m.prototype,"_domBusiness",2),o([d()],m.prototype,"_calOffset",2),o([d()],m.prototype,"_seasonMonths",2),o([d()],m.prototype,"_endsMode",2),o([d()],m.prototype,"_endsCount",2),o([d()],m.prototype,"_endsUntil",2),o([d()],m.prototype,"_schedulePreview",2),o([d()],m.prototype,"_schedulePreviewEnded",2),o([d()],m.prototype,"_notes",2),o([d()],m.prototype,"_documentationUrl",2),o([d()],m.prototype,"_customIcon",2),o([d()],m.prototype,"_priority",2),o([d()],m.prototype,"_labels",2),o([d()],m.prototype,"_enabled",2),o([d()],m.prototype,"_triggerEntityId",2),o([d()],m.prototype,"_triggerEntityIds",2),o([d()],m.prototype,"_triggerEntityLogic",2),o([d()],m.prototype,"_triggerAttribute",2),o([d()],m.prototype,"_triggerType",2),o([d()],m.prototype,"_triggerAbove",2),o([d()],m.prototype,"_triggerBelow",2),o([d()],m.prototype,"_triggerEquals",2),o([d()],m.prototype,"_triggerNotEquals",2),o([d()],m.prototype,"_triggerForMinutes",2),o([d()],m.prototype,"_triggerCombinator",2),o([d()],m.prototype,"_triggerTargetValue",2),o([d()],m.prototype,"_triggerDeltaMode",2),o([d()],m.prototype,"_triggerBaselineValue",2),o([d()],m.prototype,"_liveBaselineValue",2),o([d()],m.prototype,"_autoCompleteOnRecovery",2),o([d()],m.prototype,"_triggerFromState",2),o([d()],m.prototype,"_triggerToState",2),o([d()],m.prototype,"_triggerTargetChanges",2),o([d()],m.prototype,"_triggerRuntimeHours",2),o([d()],m.prototype,"_triggerRuntimeMaxSession",2),o([d()],m.prototype,"_triggerOnStates",2),o([d()],m.prototype,"_compoundLogic",2),o([d()],m.prototype,"_compoundConditions",2),o([d()],m.prototype,"_suggestedAttributes",2),o([d()],m.prototype,"_availableAttributes",2),o([d()],m.prototype,"_entityDomain",2),o([d()],m.prototype,"_lastPerformed",2),o([d()],m.prototype,"_nfcTagId",2),o([d()],m.prototype,"_requireTagScan",2),o([d()],m.prototype,"_allowSkip",2),o([d()],m.prototype,"_readingUnit",2),o([d()],m.prototype,"_consumesParts",2),o([d()],m.prototype,"_partsLoadFailed",2),o([d()],m.prototype,"_availableTags",2),o([d()],m.prototype,"_responsibleUserId",2),o([d()],m.prototype,"_assigneePool",2),o([d()],m.prototype,"_rotationStrategy",2),o([d()],m.prototype,"_availableUsers",2),o([d()],m.prototype,"_checklistText",2),o([d()],m.prototype,"_phaseDefs",2),o([d()],m.prototype,"_phaseSeq",2),o([d()],m.prototype,"_requiredCompletion",2),o([d()],m.prototype,"_scheduleTime",2),o([d()],m.prototype,"_actionService",2),o([d()],m.prototype,"_actionTargetEntity",2),o([d()],m.prototype,"_actionData",2),o([d()],m.prototype,"_actionDataJsonFallback",2),o([d()],m.prototype,"_actionTesting",2),o([d()],m.prototype,"_actionTestResult",2),o([d()],m.prototype,"_actionTestError",2),o([d()],m.prototype,"_qcNotes",2),o([d()],m.prototype,"_qcCost",2),o([d()],m.prototype,"_qcDuration",2),o([d()],m.prototype,"_qcFeedback",2),o([d()],m.prototype,"_environmentalEntity",2),o([d()],m.prototype,"_environmentalAttribute",2),o([d()],m.prototype,"_adaptiveEnabled",2),o([d()],m.prototype,"_adaptiveAlpha",2),o([d()],m.prototype,"_adaptiveMin",2),o([d()],m.prototype,"_adaptiveMax",2),o([d()],m.prototype,"_adaptiveSeasonal",2),o([d()],m.prototype,"_adaptivePrediction",2),o([d()],m.prototype,"_conditionAttrOptions",2);var rt=m;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",rt);var f=class extends I{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.restockDefault=null;this.restockUnitCost=null;this.currencySymbol="";this.parts=[];this.consumesParts=[];this.consumesInfo=[];this.requiredFields=[];this.phaseLabel="";this.requireTagScan=!1;this.viaTagScan=!1;this._open=!1;this._notes
Line truncated
|
||||
type="button"
|
||||
class="cost-suggestion"
|
||||
@click=${()=>this._cost=i.toFixed(2)}
|
||||
@@ -1849,7 +1866,7 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
color: var(--text-primary-color, #fff);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
`],o([v({attribute:!1})],f.prototype,"hass",2),o([v()],f.prototype,"entryId",2),o([v()],f.prototype,"taskId",2),o([v()],f.prototype,"taskName",2),o([v()],f.prototype,"lang",2),o([v({type:Array})],f.prototype,"checklist",2),o([v({type:Boolean})],f.prototype,"adaptiveEnabled",2),o([v()],f.prototype,"taskType",2),o([v()],f.prototype,"readingUnit",2),o([v({attribute:!1})],f.prototype,"restockDefault",2),o([v({attribute:!1})],f.prototype,"restockUnitCost",2),o([v()],f.prototype,"currencySymbol",2),o([v({attribute:!1})],f.prototype,"parts",2),o([v({attribute:!1})],f.prototype,"consumesParts",2),o([v({type:Array})],f.prototype,"consumesInfo",2),o([v({type:Array})],f.prototype,"requiredFields",2),o([v()],f.prototype,"phaseLabel",2),o([v({type:Boolean})],f.prototype,"requireTagScan",2),o([v({type:Boolean})],f.prototype,"viaTagScan",2),o([d()],f.prototype,"_open",2),o([d()],f.prototype,"_notes",2),o([d()],f.prototype,"_cost",2),o([d()],f.prototype,"_duration",2),o([d()],f.prototype,"_loading",2),o([d()],f.prototype,"_error",2),o([d()],f.prototype,"_checklistState",2),o([d()],f.prototype,"_feedback",2),o([d()],f.prototype,"_photoDocId",2),o([d()],f.prototype,"_photoPreview",2),o([d()],f.prototype,"_photoUploading",2),o([d()],f.prototype,"_readingValue",2),o([d()],f.prototype,"_restockQty",2),o([d()],f.prototype,"_completedAt",2),o([d()],f.prototype,"_usedParts",2),o([v({attribute:!1})],f.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",f);var q=class extends I{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null;this._partOptions=null;this._partQty={};this._partQtyOriginal=""}get _lang(){return S(this.hass)}openEdit(t){this._draft={...t},this._originalSnapshot={...t},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._loadPartOptions()}async _loadPartOptions(){let t=this._draft;if(t)try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"}),e=[];for(let c of i.parts||[]){let p=c.entry_id===t.entry_id,u=c.consumers.some(h=>h.entry_id===t.entry_id&&h.task_id===t.task_id);!p&&!u||e.push({part_id:c.part_id,name:c.name,entry_id:c.entry_id,foreign:!p,object_name:c.object_name})}for(let c of t.used_parts||[]){let p=c.entry_id||t.entry_id;e.some(u=>u.part_id===c.part_id&&u.entry_id===p)||e.push({part_id:c.part_id,name:c.name||c.part_id,entry_id:p,foreign:p!==t.entry_id,object_name:null})}let n={};for(let c of t.used_parts||[])n[`${c.entry_id||t.entry_id}:${c.part_id}`]=c.quantity??1;this._partOptions=e,this._partQty=n,this._partQtyOriginal=this._partSelectionKey()}catch{this._partOptions=[]}}_partSelectionKey(){return JSON.stringify(Object.entries(this._partQty).filter(([,t])=>t>0).sort(([t],[i])=>t.localeCompare(i)))}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(t,i){this._draft&&(this._draft={...this._draft,[t]:i})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let t={type:"maintenance_supporter/task/history/update",entry_id:this._draft.entry_id,task_id:this._draft.task_id,original_timestamp:this._originalSnapshot.original_timestamp};if(this._draft.timestamp!==this._originalSnapshot.timestamp&&(t.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(t.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(t.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(t.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(t.completed_by=this._draft.completed_by),this._partOptions!==null&&this._partSelectionKey()!==this._partQtyOriginal&&(t.used_parts=(this._partOptions||[]).filter(e=>(this._partQty[`${e.entry_id}:${e.part_id}`]||0)>0).map(e=>({part_id:e.part_id,quantity:this._partQty[`${e.entry_id}:${e.part_id}`],...e.foreign?{entry_id:e.entry_id}:{}}))),Object.keys(t).filter(e=>!["type","entry_id","task_id","original_timestamp"].includes(e)).length===0){this.close();return}await this.hass.connection.sendMessagePromise(t),this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:this._draft.entry_id,task_id:this._draft.task_id,new_timestamp:this._draft.timestamp},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=T(t,this._lang)}finally{this._saving=!1}}}render(){if(!this._open||!this._draft)return _;let t=this._lang,i=this._draft;return a`
|
||||
`],o([v({attribute:!1})],f.prototype,"hass",2),o([v()],f.prototype,"entryId",2),o([v()],f.prototype,"taskId",2),o([v()],f.prototype,"taskName",2),o([v()],f.prototype,"lang",2),o([v({type:Array})],f.prototype,"checklist",2),o([v({type:Boolean})],f.prototype,"adaptiveEnabled",2),o([v()],f.prototype,"taskType",2),o([v()],f.prototype,"readingUnit",2),o([v({attribute:!1})],f.prototype,"restockDefault",2),o([v({attribute:!1})],f.prototype,"restockUnitCost",2),o([v()],f.prototype,"currencySymbol",2),o([v({attribute:!1})],f.prototype,"parts",2),o([v({attribute:!1})],f.prototype,"consumesParts",2),o([v({type:Array})],f.prototype,"consumesInfo",2),o([v({type:Array})],f.prototype,"requiredFields",2),o([v()],f.prototype,"phaseLabel",2),o([v({type:Boolean})],f.prototype,"requireTagScan",2),o([v({type:Boolean})],f.prototype,"viaTagScan",2),o([d()],f.prototype,"_open",2),o([d()],f.prototype,"_notes",2),o([d()],f.prototype,"_cost",2),o([d()],f.prototype,"_duration",2),o([d()],f.prototype,"_loading",2),o([d()],f.prototype,"_error",2),o([d()],f.prototype,"_checklistState",2),o([d()],f.prototype,"_feedback",2),o([d()],f.prototype,"_photoDocId",2),o([d()],f.prototype,"_photoPreview",2),o([d()],f.prototype,"_photoUploading",2),o([d()],f.prototype,"_readingValue",2),o([d()],f.prototype,"_restockQty",2),o([d()],f.prototype,"_completedAt",2),o([d()],f.prototype,"_usedParts",2),o([v({attribute:!1})],f.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",f);var q=class extends I{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null;this._partOptions=null;this._partQty={};this._partQtyOriginal=""}get _lang(){return T(this.hass)}openEdit(t){this._draft={...t},this._originalSnapshot={...t},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._loadPartOptions()}async _loadPartOptions(){let t=this._draft;if(t)try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"}),e=[];for(let c of i.parts||[]){let p=c.entry_id===t.entry_id,u=c.consumers.some(h=>h.entry_id===t.entry_id&&h.task_id===t.task_id);!p&&!u||e.push({part_id:c.part_id,name:c.name,entry_id:c.entry_id,foreign:!p,object_name:c.object_name})}for(let c of t.used_parts||[]){let p=c.entry_id||t.entry_id;e.some(u=>u.part_id===c.part_id&&u.entry_id===p)||e.push({part_id:c.part_id,name:c.name||c.part_id,entry_id:p,foreign:p!==t.entry_id,object_name:null})}let n={};for(let c of t.used_parts||[])n[`${c.entry_id||t.entry_id}:${c.part_id}`]=c.quantity??1;this._partOptions=e,this._partQty=n,this._partQtyOriginal=this._partSelectionKey()}catch{this._partOptions=[]}}_partSelectionKey(){return JSON.stringify(Object.entries(this._partQty).filter(([,t])=>t>0).sort(([t],[i])=>t.localeCompare(i)))}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(t,i){this._draft&&(this._draft={...this._draft,[t]:i})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let t={type:"maintenance_supporter/task/history/update",entry_id:this._draft.entry_id,task_id:this._draft.task_id,original_timestamp:this._originalSnapshot.original_timestamp};if(this._draft.timestamp!==this._originalSnapshot.timestamp&&(t.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(t.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(t.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(t.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(t.completed_by=this._draft.completed_by),this._partOptions!==null&&this._partSelectionKey()!==this._partQtyOriginal&&(t.used_parts=(this._partOptions||[]).filter(e=>(this._partQty[`${e.entry_id}:${e.part_id}`]||0)>0).map(e=>({part_id:e.part_id,quantity:this._partQty[`${e.entry_id}:${e.part_id}`],...e.foreign?{entry_id:e.entry_id}:{}}))),Object.keys(t).filter(e=>!["type","entry_id","task_id","original_timestamp"].includes(e)).length===0){this.close();return}await this.hass.connection.sendMessagePromise(t),this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:this._draft.entry_id,task_id:this._draft.task_id,new_timestamp:this._draft.timestamp},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=S(t,this._lang)}finally{this._saving=!1}}}render(){if(!this._open||!this._draft)return _;let t=this._lang,i=this._draft;return a`
|
||||
<div class="backdrop" @click=${this.close}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true">
|
||||
<h2>${s("history_edit_title",t)||"Edit history entry"}</h2>
|
||||
@@ -1987,7 +2004,7 @@ import{a as E,b as a,c as W,d as _,e as I,f as v,g as d,i as s,j as S,k as dt,l
|
||||
.part-row-edit input[type="checkbox"] { width: auto; }
|
||||
.part-label { flex: 1; color: var(--primary-text-color); }
|
||||
.part-qty { width: 76px; }
|
||||
`,o([v({attribute:!1})],q.prototype,"hass",2),o([d()],q.prototype,"_open",2),o([d()],q.prototype,"_saving",2),o([d()],q.prototype,"_error",2),o([d()],q.prototype,"_draft",2),o([d()],q.prototype,"_partOptions",2),o([d()],q.prototype,"_partQty",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",q);function kt(r,l,t){let i=new Blob([r],{type:t}),e=URL.createObjectURL(i),n=document.createElement("a");n.href=e,n.download=l,n.target="_blank",n.rel="noopener",n.style.display="none",document.body.appendChild(n),n.dispatchEvent(new MouseEvent("click")),document.body.removeChild(n),setTimeout(()=>URL.revokeObjectURL(e),6e4)}function K(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function wt(r){return!r.startsWith("data:image/svg+xml,")&&!r.startsWith("data:image/png;base64,")?"":K(r)}function Xt(r){return r.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var A=class extends I{constructor(){super(...arguments);this.lang="en";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}openForObject(t,i){this._entryId=t,this._taskId=null,this._objectName=i,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(t,i,e,n){this._entryId=t,this._taskId=i,this._objectName=e,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let t=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let i={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(i.task_id=this._taskId);let e=[this.hass.connection.sendMessagePromise({...i,action:"view"})];this._taskId&&e.push(this.hass.connection.sendMessagePromise({...i,action:"complete"}));let n=await Promise.all(e);if(t!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(i){if(t!==this._generateSeq)return;let e=i?.code,n=i?.message;this._error=e==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?s("qr_error_no_url",this.lang):s("qr_error",this.lang)}finally{t===this._generateSeq&&(this._loading=!1)}}_setUrlMode(t){this._urlMode!==t&&(this._urlMode=t,this._generate())}_print(){if(!this._viewResult)return;let t=this._viewResult,i=t.label.task_name?`${t.label.object_name} \u2014 ${t.label.task_name}`:t.label.object_name,e=[t.label.manufacturer,t.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let c=this.lang||"en",p=K(i),u=K(e),h=!!this._completeResult,g=K(s("qr_action_view",c)),$=K(s("qr_action_complete",c));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
`,o([v({attribute:!1})],q.prototype,"hass",2),o([d()],q.prototype,"_open",2),o([d()],q.prototype,"_saving",2),o([d()],q.prototype,"_error",2),o([d()],q.prototype,"_draft",2),o([d()],q.prototype,"_partOptions",2),o([d()],q.prototype,"_partQty",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",q);function kt(r,l,t){let i=new Blob([r],{type:t}),e=URL.createObjectURL(i),n=document.createElement("a");n.href=e,n.download=l,n.target="_blank",n.rel="noopener",n.style.display="none",document.body.appendChild(n),n.dispatchEvent(new MouseEvent("click")),document.body.removeChild(n),setTimeout(()=>URL.revokeObjectURL(e),6e4)}function K(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function wt(r){return!r.startsWith("data:image/svg+xml,")&&!r.startsWith("data:image/png;base64,")?"":K(r)}function Xt(r){return r.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var A=class extends I{constructor(){super(...arguments);this.lang="en";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}openForObject(t,i){this._entryId=t,this._taskId=null,this._objectName=i,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(t,i,e,n){this._entryId=t,this._taskId=i,this._objectName=e,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let t=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let i={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(i.task_id=this._taskId);let e=[this.hass.connection.sendMessagePromise({...i,action:"view"})];this._taskId&&e.push(this.hass.connection.sendMessagePromise({...i,action:"complete"}));let n=await Promise.all(e);if(t!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(i){if(t!==this._generateSeq)return;let e=i?.code,n=i?.message;this._error=e==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?s("qr_error_no_url",this.lang):s("qr_error",this.lang)}finally{t===this._generateSeq&&(this._loading=!1)}}_setUrlMode(t){this._urlMode!==t&&(this._urlMode=t,this._generate())}_print(){if(!this._viewResult)return;let t=this._viewResult,i=t.label.task_name?`${t.label.object_name} \u2014 ${t.label.task_name}`:t.label.object_name,e=[t.label.manufacturer,t.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let c=this.lang||"en",p=K(i),u=K(e),h=!!this._completeResult,g=K(s("qr_action_view",c)),x=K(s("qr_action_complete",c));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
<meta name="color-scheme" content="light">
|
||||
<title>${p}</title>
|
||||
<style>
|
||||
@@ -2014,7 +2031,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>
|
||||
${h?`<div class="qr-col">
|
||||
<img src="${wt(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<div class="qr-label">${$}</div>
|
||||
<div class="qr-label">${x}</div>
|
||||
</div>`:""}
|
||||
</div>
|
||||
<div class="url">${K(this._viewResult.url)}</div>
|
||||
@@ -2198,7 +2215,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
color: var(--text-primary-color, #fff);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
`,o([v({attribute:!1})],A.prototype,"hass",2),o([v()],A.prototype,"lang",2),o([d()],A.prototype,"_open",2),o([d()],A.prototype,"_loading",2),o([d()],A.prototype,"_error",2),o([d()],A.prototype,"_viewResult",2),o([d()],A.prototype,"_completeResult",2),o([d()],A.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",A);function Et(r){let l=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),i=String(r.getDate()).padStart(2,"0");return`${l}-${t}-${i}`}function te(r,l){if(l<=0)return 0;let t=typeof r=="number"&&Number.isFinite(r)?Math.trunc(r):0;return t<0?0:t%l}function ee(r){return!!(r?.phases&&r.phase_sequence&&r.phase_sequence.length>0)}function nt(r){if(!r||!ee(r))return null;let l=r.phase_sequence,t=te(r.phase_cursor,l.length),i=l[t],e=r.phases?.[i];return e?{id:i,name:e.name,index:t,count:l.length,notes:e.notes,checklist:e.checklist!==void 0?e.checklist:r.checklist??[],consumesParts:e.consumes_parts!==void 0?e.consumes_parts:r.consumes_parts??[],requiredFields:e.required_completion_fields!==void 0?e.required_completion_fields:r.required_completion_fields??[]}:null}function Y(r){let l=nt(r);return l?`${l.index+1}/${l.count} \xB7 ${l.name}`:""}function It(r){let l=r.task??null,t=l?nt(l):null,i=t?t.consumesParts:l?.consumes_parts||[],e=!!l?.part_ref,n=r.objects.find(u=>u.entry_id===r.entryId)?.parts||[],c=e?n.find(u=>u.id===l.part_ref.part_id):void 0,p=r.checklistsEnabled??!0;return{entry_id:r.entryId,task_id:r.taskId,task_name:r.taskName,checklist:t?p?t.checklist:[]:r.checklist??[],adaptive_enabled:!!r.adaptiveEnabled,required_completion_fields:t?t.requiredFields:l?.required_completion_fields||[],task_type:l?.type||"",reading_unit:l?.reading_unit||"",parts:e?[]:yt({consumes_parts:i},r.entryId,r.objects,r.lang),consumes_parts:e?[]:i,phase_label:t?Y(l):"",require_tag_scan:!!l?.require_tag_scan,restock_default:e?c?.restock_quantity??1:null,restock_unit_cost:e?c?.cost??null:null,currency_symbol:r.currencySymbol??"",consumes_info:i.map(u=>ft(u,r.entryId,r.objects,r.lang)),checklist_prefill:l?.checklist_progress||{},via_tag_scan:!!r.viaTagScan}}function Tt(r,l,t){r.entryId=l.entry_id,r.taskId=l.task_id,r.taskName=l.task_name,r.lang=t,r.checklist=l.checklist??[],r.adaptiveEnabled=!!l.adaptive_enabled,r.requiredFields=l.required_completion_fields??[],r.taskType=l.task_type??"",r.readingUnit=l.reading_unit??"",r.parts=l.parts??[],r.consumesParts=l.consumes_parts??[],r.phaseLabel=l.phase_label??"",r.requireTagScan=!!l.require_tag_scan,r.restockDefault=l.restock_default??null,r.restockUnitCost=l.restock_unit_cost??null,r.currencySymbol=l.currency_symbol??"",r.consumesInfo=l.consumes_info??[],r.checklistPrefill=l.checklist_prefill??{},r.viaTagScan=!!l.via_tag_scan,r.open({viaTagScan:!!l.via_tag_scan})}function St(r,l){let t=r.interval_analysis,i=t?.weibull_beta,e=t?.weibull_eta;if(i==null||e==null||e<=0)return _;let n=r.interval_days??0,c=r.suggested_interval??n;return a`
|
||||
`,o([v({attribute:!1})],A.prototype,"hass",2),o([v()],A.prototype,"lang",2),o([d()],A.prototype,"_open",2),o([d()],A.prototype,"_loading",2),o([d()],A.prototype,"_error",2),o([d()],A.prototype,"_viewResult",2),o([d()],A.prototype,"_completeResult",2),o([d()],A.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",A);function Et(r){let l=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,"0"),i=String(r.getDate()).padStart(2,"0");return`${l}-${t}-${i}`}function te(r,l){if(l<=0)return 0;let t=typeof r=="number"&&Number.isFinite(r)?Math.trunc(r):0;return t<0?0:t%l}function ee(r){return!!(r?.phases&&r.phase_sequence&&r.phase_sequence.length>0)}function nt(r){if(!r||!ee(r))return null;let l=r.phase_sequence,t=te(r.phase_cursor,l.length),i=l[t],e=r.phases?.[i];return e?{id:i,name:e.name,index:t,count:l.length,notes:e.notes,checklist:e.checklist!==void 0?e.checklist:r.checklist??[],consumesParts:e.consumes_parts!==void 0?e.consumes_parts:r.consumes_parts??[],requiredFields:e.required_completion_fields!==void 0?e.required_completion_fields:r.required_completion_fields??[]}:null}function Y(r){let l=nt(r);return l?`${l.index+1}/${l.count} \xB7 ${l.name}`:""}function It(r){let l=r.task??null,t=l?nt(l):null,i=t?t.consumesParts:l?.consumes_parts||[],e=!!l?.part_ref,n=r.objects.find(u=>u.entry_id===r.entryId)?.parts||[],c=e?n.find(u=>u.id===l.part_ref.part_id):void 0,p=r.checklistsEnabled??!0;return{entry_id:r.entryId,task_id:r.taskId,task_name:r.taskName,checklist:t?p?t.checklist:[]:r.checklist??[],adaptive_enabled:!!r.adaptiveEnabled,required_completion_fields:t?t.requiredFields:l?.required_completion_fields||[],task_type:l?.type||"",reading_unit:l?.reading_unit||"",parts:e?[]:yt({consumes_parts:i},r.entryId,r.objects,r.lang),consumes_parts:e?[]:i,phase_label:t?Y(l):"",require_tag_scan:!!l?.require_tag_scan,restock_default:e?c?.restock_quantity??1:null,restock_unit_cost:e?c?.cost??null:null,currency_symbol:r.currencySymbol??"",consumes_info:i.map(u=>ft(u,r.entryId,r.objects,r.lang)),checklist_prefill:l?.checklist_progress||{},via_tag_scan:!!r.viaTagScan}}function St(r,l,t){r.entryId=l.entry_id,r.taskId=l.task_id,r.taskName=l.task_name,r.lang=t,r.checklist=l.checklist??[],r.adaptiveEnabled=!!l.adaptive_enabled,r.requiredFields=l.required_completion_fields??[],r.taskType=l.task_type??"",r.readingUnit=l.reading_unit??"",r.parts=l.parts??[],r.consumesParts=l.consumes_parts??[],r.phaseLabel=l.phase_label??"",r.requireTagScan=!!l.require_tag_scan,r.restockDefault=l.restock_default??null,r.restockUnitCost=l.restock_unit_cost??null,r.currencySymbol=l.currency_symbol??"",r.consumesInfo=l.consumes_info??[],r.checklistPrefill=l.checklist_prefill??{},r.viaTagScan=!!l.via_tag_scan,r.open({viaTagScan:!!l.via_tag_scan})}function Tt(r,l){let t=r.interval_analysis,i=t?.weibull_beta,e=t?.weibull_eta;if(i==null||e==null||e<=0)return _;let n=r.interval_days??0,c=r.suggested_interval??n;return a`
|
||||
<div class="weibull-section">
|
||||
<div class="weibull-title">
|
||||
<ha-svg-icon aria-hidden="true" path="M3,14L3.5,14.07L8.07,9.5C7.89,8.85 8.06,8.11 8.59,7.59C9.37,6.8 10.63,6.8 11.41,7.59C11.94,8.11 12.11,8.85 11.93,9.5L14.5,12.07L15,12C15.18,12 15.35,12 15.5,12.07L19.07,8.5C19,8.35 19,8.18 19,8A2,2 0 0,1 21,6A2,2 0 0,1 23,8A2,2 0 0,1 21,10C20.82,10 20.65,10 20.5,9.93L16.93,13.5C17,13.65 17,13.82 17,14A2,2 0 0,1 15,16A2,2 0 0,1 13,14L13.07,13.5L10.5,10.93C10.18,11 9.82,11 9.5,10.93L4.93,15.5L5,16A2,2 0 0,1 3,18A2,2 0 0,1 1,16A2,2 0 0,1 3,14Z"></ha-svg-icon>
|
||||
@@ -2214,14 +2231,14 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<ha-svg-icon path="${i}"></ha-svg-icon>
|
||||
${s(e,l)} (\u03B2=${r.toFixed(2)})
|
||||
</span>
|
||||
`}function se(r,l,t,i,e){let b=Math.max(t,i,l,1)*1.3,C=50,P=[];for(let L=0;L<=C;L++){let R=L/C*b,Dt=1-Math.exp(-Math.pow(R/l,r)),jt=32+R/b*260,zt=136-Dt*128;P.push([jt,zt])}let z=P.map(([L,R])=>`${L.toFixed(1)},${R.toFixed(1)}`).join(" "),U="M32,136 "+P.map(([L,R])=>`L${L.toFixed(1)},${R.toFixed(1)}`).join(" ")+` L${P[C][0].toFixed(1)},136 Z`,H=32+t/b*260,F=1-Math.exp(-Math.pow(t/l,r)),B=136-F*128,Ft=((1-F)*100).toFixed(0),lt=32+i/b*260,Ot=[0,.25,.5,.75,1];return a`
|
||||
`}function se(r,l,t,i,e){let b=Math.max(t,i,l,1)*1.3,C=50,L=[];for(let P=0;P<=C;P++){let R=P/C*b,jt=1-Math.exp(-Math.pow(R/l,r)),Dt=32+R/b*260,zt=136-jt*128;L.push([Dt,zt])}let z=L.map(([P,R])=>`${P.toFixed(1)},${R.toFixed(1)}`).join(" "),U="M32,136 "+L.map(([P,R])=>`L${P.toFixed(1)},${R.toFixed(1)}`).join(" ")+` L${L[C][0].toFixed(1)},136 Z`,H=32+t/b*260,F=1-Math.exp(-Math.pow(t/l,r)),B=136-F*128,Ft=((1-F)*100).toFixed(0),lt=32+i/b*260,Ot=[0,.25,.5,.75,1];return a`
|
||||
<div class="weibull-chart">
|
||||
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_weibull",e)}">
|
||||
${Ot.map(L=>{let R=136-L*128;return W`
|
||||
${Ot.map(P=>{let R=136-P*128;return W`
|
||||
<line x1="${32}" y1="${R.toFixed(1)}" x2="${292}" y2="${R.toFixed(1)}"
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${L===.5?"4,3":_}" />
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${P===.5?"4,3":_}" />
|
||||
<text x="${28}" y="${(R+3).toFixed(1)}" fill="var(--secondary-text-color)"
|
||||
font-size="8" text-anchor="end">${(L*100).toFixed(0)}%</text>
|
||||
font-size="8" text-anchor="end">${(P*100).toFixed(0)}%</text>
|
||||
`})}
|
||||
|
||||
<text x="${32}" y="${156}" fill="var(--secondary-text-color)" font-size="8" text-anchor="middle">0</text>
|
||||
@@ -2270,13 +2287,13 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>
|
||||
`:_}
|
||||
</div>
|
||||
`}function ne(r,l,t){let i=r.confidence_interval_low,e=r.confidence_interval_high,n=l.suggested_interval??l.interval_days??0,c=l.interval_days??0,p=Math.max(0,i-5),h=e+5-p,g=(i-p)/h*100,$=(e-i)/h*100,y=(n-p)/h*100,b=c>0?(c-p)/h*100:-1;return a`
|
||||
`}function ne(r,l,t){let i=r.confidence_interval_low,e=r.confidence_interval_high,n=l.suggested_interval??l.interval_days??0,c=l.interval_days??0,p=Math.max(0,i-5),h=e+5-p,g=(i-p)/h*100,x=(e-i)/h*100,y=(n-p)/h*100,b=c>0?(c-p)/h*100:-1;return a`
|
||||
<div class="confidence-range">
|
||||
<div class="confidence-range-title">
|
||||
${s("confidence_interval",t)}: ${n} ${s("days",t)} (${i}\u2013${e})
|
||||
</div>
|
||||
<div class="confidence-bar">
|
||||
<div class="confidence-fill" style="left:${g.toFixed(1)}%;width:${$.toFixed(1)}%"></div>
|
||||
<div class="confidence-fill" style="left:${g.toFixed(1)}%;width:${x.toFixed(1)}%"></div>
|
||||
${b>=0?a`<div class="confidence-marker current" style="left:${b.toFixed(1)}%"></div>`:_}
|
||||
<div class="confidence-marker recommended" style="left:${y.toFixed(1)}%"></div>
|
||||
</div>
|
||||
@@ -2326,7 +2343,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
`:_}
|
||||
</div>
|
||||
</div>
|
||||
`}function Pt(r,l,t,i){let e=Math.max(r||1,l);return a`
|
||||
`}function Lt(r,l,t,i){let e=Math.max(r||1,l);return a`
|
||||
<div class="interval-comparison">
|
||||
<div class="interval-bar">
|
||||
<div class="interval-label">
|
||||
@@ -2344,7 +2361,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
style="width: ${Math.min(l/e*100,100)}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
`}var Lt=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"];function qt(r,l,t){if(!t.seasonal||!r.seasonal_factor||r.seasonal_factor===1)return _;let i=Lt.map(p=>s(p,l)),e=new Date().getMonth(),n=r.seasonal_factors||r.interval_analysis?.seasonal_factors||null,c=n&&n.length===12?n:i.map((p,u)=>{let h=r.seasonal_factor||1,g=Math.sin((u-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,h+g))});return a`
|
||||
`}var Pt=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"];function qt(r,l,t){if(!t.seasonal||!r.seasonal_factor||r.seasonal_factor===1)return _;let i=Pt.map(p=>s(p,l)),e=new Date().getMonth(),n=r.seasonal_factors||r.interval_analysis?.seasonal_factors||null,c=n&&n.length===12?n:i.map((p,u)=>{let h=r.seasonal_factor||1,g=Math.sin((u-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,h+g))});return a`
|
||||
<div class="seasonal-card-compact">
|
||||
<h4>${s("seasonal_awareness",l)}</h4>
|
||||
<div class="seasonal-mini-chart">
|
||||
@@ -2361,7 +2378,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<span class="legend-item"><span class="dot high"></span> ${s("longer",l)||"L\xE4nger"}</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function Ct(r,l){return ae(r,l)}function ae(r,l){let t=r.seasonal_factors??r.interval_analysis?.seasonal_factors;if(!t||t.length!==12)return _;let i=r.interval_analysis?.seasonal_reason,e=new Date().getMonth(),n=300,c=100,p=8,h=c-p-4,g=Math.max(...t,1.5),$=n/12,y=$*.65,b=p+h-1/g*h;return a`
|
||||
`}function Ct(r,l){return ae(r,l)}function ae(r,l){let t=r.seasonal_factors??r.interval_analysis?.seasonal_factors;if(!t||t.length!==12)return _;let i=r.interval_analysis?.seasonal_reason,e=new Date().getMonth(),n=300,c=100,p=8,h=c-p-4,g=Math.max(...t,1.5),x=n/12,y=x*.65,b=p+h-1/g*h;return a`
|
||||
<div class="seasonal-chart">
|
||||
<div class="seasonal-chart-title">
|
||||
<ha-svg-icon aria-hidden="true" path="M17.75 4.09L15.22 6.03L16.13 9.09L13.5 7.28L10.87 9.09L11.78 6.03L9.25 4.09L12.44 4L13.5 1L14.56 4L17.75 4.09M21.25 11L19.61 12.25L20.2 14.23L18.5 13.06L16.8 14.23L17.39 12.25L15.75 11L17.81 10.95L18.5 9L19.19 10.95L21.25 11M18.97 15.95C19.8 15.87 20.69 17.05 20.16 17.8C19.84 18.25 19.5 18.67 19.08 19.07C15.17 23 8.84 23 4.94 19.07C1.03 15.17 1.03 8.83 4.94 4.93C5.34 4.53 5.76 4.17 6.21 3.85C6.96 3.32 8.14 4.21 8.06 5.04C7.79 7.9 8.75 10.87 10.95 13.06C13.14 15.26 16.1 16.22 18.97 15.95Z"></ha-svg-icon>
|
||||
@@ -2371,20 +2388,20 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<svg viewBox="0 0 ${n} ${c}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_seasonal",l)}">
|
||||
<line x1="0" y1="${b.toFixed(1)}" x2="${n}" y2="${b.toFixed(1)}"
|
||||
stroke="var(--divider-color)" stroke-width="1" stroke-dasharray="4,3" />
|
||||
${t.map((C,P)=>{let z=C/g*h,U=P*$+($-y)/2,H=p+h-z,F=P===e,B=C<1?"var(--success-color, #4caf50)":C>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return W`
|
||||
${t.map((C,L)=>{let z=C/g*h,U=L*x+(x-y)/2,H=p+h-z,F=L===e,B=C<1?"var(--success-color, #4caf50)":C>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return W`
|
||||
<rect x="${U.toFixed(1)}" y="${H.toFixed(1)}"
|
||||
width="${y.toFixed(1)}" height="${z.toFixed(1)}"
|
||||
fill="${B}" opacity="${F?1:.5}" rx="2" />
|
||||
`})}
|
||||
</svg>
|
||||
<div class="seasonal-labels">
|
||||
${Lt.map((C,P)=>a`<span class="seasonal-label ${P===e?"active-month":""}">${s(C,l)}</span>`)}
|
||||
${Pt.map((C,L)=>a`<span class="seasonal-label ${L===e?"active-month":""}">${s(C,l)}</span>`)}
|
||||
</div>
|
||||
</div>
|
||||
`}var k=class extends I{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1;this._currencySymbol=""}get _lang(){return S(this.hass)}async openFor(t,i){this._entryId=t,this._taskId=i,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=Et(new Date),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});t?.features&&(this._features={...this._features,...t.features}),this._currencySymbol=t?.budget?.currency_symbol||"",this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=t.object?.name||"";let i=(t.tasks||[]).find(e=>e.id===this._taskId);this._task=i??null}catch(t){this._error=T(t,this._lang)}}async _runWs(t){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(t),this._busy=!1,!0}catch(i){return this._error=T(i,this._lang),this._busy=!1,!1}}_notifyChanged(t){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:t},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-5363NDAL.js").then(async({openCompleteDialog:t})=>{let i=this._task,e=[];try{e=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0})).objects||[]}catch{}t(It({entryId:this._entryId,taskId:this._taskId,taskName:i.name,task:i,objects:e,lang:this._lang,checklist:i.checklist||[],adaptiveEnabled:!!i.adaptive_config?.enabled,currencySymbol:this._currencySymbol}))&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||import("./dialog-mount-5363NDAL.js").then(({openEditTaskDialog:t})=>{t(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-5363NDAL.js").then(({openQrDialog:t})=>{t({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let t=s("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(t))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let t=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",t),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=s("suggestion_applied",this._lang)||"Applied",this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=t.recommended_interval?`${s("reanalyze_result",this._lang)||"Recomputed"}: ${ht(t.recommended_interLine truncated
|
||||
`}var k=class extends I{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1;this._currencySymbol=""}get _lang(){return T(this.hass)}async openFor(t,i){this._entryId=t,this._taskId=i,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=Et(new Date),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});t?.features&&(this._features={...this._features,...t.features}),this._currencySymbol=t?.budget?.currency_symbol||"",this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=t.object?.name||"";let i=(t.tasks||[]).find(e=>e.id===this._taskId);this._task=i??null}catch(t){this._error=S(t,this._lang)}}async _runWs(t){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(t),this._busy=!1,!0}catch(i){return this._error=S(i,this._lang),this._busy=!1,!1}}_notifyChanged(t){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:t},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-3UTDIR2B.js").then(async({openCompleteDialog:t})=>{let i=this._task,e=[];try{e=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0})).objects||[]}catch{}t(It({entryId:this._entryId,taskId:this._taskId,taskName:i.name,task:i,objects:e,lang:this._lang,checklist:i.checklist||[],adaptiveEnabled:!!i.adaptive_config?.enabled,currencySymbol:this._currencySymbol}))&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||import("./dialog-mount-3UTDIR2B.js").then(({openEditTaskDialog:t})=>{t(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-3UTDIR2B.js").then(({openQrDialog:t})=>{t({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let t=s("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(t))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let t=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",t),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=s("suggestion_applied",this._lang)||"Applied",this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=t.recommended_interval?`${s("reanalyze_result",this._lang)||"Recomputed"}: ${ht(t.recommended_interLine truncated
|
||||
<div class="recommendation-card">
|
||||
<h4>${s("suggested_interval",i)}</h4>
|
||||
${Pt(t.interval_days,t.suggested_interval,t.interval_confidence||"medium",i)}
|
||||
${Lt(t.interval_days,t.suggested_interval,t.interval_confidence||"medium",i)}
|
||||
<div class="recommendation-actions">
|
||||
<button class="btn primary"
|
||||
@click=${this._applySuggestion} ?disabled=${this._busy}>
|
||||
@@ -2405,7 +2422,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
${this._toast?a`<div class="toast">${this._toast}</div>`:_}
|
||||
${e?this._renderRecommendation(t):_}
|
||||
${n?At(t,i,this._features):_}
|
||||
${c?St(t,i):_}
|
||||
${c?Tt(t,i):_}
|
||||
${p?a`
|
||||
${qt(t,i,this._features)}
|
||||
${t.seasonal_factors?.length===12||t.interval_analysis?.seasonal_factors?.length===12?Ct(t,i):_}
|
||||
@@ -2465,7 +2482,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<span class="task-name">${i.name}</span>
|
||||
</div>
|
||||
<div class="object">
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-5363NDAL.js").then(({openObjectQuickActions:n})=>{n(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-3UTDIR2B.js").then(({openObjectQuickActions:n})=>{n(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
</div>
|
||||
<div class="quick-info">
|
||||
${i.next_due?a`<span><strong>${s("next_due",t)||"Next due"}:</strong> ${V(i.next_due,t)}</span>`:_}
|
||||
@@ -2511,11 +2528,13 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<ha-icon slot="start" icon="mdi:check"></ha-icon>
|
||||
${s("complete",t)||"Complete"}
|
||||
</ha-button>
|
||||
<ha-button appearance="plain" variant="neutral" @click=${()=>{this._showSkip=!0}} .disabled=${this._busy}>
|
||||
<ha-icon slot="start" icon="mdi:skip-next"></ha-icon>
|
||||
${s("skip",t)||"Skip"}
|
||||
</ha-button>
|
||||
<ha-button appearance="plain" variant="neutral" @click=${()=>{this._showReset=!0}} .disabled=${this._busy}>
|
||||
${i.allow_skip!==!1?a`
|
||||
<ha-button appearance="outlined" variant="neutral" @click=${()=>{this._showSkip=!0}} .disabled=${this._busy}>
|
||||
<ha-icon slot="start" icon="mdi:skip-next"></ha-icon>
|
||||
${s("skip",t)||"Skip"}
|
||||
</ha-button>
|
||||
`:_}
|
||||
<ha-button appearance="outlined" variant="neutral" @click=${()=>{this._showReset=!0}} .disabled=${this._busy}>
|
||||
<ha-icon slot="start" icon="mdi:restart"></ha-icon>
|
||||
${s("reset",t)||"Reset"}
|
||||
</ha-button>
|
||||
@@ -2746,7 +2765,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
.weibull-section, .seasonal-card-compact { max-width: 100%; }
|
||||
.weibull-chart svg { max-width: 100%; height: auto; }
|
||||
.details-toggle { gap: 12px; flex-wrap: wrap; }
|
||||
`],o([v({attribute:!1})],k.prototype,"hass",2),o([d()],k.prototype,"_open",2),o([d()],k.prototype,"_entryId",2),o([d()],k.prototype,"_taskId",2),o([d()],k.prototype,"_task",2),o([d()],k.prototype,"_objectName",2),o([d()],k.prototype,"_busy",2),o([d()],k.prototype,"_error",2),o([d()],k.prototype,"_showSkip",2),o([d()],k.prototype,"_showReset",2),o([d()],k.prototype,"_showDetails",2),o([d()],k.prototype,"_showAdaptive",2),o([d()],k.prototype,"_skipReason",2),o([d()],k.prototype,"_resetDate",2),o([d()],k.prototype,"_features",2),o([d()],k.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",k);function Ht(r){return!!r&&/^https?:\/\//i.test(r)}function Rt(r){return r?customElements.get("ha-markdown")?a`<ha-markdown class="notes-md" .content=${r} breaks></ha-markdown>`:a`${r}`:_}var M=class extends I{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return S(this.hass)}async openFor(t){this._entryId=t,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=t}catch(t){this._error=T(t,this._lang)}}_onEditObject(){!this._entryId||!this._data||import("./dialog-mount-5363NDAL.js").then(({openEditObjectDialog:t})=>{t(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-5363NDAL.js").then(({openCreateTaskDialog:t})=>{t(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let t=s("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(t)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(i){this._error=T(i,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let t=!!this._data.object.archived;if(!t){let i=s("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(i))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:t?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(i){this._error=T(i,this._lang)}finally{this._busy=!1}}_onTaskClick(t){this._entryId&&import("./dialog-mount-5363NDAL.js").then(({openTaskQuickActions:i})=>{i(this._entryId,t)})}render(){if(!this._open)return _;let t=this._lang,i=this._data,e=i?.object,n=i?.tasks||[],c=this.hass?.user?.is_admin??!0;return a`
|
||||
`],o([v({attribute:!1})],k.prototype,"hass",2),o([d()],k.prototype,"_open",2),o([d()],k.prototype,"_entryId",2),o([d()],k.prototype,"_taskId",2),o([d()],k.prototype,"_task",2),o([d()],k.prototype,"_objectName",2),o([d()],k.prototype,"_busy",2),o([d()],k.prototype,"_error",2),o([d()],k.prototype,"_showSkip",2),o([d()],k.prototype,"_showReset",2),o([d()],k.prototype,"_showDetails",2),o([d()],k.prototype,"_showAdaptive",2),o([d()],k.prototype,"_skipReason",2),o([d()],k.prototype,"_resetDate",2),o([d()],k.prototype,"_features",2),o([d()],k.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",k);function Ht(r){return!!r&&/^https?:\/\//i.test(r)}function Rt(r){return r?customElements.get("ha-markdown")?a`<ha-markdown class="notes-md" .content=${r} breaks></ha-markdown>`:a`${r}`:_}var M=class extends I{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return T(this.hass)}async openFor(t){this._entryId=t,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=t}catch(t){this._error=S(t,this._lang)}}_onEditObject(){!this._entryId||!this._data||import("./dialog-mount-3UTDIR2B.js").then(({openEditObjectDialog:t})=>{t(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-3UTDIR2B.js").then(({openCreateTaskDialog:t})=>{t(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let t=s("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(t)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(i){this._error=S(i,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let t=!!this._data.object.archived;if(!t){let i=s("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(i))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:t?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(i){this._error=S(i,this._lang)}finally{this._busy=!1}}_onTaskClick(t){this._entryId&&import("./dialog-mount-3UTDIR2B.js").then(({openTaskQuickActions:i})=>{i(this._entryId,t)})}render(){if(!this._open)return _;let t=this._lang,i=this._data,e=i?.object,n=i?.tasks||[],c=this.hass?.user?.is_admin??!0;return a`
|
||||
<div class="backdrop" @click=${this.close}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true">
|
||||
${i&&e?a`
|
||||
@@ -2873,4 +2892,4 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
.btn ha-icon { --mdc-icon-size: 16px; }
|
||||
.loading { padding: 24px; text-align: center; color: var(--secondary-text-color); }
|
||||
.error { padding: 8px; border-radius: 6px; background: rgba(211,47,47,0.1); color: var(--error-color); font-size: 13px; }
|
||||
`,o([v({attribute:!1})],M.prototype,"hass",2),o([d()],M.prototype,"_open",2),o([d()],M.prototype,"_entryId",2),o([d()],M.prototype,"_data",2),o([d()],M.prototype,"_busy",2),o([d()],M.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",M);var Nt="maintenance-object-dialog",Mt="maintenance-task-dialog",oe="maintenance-history-edit-dialog",le="maintenance-complete-dialog",de="maintenance-qr-dialog",ce="maintenance-task-quick-actions-dialog",pe="maintenance-object-quick-actions-dialog";function X(){return document.querySelector("home-assistant")?.hass}function he(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function D(r){let l=he(),t=l.querySelector(r)??document.body.querySelector(r);return t?t.parentNode!==l&&l.appendChild(t):(t=document.createElement(r),l.appendChild(t)),t}function j(r){let l=X();if(!l)return!1;r.hass=l;let t=S(l);return dt(t)||ct(t).then(()=>{r.requestUpdate?.()}),!0}var at={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7,rowActionStyle:"buttons_compact"};function as(r){return ot(r).then(l=>l.rowActionStyle)}function os(){G=null}var G=null;function ot(r){return G||(G=r.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(l=>({features:l.features??at.features,defaultWarningDays:l.general?.default_warning_days??7,rowActionStyle:l.general?.row_action_style??at.rowActionStyle})).catch(()=>at),G)}function ls(){let r=D(Nt);return j(r)?(r.openCreate(),!0):!1}function ds(r,l){let t=D(Nt);return j(t)?(t.openEdit(r,l),!0):!1}function cs(r="",l){let t=D(Mt);if(!j(t))return!1;let i=X();return i?((async()=>{let e=await ot(i),n=t;n.checklistsEnabled=e.features.checklists,n.scheduleTimeEnabled=e.features.schedule_time,n.completionActionsEnabled=e.features.completion_actions,n.defaultWarningDays=e.defaultWarningDays,n.openCreate(r,l)})(),!0):!1}function ps(r,l){let t=D(Mt);if(!j(t))return!1;let i=X();return i?((async()=>{try{let[e,n]=await Promise.all([i.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:r}),ot(i)]),c=(e.tasks||[]).find(u=>u.id===l);if(!c){console.warn(`openEditTaskDialog: task ${l} not found in entry ${r}`);return}let p=t;p.checklistsEnabled=n.features.checklists,p.scheduleTimeEnabled=n.features.schedule_time,p.completionActionsEnabled=n.features.completion_actions,p.defaultWarningDays=n.defaultWarningDays,await p.openEdit(r,c)}catch(e){console.warn("openEditTaskDialog: failed to load task/features",e)}})(),!0):!1}function hs(r){let l=D(oe);return j(l)?(l.openEdit(r),!0):!1}function us(r){let l=D(le);return j(l)?(Tt(l,r,X()?.language||"en"),!0):!1}function _s(r){let l=D(de);return j(l)?(l.openForTask(r.entry_id,r.task_id,r.object_name,r.task_name),!0):!1}function ms(r,l){let t=D(ce);return j(t)?(t.openFor(r,l),!0):!1}function gs(r){let l=D(pe);return j(l)?(l.openFor(r),!0):!1}export{os as __resetSettingsCacheForTests,as as getRowActionStyle,us as openCompleteDialog,ls as openCreateObjectDialog,cs as openCreateTaskDialog,ds as openEditObjectDialog,ps as openEditTaskDialog,hs as openHistoryEditDialog,gs as openObjectQuickActions,_s as openQrDialog,ms as openTaskQuickActions};
|
||||
`,o([v({attribute:!1})],M.prototype,"hass",2),o([d()],M.prototype,"_open",2),o([d()],M.prototype,"_entryId",2),o([d()],M.prototype,"_data",2),o([d()],M.prototype,"_busy",2),o([d()],M.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",M);var Nt="maintenance-object-dialog",Mt="maintenance-task-dialog",oe="maintenance-history-edit-dialog",le="maintenance-complete-dialog",de="maintenance-qr-dialog",ce="maintenance-task-quick-actions-dialog",pe="maintenance-object-quick-actions-dialog";function X(){return document.querySelector("home-assistant")?.hass}function he(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function j(r){let l=he(),t=l.querySelector(r)??document.body.querySelector(r);return t?t.parentNode!==l&&l.appendChild(t):(t=document.createElement(r),l.appendChild(t)),t}function D(r){let l=X();if(!l)return!1;r.hass=l;let t=T(l);return dt(t)||ct(t).then(()=>{r.requestUpdate?.()}),!0}var at={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7,rowActionStyle:"buttons_compact"};function as(r){return ot(r).then(l=>l.rowActionStyle)}function os(){G=null}var G=null;function ot(r){return G||(G=r.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(l=>({features:l.features??at.features,defaultWarningDays:l.general?.default_warning_days??7,rowActionStyle:l.general?.row_action_style??at.rowActionStyle})).catch(()=>at),G)}function ls(){let r=j(Nt);return D(r)?(r.openCreate(),!0):!1}function ds(r,l){let t=j(Nt);return D(t)?(t.openEdit(r,l),!0):!1}function cs(r="",l){let t=j(Mt);if(!D(t))return!1;let i=X();return i?((async()=>{let e=await ot(i),n=t;n.checklistsEnabled=e.features.checklists,n.scheduleTimeEnabled=e.features.schedule_time,n.completionActionsEnabled=e.features.completion_actions,n.defaultWarningDays=e.defaultWarningDays,n.openCreate(r,l)})(),!0):!1}function ps(r,l){let t=j(Mt);if(!D(t))return!1;let i=X();return i?((async()=>{try{let[e,n]=await Promise.all([i.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:r}),ot(i)]),c=(e.tasks||[]).find(u=>u.id===l);if(!c){console.warn(`openEditTaskDialog: task ${l} not found in entry ${r}`);return}let p=t;p.checklistsEnabled=n.features.checklists,p.scheduleTimeEnabled=n.features.schedule_time,p.completionActionsEnabled=n.features.completion_actions,p.defaultWarningDays=n.defaultWarningDays,await p.openEdit(r,c)}catch(e){console.warn("openEditTaskDialog: failed to load task/features",e)}})(),!0):!1}function hs(r){let l=j(oe);return D(l)?(l.openEdit(r),!0):!1}function us(r){let l=j(le);return D(l)?(St(l,r,X()?.language||"en"),!0):!1}function _s(r){let l=j(de);return D(l)?(l.openForTask(r.entry_id,r.task_id,r.object_name,r.task_name),!0):!1}function ms(r,l){let t=j(ce);return D(t)?(t.openFor(r,l),!0):!1}function gs(r){let l=j(pe);return D(l)?(l.openFor(r),!0):!1}export{os as __resetSettingsCacheForTests,as as getRowActionStyle,us as openCompleteDialog,ls as openCreateObjectDialog,cs as openCreateTaskDialog,ds as openEditObjectDialog,ps as openEditTaskDialog,hs as openHistoryEditDialog,gs as openObjectQuickActions,_s as openQrDialog,ms as openTaskQuickActions};
|
||||
-2873
File diff suppressed because it is too large.
Load diff
-137
@@ -1,137 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.68.0 */
|
||||
import{a as v,b}from"./chunk-KZELY5AU.js";import{a as u,b as s,d as c,e as h,f as g,g as o,i,j as _,l as m,u as p}from"./chunk-IX76Z563.js";import{a}from"./chunk-2QUB5MLN.js";var e=class extends h{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return _(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),m(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/groups"});this._groups=t.groups||{},this._loaded=!0}catch(t){this._error=p(t,this._lang)}}async _addGroup(){if(!this._isAdmin)return;let t=this._newName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/create",name:t}),this._newName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._isAdmin||!this._editingId)return;let t=this._editingName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t}),this._editingId=null,this._editingName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}async _deleteGroup(t,r){if(!this._isAdmin)return;let n=(i("group_delete_confirm",this._lang)||'Delete group "{name}"?').replace("{name}",r);if(window.confirm(n)){this._busy=!0;try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/delete",group_id:t}),await this._load()}catch(d){this._error=p(d,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_groups"),window.dispatchEvent(new CustomEvent("location-changed"))}_onKeyDown(t,r){t.key==="Enter"?(t.preventDefault(),r()):t.key==="Escape"&&(t.preventDefault(),this._editingId=null,this._editingName="")}render(){let t=this._lang;if(!this._loaded)return s`<ha-card><div class="loading">${i("loading",t)||"Loading\u2026"}</div></ha-card>`;let r=Object.keys(this._groups);return s`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">🏷️</span>
|
||||
<span>${this._config.title||i("groups",t)||"Groups"}</span>
|
||||
<span class="count">${r.length}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
${this._error?s`<div class="error">${this._error}</div>`:c}
|
||||
|
||||
${r.length===0?s`<div class="empty">${i("groups_empty",t)||"No groups yet."}</div>`:s`
|
||||
<div class="group-list">
|
||||
${r.map(n=>{let d=this._groups[n],y=d.task_refs?.length??0,f=this._editingId===n;return s`
|
||||
<div class="group-row">
|
||||
${f?s`
|
||||
<input class="edit-input" type="text"
|
||||
.value=${this._editingName}
|
||||
?disabled=${this._busy}
|
||||
@input=${l=>{this._editingName=l.target.value}}
|
||||
@keydown=${l=>this._onKeyDown(l,this._saveEdit.bind(this))} />
|
||||
<button class="btn small primary"
|
||||
@click=${this._saveEdit}
|
||||
?disabled=${this._busy||!this._editingName.trim()}>
|
||||
${i("save",t)||"Save"}
|
||||
</button>
|
||||
<button class="btn small"
|
||||
@click=${()=>{this._editingId=null}}>
|
||||
${i("cancel",t)||"Cancel"}
|
||||
</button>
|
||||
`:s`
|
||||
<span class="group-name">${d.name||"Unnamed"}</span>
|
||||
<span class="task-count">${y}</span>
|
||||
${this._isAdmin?s`
|
||||
<button class="icon-btn"
|
||||
title="${i("edit",t)||"Edit"}"
|
||||
@click=${()=>this._startEdit(n)}
|
||||
?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:pencil"></ha-icon>
|
||||
</button>
|
||||
<button class="icon-btn danger"
|
||||
title="${i("delete",t)||"Delete"}"
|
||||
@click=${()=>this._deleteGroup(n,d.name||"Unnamed")}
|
||||
?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:delete"></ha-icon>
|
||||
</button>
|
||||
`:c}
|
||||
`}
|
||||
</div>
|
||||
`})}
|
||||
</div>
|
||||
`}
|
||||
|
||||
${this._isAdmin?s`
|
||||
<div class="add-row">
|
||||
<input type="text"
|
||||
placeholder="${i("group_new_placeholder",t)||"Add group\u2026"}"
|
||||
.value=${this._newName}
|
||||
?disabled=${this._busy}
|
||||
@input=${n=>{this._newName=n.target.value}}
|
||||
@keydown=${n=>this._onKeyDown(n,this._addGroup.bind(this))} />
|
||||
<button class="btn primary"
|
||||
@click=${this._addGroup}
|
||||
?disabled=${this._busy||!this._newName.trim()}>
|
||||
<ha-icon icon="mdi:plus"></ha-icon>
|
||||
${i("add",t)||"Add"}
|
||||
</button>
|
||||
</div>
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("groups_manage_tasks",t)||"Manage task assignments\u2026"}
|
||||
</button>
|
||||
`:s`
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("groups_open_panel",t)||"Open in panel"}
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};e.styles=[b,u`
|
||||
.count {
|
||||
font-size: 12px; color: var(--secondary-text-color);
|
||||
background: var(--secondary-background-color);
|
||||
padding: 2px 8px; border-radius: 999px;
|
||||
}
|
||||
.empty {
|
||||
padding: 16px; text-align: center;
|
||||
color: var(--secondary-text-color); font-style: italic;
|
||||
}
|
||||
.group-list { display: flex; flex-direction: column; gap: 4px; }
|
||||
.group-row {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
padding: 6px 8px; border-radius: 6px;
|
||||
background: var(--secondary-background-color, rgba(255,255,255,0.03));
|
||||
}
|
||||
.group-name { flex: 1; font-size: 14px; }
|
||||
.task-count {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
background: var(--card-background-color, rgba(0,0,0,0.2));
|
||||
padding: 1px 8px; border-radius: 999px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.edit-input {
|
||||
flex: 1; padding: 4px 8px; font-size: 14px;
|
||||
background: var(--card-background-color, #1c1c1c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--primary-color); border-radius: 4px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.icon-btn {
|
||||
background: transparent; border: none; cursor: pointer;
|
||||
color: var(--secondary-text-color); padding: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.icon-btn:hover {
|
||||
background: var(--state-icon-color, rgba(255,255,255,0.06));
|
||||
color: var(--primary-text-color);
|
||||
}
|
||||
.icon-btn.danger:hover { color: var(--error-color); }
|
||||
.icon-btn ha-icon { --mdc-icon-size: 18px; }
|
||||
.add-row {
|
||||
display: flex; gap: 6px;
|
||||
padding-top: 8px; border-top: 1px solid var(--divider-color);
|
||||
}
|
||||
.add-row input {
|
||||
flex: 1; padding: 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
/* Card-specific overrides on the shared .btn */
|
||||
.btn.small { padding: 4px 8px; font-size: 12px; }
|
||||
.btn ha-icon { --mdc-icon-size: 16px; }
|
||||
`],a([g({attribute:!1})],e.prototype,"hass",2),a([o()],e.prototype,"_config",2),a([o()],e.prototype,"_groups",2),a([o()],e.prototype,"_loaded",2),a([o()],e.prototype,"_busy",2),a([o()],e.prototype,"_error",2),a([o()],e.prototype,"_newName",2),a([o()],e.prototype,"_editingId",2),a([o()],e.prototype,"_editingName",2);customElements.get("maintenance-groups-section-card")||customElements.define("maintenance-groups-section-card",e);v({type:"maintenance-groups-section-card",name:"Maintenance Supporter \u2014 Groups",description:"Inline group CRUD",preview:!1});export{e as MaintenanceGroupsSectionCard};
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.70.0 */
|
||||
import{a as v,b}from"./chunk-ER5MID6O.js";import{a as u,b as s,d as c,e as h,f as g,g as o,i,j as _,l as m,u as p}from"./chunk-JMXXW5KM.js";import{a}from"./chunk-CAQJ66HF.js";var e=class extends h{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return _(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),m(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/groups"});this._groups=t.groups||{},this._loaded=!0}catch(t){this._error=p(t,this._lang)}}async _addGroup(){if(!this._isAdmin)return;let t=this._newName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/create",name:t}),this._newName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._isAdmin||!this._editingId)return;let t=this._editingName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t}),this._editingId=null,this._editingName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}async _deleteGroup(t,r){if(!this._isAdmin)return;let n=(i("group_delete_confirm",this._lang)||'Delete group "{name}"?').replace("{name}",r);if(window.confirm(n)){this._busy=!0;try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/delete",group_id:t}),await this._load()}catch(d){this._error=p(d,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_groups"),window.dispatchEvent(new CustomEvent("location-changed"))}_onKeyDown(t,r){t.key==="Enter"?(t.preventDefault(),r()):t.key==="Escape"&&(t.preventDefault(),this._editingId=null,this._editingName="")}render(){let t=this._lang;if(!this._loaded)return s`<ha-card><div class="loading">${i("loading",t)||"Loading\u2026"}</div></ha-card>`;let r=Object.keys(this._groups);return s`
|
||||
/*! maintenance_supporter frontend 2.71.0 */
|
||||
import{a as v,b}from"./chunk-3OUB5IHO.js";import{a as u,b as s,d as c,e as h,f as g,g as o,i,j as _,l as m,u as p}from"./chunk-MKETKKBB.js";import{a}from"./chunk-DEN57ILL.js";var e=class extends h{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return _(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),m(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/groups"});this._groups=t.groups||{},this._loaded=!0}catch(t){this._error=p(t,this._lang)}}async _addGroup(){if(!this._isAdmin)return;let t=this._newName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/create",name:t}),this._newName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._isAdmin||!this._editingId)return;let t=this._editingName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t}),this._editingId=null,this._editingName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}async _deleteGroup(t,r){if(!this._isAdmin)return;let n=(i("group_delete_confirm",this._lang)||'Delete group "{name}"?').replace("{name}",r);if(window.confirm(n)){this._busy=!0;try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/delete",group_id:t}),await this._load()}catch(d){this._error=p(d,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_groups"),window.dispatchEvent(new CustomEvent("location-changed"))}_onKeyDown(t,r){t.key==="Enter"?(t.preventDefault(),r()):t.key==="Escape"&&(t.preventDefault(),this._editingId=null,this._editingName="")}render(){let t=this._lang;if(!this._loaded)return s`<ha-card><div class="loading">${i("loading",t)||"Loading\u2026"}</div></ha-card>`;let r=Object.keys(this._groups);return s`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
-122
@@ -1,122 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.70.0 */
|
||||
import{a as m,b as g}from"./chunk-ER5MID6O.js";import{a as h,b as n,d as c,e as _,f as v,g as r,i as e,j as f,l as b,u as l}from"./chunk-JMXXW5KM.js";import{a as i}from"./chunk-CAQJ66HF.js";var a=class extends _{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer=7;this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return f(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),b(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/state"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=t.buffer_days??7,this._dirty=!1}catch(t){this._error=l(t,this._lang)}}async _toggleEnabled(t){this._busy=!0,this._error="";try{let s=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",enabled:t});this._state=s}catch(s){this._error=l(s,this._lang)}finally{this._busy=!1}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:this._localBuffer});this._state=t,this._dirty=!1}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}async _endNow(){if(this._isAdmin&&window.confirm(e("vacation_end_now_confirm",this._lang)||"End vacation immediately?")){this._busy=!0;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/end_now"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||""}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,s=this._state;if(!s)return n`<ha-card><div class="loading">${e("loading",t)||"Loading\u2026"}</div></ha-card>`;let p=s.is_active===!0,d=s.enabled===!0,u=s.exempt_task_ids?.length??0,y=p?e("vacation_status_active",t)||"Active now":d?e("vacation_status_scheduled",t)||"Scheduled":e("vacation_status_inactive",t)||"Inactive",$=p?"active":d?"scheduled":"inactive";return n`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">🏖️</span>
|
||||
<span>${this._config.title||e("vacation_mode",t)||"Vacation mode"}</span>
|
||||
</div>
|
||||
<span class="status-pill ${$}">${y}</span>
|
||||
</div>
|
||||
|
||||
${this._error?n`<div class="error">${this._error}</div>`:c}
|
||||
|
||||
${this._isAdmin?n`
|
||||
<div class="row toggle-row">
|
||||
<label>${e("enable",t)||"Enable"}</label>
|
||||
<ha-switch
|
||||
.checked=${d}
|
||||
.disabled=${this._busy}
|
||||
@change=${o=>this._toggleEnabled(o.target.checked)}
|
||||
></ha-switch>
|
||||
</div>
|
||||
|
||||
<div class="dates-row">
|
||||
<div class="date-field">
|
||||
<label>${e("vacation_start",t)||"Start"}</label>
|
||||
<input type="date" .value=${this._localStart}
|
||||
?disabled=${this._busy}
|
||||
@input=${o=>{this._localStart=o.target.value,this._dirty=!0}} />
|
||||
</div>
|
||||
<div class="date-field">
|
||||
<label>${e("vacation_end",t)||"End"}</label>
|
||||
<input type="date" .value=${this._localEnd}
|
||||
?disabled=${this._busy}
|
||||
@input=${o=>{this._localEnd=o.target.value,this._dirty=!0}} />
|
||||
</div>
|
||||
<div class="date-field buffer">
|
||||
<label>${e("vacation_buffer",t)||"Buffer days"}</label>
|
||||
<input type="number" min="0" max="14"
|
||||
.value=${String(this._localBuffer)}
|
||||
?disabled=${this._busy}
|
||||
@input=${o=>{this._localBuffer=parseInt(o.target.value,10)||0,this._dirty=!0}} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
||||
@click=${this._save}
|
||||
?disabled=${this._busy||!this._dirty}>
|
||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
||||
${this._dirty?e("save",t)||"Save":e("saved",t)||"Saved"}
|
||||
</button>
|
||||
${p?n`<button class="btn"
|
||||
@click=${this._endNow}
|
||||
?disabled=${this._busy}>
|
||||
${e("vacation_end_now",t)||"End now"}
|
||||
</button>`:c}
|
||||
${u>0?n`<button class="btn link"
|
||||
@click=${this._onDeepLink}>
|
||||
${u} ${e("vacation_exempt_count",t)||"exempt"}…
|
||||
</button>`:n`<button class="btn link"
|
||||
@click=${this._onDeepLink}>
|
||||
${e("vacation_advanced",t)||"Advanced\u2026"}
|
||||
</button>`}
|
||||
</div>
|
||||
`:n`
|
||||
<div class="readonly">
|
||||
${d&&s.start&&s.end?n`<div>${s.start} → ${s.end}</div>`:c}
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${e("vacation_open_panel",t)||"Open in panel"}
|
||||
</button>
|
||||
</div>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};a.styles=[g,h`
|
||||
.status-pill {
|
||||
font-size: 11px; font-weight: 600;
|
||||
padding: 3px 8px; border-radius: 999px;
|
||||
text-transform: uppercase; letter-spacing: 0.5px;
|
||||
}
|
||||
.status-pill.active {
|
||||
background: rgba(76, 175, 80, 0.15);
|
||||
color: #4caf50;
|
||||
}
|
||||
.status-pill.scheduled {
|
||||
background: rgba(255, 152, 0, 0.15);
|
||||
color: #ff9800;
|
||||
}
|
||||
.status-pill.inactive {
|
||||
background: rgba(158, 158, 158, 0.15);
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
.row.toggle-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
}
|
||||
.row.toggle-row label {
|
||||
font-size: 14px; color: var(--primary-text-color);
|
||||
}
|
||||
.dates-row {
|
||||
display: grid; grid-template-columns: 1fr 1fr 100px; gap: 10px;
|
||||
}
|
||||
.date-field.buffer label { white-space: nowrap; }
|
||||
.date-field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.date-field label {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.3px;
|
||||
}
|
||||
.date-field input {
|
||||
padding: 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.date-field input:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.actions {
|
||||
display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
|
||||
}
|
||||
.readonly { display: flex; flex-direction: column; gap: 8px; }
|
||||
`],i([v({attribute:!1})],a.prototype,"hass",2),i([r()],a.prototype,"_config",2),i([r()],a.prototype,"_state",2),i([r()],a.prototype,"_busy",2),i([r()],a.prototype,"_error",2),i([r()],a.prototype,"_localStart",2),i([r()],a.prototype,"_localEnd",2),i([r()],a.prototype,"_localBuffer",2),i([r()],a.prototype,"_dirty",2);customElements.get("maintenance-vacation-section-card")||customElements.define("maintenance-vacation-section-card",a);m({type:"maintenance-vacation-section-card",name:"Maintenance Supporter \u2014 Vacation",description:"Inline vacation mode toggle + dates",preview:!1});export{a as MaintenanceVacationSectionCard};
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.68.0 */
|
||||
import{a as m,b as g}from"./chunk-KZELY5AU.js";import{a as h,b as n,d as c,e as _,f as v,g as r,i as e,j as f,l as b,u as l}from"./chunk-IX76Z563.js";import{a as i}from"./chunk-2QUB5MLN.js";var a=class extends _{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer=7;this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return f(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),b(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/state"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=t.buffer_days??7,this._dirty=!1}catch(t){this._error=l(t,this._lang)}}async _toggleEnabled(t){this._busy=!0,this._error="";try{let s=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",enabled:t});this._state=s}catch(s){this._error=l(s,this._lang)}finally{this._busy=!1}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:this._localBuffer});this._state=t,this._dirty=!1}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}async _endNow(){if(this._isAdmin&&window.confirm(e("vacation_end_now_confirm",this._lang)||"End vacation immediately?")){this._busy=!0;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/end_now"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||""}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,s=this._state;if(!s)return n`<ha-card><div class="loading">${e("loading",t)||"Loading\u2026"}</div></ha-card>`;let p=s.is_active===!0,d=s.enabled===!0,u=s.exempt_task_ids?.length??0,y=p?e("vacation_status_active",t)||"Active now":d?e("vacation_status_scheduled",t)||"Scheduled":e("vacation_status_inactive",t)||"Inactive",$=p?"active":d?"scheduled":"inactive";return n`
|
||||
/*! maintenance_supporter frontend 2.71.0 */
|
||||
import{a as m,b as g}from"./chunk-3OUB5IHO.js";import{a as h,b as n,d as c,e as _,f as v,g as r,i as e,j as f,l as b,u as l}from"./chunk-MKETKKBB.js";import{a as i}from"./chunk-DEN57ILL.js";var a=class extends _{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer=7;this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return f(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),b(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/state"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=t.buffer_days??7,this._dirty=!1}catch(t){this._error=l(t,this._lang)}}async _toggleEnabled(t){this._busy=!0,this._error="";try{let s=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",enabled:t});this._state=s}catch(s){this._error=l(s,this._lang)}finally{this._busy=!1}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:this._localBuffer});this._state=t,this._dirty=!1}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}async _endNow(){if(this._isAdmin&&window.confirm(e("vacation_end_now_confirm",this._lang)||"End vacation immediately?")){this._busy=!0;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/end_now"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||""}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,s=this._state;if(!s)return n`<ha-card><div class="loading">${e("loading",t)||"Loading\u2026"}</div></ha-card>`;let p=s.is_active===!0,d=s.enabled===!0,u=s.exempt_task_ids?.length??0,y=p?e("vacation_status_active",t)||"Active now":d?e("vacation_status_scheduled",t)||"Scheduled":e("vacation_status_inactive",t)||"Inactive",$=p?"active":d?"scheduled":"inactive";return n`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
Reference in new issue
Block a user