197 files

This commit is contained in:
Home Assistant Version Control committed 2026-08-21 18:53:37 +00:00
1 parent 89d9f5e49b
commit 383e9ed04e
197 files changed
+4386 -1837

No files matched your search

@@ -1,9 +1,9 @@
/*! maintenance_supporter frontend 2.61.0 */
var bt=Object.defineProperty;var Wi=Object.getOwnPropertyDescriptor;var w=(a,r,e)=>()=>{if(e)throw e[0];try{return a&&(r=a(a=0)),r}catch(t){throw e=[t],t}};var Vi=(a,r)=>{for(var e in r)bt(a,e,{get:r[e],enumerable:!0})};var d=(a,r,e,t)=>{for(var i=t>1?void 0:t?Wi(r,e):r,n=a.length-1,o;n>=0;n--)(o=a[n])&&(i=(t?o(r,e,i):o(i))||i);return t&&i&&bt(r,e,i),i};var Ne,He,Je,xt,ye,wt,S,$t,Ze,Xe=w(()=>{Ne=globalThis,He=Ne.ShadowRoot&&(Ne.ShadyCSS===void 0||Ne.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Je=Symbol(),xt=new WeakMap,ye=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Je)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(He&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=xt.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&xt.set(e,r))}return r}toString(){return this.cssText}},wt=a=>new ye(typeof a=="string"?a:a+"",void 0,Je),S=(a,...r)=>{let e=a.length===1?a[0]:r.reduce((t,i,n)=>t+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+a[n+1],a[0]);return new ye(e,a,Je)},$t=(a,r)=>{if(He)a.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=Ne.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,a.appendChild(t)}},Ze=He?a=>a:a=>a instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return wt(e)})(a):a});var Ki,Gi,Yi,Qi,Ji,Zi,qe,kt,Xi,er,be,xe,Me,Et,K,we=w(()=>{Xe();Xe();({is:Ki,defineProperty:Gi,getOwnPropertyDescriptor:Yi,getOwnPropertyNames:Qi,getOwnPropertySymbols:Ji,getPrototypeOf:Zi}=Object),qe=globalThis,kt=qe.trustedTypes,Xi=kt?kt.emptyScript:"",er=qe.reactiveElementPolyfillSupport,be=(a,r)=>a,xe={toAttribute(a,r){switch(r){case Boolean:a=a?Xi:null;break;case Object:case Array:a=a==null?a:JSON.stringify(a)}return a},fromAttribute(a,r){let e=a;switch(r){case Boolean:e=a!==null;break;case Number:e=a===null?null:Number(a);break;case Object:case Array:try{e=JSON.parse(a)}catch{e=null}}return e}},Me=(a,r)=>!Ki(a,r),Et={attribute:!0,type:String,converter:xe,reflect:!1,useDefault:!1,hasChanged:Me};Symbol.metadata??=Symbol("metadata"),qe.litPropertyMetadata??=new WeakMap;K=class extends HTMLElement{static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Et){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&Gi(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:n}=Yi(this.prototype,r)??{get(){return this[e]},set(o){this[e]=o}};return{get:i,set(o){let p=i?.call(this);n?.call(this,o),this.requestUpdate(r,p,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Et}static _$Ei(){if(this.hasOwnProperty(be("elementProperties")))return;let r=Zi(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(be("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(be("properties"))){let e=this.properties,t=[...Qi(e),...Ji(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Ze(i))}else r!==void 0&&e.push(Ze(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.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(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return $t(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=thiLine truncated
/*! maintenance_supporter frontend 2.63.1 */
var bt=Object.defineProperty;var Yi=Object.getOwnPropertyDescriptor;var w=(a,r,e)=>()=>{if(e)throw e[0];try{return a&&(r=a(a=0)),r}catch(t){throw e=[t],t}};var Qi=(a,r)=>{for(var e in r)bt(a,e,{get:r[e],enumerable:!0})};var d=(a,r,e,t)=>{for(var i=t>1?void 0:t?Yi(r,e):r,n=a.length-1,o;n>=0;n--)(o=a[n])&&(i=(t?o(r,e,i):o(i))||i);return t&&i&&bt(r,e,i),i};var je,He,Je,xt,ye,wt,S,$t,Ze,Xe=w(()=>{je=globalThis,He=je.ShadowRoot&&(je.ShadyCSS===void 0||je.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Je=Symbol(),xt=new WeakMap,ye=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Je)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(He&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=xt.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&xt.set(e,r))}return r}toString(){return this.cssText}},wt=a=>new ye(typeof a=="string"?a:a+"",void 0,Je),S=(a,...r)=>{let e=a.length===1?a[0]:r.reduce((t,i,n)=>t+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+a[n+1],a[0]);return new ye(e,a,Je)},$t=(a,r)=>{if(He)a.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=je.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,a.appendChild(t)}},Ze=He?a=>a:a=>a instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return wt(e)})(a):a});var Ji,Zi,Xi,er,tr,ir,qe,kt,rr,sr,be,xe,Me,Et,K,we=w(()=>{Xe();Xe();({is:Ji,defineProperty:Zi,getOwnPropertyDescriptor:Xi,getOwnPropertyNames:er,getOwnPropertySymbols:tr,getPrototypeOf:ir}=Object),qe=globalThis,kt=qe.trustedTypes,rr=kt?kt.emptyScript:"",sr=qe.reactiveElementPolyfillSupport,be=(a,r)=>a,xe={toAttribute(a,r){switch(r){case Boolean:a=a?rr:null;break;case Object:case Array:a=a==null?a:JSON.stringify(a)}return a},fromAttribute(a,r){let e=a;switch(r){case Boolean:e=a!==null;break;case Number:e=a===null?null:Number(a);break;case Object:case Array:try{e=JSON.parse(a)}catch{e=null}}return e}},Me=(a,r)=>!Ji(a,r),Et={attribute:!0,type:String,converter:xe,reflect:!1,useDefault:!1,hasChanged:Me};Symbol.metadata??=Symbol("metadata"),qe.litPropertyMetadata??=new WeakMap;K=class extends HTMLElement{static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Et){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&Zi(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:n}=Xi(this.prototype,r)??{get(){return this[e]},set(o){this[e]=o}};return{get:i,set(o){let p=i?.call(this);n?.call(this,o),this.requestUpdate(r,p,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Et}static _$Ei(){if(this.hasOwnProperty(be("elementProperties")))return;let r=ir(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(be("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(be("properties"))){let e=this.properties,t=[...er(e),...tr(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Ze(i))}else r!==void 0&&e.push(Ze(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.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(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return $t(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=thiLine truncated
\f\r]`,$e=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Tt=/-->/g,Ct=/>/g,ie=RegExp(`>|${et}(?:([^\\s"'>=/]+)(${et}*=${et}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),It=/'/g,Lt=/"/g,Nt=/^(?:script|style|textarea|title)$/i,lt=a=>(r,...e)=>({_$litType$:a,strings:r,values:e}),l=lt(1),_e=lt(2),rs=lt(3),ae=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Pt=new WeakMap,re=se.createTreeWalker(se,129);rr=(a,r)=>{let e=a.length-1,t=[],i,n=r===2?"<svg>":r===3?"<math>":"",o=$e;for(let p=0;p<e;p++){let c=a[p],_,f,m=-1,y=0;for(;y<c.length&&(o.lastIndex=y,f=o.exec(c),f!==null);)y=o.lastIndex,o===$e?f[1]==="!--"?o=Tt:f[1]!==void 0?o=Ct:f[2]!==void 0?(Nt.test(f[2])&&(i=RegExp("</"+f[2],"g")),o=ie):f[3]!==void 0&&(o=ie):o===ie?f[0]===">"?(o=i??$e,m=-1):f[1]===void 0?m=-2:(m=o.lastIndex-f[2].length,_=f[1],o=f[3]===void 0?ie:f[3]==='"'?Lt:It):o===Lt||o===It?o=ie:o===Tt||o===Ct?o=$e:(o=ie,i=void 0);let b=o===ie&&a[p+1].startsWith("/>")?" ":"";n+=o===$e?c+tr:m>=0?(t.push(_),c.slice(0,m)+Rt+c.slice(m)+X+b):c+X+(m===-2?p:b)}return[Ht(a,n+(a[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Se=class a{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let n=0,o=0,p=r.length-1,c=this.parts,[_,f]=rr(r,e);if(this.el=a.createElement(_,t),re.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=re.nextNode())!==null&&c.length<p;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Rt)){let y=f[o++],b=i.getAttribute(m).split(X),k=/([.?@])?(.*)/.exec(y);c.push({type:1,index:n,name:k[2],strings:b,ctor:k[1]==="."?it:k[1]==="?"?rt:k[1]==="@"?st:ue}),i.removeAttribute(m)}else m.startsWith(X)&&(c.push({type:6,index:n}),i.removeAttribute(m));if(Nt.test(i.tagName)){let m=i.textContent.split(X),y=m.length-1;if(y>0){i.textContent=Oe?Oe.emptyScript:"";for(let b=0;b<y;b++)i.append(m[b],ke()),re.nextNode(),c.push({type:2,index:++n});i.append(m[y],ke())}}}else if(i.nodeType===8)if(i.data===jt)c.push({type:2,index:n});else{let m=-1;for(;(m=i.data.indexOf(X,m+1))!==-1;)c.push({type:7,index:n}),m+=X.length-1}n++}}static createElement(r,e){let t=se.createElement("template");return t.innerHTML=r,t}};tt=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??se).importNode(e,!0);re.currentNode=i;let n=re.nextNode(),o=0,p=0,c=t[0];for(;c!==void 0;){if(o===c.index){let _;c.type===2?_=new Ae(n,n.nextSibling,this,r):c.type===1?_=new c.ctor(n,c.name,c.strings,this,r):c.type===6&&(_=new at(n,this,r)),this._$AV.push(_),c=t[++p]}o!==c?.index&&(n=re.nextNode(),o++)}return re.currentNode=se,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},Ae=class a{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=pe(this,r,e),Ee(r)?r===h||r==null||r===""?(this._$AH!==h&&this._$AR(),this._$AH=h):r!==this._$AH&&r!==ae&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):ir(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==h&&Ee(this._$AH)?this._$AA.nextSibling.data=r:this.T(se.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Se.createElement(Ht(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new tt(i,this),o=n.u(this.options);n.p(e),this.T(o),this._$AH=n}}_$AC(r){let e=Pt.get(r.strings);return e===void 0&&Pt.set(r.strings,e=new Se(r)),e}k(r){ot(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of r)i===e.length?e.push(t=new a(this.O(ke()),this.O(ke()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=St(r).nextSibling;St(r).remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},ue=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,n){this.type=1,this._$AH=h,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=h}_$AI(r,e=this,t,i){let n=this.strings,o=!1;if(n===void 0)r=pe(this,r,e,0),o=!Ee(r)||r!==this._$AH&&r!==ae,o&&(this._$AH=r);else{let p=r,c,_;for(r=n[0],c=0;c<n.length-1;c++)_=pe(this,p[t+c],e,c),_===ae&&(_=this._$AH[c]),o||=!Ee(_)||_!==this._$AH[c],_===h?r=h:r!==h&&(r+=(_??"")+n[c+1]),this._$AH[c]=_}o&&!i&&this.j(r)}j(r){r===h?this.element.removeAttribute(this.name):thiLine truncated
\f\r"'\`<>=]|("|')|))|$)`,"g"),It=/'/g,Lt=/"/g,jt=/^(?:script|style|textarea|title)$/i,lt=a=>(r,...e)=>({_$litType$:a,strings:r,values:e}),l=lt(1),_e=lt(2),ds=lt(3),ae=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Pt=new WeakMap,re=se.createTreeWalker(se,129);or=(a,r)=>{let e=a.length-1,t=[],i,n=r===2?"<svg>":r===3?"<math>":"",o=$e;for(let p=0;p<e;p++){let c=a[p],u,f,m=-1,y=0;for(;y<c.length&&(o.lastIndex=y,f=o.exec(c),f!==null);)y=o.lastIndex,o===$e?f[1]==="!--"?o=Tt:f[1]!==void 0?o=Ct:f[2]!==void 0?(jt.test(f[2])&&(i=RegExp("</"+f[2],"g")),o=ie):f[3]!==void 0&&(o=ie):o===ie?f[0]===">"?(o=i??$e,m=-1):f[1]===void 0?m=-2:(m=o.lastIndex-f[2].length,u=f[1],o=f[3]===void 0?ie:f[3]==='"'?Lt:It):o===Lt||o===It?o=ie:o===Tt||o===Ct?o=$e:(o=ie,i=void 0);let b=o===ie&&a[p+1].startsWith("/>")?" ":"";n+=o===$e?c+ar:m>=0?(t.push(u),c.slice(0,m)+Rt+c.slice(m)+X+b):c+X+(m===-2?p:b)}return[Ht(a,n+(a[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Se=class a{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let n=0,o=0,p=r.length-1,c=this.parts,[u,f]=or(r,e);if(this.el=a.createElement(u,t),re.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=re.nextNode())!==null&&c.length<p;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Rt)){let y=f[o++],b=i.getAttribute(m).split(X),k=/([.?@])?(.*)/.exec(y);c.push({type:1,index:n,name:k[2],strings:b,ctor:k[1]==="."?it:k[1]==="?"?rt:k[1]==="@"?st:ue}),i.removeAttribute(m)}else m.startsWith(X)&&(c.push({type:6,index:n}),i.removeAttribute(m));if(jt.test(i.tagName)){let m=i.textContent.split(X),y=m.length-1;if(y>0){i.textContent=Oe?Oe.emptyScript:"";for(let b=0;b<y;b++)i.append(m[b],ke()),re.nextNode(),c.push({type:2,index:++n});i.append(m[y],ke())}}}else if(i.nodeType===8)if(i.data===Nt)c.push({type:2,index:n});else{let m=-1;for(;(m=i.data.indexOf(X,m+1))!==-1;)c.push({type:7,index:n}),m+=X.length-1}n++}}static createElement(r,e){let t=se.createElement("template");return t.innerHTML=r,t}};tt=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??se).importNode(e,!0);re.currentNode=i;let n=re.nextNode(),o=0,p=0,c=t[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Ae(n,n.nextSibling,this,r):c.type===1?u=new c.ctor(n,c.name,c.strings,this,r):c.type===6&&(u=new at(n,this,r)),this._$AV.push(u),c=t[++p]}o!==c?.index&&(n=re.nextNode(),o++)}return re.currentNode=se,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},Ae=class a{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=pe(this,r,e),Ee(r)?r===h||r==null||r===""?(this._$AH!==h&&this._$AR(),this._$AH=h):r!==this._$AH&&r!==ae&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):nr(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==h&&Ee(this._$AH)?this._$AA.nextSibling.data=r:this.T(se.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Se.createElement(Ht(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new tt(i,this),o=n.u(this.options);n.p(e),this.T(o),this._$AH=n}}_$AC(r){let e=Pt.get(r.strings);return e===void 0&&Pt.set(r.strings,e=new Se(r)),e}k(r){ot(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of r)i===e.length?e.push(t=new a(this.O(ke()),this.O(ke()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=St(r).nextSibling;St(r).remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},ue=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,n){this.type=1,this._$AH=h,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=h}_$AI(r,e=this,t,i){let n=this.strings,o=!1;if(n===void 0)r=pe(this,r,e,0),o=!Ee(r)||r!==this._$AH&&r!==ae,o&&(this._$AH=r);else{let p=r,c,u;for(r=n[0],c=0;c<n.length-1;c++)u=pe(this,p[t+c],e,c),u===ae&&(u=this._$AH[c]),o||=!Ee(u)||u!==this._$AH[c],u===h?r=h:r!==h&&(r+=(u??"")+n[c+1]),this._$AH[c]=u}o&&!i&&this.j(r)}j(r){r===h?this.element.removeAttribute(this.name):thiLine 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)",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",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",m 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)",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",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",m Line truncated
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; color: var(--secondary-text-color); }
.field-input {
@@ -755,48 +755,9 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.confidence-dot.medium { background: var(--warning-color, #ff9800); }
.confidence-dot.high { background: var(--success-color, #4caf50); }
/* Feedback toggle buttons in complete dialog */
.feedback-section {
display: flex;
flex-direction: column;
gap: 8px;
padding: 8px 0;
border-top: 1px solid var(--divider-color);
}
.feedback-label {
font-weight: 500;
font-size: 13px;
color: var(--secondary-text-color);
}
.feedback-buttons {
display: flex;
gap: 8px;
}
.feedback-btn {
flex: 1;
padding: 8px 12px;
border: 1px solid var(--divider-color);
border-radius: 8px;
background: var(--card-background-color, #fff);
color: var(--primary-text-color);
font-size: 13px;
cursor: pointer;
text-align: center;
transition: all 0.2s;
}
.feedback-btn:hover {
background: var(--secondary-background-color, #f5f5f5);
}
.feedback-btn.selected {
background: var(--primary-color);
color: var(--text-primary-color, #fff);
border-color: var(--primary-color);
}
/* (The complete-dialog's .feedback-* rules live in complete-dialog.ts —
this sheet carried a dead byte-identical copy until the 2026-08 drift
audit; complete-dialog never imports sharedStyles.) */
/* Seasonal chart */
.seasonal-chart {
@@ -1157,7 +1118,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; }
}
`});function br(a,r){let e=yr[a];if(!e)return a;let t=s(e,r);return t&&t!==e?t:a}function xr(a){let e=a.match(/data\['([^']+)'\]/)?.[1],t;return(t=a.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=a.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=a.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=a.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(a)?{field:e,rule:"required"}:(t=a.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(a)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(a)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function j(a,r,e){if(e=e??s("action_error",r),typeof a=="string")return a;if(typeof a!="object"||a===null)return e;let t=a,i=t.message||t.error?.message||"";if(!i)return e;let n=xr(i),o=n.field?br(n.field,r):"",p=c=>s(c,r).replace("{field}",o).replace("{n}",n.param??"");switch(n.rule){case"too_long":return p("err_too_long");case"too_short":return p("err_too_short");case"value_too_high":return p("err_value_too_high");case"value_too_low":return p("err_value_too_low");case"required":return p("err_required");case"wrong_type":return p("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return p("err_invalid_choice");case"invalid_value":return p("err_invalid_value");default:return i||e}}var yr,oe=w(()=>{"use strict";R();yr={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"}});var N,ut=w(()=>{"use strict";P();U();N=class extends A{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(e){let t=e.target.value;this.value=t,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){return l`
`});function Sr(a,r){let e=Er[a];if(!e)return a;let t=s(e,r);return t&&t!==e?t:a}function Ar(a){let e=a.match(/data\['([^']+)'\]/)?.[1],t;return(t=a.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=a.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=a.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=a.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(a)?{field:e,rule:"required"}:(t=a.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(a)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(a)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function N(a,r,e){if(e=e??s("action_error",r),typeof a=="string")return a;if(typeof a!="object"||a===null)return e;let t=a,i=t.message||t.error?.message||"";if(!i)return e;let n=Ar(i),o=n.field?Sr(n.field,r):"",p=c=>s(c,r).replace("{field}",o).replace("{n}",n.param??"");switch(n.rule){case"too_long":return p("err_too_long");case"too_short":return p("err_too_short");case"value_too_high":return p("err_value_too_high");case"value_too_low":return p("err_value_too_low");case"required":return p("err_required");case"wrong_type":return p("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return p("err_invalid_choice");case"invalid_value":return p("err_invalid_value");default:return i||e}}var Er,oe=w(()=>{"use strict";R();Er={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"}});var H,ut=w(()=>{"use strict";P();U();H=class extends A{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(e){let t=e.target.value;this.value=t,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){return l`
<label class="field">
${this.label?l`<span class="label">${this.label}${this.required?l`<span class="req">*</span>`:h}</span>`:h}
<input
@@ -1175,7 +1136,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
/>
${this.helper?l`<span class="helper">${this.helper}</span>`:h}
</label>
`}};N.styles=S`
`}};H.styles=S`
:host { display: block; }
.field {
display: flex;
@@ -1209,7 +1170,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
color: var(--secondary-text-color);
font-style: italic;
}
`,d([x()],N.prototype,"label",2),d([x()],N.prototype,"value",2),d([x()],N.prototype,"placeholder",2),d([x()],N.prototype,"type",2),d([x({type:Boolean})],N.prototype,"required",2),d([x({type:Boolean})],N.prototype,"disabled",2),d([x()],N.prototype,"step",2),d([x()],N.prototype,"min",2),d([x()],N.prototype,"max",2),d([x()],N.prototype,"pattern",2),d([x()],N.prototype,"helper",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",N)});var T,_i=w(()=>{"use strict";P();U();R();oe();ut();T=class extends A{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 H(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(e,t){this._entryId=e,this._name=t.name||"",this._manufacturer=t.manufacturer||"",this._model=t.model||"",this._serialNumber=t.serial_number||"",this._areaId=t.area_id||"",this._installationDate=t.installation_date||"",this._warrantyExpiry=t.warranty_expiry||"",this._documentationUrl=t.documentation_url||"",this._notes=t.notes||"",this._haDeviceId=t.ha_device_id||"",this._parentEntryId=t.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(e){this._error=j(e,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(e=>e.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return l``;let e=this._lang,t=this._entryId?s("edit_object",e):s("new_object",e);return l`
`,d([x()],H.prototype,"label",2),d([x()],H.prototype,"value",2),d([x()],H.prototype,"placeholder",2),d([x()],H.prototype,"type",2),d([x({type:Boolean})],H.prototype,"required",2),d([x({type:Boolean})],H.prototype,"disabled",2),d([x()],H.prototype,"step",2),d([x()],H.prototype,"min",2),d([x()],H.prototype,"max",2),d([x()],H.prototype,"pattern",2),d([x()],H.prototype,"helper",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",H)});var T,gi=w(()=>{"use strict";P();U();R();oe();ut();T=class extends A{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 j(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(e,t){this._entryId=e,this._name=t.name||"",this._manufacturer=t.manufacturer||"",this._model=t.model||"",this._serialNumber=t.serial_number||"",this._areaId=t.area_id||"",this._installationDate=t.installation_date||"",this._warrantyExpiry=t.warranty_expiry||"",this._documentationUrl=t.documentation_url||"",this._notes=t.notes||"",this._haDeviceId=t.ha_device_id||"",this._parentEntryId=t.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(e){this._error=N(e,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(e=>e.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return l``;let e=this._lang,t=this._entryId?s("edit_object",e):s("new_object",e);return l`
<ha-dialog open @closed=${this._close}>
<div class="dialog-title">${t}</div>
<div class="content">
@@ -1350,8 +1311,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
color: var(--error-color, #f44336);
font-size: 13px;
}
`,d([x({attribute:!1})],T.prototype,"hass",2),d([x({attribute:!1})],T.prototype,"objects",2),d([u()],T.prototype,"_open",2),d([u()],T.prototype,"_loading",2),d([u()],T.prototype,"_error",2),d([u()],T.prototype,"_name",2),d([u()],T.prototype,"_manufacturer",2),d([u()],T.prototype,"_model",2),d([u()],T.prototype,"_serialNumber",2),d([u()],T.prototype,"_areaId",2),d([u()],T.prototype,"_installationDate",2),d([u()],T.prototype,"_warrantyExpiry",2),d([u()],T.prototype,"_documentationUrl",2),d([u()],T.prototype,"_notes",2),d([u()],T.prototype,"_haDeviceId",2),d([u()],T.prototype,"_parentEntryId",2),d([u()],T.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",T)});var Ke,hi=w(()=>{"use strict";Ke=class{constructor(r){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=r}updateHass(r){this.hass=r}async getUsers(r=!1){let e=Date.now();if(!r&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(r,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:r,task_id:e,user_id:t})}async getTasksByUser(r){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:r})).tasks}getUserName(r){return!r||!this.usersCache?null:this.usersCache.find(t=>t.id===r)?.name||null}getUser(r){return!r||!this.usersCache?null:this.usersCache.find(e=>e.id===r)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(r){return r?r===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function ee(a){return`${a.entry_id??""}\0${a.part_id}`}var _t=w(()=>{"use strict";R()});var ht,gi,mi,fi=w(()=>{"use strict";ht=["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"],gi=["sensor"],mi=["temperature","humidity","pressure"]});var vi,Ge,gt=w(()=>{"use strict";vi=["notes","cost","duration","photo","user"],Ge={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"}});function Sr(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}function Tr(a){return{entityIds:(a.entity_ids||(a.entity_id?[a.entity_id]:[])).join(", "),type:a.type||"threshold",attribute:a.attribute||"",above:a.trigger_above?.toString()??"",below:a.trigger_below?.toString()??"",equals:a.trigger_equals?.toString()??"",notEquals:a.trigger_not_equals?.toString()??"",forMinutes:a.trigger_for_minutes?.toString()??"0",targetValue:a.trigger_target_value?.toString()??"",deltaMode:a.trigger_delta_mode||!1,fromState:a.trigger_from_state||"",toState:a.trigger_to_state||"",targetChanges:a.trigger_target_changes?.toString()??"",runtimeHours:a.trigger_runtime_hours?.toString()??"",onStates:(a.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(a).filter(([e])=>!Ar.has(e)&&!e.startsWith("_")))}}function Cr(a){let r=a.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(r.length===0)return null;let e={...a.carry||{},entity_id:r[0],entity_ids:r,type:a.type};if(a.attribute&&(e.attribute=a.attribute),a.type==="threshold"){let t=parseFloat(a.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(a.below);isNaN(i)||(e.trigger_below=i);let n=parseFloat(a.equals);isNaN(n)||(e.trigger_equals=n);let o=parseFloat(a.notEquals);isNaN(o)||(e.trigger_not_equals=o);let p=parseInt(a.forMinutes,10);isNaN(p)||(e.trigger_for_minutes=p)}else if(a.type==="counter"){let t=parseFloat(a.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=a.deltaMode}else if(a.type==="state_change"){a.fromState&&(e.trigger_from_state=a.fromState),a.toState&&(e.trigger_to_state=a.toState);let t=parseInt(a.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(a.type==="runtime"){let t=parseFloat(a.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t);let i=(a.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);i.length>0&&(e.trigger_on_states=i)}return e}function Ir(a){return Array.from({length:7},(r,e)=>Pe(e,a,"short"))}function Lr(a){let r=new Intl.DateTimeFormat(a||"en",{month:"short"});return Array.from({length:12},(e,t)=>r.format(new Date(2021,t,1)))}var wr,$r,kr,mt,yi,Er,Y,Ar,g,ft,bi=w(()=>{"use strict";P();U();R();hi();_t();fi();oe();gt();ut();wr=["cleaning","inspection","replacement","calibration","service","reading","custom"],$r=["low","normal","high"],kr=["time_based","weekdays","nth_weekday","day_of_month"," Line truncated
`),this._requiredCompletion=[...t.required_completion_fields||[]],this._scheduleTime=t.schedule_time||"";let o=t.on_complete_action;if(o&&o.service){this._actionService=o.service;let _=o.target?.entity_id;this._actionTargetEntity=Array.isArray(_)?_[0]||"":_||"",this._actionData=o.data&&typeof o.data=="object"?{...o.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let p=t.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 c=t.adaptive_config||{};if(this._environmentalEntity=c.environmental_entity||"",this._environmentalAttribute=c.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!c.enabled,this._adaptiveAlpha=c.ewa_alpha?.toString()??Y.alpha,this._adaptiveMin=c.min_interval_days?.toString()??Y.min,this._adaptiveMax=c.max_interval_days?.toString()??Y.max,this._adaptiveSeasonal=c.seasonal_enabled!==!1,this._adaptivePrediction=c.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),t.trigger_config){let _=t.trigger_config;this._triggerEntityId=_.entity_id||_.entity_ids&&_.entity_ids[0]||"",this._triggerEntityIds=_.entity_ids||(_.entity_id?[_.entity_id]:[]),this._triggerEntityLogic=_.entity_logic||"any",this._triggerAttribute=_.attribute||"",this._triggerType=_.type||"threshold",this._triggerAbove=_.trigger_above?.toString()||"",this._triggerBelow=_.trigger_below?.toString()||"",this._triggerEquals=_.trigger_equals?.toString()||"",this._triggerNotEquals=_.trigger_not_equals?.toString()||"",this._triggerForMinutes=_.trigger_for_minutes?.toString()||"0",this._triggerCombinator=_.trigger_combinator==="all"?"all":"any",this._triggerTargetValue=_.trigger_target_value?.toString()||"",this._triggerDeltaMode=_.trigger_delta_mode||!1,this._triggerBaselineValue=_.trigger_baseline_value?.toString()||"",this._liveBaselineValue=t.trigger_baseline_value??null,this._autoCompleteOnRecovery=_.auto_complete_on_recovery||!1,this._triggerFromState=_.trigger_from_state||"",this._triggerToState=_.trigger_to_state||"",this._triggerTargetChanges=_.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=_.trigger_runtime_hours?.toString()||"",this._triggerOnStates=(_.trigger_on_states||[]).join(", "),_.type==="compound"?(this._compoundLogic=_.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(_.conditions||[]).map(Tr)):(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._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._requiredCompletion=[],this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=Y.alpha,this._adaptiveMin=Y.min,this._adaptiveMax=Y.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._triggerForMinutes="0",this._triggerCombinator="any",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._triggerBaselineValue="",this._liveBaselineValue=null,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._triggerOnStates="",this._comp Line truncated
`,d([x({attribute:!1})],T.prototype,"hass",2),d([x({attribute:!1})],T.prototype,"objects",2),d([_()],T.prototype,"_open",2),d([_()],T.prototype,"_loading",2),d([_()],T.prototype,"_error",2),d([_()],T.prototype,"_name",2),d([_()],T.prototype,"_manufacturer",2),d([_()],T.prototype,"_model",2),d([_()],T.prototype,"_serialNumber",2),d([_()],T.prototype,"_areaId",2),d([_()],T.prototype,"_installationDate",2),d([_()],T.prototype,"_warrantyExpiry",2),d([_()],T.prototype,"_documentationUrl",2),d([_()],T.prototype,"_notes",2),d([_()],T.prototype,"_haDeviceId",2),d([_()],T.prototype,"_parentEntryId",2),d([_()],T.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",T)});var Ke,mi=w(()=>{"use strict";Ke=class{constructor(r){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=r}updateHass(r){this.hass=r}async getUsers(r=!1){let e=Date.now();if(!r&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(r,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:r,task_id:e,user_id:t})}async getTasksByUser(r){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:r})).tasks}getUserName(r){return!r||!this.usersCache?null:this.usersCache.find(t=>t.id===r)?.name||null}getUser(r){return!r||!this.usersCache?null:this.usersCache.find(e=>e.id===r)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(r){return r?r===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function ee(a){return`${a.entry_id??""}\0${a.part_id}`}var _t=w(()=>{"use strict";R()});var ht,fi,vi,yi=w(()=>{"use strict";ht=["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"],fi=["sensor"],vi=["temperature","humidity","pressure"]});var bi,Ge,gt=w(()=>{"use strict";bi=["notes","cost","duration","photo","user"],Ge={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"}});function Pr(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}function Nr(a){return{entityIds:(a.entity_ids||(a.entity_id?[a.entity_id]:[])).join(", "),type:a.type||"threshold",attribute:a.attribute||"",above:a.trigger_above?.toString()??"",below:a.trigger_below?.toString()??"",equals:a.trigger_equals?.toString()??"",notEquals:a.trigger_not_equals?.toString()??"",forMinutes:a.trigger_for_minutes?.toString()??"0",targetValue:a.trigger_target_value?.toString()??"",deltaMode:a.trigger_delta_mode||!1,fromState:a.trigger_from_state||"",toState:a.trigger_to_state||"",targetChanges:a.trigger_target_changes?.toString()??"",runtimeHours:a.trigger_runtime_hours?.toString()??"",onStates:(a.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(a).filter(([e])=>!Rr.has(e)&&!e.startsWith("_")))}}function jr(a){let r=a.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(r.length===0)return null;let e={...a.carry||{},entity_id:r[0],entity_ids:r,type:a.type};if(a.attribute&&(e.attribute=a.attribute),a.type==="threshold"){let t=parseFloat(a.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(a.below);isNaN(i)||(e.trigger_below=i);let n=parseFloat(a.equals);isNaN(n)||(e.trigger_equals=n);let o=parseFloat(a.notEquals);isNaN(o)||(e.trigger_not_equals=o);let p=parseInt(a.forMinutes,10);isNaN(p)||(e.trigger_for_minutes=p)}else if(a.type==="counter"){let t=parseFloat(a.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=a.deltaMode}else if(a.type==="state_change"){a.fromState&&(e.trigger_from_state=a.fromState),a.toState&&(e.trigger_to_state=a.toState);let t=parseInt(a.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(a.type==="runtime"){let t=parseFloat(a.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t);let i=(a.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);i.length>0&&(e.trigger_on_states=i)}return e}function Hr(a){return Array.from({length:7},(r,e)=>Pe(e,a,"short"))}function qr(a){let r=new Intl.DateTimeFormat(a||"en",{month:"short"});return Array.from({length:12},(e,t)=>r.format(new Date(2021,t,1)))}var Tr,Cr,Ir,mt,xi,Lr,Y,Rr,g,ft,wi=w(()=>{"use strict";P();U();R();mi();_t();yi();oe();gt();ut();Tr=["cleaning","inspection","replacement","calibration","service","reading","custom"],Cr=["low","normal","high"],Ir=["time_based","weekdays","nth_weekday","day_of_month"," Line truncated
`),this._requiredCompletion=[...t.required_completion_fields||[]],this._scheduleTime=t.schedule_time||"";let o=t.on_complete_action;if(o&&o.service){this._actionService=o.service;let u=o.target?.entity_id;this._actionTargetEntity=Array.isArray(u)?u[0]||"":u||"",this._actionData=o.data&&typeof o.data=="object"?{...o.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let p=t.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 c=t.adaptive_config||{};if(this._environmentalEntity=c.environmental_entity||"",this._environmentalAttribute=c.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!c.enabled,this._adaptiveAlpha=c.ewa_alpha?.toString()??Y.alpha,this._adaptiveMin=c.min_interval_days?.toString()??Y.min,this._adaptiveMax=c.max_interval_days?.toString()??Y.max,this._adaptiveSeasonal=c.seasonal_enabled!==!1,this._adaptivePrediction=c.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),t.trigger_config){let u=t.trigger_config;this._triggerEntityId=u.entity_id||u.entity_ids&&u.entity_ids[0]||"",this._triggerEntityIds=u.entity_ids||(u.entity_id?[u.entity_id]:[]),this._triggerEntityLogic=u.entity_logic||"any",this._triggerAttribute=u.attribute||"",this._triggerType=u.type||"threshold",this._triggerAbove=u.trigger_above?.toString()||"",this._triggerBelow=u.trigger_below?.toString()||"",this._triggerEquals=u.trigger_equals?.toString()||"",this._triggerNotEquals=u.trigger_not_equals?.toString()||"",this._triggerForMinutes=u.trigger_for_minutes?.toString()||"0",this._triggerCombinator=u.trigger_combinator==="all"?"all":"any",this._triggerTargetValue=u.trigger_target_value?.toString()||"",this._triggerDeltaMode=u.trigger_delta_mode||!1,this._triggerBaselineValue=u.trigger_baseline_value?.toString()||"",this._liveBaselineValue=t.trigger_baseline_value??null,this._autoCompleteOnRecovery=u.auto_complete_on_recovery||!1,this._triggerFromState=u.trigger_from_state||"",this._triggerToState=u.trigger_to_state||"",this._triggerTargetChanges=u.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=u.trigger_runtime_hours?.toString()||"",this._triggerOnStates=(u.trigger_on_states||[]).join(", "),u.type==="compound"?(this._compoundLogic=u.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(u.conditions||[]).map(Nr)):(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._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._requiredCompletion=[],this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=Y.alpha,this._adaptiveMin=Y.min,this._adaptiveMax=Y.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._triggerForMinutes="0",this._triggerCombinator="any",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._triggerBaselineValue="",this._liveBaselineValue=null,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._triggerOnStates="",this._comp Line truncated
<details class="ca-section">
<summary>${s("on_complete_action_title",e)}</summary>
<p class="field-help">${s("on_complete_action_desc",e)}</p>
@@ -1447,8 +1408,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
@input=${p=>{let c=parseFloat(p.target.value);this._consumesParts={...this._consumesParts,[i]:{...o,quantity:Number.isFinite(c)&&c>=.01?c:1}}}}
/>`:h}
</div>
`}_toggleRequired(e,t){let i=new Set(this._requiredCompletion);t?i.add(e):i.delete(e),this._requiredCompletion=[...i]}async _save(){if(!this._loading&&this._name.trim()){if(this._adaptiveSnapshot()!==this._adaptiveInitial){let e=parseInt(this._adaptiveMin,10),t=parseInt(this._adaptiveMax,10);if(!isNaN(e)&&!isNaN(t)&&e>t){this._error=`${s("adaptive_min_interval",this._lang)} > ${s("adaptive_max_interval",this._lang)}`;return}}this._loading=!0,this._error="";try{let e={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))},t=this._earliestCompletionDays.trim();if(e.earliest_completion_days=t===""?null:Math.max(0,parseInt(t,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):mt.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.priority=this._priority,e.labels=this._labels.split(",").map(p=>p.trim()).filter(Boolean),e.enabled=this._enabled,e.last_performed=this._lastPerformed||null,e.nfc_tag_id=this._nfcTagId||null,e.reading_unit=this._readingUnit.trim()||null,(this.parts.length||this._foreignOwners.length)&&(e.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})),e.responsible_user_id=this._responsibleUserId,e.assignee_pool=this._assigneePool,e.required_completion_fields=this._requiredCompletion,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let p=this._compoundConditions.map(Cr).filter(c=>c!==null);if(p.length>0){let c={type:"compound",compound_logic:this._compoundLogic,conditions:p};this._autoCompleteOnRecovery&&(c.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(c.trigger_combinator="all"),e.trigger_config=c}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let p=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],c={entity_id:p[0],entity_ids:p,type:this._triggerType};if(this._triggerAttribute&&(c.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(c.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(c.trigger_combinator="all"),p.length>1&&(c.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let _=parseFloat(this._triggerAbove);isNaN(_)||(c.trigger_above=_)}if(this._triggerBelow){let _=parseFloat(this._triggerBelow);isNaN(_)||(c.trigger_below=_)}if(this._triggerEquals){let _=parseFloat(this._triggerEquals);isNaN(_)||(c.trigger_equals=_)}if(this._triggerNotEquals){let _=parseFloat(this._triggerNotEquals);isNaN(_)||(c.trigger_not_equals=_)}if(this._triggerForMinutes){let _=parseInt(this._triggerForMinutes,10);isNaN(_)||(c.trigger_for_minutes=_)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let _=parseFloat(this._triggerTargetValue);isNaN(_)||(c.trigger_target_value=_)}if(c.trigger_delta_mode=this._triggerDeltaMode,this._triggerDeltaMode&&this._triggerBaselineValue){let _=parseFloat(this._triggerBaselineValue);!isNaN(_)&&_>=0&&(c.trigger_baseline_value=_)}}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(c.trigger_from_state=this._triggerFromState),this._triggerToState&&(c.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let _=parseInt(this._triggerTargetChanges,10);isNaN(_)||(c.trigger_target_changes=_)}}else if(this._triggerType==="runtime"){if(this._triggerRuntimeHours){let f=parseFloat(this._triggerRuntimeHours);isNaN(f)||(c.trigger_runtime_hours=f)}let _=this._triggerOnStates.split(",").map(f=>f.trim()).filter(Boolean);_.length>0&&(c.trigger_on_states=_)}e.trigger_config=c}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let p=this._scheduleTime.trim();e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(p)?p:null}if(this.checklistsEnabled){let p=this._checklistText.split(`
`).map(c=>c.trim()).filter(Boolean).slice(0,100);e.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 m={service:p},y=this._actionTargetEntity.trim();y&&(m.target={entity_id:y});let b=this._buildActionData();Object.keys(b).length>0&&(m.data=b),e.on_complete_action=m}else e.on_complete_action=null;let c={};this._qcNotes.trim()&&(c.notes=this._qcNotes.trim());let _=parseFloat(this._qcCost);!isNaN(_)&&_>=0&&(c.cost=_);let f=parseInt(this._qcDuration,10);!isNaN(f)&&f>=0&&(c.duration=f),this._qcFeedback&&(c.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(c).length?c:null}let i=await this.hass.connection.sendMessagePromise(e),n=this._taskId||i?.task_id,o=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(n&&this._scheduleType==="sensor_based"&&o)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),c=parseInt(this._adaptiveMin,10),_=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(c)&&c>=1?{min_interval_days:c}:{},...!isNaN(_)&&_>=1?{max_interval_days:_}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction}),this._adaptiveInitial=this._adaptiveSnapshot()}catch{}}this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}catch(e){this._error=j(e,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 h;let e=this._lang,t=this._triggerType==="compound";return l`
`}_toggleRequired(e,t){let i=new Set(this._requiredCompletion);t?i.add(e):i.delete(e),this._requiredCompletion=[...i]}async _save(){if(!this._loading&&this._name.trim()){if(this._adaptiveSnapshot()!==this._adaptiveInitial){let e=parseInt(this._adaptiveMin,10),t=parseInt(this._adaptiveMax,10);if(!isNaN(e)&&!isNaN(t)&&e>t){this._error=`${s("adaptive_min_interval",this._lang)} > ${s("adaptive_max_interval",this._lang)}`;return}}this._loading=!0,this._error="";try{let e={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))},t=this._earliestCompletionDays.trim();if(e.earliest_completion_days=t===""?null:Math.max(0,parseInt(t,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):mt.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.priority=this._priority,e.labels=this._labels.split(",").map(p=>p.trim()).filter(Boolean),e.enabled=this._enabled,e.last_performed=this._lastPerformed||null,e.nfc_tag_id=this._nfcTagId||null,e.reading_unit=this._readingUnit.trim()||null,(this.parts.length||this._foreignOwners.length)&&(e.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})),e.responsible_user_id=this._responsibleUserId,e.assignee_pool=this._assigneePool,e.required_completion_fields=this._requiredCompletion,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let p=this._compoundConditions.map(jr).filter(c=>c!==null);if(p.length>0){let c={type:"compound",compound_logic:this._compoundLogic,conditions:p};this._autoCompleteOnRecovery&&(c.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(c.trigger_combinator="all"),e.trigger_config=c}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let p=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],c={entity_id:p[0],entity_ids:p,type:this._triggerType};if(this._triggerAttribute&&(c.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(c.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(c.trigger_combinator="all"),p.length>1&&(c.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let u=parseFloat(this._triggerAbove);isNaN(u)||(c.trigger_above=u)}if(this._triggerBelow){let u=parseFloat(this._triggerBelow);isNaN(u)||(c.trigger_below=u)}if(this._triggerEquals){let u=parseFloat(this._triggerEquals);isNaN(u)||(c.trigger_equals=u)}if(this._triggerNotEquals){let u=parseFloat(this._triggerNotEquals);isNaN(u)||(c.trigger_not_equals=u)}if(this._triggerForMinutes){let u=parseInt(this._triggerForMinutes,10);isNaN(u)||(c.trigger_for_minutes=u)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let u=parseFloat(this._triggerTargetValue);isNaN(u)||(c.trigger_target_value=u)}if(c.trigger_delta_mode=this._triggerDeltaMode,this._triggerDeltaMode&&this._triggerBaselineValue){let u=parseFloat(this._triggerBaselineValue);!isNaN(u)&&u>=0&&(c.trigger_baseline_value=u)}}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(c.trigger_from_state=this._triggerFromState),this._triggerToState&&(c.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let u=parseInt(this._triggerTargetChanges,10);isNaN(u)||(c.trigger_target_changes=u)}if(this._triggerForMinutes){let u=parseInt(this._triggerForMinutes,10);isNaN(u)||(c.trigger_for_minutes=u)}}else if(this._triggerType==="runtime"){if(this._triggerRuntimeHours){let f=parseFloat(this._triggerRuntimeHours);isNaN(f)||(c.trigger_runtime_hours=f)}let u=this._triggerOnStates.split(",").map(f=>f.trim()).filter(Boolean);u.length>0&&(c.trigger_on_states=u)}e.trigger_config=c}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let p=this._scheduleTime.trim();e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(p)?p:null}if(this.checklistsEnabled){let p=this._checklistText.split(`
`).map(c=>c.trim()).filter(Boolean).slice(0,100);e.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 m={service:p},y=this._actionTargetEntity.trim();y&&(m.target={entity_id:y});let b=this._buildActionData();Object.keys(b).length>0&&(m.data=b),e.on_complete_action=m}else e.on_complete_action=null;let c={};this._qcNotes.trim()&&(c.notes=this._qcNotes.trim());let u=parseFloat(this._qcCost);!isNaN(u)&&u>=0&&(c.cost=u);let f=parseInt(this._qcDuration,10);!isNaN(f)&&f>=0&&(c.duration=f),this._qcFeedback&&(c.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(c).length?c:null}let i=await this.hass.connection.sendMessagePromise(e),n=this._taskId||i?.task_id,o=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(n&&this._scheduleType==="sensor_based"&&o)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),c=parseInt(this._adaptiveMin,10),u=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(c)&&c>=1?{min_interval_days:c}:{},...!isNaN(u)&&u>=1?{max_interval_days:u}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction}),this._adaptiveInitial=this._adaptiveSnapshot()}catch{}}this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}catch(e){this._error=N(e,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 h;let e=this._lang,t=this._triggerType==="compound";return l`
<h3>${s("trigger_configuration",e)}</h3>
<div class="select-row">
<label>${s("trigger_type",e)}</label>
@@ -1456,7 +1417,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.value=${this._triggerType}
@change=${i=>this._triggerType=i.target.value}
>
${Er.map(i=>l`<option value=${i} ?selected=${i===this._triggerType}>${s(i,e)}</option>`)}
${Lr.map(i=>l`<option value=${i} ?selected=${i===this._triggerType}>${s(i,e)}</option>`)}
</select>
</div>
${t?this._renderCompoundEditor():l`
@@ -1518,7 +1479,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
</select>
</div>
`:h}
`}_patchCondition(e,t){this._compoundConditions=this._compoundConditions.map((i,n)=>n===e?{...i,...t}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Sr()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((t,i)=>i!==e)}_renderCompoundEditor(){let e=this._lang;return l`
`}_patchCondition(e,t){this._compoundConditions=this._compoundConditions.map((i,n)=>n===e?{...i,...t}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Pr()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((t,i)=>i!==e)}_renderCompoundEditor(){let e=this._lang;return l`
<div class="select-row">
<label>${s("compound_logic",e)}</label>
<select
@@ -1567,7 +1528,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.value=${e.type}
@change=${o=>this._patchCondition(t,{type:o.target.value})}
>
${yi.map(o=>l`<option value=${o} ?selected=${o===e.type}>${s(o,i)}</option>`)}
${xi.map(o=>l`<option value=${o} ?selected=${o===e.type}>${s(o,i)}</option>`)}
</select>
</div>
${this._renderConditionTypeFields(e,t)}
@@ -1711,12 +1672,12 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
>
${["days","weeks","months","years"].map(t=>l`<option value=${t} ?selected=${t===this._intervalUnit}>${s("unit_"+t,e)}</option>`)}
</select>
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(mt.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e),this._scheduleEntityPickerProbe();for(let t of e.keys())if(g._PREVIEW_RELEVANT.has(String(t))){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 e=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),t=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!e||!t){this._pickerProbeStrikes=0;return}let i=(c,_,f=0)=>{if(!(!c||f>10)){(c.tagName?.toLowerCase()??"")==="ha-entity-picker"&&_.push(c);for(let m of[c.shadowRoot,c])if(m)for(let y of Array.from(m.children??[]))i(y,_,f+1)}},n=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],o=[];for(let c of n)i(c,o);let p=o.length===0||o.some(c=>c.offsetHeight===0);if(e.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 e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let t=++this._previewSeq;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(t!==this._previewSeq)return;this._schedulePreview=i.occurrences||[],this._schedulePreviewEnded=!!i.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return h;let e=this._lang,t=this.scheduleTimeEnabled&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((o,p)=>{let c=new Date(`${o}T12:00:00`).getDay();return`${Pe(c===0?6:c-1,e,"short")} ${G(o,e)}${p===0?t:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?l`<div class="field-help">${s("schedule_preview_ontime",e)}</div>`:h;return l`
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(mt.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e),this._scheduleEntityPickerProbe();for(let t of e.keys())if(g._PREVIEW_RELEVANT.has(String(t))){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 e=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),t=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!e||!t){this._pickerProbeStrikes=0;return}let i=(c,u,f=0)=>{if(!(!c||f>10)){(c.tagName?.toLowerCase()??"")==="ha-entity-picker"&&u.push(c);for(let m of[c.shadowRoot,c])if(m)for(let y of Array.from(m.children??[]))i(y,u,f+1)}},n=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],o=[];for(let c of n)i(c,o);let p=o.length===0||o.some(c=>c.offsetHeight===0);if(e.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 e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let t=++this._previewSeq;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(t!==this._previewSeq)return;this._schedulePreview=i.occurrences||[],this._schedulePreviewEnded=!!i.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return h;let e=this._lang,t=this.scheduleTimeEnabled&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((o,p)=>{let c=new Date(`${o}T12:00:00`).getDay();return`${Pe(c===0?6:c-1,e,"short")} ${G(o,e)}${p===0?t:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?l`<div class="field-help">${s("schedule_preview_ontime",e)}</div>`:h;return l`
<div class="trigger-live-hint schedule-preview">
${s("schedule_preview_title",e)}: ${i}${this._schedulePreviewEnded?l` <span class="field-help">${s("schedule_preview_ends",e)}</span>`:h}
${n}
</div>
`}_buildSchedule(){let e=i=>{let n=parseInt(this._calOffset,10)||0;return n&&(i.offset=Math.max(-15,Math.min(n,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||mt.includes(this._scheduleType)))return h;let i=Lr(e);return l`
`}_buildSchedule(){let e=i=>{let n=parseInt(this._calOffset,10)||0;return n&&(i.offset=Math.max(-15,Math.min(n,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||mt.includes(this._scheduleType)))return h;let i=qr(e);return l`
<label class="field-label">${s("season_window_label",e)}</label>
<div class="field-help">${s("season_window_hint",e)}</div>
<div class="weekday-chips season-chips">
@@ -1751,7 +1712,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.value=${this._endsUntil}
@input=${n=>this._endsUntil=n.target.value}
></ms-textfield>`:h}
`}_renderCalendarFields(){let e=this._lang,t=Ir(e);if(this._scheduleType==="weekdays")return l`
`}_renderCalendarFields(){let e=this._lang,t=Hr(e);if(this._scheduleType==="weekdays")return l`
<label class="field-label">${s("recurrence_on_days",e)}</label>
<div class="weekday-chips">
${t.map((i,n)=>l`
@@ -1803,7 +1764,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
max="15"
.value=${this._calOffset}
@input=${t=>this._calOffset=t.target.value}
></ms-textfield>`}_renderTriggerLiveHint(){if(this._triggerType==="compound")return h;let e=this._triggerEntityId||this._triggerEntityIds[0];if(!e||!this.hass?.states)return h;let t=this.hass.states[e];if(!t)return h;let i=this._lang,n=t.attributes?.unit_of_measurement,o=typeof n=="string"&&n?` ${n}`:"",p=this._triggerAttribute?t.attributes?.[this._triggerAttribute]:t.state,c=typeof p=="number"?p:parseFloat(String(p)),_=p!=="unknown"&&p!=="unavailable"&&p!=null&&!isNaN(c),f=y=>Number.isInteger(y)?String(y):String(Math.round(y*10)/10),m=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),b=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN(b))return h;_&&m.push(s("trigger_hint_now",i).replace("{value}",f(c)+o)),isNaN(y)||m.push(s("trigger_hint_above",i).replace("{target}",f(y)+o)),isNaN(b)||m.push(s("trigger_hint_below",i).replace("{target}",f(b)+o))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return h;this._triggerDeltaMode?this._taskId?m.push(s("trigger_hint_counter_delta_edit",i).replace("{target}",f(y)+o)):_?m.push(s("trigger_hint_counter_delta",i).replace("{value}",f(c)+o).replace("{due}",f(c+y)+o).replace("{target}",f(y)+o)):m.push(s("trigger_hint_counter_delta_edit",i).replace("{target}",f(y)+o)):(_&&m.push(s("trigger_hint_now",i).replace("{value}",f(c)+o)),m.push(s("trigger_hint_counter_abs",i).replace("{target}",f(y)+o)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return h;m.push(s("trigger_hint_runtime",i).replace("{hours}",f(y))),m.push(s("trigger_hint_state_now",i).replace("{value}",String(t.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,b=this._triggerToState.trim();m.push((b?s("trigger_hint_state_change_to",i).replace("{state}",b):s("trigger_hint_state_change",i)).replace("{count}",String(y))),m.push(s("trigger_hint_state_now",i).replace("{value}",String(t.state)))}return m.length?l`<div class="trigger-live-hint">${m.join(" ")}</div>`:h}_renderTriggerTypeFields(){let e=this._lang;return this._triggerType==="threshold"?l`
></ms-textfield>`}_renderTriggerLiveHint(){if(this._triggerType==="compound")return h;let e=this._triggerEntityId||this._triggerEntityIds[0];if(!e||!this.hass?.states)return h;let t=this.hass.states[e];if(!t)return h;let i=this._lang,n=t.attributes?.unit_of_measurement,o=typeof n=="string"&&n?` ${n}`:"",p=this._triggerAttribute?t.attributes?.[this._triggerAttribute]:t.state,c=typeof p=="number"?p:parseFloat(String(p)),u=p!=="unknown"&&p!=="unavailable"&&p!=null&&!isNaN(c),f=y=>Number.isInteger(y)?String(y):String(Math.round(y*10)/10),m=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),b=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN(b))return h;u&&m.push(s("trigger_hint_now",i).replace("{value}",f(c)+o)),isNaN(y)||m.push(s("trigger_hint_above",i).replace("{target}",f(y)+o)),isNaN(b)||m.push(s("trigger_hint_below",i).replace("{target}",f(b)+o))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return h;this._triggerDeltaMode?this._taskId?m.push(s("trigger_hint_counter_delta_edit",i).replace("{target}",f(y)+o)):u?m.push(s("trigger_hint_counter_delta",i).replace("{value}",f(c)+o).replace("{due}",f(c+y)+o).replace("{target}",f(y)+o)):m.push(s("trigger_hint_counter_delta_edit",i).replace("{target}",f(y)+o)):(u&&m.push(s("trigger_hint_now",i).replace("{value}",f(c)+o)),m.push(s("trigger_hint_counter_abs",i).replace("{target}",f(y)+o)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return h;m.push(s("trigger_hint_runtime",i).replace("{hours}",f(y))),m.push(s("trigger_hint_state_now",i).replace("{value}",String(t.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,b=this._triggerToState.trim();m.push((b?s("trigger_hint_state_change_to",i).replace("{state}",b):s("trigger_hint_state_change",i)).replace("{count}",String(y))),m.push(s("trigger_hint_state_now",i).replace("{value}",String(t.state)))}return m.length?l`<div class="trigger-live-hint">${m.join(" ")}</div>`:h}_renderTriggerTypeFields(){let e=this._lang;return this._triggerType==="threshold"?l`
<ms-textfield
label="${s("trigger_above",e)}"
type="number"
@@ -1881,6 +1842,14 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
@input=${t=>this._triggerTargetChanges=t.target.value}
></ms-textfield>
<div class="field-help">${s("target_changes_help",e)}</div>
<ms-textfield
label="${s("for_at_least_minutes",e)}"
type="number"
min="0"
.value=${this._triggerForMinutes}
@input=${t=>this._triggerForMinutes=t.target.value}
></ms-textfield>
<div class="field-help">${s("for_minutes_state_help",e)}</div>
`:this._triggerType==="runtime"?l`
<ms-textfield
label="${s("runtime_hours",e)}"
@@ -1919,7 +1888,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.value=${this._type}
@change=${i=>this._type=i.target.value}
>
${wr.map(i=>l`<option value=${i} ?selected=${i===this._type}>${s(i,e)}</option>`)}
${Tr.map(i=>l`<option value=${i} ?selected=${i===this._type}>${s(i,e)}</option>`)}
</select>
</div>
${this._type==="reading"?l`
@@ -1953,7 +1922,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.value=${this._priority}
@change=${i=>this._priority=i.target.value}
>
${$r.map(i=>l`<option value=${i} ?selected=${i===this._priority}>${s("priority_"+i,e)}</option>`)}
${Cr.map(i=>l`<option value=${i} ?selected=${i===this._priority}>${s("priority_"+i,e)}</option>`)}
</select>
</div>
<div class="field">
@@ -1972,7 +1941,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.value=${this._scheduleType}
@change=${i=>this._scheduleType=i.target.value}
>
${kr.map(i=>l`<option value=${i} ?selected=${i===this._scheduleType}>${s(i,e)}</option>`)}
${Ir.map(i=>l`<option value=${i} ?selected=${i===this._scheduleType}>${s(i,e)}</option>`)}
</select>
</div>
${this._scheduleType==="time_based"?l`
@@ -2043,7 +2012,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
`:h}
<h3>${s("require_on_completion",e)}</h3>
<div class="required-completion">
${vi.map(i=>l`
${bi.map(i=>l`
<label class="req-option">
<input
type="checkbox"
@@ -2109,7 +2078,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
<ha-form
class="entity-picker-form"
.hass=${this.hass}
.schema=${[{name:"environmental_entity",selector:{entity:{domain:gi,device_class:mi}}}]}
.schema=${[{name:"environmental_entity",selector:{entity:{domain:fi,device_class:vi}}}]}
.data=${{environmental_entity:this._environmentalEntity}}
.computeLabel=${()=>s("environmental_entity_optional",e)}
.computeHelper=${()=>s("environmental_entity_helper",e)}
@@ -2473,7 +2442,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
font-size: 14px;
cursor: pointer;
}
`,d([x({attribute:!1})],g.prototype,"hass",2),d([x({type:Boolean,attribute:"checklists-enabled"})],g.prototype,"checklistsEnabled",2),d([x({type:Boolean,attribute:"schedule-time-enabled"})],g.prototype,"scheduleTimeEnabled",2),d([x({type:Boolean,attribute:"completion-actions-enabled"})],g.prototype,"completionActionsEnabled",2),d([x({type:Number,attribute:"default-warning-days"})],g.prototype,"defaultWarningDays",2),d([u()],g.prototype,"parts",2),d([u()],g.prototype,"_foreignOwners",2),d([u()],g.prototype,"_open",2),d([u()],g.prototype,"_entityPickerFallback",2),d([u()],g.prototype,"_loading",2),d([u()],g.prototype,"_error",2),d([u()],g.prototype,"_entryId",2),d([u()],g.prototype,"_taskId",2),d([u()],g.prototype,"_objectChoices",2),d([u()],g.prototype,"_name",2),d([u()],g.prototype,"_type",2),d([u()],g.prototype,"_scheduleType",2),d([u()],g.prototype,"_intervalDays",2),d([u()],g.prototype,"_intervalUnit",2),d([u()],g.prototype,"_dueDate",2),d([u()],g.prototype,"_warningDays",2),d([u()],g.prototype,"_earliestCompletionDays",2),d([u()],g.prototype,"_intervalAnchor",2),d([u()],g.prototype,"_weekdays",2),d([u()],g.prototype,"_nth",2),d([u()],g.prototype,"_nthWeekday",2),d([u()],g.prototype,"_domDay",2),d([u()],g.prototype,"_domLastDay",2),d([u()],g.prototype,"_domBusiness",2),d([u()],g.prototype,"_calOffset",2),d([u()],g.prototype,"_seasonMonths",2),d([u()],g.prototype,"_endsMode",2),d([u()],g.prototype,"_endsCount",2),d([u()],g.prototype,"_endsUntil",2),d([u()],g.prototype,"_schedulePreview",2),d([u()],g.prototype,"_schedulePreviewEnded",2),d([u()],g.prototype,"_notes",2),d([u()],g.prototype,"_documentationUrl",2),d([u()],g.prototype,"_customIcon",2),d([u()],g.prototype,"_priority",2),d([u()],g.prototype,"_labels",2),d([u()],g.prototype,"_enabled",2),d([u()],g.prototype,"_triggerEntityId",2),d([u()],g.prototype,"_triggerEntityIds",2),d([u()],g.prototype,"_triggerEntityLogic",2),d([u()],g.prototype,"_triggerAttribute",2),d([u()],g.prototype,"_triggerType",2),d([u()],g.prototype,"_triggerAbove",2),d([u()],g.prototype,"_triggerBelow",2),d([u()],g.prototype,"_triggerEquals",2),d([u()],g.prototype,"_triggerNotEquals",2),d([u()],g.prototype,"_triggerForMinutes",2),d([u()],g.prototype,"_triggerCombinator",2),d([u()],g.prototype,"_triggerTargetValue",2),d([u()],g.prototype,"_triggerDeltaMode",2),d([u()],g.prototype,"_triggerBaselineValue",2),d([u()],g.prototype,"_liveBaselineValue",2),d([u()],g.prototype,"_autoCompleteOnRecovery",2),d([u()],g.prototype,"_triggerFromState",2),d([u()],g.prototype,"_triggerToState",2),d([u()],g.prototype,"_triggerTargetChanges",2),d([u()],g.prototype,"_triggerRuntimeHours",2),d([u()],g.prototype,"_triggerOnStates",2),d([u()],g.prototype,"_compoundLogic",2),d([u()],g.prototype,"_compoundConditions",2),d([u()],g.prototype,"_suggestedAttributes",2),d([u()],g.prototype,"_availableAttributes",2),d([u()],g.prototype,"_entityDomain",2),d([u()],g.prototype,"_lastPerformed",2),d([u()],g.prototype,"_nfcTagId",2),d([u()],g.prototype,"_readingUnit",2),d([u()],g.prototype,"_consumesParts",2),d([u()],g.prototype,"_partsLoadFailed",2),d([u()],g.prototype,"_availableTags",2),d([u()],g.prototype,"_responsibleUserId",2),d([u()],g.prototype,"_assigneePool",2),d([u()],g.prototype,"_rotationStrategy",2),d([u()],g.prototype,"_availableUsers",2),d([u()],g.prototype,"_checklistText",2),d([u()],g.prototype,"_requiredCompletion",2),d([u()],g.prototype,"_scheduleTime",2),d([u()],g.prototype,"_actionService",2),d([u()],g.prototype,"_actionTargetEntity",2),d([u()],g.prototype,"_actionData",2),d([u()],g.prototype,"_actionDataJsonFallback",2),d([u()],g.prototype,"_actionTesting",2),d([u()],g.prototype,"_actionTestResult",2),d([u()],g.prototype,"_actionTestError",2),d([u()],g.prototype,"_qcNotes",2),d([u()],g.prototype,"_qcCost",2),d([u()],g.prototype,"_qcDuration",2),d([u()],g.prototype,"_qcFeedback",2),d([u()],g.prototype,"_environmentalEntity",2),d([u()],g.prototype,"_environmentalAttribute",2),d([u()],g.prototype,"_adaptiveEnabled",2),d([u()],g.prototype,"_adaptiveAlpha",2),d([u()],g.prototype,"_adaptiveMin",2),d([u()],g.prototype,"_adaptiveMax",2),d([u()],g.prototype,"_adaptiveSeasonal",2),d([u()],g.prototype,"_adaptivePrediction",2),d([u()],g.prototype,"_conditionAttrOptions",2);ft=g;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",ft)});var $,xi=w(()=>{"use strict";P();U();R();oe();_t();gt();$=class extends A{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._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photoDocId="";this._photoPreview="";this._photoUploading=!1;this._readingValue="";this._ Line truncated
`,d([x({attribute:!1})],g.prototype,"hass",2),d([x({type:Boolean,attribute:"checklists-enabled"})],g.prototype,"checklistsEnabled",2),d([x({type:Boolean,attribute:"schedule-time-enabled"})],g.prototype,"scheduleTimeEnabled",2),d([x({type:Boolean,attribute:"completion-actions-enabled"})],g.prototype,"completionActionsEnabled",2),d([x({type:Number,attribute:"default-warning-days"})],g.prototype,"defaultWarningDays",2),d([_()],g.prototype,"parts",2),d([_()],g.prototype,"_foreignOwners",2),d([_()],g.prototype,"_open",2),d([_()],g.prototype,"_entityPickerFallback",2),d([_()],g.prototype,"_loading",2),d([_()],g.prototype,"_error",2),d([_()],g.prototype,"_entryId",2),d([_()],g.prototype,"_taskId",2),d([_()],g.prototype,"_objectChoices",2),d([_()],g.prototype,"_name",2),d([_()],g.prototype,"_type",2),d([_()],g.prototype,"_scheduleType",2),d([_()],g.prototype,"_intervalDays",2),d([_()],g.prototype,"_intervalUnit",2),d([_()],g.prototype,"_dueDate",2),d([_()],g.prototype,"_warningDays",2),d([_()],g.prototype,"_earliestCompletionDays",2),d([_()],g.prototype,"_intervalAnchor",2),d([_()],g.prototype,"_weekdays",2),d([_()],g.prototype,"_nth",2),d([_()],g.prototype,"_nthWeekday",2),d([_()],g.prototype,"_domDay",2),d([_()],g.prototype,"_domLastDay",2),d([_()],g.prototype,"_domBusiness",2),d([_()],g.prototype,"_calOffset",2),d([_()],g.prototype,"_seasonMonths",2),d([_()],g.prototype,"_endsMode",2),d([_()],g.prototype,"_endsCount",2),d([_()],g.prototype,"_endsUntil",2),d([_()],g.prototype,"_schedulePreview",2),d([_()],g.prototype,"_schedulePreviewEnded",2),d([_()],g.prototype,"_notes",2),d([_()],g.prototype,"_documentationUrl",2),d([_()],g.prototype,"_customIcon",2),d([_()],g.prototype,"_priority",2),d([_()],g.prototype,"_labels",2),d([_()],g.prototype,"_enabled",2),d([_()],g.prototype,"_triggerEntityId",2),d([_()],g.prototype,"_triggerEntityIds",2),d([_()],g.prototype,"_triggerEntityLogic",2),d([_()],g.prototype,"_triggerAttribute",2),d([_()],g.prototype,"_triggerType",2),d([_()],g.prototype,"_triggerAbove",2),d([_()],g.prototype,"_triggerBelow",2),d([_()],g.prototype,"_triggerEquals",2),d([_()],g.prototype,"_triggerNotEquals",2),d([_()],g.prototype,"_triggerForMinutes",2),d([_()],g.prototype,"_triggerCombinator",2),d([_()],g.prototype,"_triggerTargetValue",2),d([_()],g.prototype,"_triggerDeltaMode",2),d([_()],g.prototype,"_triggerBaselineValue",2),d([_()],g.prototype,"_liveBaselineValue",2),d([_()],g.prototype,"_autoCompleteOnRecovery",2),d([_()],g.prototype,"_triggerFromState",2),d([_()],g.prototype,"_triggerToState",2),d([_()],g.prototype,"_triggerTargetChanges",2),d([_()],g.prototype,"_triggerRuntimeHours",2),d([_()],g.prototype,"_triggerOnStates",2),d([_()],g.prototype,"_compoundLogic",2),d([_()],g.prototype,"_compoundConditions",2),d([_()],g.prototype,"_suggestedAttributes",2),d([_()],g.prototype,"_availableAttributes",2),d([_()],g.prototype,"_entityDomain",2),d([_()],g.prototype,"_lastPerformed",2),d([_()],g.prototype,"_nfcTagId",2),d([_()],g.prototype,"_readingUnit",2),d([_()],g.prototype,"_consumesParts",2),d([_()],g.prototype,"_partsLoadFailed",2),d([_()],g.prototype,"_availableTags",2),d([_()],g.prototype,"_responsibleUserId",2),d([_()],g.prototype,"_assigneePool",2),d([_()],g.prototype,"_rotationStrategy",2),d([_()],g.prototype,"_availableUsers",2),d([_()],g.prototype,"_checklistText",2),d([_()],g.prototype,"_requiredCompletion",2),d([_()],g.prototype,"_scheduleTime",2),d([_()],g.prototype,"_actionService",2),d([_()],g.prototype,"_actionTargetEntity",2),d([_()],g.prototype,"_actionData",2),d([_()],g.prototype,"_actionDataJsonFallback",2),d([_()],g.prototype,"_actionTesting",2),d([_()],g.prototype,"_actionTestResult",2),d([_()],g.prototype,"_actionTestError",2),d([_()],g.prototype,"_qcNotes",2),d([_()],g.prototype,"_qcCost",2),d([_()],g.prototype,"_qcDuration",2),d([_()],g.prototype,"_qcFeedback",2),d([_()],g.prototype,"_environmentalEntity",2),d([_()],g.prototype,"_environmentalAttribute",2),d([_()],g.prototype,"_adaptiveEnabled",2),d([_()],g.prototype,"_adaptiveAlpha",2),d([_()],g.prototype,"_adaptiveMin",2),d([_()],g.prototype,"_adaptiveMax",2),d([_()],g.prototype,"_adaptiveSeasonal",2),d([_()],g.prototype,"_adaptivePrediction",2),d([_()],g.prototype,"_conditionAttrOptions",2);ft=g;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",ft)});var $,$i=w(()=>{"use strict";P();U();R();oe();_t();gt();$=class extends A{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._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photoDocId="";this._photoPreview="";this._photoUploading=!1;this._readingValue="";this._ Line truncated
type="button"
class="cost-suggestion"
@click=${()=>this._cost=t.toFixed(2)}
@@ -2505,14 +2474,14 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
${this.parts.map(t=>{let i=ee({part_id:t.id,entry_id:t.entry_id}),n=this._usedParts[i],o=n!==void 0,p=t.entry_id?{part_id:t.id,quantity:1,entry_id:t.entry_id}:{part_id:t.id,quantity:1};return l`<div class="used-part-row">
<label class="used-part-check">
<input type="checkbox" .checked=${o}
@change=${c=>{let _={...this._usedParts};c.target.checked?_[i]=_[i]||p:delete _[i],this._usedParts=_}} />
@change=${c=>{let u={...this._usedParts};c.target.checked?u[i]=u[i]||p:delete u[i],this._usedParts=u}} />
<span
>${t.name}${t.owner_name?l`<span class="used-part-owner"> (${t.owner_name})</span>`:h}${t.stock!==null&&t.stock!==void 0?` (${t.stock}${t.unit?" "+t.unit:""})`:""}</span
>
</label>
${o?l`<input class="used-part-qty" type="number" min="0.01" max="999" step="0.01"
.value=${String(n.quantity)}
@input=${c=>{let _=parseFloat(c.target.value);this._usedParts={...this._usedParts,[i]:{...p,quantity:Number.isFinite(_)&&_>=.01?_:1}}}} />`:h}
@input=${c=>{let u=parseFloat(c.target.value);this._usedParts={...this._usedParts,[i]:{...p,quantity:Number.isFinite(u)&&u>=.01?u:1}}}} />`:h}
</div>`})}
</div>`:this.consumesInfo.length?l`<div class="consumes-hint">
${this.consumesInfo.map(t=>l`<div>${t}</div>`)}
@@ -2605,7 +2574,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
</ha-button>
</div>
</ha-dialog>
`}};$.styles=[pi,S`
`}};$.styles=[_i,S`
.req-mark {
color: var(--error-color, #f44336);
margin-left: 2px;
@@ -2770,7 +2739,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
color: var(--text-primary-color, #fff);
border-color: var(--primary-color);
}
`],d([x({attribute:!1})],$.prototype,"hass",2),d([x()],$.prototype,"entryId",2),d([x()],$.prototype,"taskId",2),d([x()],$.prototype,"taskName",2),d([x()],$.prototype,"lang",2),d([x({type:Array})],$.prototype,"checklist",2),d([x({type:Boolean})],$.prototype,"adaptiveEnabled",2),d([x()],$.prototype,"taskType",2),d([x()],$.prototype,"readingUnit",2),d([x({attribute:!1})],$.prototype,"restockDefault",2),d([x({attribute:!1})],$.prototype,"restockUnitCost",2),d([x()],$.prototype,"currencySymbol",2),d([x({attribute:!1})],$.prototype,"parts",2),d([x({attribute:!1})],$.prototype,"consumesParts",2),d([x({type:Array})],$.prototype,"consumesInfo",2),d([x({type:Array})],$.prototype,"requiredFields",2),d([u()],$.prototype,"_open",2),d([u()],$.prototype,"_notes",2),d([u()],$.prototype,"_cost",2),d([u()],$.prototype,"_duration",2),d([u()],$.prototype,"_loading",2),d([u()],$.prototype,"_error",2),d([u()],$.prototype,"_checklistState",2),d([u()],$.prototype,"_feedback",2),d([u()],$.prototype,"_photoDocId",2),d([u()],$.prototype,"_photoPreview",2),d([u()],$.prototype,"_photoUploading",2),d([u()],$.prototype,"_readingValue",2),d([u()],$.prototype,"_restockQty",2),d([u()],$.prototype,"_completedAt",2),d([u()],$.prototype,"_usedParts",2),d([x({attribute:!1})],$.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",$)});var z,wi=w(()=>{"use strict";P();U();R();oe();z=class extends A{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 H(this.hass)}openEdit(e){this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._loadPartOptions()}async _loadPartOptions(){let e=this._draft;if(e)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"}),i=[];for(let o of t.parts||[]){let p=o.entry_id===e.entry_id,c=o.consumers.some(_=>_.entry_id===e.entry_id&&_.task_id===e.task_id);!p&&!c||i.push({part_id:o.part_id,name:o.name,entry_id:o.entry_id,foreign:!p,object_name:o.object_name})}for(let o of e.used_parts||[]){let p=o.entry_id||e.entry_id;i.some(c=>c.part_id===o.part_id&&c.entry_id===p)||i.push({part_id:o.part_id,name:o.name||o.part_id,entry_id:p,foreign:p!==e.entry_id,object_name:null})}let n={};for(let o of e.used_parts||[])n[`${o.entry_id||e.entry_id}:${o.part_id}`]=o.quantity??1;this._partOptions=i,this._partQty=n,this._partQtyOriginal=this._partSelectionKey()}catch{this._partOptions=[]}}_partSelectionKey(){return JSON.stringify(Object.entries(this._partQty).filter(([,e])=>e>0).sort(([e],[t])=>e.localeCompare(t)))}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(e,t){this._draft&&(this._draft={...this._draft,[e]:t})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let e={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&&(e.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(e.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(e.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(e.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(e.completed_by=this._draft.completed_by),this._partOptions!==null&&this._partSelectionKey()!==this._partQtyOriginal&&(e.used_parts=(this._partOptions||[]).filter(i=>(this._partQty[`${i.entry_id}:${i.part_id}`]||0)>0).map(i=>({part_id:i.part_id,quantity:this._partQty[`${i.entry_id}:${i.part_id}`],...i.foreign?{entry_id:i.entry_id}:{}}))),Object.keys(e).filter(i=>!["type","entry_id","task_id","original_timestamp"].includes(i)).length===0){this.close();return}await this.hass.connection.sendMessagePromise(e),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(e){this._error=j(e,this._lang)}finally{this._saving=!1}}}render(){if(!this._open||!this._draft)return h;let e=this._lang,t=this._draft;return l`
`],d([x({attribute:!1})],$.prototype,"hass",2),d([x()],$.prototype,"entryId",2),d([x()],$.prototype,"taskId",2),d([x()],$.prototype,"taskName",2),d([x()],$.prototype,"lang",2),d([x({type:Array})],$.prototype,"checklist",2),d([x({type:Boolean})],$.prototype,"adaptiveEnabled",2),d([x()],$.prototype,"taskType",2),d([x()],$.prototype,"readingUnit",2),d([x({attribute:!1})],$.prototype,"restockDefault",2),d([x({attribute:!1})],$.prototype,"restockUnitCost",2),d([x()],$.prototype,"currencySymbol",2),d([x({attribute:!1})],$.prototype,"parts",2),d([x({attribute:!1})],$.prototype,"consumesParts",2),d([x({type:Array})],$.prototype,"consumesInfo",2),d([x({type:Array})],$.prototype,"requiredFields",2),d([_()],$.prototype,"_open",2),d([_()],$.prototype,"_notes",2),d([_()],$.prototype,"_cost",2),d([_()],$.prototype,"_duration",2),d([_()],$.prototype,"_loading",2),d([_()],$.prototype,"_error",2),d([_()],$.prototype,"_checklistState",2),d([_()],$.prototype,"_feedback",2),d([_()],$.prototype,"_photoDocId",2),d([_()],$.prototype,"_photoPreview",2),d([_()],$.prototype,"_photoUploading",2),d([_()],$.prototype,"_readingValue",2),d([_()],$.prototype,"_restockQty",2),d([_()],$.prototype,"_completedAt",2),d([_()],$.prototype,"_usedParts",2),d([x({attribute:!1})],$.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",$)});var z,ki=w(()=>{"use strict";P();U();R();oe();z=class extends A{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 j(this.hass)}openEdit(e){this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._loadPartOptions()}async _loadPartOptions(){let e=this._draft;if(e)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"}),i=[];for(let o of t.parts||[]){let p=o.entry_id===e.entry_id,c=o.consumers.some(u=>u.entry_id===e.entry_id&&u.task_id===e.task_id);!p&&!c||i.push({part_id:o.part_id,name:o.name,entry_id:o.entry_id,foreign:!p,object_name:o.object_name})}for(let o of e.used_parts||[]){let p=o.entry_id||e.entry_id;i.some(c=>c.part_id===o.part_id&&c.entry_id===p)||i.push({part_id:o.part_id,name:o.name||o.part_id,entry_id:p,foreign:p!==e.entry_id,object_name:null})}let n={};for(let o of e.used_parts||[])n[`${o.entry_id||e.entry_id}:${o.part_id}`]=o.quantity??1;this._partOptions=i,this._partQty=n,this._partQtyOriginal=this._partSelectionKey()}catch{this._partOptions=[]}}_partSelectionKey(){return JSON.stringify(Object.entries(this._partQty).filter(([,e])=>e>0).sort(([e],[t])=>e.localeCompare(t)))}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(e,t){this._draft&&(this._draft={...this._draft,[e]:t})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let e={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&&(e.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(e.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(e.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(e.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(e.completed_by=this._draft.completed_by),this._partOptions!==null&&this._partSelectionKey()!==this._partQtyOriginal&&(e.used_parts=(this._partOptions||[]).filter(i=>(this._partQty[`${i.entry_id}:${i.part_id}`]||0)>0).map(i=>({part_id:i.part_id,quantity:this._partQty[`${i.entry_id}:${i.part_id}`],...i.foreign?{entry_id:i.entry_id}:{}}))),Object.keys(e).filter(i=>!["type","entry_id","task_id","original_timestamp"].includes(i)).length===0){this.close();return}await this.hass.connection.sendMessagePromise(e),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(e){this._error=N(e,this._lang)}finally{this._saving=!1}}}render(){if(!this._open||!this._draft)return h;let e=this._lang,t=this._draft;return l`
<div class="backdrop" @click=${this.close}></div>
<div class="dialog" role="dialog" aria-modal="true">
<h2>${s("history_edit_title",e)||"Edit history entry"}</h2>
@@ -2908,7 +2877,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.part-row-edit input[type="checkbox"] { width: auto; }
.part-label { flex: 1; color: var(--primary-text-color); }
.part-qty { width: 76px; }
`,d([x({attribute:!1})],z.prototype,"hass",2),d([u()],z.prototype,"_open",2),d([u()],z.prototype,"_saving",2),d([u()],z.prototype,"_error",2),d([u()],z.prototype,"_draft",2),d([u()],z.prototype,"_partOptions",2),d([u()],z.prototype,"_partQty",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",z)});function ge(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function $i(a){return!a.startsWith("data:image/svg+xml,")&&!a.startsWith("data:image/png;base64,")?"":ge(a)}function Pr(a){return a.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var O,ki=w(()=>{"use strict";P();U();R();O=class extends A{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(e,t){this._entryId=e,this._taskId=null,this._objectName=t,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(e,t,i,n){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let t={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(t.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...t,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...t,action:"complete"}));let n=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,n=t?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?s("qr_error_no_url",this.lang):s("qr_error",this.lang)}finally{e===this._generateSeq&&(this._loading=!1)}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,t=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,i=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let o=this.lang||"en",p=ge(t),c=ge(i),_=!!this._completeResult,f=ge(s("qr_action_view",o)),m=ge(s("qr_action_complete",o));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
`,d([x({attribute:!1})],z.prototype,"hass",2),d([_()],z.prototype,"_open",2),d([_()],z.prototype,"_saving",2),d([_()],z.prototype,"_error",2),d([_()],z.prototype,"_draft",2),d([_()],z.prototype,"_partOptions",2),d([_()],z.prototype,"_partQty",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",z)});function Ei(a,r,e){let t=new Blob([a],{type:e}),i=URL.createObjectURL(t),n=document.createElement("a");n.href=i,n.download=r,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(i),6e4)}var Si=w(()=>{"use strict"});function ge(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ai(a){return!a.startsWith("data:image/svg+xml,")&&!a.startsWith("data:image/png;base64,")?"":ge(a)}function Mr(a){return a.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var O,Ti=w(()=>{"use strict";P();U();R();Si();O=class extends A{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(e,t){this._entryId=e,this._taskId=null,this._objectName=t,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(e,t,i,n){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let t={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(t.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...t,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...t,action:"complete"}));let n=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,n=t?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?s("qr_error_no_url",this.lang):s("qr_error",this.lang)}finally{e===this._generateSeq&&(this._loading=!1)}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,t=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,i=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let o=this.lang||"en",p=ge(t),c=ge(i),u=!!this._completeResult,f=ge(s("qr_action_view",o)),m=ge(s("qr_action_complete",o));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
<meta name="color-scheme" content="light">
<title>${p}</title>
<style>
@@ -2922,7 +2891,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.sub{color:#666;font-size:14px;margin-bottom:16px}
.qr-row{display:flex;justify-content:center;gap:24px;margin:12px 0}
.qr-col{display:flex;flex-direction:column;align-items:center;gap:6px}
.qr-col img{width:${_?"200px":"280px"}}
.qr-col img{width:${u?"200px":"280px"}}
.qr-label{font-size:13px;font-weight:500;color:#333}
.url{font-size:10px;color:#999;word-break:break-all;margin-top:8px;max-width:480px}
</style></head><body>
@@ -2930,17 +2899,17 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
${c?`<div class="sub">${c}</div>`:""}
<div class="qr-row">
<div class="qr-col">
<img src="${$i(this._viewResult.svg_data_uri)}" alt="QR Info" />
<img src="${Ai(this._viewResult.svg_data_uri)}" alt="QR Info" />
<div class="qr-label">${f}</div>
</div>
${_?`<div class="qr-col">
<img src="${$i(this._completeResult.svg_data_uri)}" alt="QR Complete" />
${u?`<div class="qr-col">
<img src="${Ai(this._completeResult.svg_data_uri)}" alt="QR Complete" />
<div class="qr-label">${m}</div>
</div>`:""}
</div>
<div class="url">${ge(this._viewResult.url)}</div>
<script>setTimeout(()=>window.print(),300)<\/script>
</body></html>`),n.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=new Blob([i],{type:"image/svg+xml"}),o=URL.createObjectURL(n),p=document.createElement("a");p.href=o;let c=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;p.download=`qr-${Pr(c)}-${t}.svg`,p.click(),URL.revokeObjectURL(o)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return l``;let e=this.lang||this.hass?.language||"en",t=this._taskName?`${s("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${s("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return l`
</body></html>`),n.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;Ei(i,`qr-${Mr(n)}-${t}.svg`,"image/svg+xml")}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return l``;let e=this.lang||this.hass?.language||"en",t=this._taskName?`${s("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${s("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return l`
<ha-dialog open @closed=${this._close}>
<div class="dialog-title">${t}</div>
<div class="content">
@@ -3119,23 +3088,23 @@ ${c?`<div class="sub">${c}</div>`:""}
color: var(--text-primary-color, #fff);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
`,d([x({attribute:!1})],O.prototype,"hass",2),d([x()],O.prototype,"lang",2),d([u()],O.prototype,"_open",2),d([u()],O.prototype,"_loading",2),d([u()],O.prototype,"_error",2),d([u()],O.prototype,"_viewResult",2),d([u()],O.prototype,"_completeResult",2),d([u()],O.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",O)});function Ei(a,r){let e=a.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return h;let n=a.interval_days??0,o=a.suggested_interval??n;return l`
`,d([x({attribute:!1})],O.prototype,"hass",2),d([x()],O.prototype,"lang",2),d([_()],O.prototype,"_open",2),d([_()],O.prototype,"_loading",2),d([_()],O.prototype,"_error",2),d([_()],O.prototype,"_viewResult",2),d([_()],O.prototype,"_completeResult",2),d([_()],O.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",O)});function Ci(a,r){let e=a.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return h;let n=a.interval_days??0,o=a.suggested_interval??n;return l`
<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>
${s("weibull_reliability_curve",r)}
${Rr(t,r)}
${Or(t,r)}
</div>
${jr(t,i,n,o,r)}
${Nr(e,r)}
${e?.confidence_interval_low!=null?Hr(e,a,r):h}
${Dr(t,i,n,o,r)}
${zr(e,r)}
${e?.confidence_interval_low!=null?Fr(e,a,r):h}
</div>
`}function Rr(a,r){let e,t,i;return a<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):a<=1.2?(e="random_failures",t="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,17H11V15H13V17M13,13H11V7H13V13Z",i="beta_random_failures"):a<=3.5?(e="wear_out",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4M12,6A6,6 0 0,1 18,12H12V6Z",i="beta_wear_out"):(e="highly_predictable",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M11,16.5L18,9.5L16.59,8.09L11,13.67L7.91,10.59L6.5,12L11,16.5Z",i="beta_highly_predictable"),l`
`}function Or(a,r){let e,t,i;return a<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):a<=1.2?(e="random_failures",t="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,17H11V15H13V17M13,13H11V7H13V13Z",i="beta_random_failures"):a<=3.5?(e="wear_out",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4M12,6A6,6 0 0,1 18,12H12V6Z",i="beta_wear_out"):(e="highly_predictable",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M11,16.5L18,9.5L16.59,8.09L11,13.67L7.91,10.59L6.5,12L11,16.5Z",i="beta_highly_predictable"),l`
<span class="beta-badge ${e}">
<ha-svg-icon path="${t}"></ha-svg-icon>
${s(i,r)} (\u03B2=${a.toFixed(2)})
</span>
`}function jr(a,r,e,t,i){let b=Math.max(e,t,r,1)*1.3,k=50,E=[];for(let I=0;I<=k;I++){let L=I/k*b,te=1-Math.exp(-Math.pow(L/r,a)),fe=32+L/b*260,ve=136-te*128;E.push([fe,ve])}let D=E.map(([I,L])=>`${I.toFixed(1)},${L.toFixed(1)}`).join(" "),V="M32,136 "+E.map(([I,L])=>`L${I.toFixed(1)},${L.toFixed(1)}`).join(" ")+` L${E[k][0].toFixed(1)},136 Z`,M=32+e/b*260,le=1-Math.exp(-Math.pow(e/r,a)),de=136-le*128,v=((1-le)*100).toFixed(0),F=32+t/b*260,ce=[0,.25,.5,.75,1];return l`
`}function Dr(a,r,e,t,i){let b=Math.max(e,t,r,1)*1.3,k=50,E=[];for(let I=0;I<=k;I++){let L=I/k*b,te=1-Math.exp(-Math.pow(L/r,a)),fe=32+L/b*260,ve=136-te*128;E.push([fe,ve])}let D=E.map(([I,L])=>`${I.toFixed(1)},${L.toFixed(1)}`).join(" "),V="M32,136 "+E.map(([I,L])=>`L${I.toFixed(1)},${L.toFixed(1)}`).join(" ")+` L${E[k][0].toFixed(1)},136 Z`,M=32+e/b*260,le=1-Math.exp(-Math.pow(e/r,a)),de=136-le*128,v=((1-le)*100).toFixed(0),F=32+t/b*260,ce=[0,.25,.5,.75,1];return l`
<div class="weibull-chart">
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_weibull",i)}">
${ce.map(I=>{let L=136-I*128;return _e`
@@ -3178,7 +3147,7 @@ ${c?`<div class="sub">${c}</div>`:""}
${e>0?l`<span class="legend-item"><span class="legend-swatch" style="background:var(--primary-color, #03a9f4); opacity:0.5"></span> ${s("current_interval_marker",i)}</span>`:h}
${t>0&&t!==e?l`<span class="legend-item"><span class="legend-swatch" style="background:var(--success-color, #4caf50)"></span> ${s("recommended_marker",i)}</span>`:h}
</div>
`}function Nr(a,r){return l`
`}function zr(a,r){return l`
<div class="weibull-info-row">
<div class="weibull-info-item">
<span>${s("characteristic_life",r)}</span>
@@ -3191,7 +3160,7 @@ ${c?`<div class="sub">${c}</div>`:""}
</div>
`:h}
</div>
`}function Hr(a,r,e){let t=a.confidence_interval_low,i=a.confidence_interval_high,n=r.suggested_interval??r.interval_days??0,o=r.interval_days??0,p=Math.max(0,t-5),_=i+5-p,f=(t-p)/_*100,m=(i-t)/_*100,y=(n-p)/_*100,b=o>0?(o-p)/_*100:-1;return l`
`}function Fr(a,r,e){let t=a.confidence_interval_low,i=a.confidence_interval_high,n=r.suggested_interval??r.interval_days??0,o=r.interval_days??0,p=Math.max(0,t-5),u=i+5-p,f=(t-p)/u*100,m=(i-t)/u*100,y=(n-p)/u*100,b=o>0?(o-p)/u*100:-1;return l`
<div class="confidence-range">
<div class="confidence-range-title">
${s("confidence_interval",e)}: ${n} ${s("days",e)} (${t}\u2013${i})
@@ -3206,7 +3175,7 @@ ${c?`<div class="sub">${c}</div>`:""}
<span class="confidence-text high">${s("confidence_aggressive",e)} (${i}${s("days",e).charAt(0)})</span>
</div>
</div>
`}var Si=w(()=>{"use strict";P();R()});function Ai(a,r,e){let t=a.degradation_trend!=null&&a.degradation_trend!=="insufficient_data",i=a.days_until_threshold!=null,n=a.environmental_factor!=null&&a.environmental_factor!==1;if(!t&&!i&&!n)return h;let o=a.degradation_trend==="rising"?"M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z":a.degradation_trend==="falling"?"M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z":"M22,12L18,8V11H3V13H18V16L22,12Z";return l`
`}var Ii=w(()=>{"use strict";P();R()});function Li(a,r,e){let t=a.degradation_trend!=null&&a.degradation_trend!=="insufficient_data",i=a.days_until_threshold!=null,n=a.environmental_factor!=null&&a.environmental_factor!==1;if(!t&&!i&&!n)return h;let o=a.degradation_trend==="rising"?"M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z":a.degradation_trend==="falling"?"M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z":"M22,12L18,8V11H3V13H18V16L22,12Z";return l`
<div class="prediction-section">
${a.sensor_prediction_urgency?l`
<div class="prediction-urgency-banner">
@@ -3241,12 +3210,12 @@ ${c?`<div class="sub">${c}</div>`:""}
<ha-svg-icon path="M15,13V5A3,3 0 0,0 12,2A3,3 0 0,0 9,5V13A5,5 0 0,0 7,17A5,5 0 0,0 12,22A5,5 0 0,0 17,17A5,5 0 0,0 15,13M12,4A1,1 0 0,1 13,5V8H11V5A1,1 0 0,1 12,4Z"></ha-svg-icon>
<span class="prediction-label">${s("environmental_adjustment",r)}</span>
<span class="prediction-value">${a.environmental_factor.toFixed(2)}x</span>
${a.environmental_entity?l`<span class="prediction-entity entity-link" @click=${p=>ci(p,a.environmental_entity)}>${a.environmental_entity}</span>`:h}
${a.environmental_entity?l`<span class="prediction-entity entity-link" @click=${p=>ui(p,a.environmental_entity)}>${a.environmental_entity}</span>`:h}
</div>
`:h}
</div>
</div>
`}var Ti=w(()=>{"use strict";P();R()});function Ci(a,r,e,t){let i=Math.max(a||1,r);return l`
`}var Pi=w(()=>{"use strict";P();R()});function Ri(a,r,e,t){let i=Math.max(a||1,r);return l`
<div class="interval-comparison">
<div class="interval-bar">
<div class="interval-label">
@@ -3264,13 +3233,13 @@ ${c?`<div class="sub">${c}</div>`:""}
style="width: ${Math.min(r/i*100,100)}%"></div>
</div>
</div>
`}var Ii=w(()=>{"use strict";P();R()});function Pi(a,r,e){if(!e.seasonal||!a.seasonal_factor||a.seasonal_factor===1)return h;let t=Li.map(p=>s(p,r)),i=new Date().getMonth(),n=a.seasonal_factors||a.interval_analysis?.seasonal_factors||null,o=n&&n.length===12?n:t.map((p,c)=>{let _=a.seasonal_factor||1,f=Math.sin((c-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,_+f))});return l`
`}var Ni=w(()=>{"use strict";P();R()});function Hi(a,r,e){if(!e.seasonal||!a.seasonal_factor||a.seasonal_factor===1)return h;let t=ji.map(p=>s(p,r)),i=new Date().getMonth(),n=a.seasonal_factors||a.interval_analysis?.seasonal_factors||null,o=n&&n.length===12?n:t.map((p,c)=>{let u=a.seasonal_factor||1,f=Math.sin((c-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,u+f))});return l`
<div class="seasonal-card-compact">
<h4>${s("seasonal_awareness",r)}</h4>
<div class="seasonal-mini-chart">
${o.map((p,c)=>{let _=p*40,f=p<.9?"low":p>1.1?"high":"normal";return l`
${o.map((p,c)=>{let u=p*40,f=p<.9?"low":p>1.1?"high":"normal";return l`
<div class="seasonal-bar ${f} ${c===i?"current":""}"
style="height: ${_}px"
style="height: ${u}px"
title="${t[c]}: ${p.toFixed(2)}x">
</div>
`})}
@@ -3281,7 +3250,7 @@ ${c?`<div class="sub">${c}</div>`:""}
<span class="legend-item"><span class="dot high"></span> ${s("longer",r)||"L\xE4nger"}</span>
</div>
</div>
`}function Ri(a,r){return qr(a,r)}function qr(a,r){let e=a.seasonal_factors??a.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return h;let t=a.interval_analysis?.seasonal_reason,i=new Date().getMonth(),n=300,o=100,p=8,_=o-p-4,f=Math.max(...e,1.5),m=n/12,y=m*.65,b=p+_-1/f*_;return l`
`}function qi(a,r){return Ur(a,r)}function Ur(a,r){let e=a.seasonal_factors??a.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return h;let t=a.interval_analysis?.seasonal_reason,i=new Date().getMonth(),n=300,o=100,p=8,u=o-p-4,f=Math.max(...e,1.5),m=n/12,y=m*.65,b=p+u-1/f*u;return l`
<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>
@@ -3291,20 +3260,20 @@ ${c?`<div class="sub">${c}</div>`:""}
<svg viewBox="0 0 ${n} ${o}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_seasonal",r)}">
<line x1="0" y1="${b.toFixed(1)}" x2="${n}" y2="${b.toFixed(1)}"
stroke="var(--divider-color)" stroke-width="1" stroke-dasharray="4,3" />
${e.map((k,E)=>{let D=k/f*_,V=E*m+(m-y)/2,M=p+_-D,le=E===i,de=k<1?"var(--success-color, #4caf50)":k>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return _e`
${e.map((k,E)=>{let D=k/f*u,V=E*m+(m-y)/2,M=p+u-D,le=E===i,de=k<1?"var(--success-color, #4caf50)":k>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return _e`
<rect x="${V.toFixed(1)}" y="${M.toFixed(1)}"
width="${y.toFixed(1)}" height="${D.toFixed(1)}"
fill="${de}" opacity="${le?1:.5}" rx="2" />
`})}
</svg>
<div class="seasonal-labels">
${Li.map((k,E)=>l`<span class="seasonal-label ${E===i?"active-month":""}">${s(k,r)}</span>`)}
${ji.map((k,E)=>l`<span class="seasonal-label ${E===i?"active-month":""}">${s(k,r)}</span>`)}
</div>
</div>
`}var Li,ji=w(()=>{"use strict";P();R();Li=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"]});var C,Ni=w(()=>{"use strict";P();U();R();oe();Si();Ti();Ii();ji();C=class extends A{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}get _lang(){return H(this.hass)}async openFor(e,t){this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=new Date().toISOString().slice(0,10),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});e?.features&&(this._features={...this._features,...e.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=e.object?.name||"";let t=(e.tasks||[]).find(i=>i.id===this._taskId);this._task=t??null}catch(e){this._error=j(e,this._lang)}}async _runWs(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e),this._busy=!1,!0}catch(t){return this._error=j(t,this._lang),this._busy=!1,!1}}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(B(),Q)).then(({openCompleteDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,checklist:this._task.checklist||[],adaptive_enabled:!!this._task.adaptive_config?.enabled})&&(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||Promise.resolve().then(()=>(B(),Q)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(B(),Q)).then(({openQrDialog:e})=>{e({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 e=s("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(e))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 e=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",e),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 e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=e.recommended_interval?`${s("reanalyze_result",this._lang)||"Recomputed"}: ${Be(e.recommended_inLine truncated
`}var ji,Mi=w(()=>{"use strict";P();R();ji=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"]});var C,Oi=w(()=>{"use strict";P();U();R();oe();Ii();Pi();Ni();Mi();C=class extends A{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}get _lang(){return j(this.hass)}async openFor(e,t){this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=new Date().toISOString().slice(0,10),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});e?.features&&(this._features={...this._features,...e.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=e.object?.name||"";let t=(e.tasks||[]).find(i=>i.id===this._taskId);this._task=t??null}catch(e){this._error=N(e,this._lang)}}async _runWs(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e),this._busy=!1,!0}catch(t){return this._error=N(t,this._lang),this._busy=!1,!1}}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(B(),Q)).then(({openCompleteDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,checklist:this._task.checklist||[],adaptive_enabled:!!this._task.adaptive_config?.enabled})&&(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||Promise.resolve().then(()=>(B(),Q)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(B(),Q)).then(({openQrDialog:e})=>{e({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 e=s("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(e))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 e=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",e),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 e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=e.recommended_interval?`${s("reanalyze_result",this._lang)||"Recomputed"}: ${Be(e.recommended_inLine truncated
<div class="recommendation-card">
<h4>${s("suggested_interval",t)}</h4>
${Ci(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
${Ri(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
<div class="recommendation-actions">
<button class="btn primary"
@click=${this._applySuggestion} ?disabled=${this._busy}>
@@ -3324,14 +3293,14 @@ ${c?`<div class="sub">${c}</div>`:""}
<div class="adaptive-stack">
${this._toast?l`<div class="toast">${this._toast}</div>`:h}
${i?this._renderRecommendation(e):h}
${n?Ai(e,t,this._features):h}
${o?Ei(e,t):h}
${n?Li(e,t,this._features):h}
${o?Ci(e,t):h}
${p?l`
${Pi(e,t,this._features)}
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?Ri(e,t):h}
${Hi(e,t,this._features)}
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?qi(e,t):h}
`:h}
</div>
`}_renderDetails(e){let t=this._lang,i=e.history||[],n=i.filter(c=>c.type==="completed"),o=n.reduce((c,_)=>c+(typeof _.cost=="number"?_.cost:0),0),p=(()=>{let c=n.map(_=>typeof _.duration=="number"?_.duration:null).filter(_=>_!=null);return c.length?Math.round(c.reduce((_,f)=>_+f,0)/c.length):null})();return l`
`}_renderDetails(e){let t=this._lang,i=e.history||[],n=i.filter(c=>c.type==="completed"),o=n.reduce((c,u)=>c+(typeof u.cost=="number"?u.cost:0),0),p=(()=>{let c=n.map(u=>typeof u.duration=="number"?u.duration:null).filter(u=>u!=null);return c.length?Math.round(c.reduce((u,f)=>u+f,0)/c.length):null})();return l`
<div class="details">
<div class="stats-grid">
<div class="stat">
@@ -3353,12 +3322,12 @@ ${c?`<div class="sub">${c}</div>`:""}
</div>
${i.length===0?l`<div class="history-empty">${s("history_empty",t)||"No history yet."}</div>`:l`
<div class="history-list">
${[...i].reverse().slice(0,20).map(c=>{let _=["completed","reset","skipped"].includes(c.type);return l`
${[...i].reverse().slice(0,20).map(c=>{let u=["completed","reset","skipped"].includes(c.type);return l`
<div class="history-entry">
<div class="history-line">
<span class="history-type type-${c.type}">${s(c.type,t)}</span>
<span class="history-date">${oi(c.timestamp,t)}</span>
${_?l`<button class="history-edit"
<span class="history-date">${di(c.timestamp,t)}</span>
${u?l`<button class="history-edit"
title="${s("history_edit_button",t)||"Edit"}"
@click=${()=>this._onEditHistoryEntry(c)}>
<ha-icon icon="mdi:pencil"></ha-icon>
@@ -3390,7 +3359,7 @@ ${c?`<div class="sub">${c}</div>`:""}
<div class="quick-info">
${t.next_due?l`<span><strong>${s("next_due",e)||"Next due"}:</strong> ${G(t.next_due,e)}</span>`:h}
${t.last_performed?l`<span><strong>${s("last_performed",e)||"Last"}:</strong> ${G(t.last_performed,e)}</span>`:h}
${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?l`<span><strong>${s("interval",e)||"Interval"}:</strong> ${di(t,e)}</span>`:h}
${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?l`<span><strong>${s("interval",e)||"Interval"}:</strong> ${pi(t,e)}</span>`:h}
</div>
</div>
@@ -3662,7 +3631,7 @@ ${c?`<div class="sub">${c}</div>`:""}
.weibull-section, .seasonal-card-compact { max-width: 100%; }
.weibull-chart svg { max-width: 100%; height: auto; }
.details-toggle { gap: 12px; flex-wrap: wrap; }
`],d([x({attribute:!1})],C.prototype,"hass",2),d([u()],C.prototype,"_open",2),d([u()],C.prototype,"_entryId",2),d([u()],C.prototype,"_taskId",2),d([u()],C.prototype,"_task",2),d([u()],C.prototype,"_objectName",2),d([u()],C.prototype,"_busy",2),d([u()],C.prototype,"_error",2),d([u()],C.prototype,"_showSkip",2),d([u()],C.prototype,"_showReset",2),d([u()],C.prototype,"_showDetails",2),d([u()],C.prototype,"_showAdaptive",2),d([u()],C.prototype,"_skipReason",2),d([u()],C.prototype,"_resetDate",2),d([u()],C.prototype,"_features",2),d([u()],C.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",C)});function Hi(a){return!!a&&/^https?:\/\//i.test(a)}var qi=w(()=>{"use strict"});var W,Mi=w(()=>{"use strict";P();qi();U();R();oe();W=class extends A{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return H(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=j(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(B(),Q)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(B(),Q)).then(({openCreateTaskDialog:e})=>{e(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=s("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){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(t){this._error=j(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=s("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"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(t){this._error=j(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(B(),Q)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return h;let e=this._lang,t=this._data,i=t?.object,n=t?.tasks||[],o=this.hass?.user?.is_admin??!0;return l`
`],d([x({attribute:!1})],C.prototype,"hass",2),d([_()],C.prototype,"_open",2),d([_()],C.prototype,"_entryId",2),d([_()],C.prototype,"_taskId",2),d([_()],C.prototype,"_task",2),d([_()],C.prototype,"_objectName",2),d([_()],C.prototype,"_busy",2),d([_()],C.prototype,"_error",2),d([_()],C.prototype,"_showSkip",2),d([_()],C.prototype,"_showReset",2),d([_()],C.prototype,"_showDetails",2),d([_()],C.prototype,"_showAdaptive",2),d([_()],C.prototype,"_skipReason",2),d([_()],C.prototype,"_resetDate",2),d([_()],C.prototype,"_features",2),d([_()],C.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",C)});function Di(a){return!!a&&/^https?:\/\//i.test(a)}var zi=w(()=>{"use strict"});var W,Fi=w(()=>{"use strict";P();zi();U();R();oe();W=class extends A{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return j(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=N(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(B(),Q)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(B(),Q)).then(({openCreateTaskDialog:e})=>{e(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=s("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){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(t){this._error=N(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=s("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"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(t){this._error=N(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(B(),Q)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return h;let e=this._lang,t=this._data,i=t?.object,n=t?.tasks||[],o=this.hass?.user?.is_admin??!0;return l`
<div class="backdrop" @click=${this.close}></div>
<div class="dialog" role="dialog" aria-modal="true">
${t&&i?l`
@@ -3725,7 +3694,7 @@ ${c?`<div class="sub">${c}</div>`:""}
${i.map(([n,o])=>l`
<div class="meta-item">
<span class="meta-label">${n}</span>
<span class="meta-value">${Hi(o)?l`<a href="${o}" target="_blank" rel="noopener noreferrer">${o}</a>`:o}</span>
<span class="meta-value">${Di(o)?l`<a href="${o}" target="_blank" rel="noopener noreferrer">${o}</a>`:o}</span>
</div>
`)}
</div>
@@ -3788,7 +3757,7 @@ ${c?`<div class="sub">${c}</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; }
`,d([x({attribute:!1})],W.prototype,"hass",2),d([u()],W.prototype,"_open",2),d([u()],W.prototype,"_entryId",2),d([u()],W.prototype,"_data",2),d([u()],W.prototype,"_busy",2),d([u()],W.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",W)});var Q={};Vi(Q,{openCompleteDialog:()=>Gr,openCreateObjectDialog:()=>Br,openCreateTaskDialog:()=>Vr,openEditObjectDialog:()=>Wr,openEditTaskDialog:()=>Kr,openHistoryEditDialog:()=>vt,openObjectQuickActions:()=>Qr,openQrDialog:()=>Yr,openTaskQuickActions:()=>yt});function Qe(){return document.querySelector("home-assistant")?.hass}function Ur(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function J(a){let r=Ur(),e=r.querySelector(a)??document.body.querySelector(a);return e?e.parentNode!==r&&r.appendChild(e):(e=document.createElement(a),r.appendChild(e)),e}function Z(a){let r=Qe();if(!r)return!1;a.hass=r;let e=r.language||"en";return Re(e)||je(e).then(()=>{a.requestUpdate?.()}),!0}function Fi(a){return Ye||(Ye=a.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(r=>({features:r.features??Oi.features,defaultWarningDays:r.general?.default_warning_days??7})).catch(()=>Oi),Ye)}function Br(){let a=J(Di);return Z(a)?(a.openCreate(),!0):!1}function Wr(a,r){let e=J(Di);return Z(e)?(e.openEdit(a,r),!0):!1}function Vr(){let a=J(zi);if(!Z(a))return!1;let r=Qe();return r?((async()=>{let e=await Fi(r),t=a;t.checklistsEnabled=e.features.checklists,t.scheduleTimeEnabled=e.features.schedule_time,t.completionActionsEnabled=e.features.completion_actions,t.defaultWarningDays=e.defaultWarningDays,t.openCreate()})(),!0):!1}function Kr(a,r){let e=J(zi);if(!Z(e))return!1;let t=Qe();return t?((async()=>{try{let[i,n]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:a}),Fi(t)]),o=(i.tasks||[]).find(c=>c.id===r);if(!o){console.warn(`openEditTaskDialog: task ${r} not found in entry ${a}`);return}let p=e;p.checklistsEnabled=n.features.checklists,p.scheduleTimeEnabled=n.features.schedule_time,p.completionActionsEnabled=n.features.completion_actions,p.defaultWarningDays=n.defaultWarningDays,await p.openEdit(a,o)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function vt(a){let r=J(Mr);return Z(r)?(r.openEdit(a),!0):!1}function Gr(a){let r=J(Or);return Z(r)?(r.entryId=a.entry_id,r.taskId=a.task_id,r.taskName=a.task_name,r.checklist=a.checklist??[],r.adaptiveEnabled=!!a.adaptive_enabled,r.requiredFields=a.required_completion_fields??[],r.lang=Qe()?.language||"en",r.open(),!0):!1}function Yr(a){let r=J(Dr);return Z(r)?(r.openForTask(a.entry_id,a.task_id,a.object_name,a.task_name),!0):!1}function yt(a,r){let e=J(zr);return Z(e)?(e.openFor(a,r),!0):!1}function Qr(a){let r=J(Fr);return Z(r)?(r.openFor(a),!0):!1}var Di,zi,Mr,Or,Dr,zr,Fr,Oi,Ye,B=w(()=>{"use strict";_i();bi();xi();wi();ki();Ni();Mi();R();Di="maintenance-object-dialog",zi="maintenance-task-dialog",Mr="maintenance-history-edit-dialog",Or="maintenance-complete-dialog",Dr="maintenance-qr-dialog",zr="maintenance-task-quick-actions-dialog",Fr="maintenance-object-quick-actions-dialog";Oi={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7},Ye=null});P();U();var lr={days:1,weeks:7,months:30.4368,years:365.25};function Gt(a,r){return!a||a<=0?0:a*(lr[r||"days"]??1)}var Yt=5;function Te(a){let r=a.getFullYear(),e=String(a.getMonth()+1).padStart(2,"0"),t=String(a.getDate()).padStart(2,"0");return`${r}-${e}-${t}`}function dr(a,r){let e=[];for(let t=0;t<r;t++){let i=new Date(a);i.setDate(i.getDate()+t),i.setHours(0,0,0,0),e.push(Te(i))}return e}function Fe(a,r){let[e,t,i]=a.split("-").map(Number),n=new Date(e,t-1,i);return n.setDate(n.getDate()+r),Te(n)}function cr(a){if(!a||a.length===0)return null;let r=a.map(e=>e.cost).filter(e=>typeof e=="number");return r.length===0?null:r.reduce((e,t)=>e+t,0)/r.length}function pr(a){let{windowStart:r,windowEnd:e,task:t,entryId:i,objectName:n}=a,o=[],p=(m,y)=>({date:m,entry_id:i,task_id:t.id,task_name:t.name,object_name:n,status:y&&(t.status==="overdue"||t.status==="triggered")?"ok":t.status,days_until_due:y?null:t.days_until_due??null,projected:y,schedule_type:t.schedule_type,interval_days:t.interval_days??null,interval_unit:t.interval_unit??null,responsible_user_id:t.responsible_user_id??null,avg_cost:cr(t.history),adaptive_enabled:!!t.adaptive_config?.enabled,prediction_confidence:t.threshold_prediction_confidence??null}),c=Math.max(1,Math.round(Gt(t.interval_days,t.interval_unit)));if(t.status==="overdue"||t.status==="triggered"){if(o.push(p(r,!1)),t.schedule_type==="time_based"&&t.interval_days&&t.interval_days>0){let m=Fe(r,c),y=1;for(;m<=e&&y<Yt;)o.push(p(m,!0)),y++,m=Fe(m,c)}return o}let _=t.next_due;if(typeof _!="string"||!_)return o;let f=_.slice(0,10);if(f>=r&&f<=e Line truncated
`,d([x({attribute:!1})],W.prototype,"hass",2),d([_()],W.prototype,"_open",2),d([_()],W.prototype,"_entryId",2),d([_()],W.prototype,"_data",2),d([_()],W.prototype,"_busy",2),d([_()],W.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",W)});var Q={};Qi(Q,{openCompleteDialog:()=>es,openCreateObjectDialog:()=>Qr,openCreateTaskDialog:()=>Zr,openEditObjectDialog:()=>Jr,openEditTaskDialog:()=>Xr,openHistoryEditDialog:()=>vt,openObjectQuickActions:()=>is,openQrDialog:()=>ts,openTaskQuickActions:()=>yt});function Qe(){return document.querySelector("home-assistant")?.hass}function Yr(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function J(a){let r=Yr(),e=r.querySelector(a)??document.body.querySelector(a);return e?e.parentNode!==r&&r.appendChild(e):(e=document.createElement(a),r.appendChild(e)),e}function Z(a){let r=Qe();if(!r)return!1;a.hass=r;let e=j(r);return Re(e)||Ne(e).then(()=>{a.requestUpdate?.()}),!0}function Vi(a){return Ye||(Ye=a.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(r=>({features:r.features??Ui.features,defaultWarningDays:r.general?.default_warning_days??7})).catch(()=>Ui),Ye)}function Qr(){let a=J(Bi);return Z(a)?(a.openCreate(),!0):!1}function Jr(a,r){let e=J(Bi);return Z(e)?(e.openEdit(a,r),!0):!1}function Zr(){let a=J(Wi);if(!Z(a))return!1;let r=Qe();return r?((async()=>{let e=await Vi(r),t=a;t.checklistsEnabled=e.features.checklists,t.scheduleTimeEnabled=e.features.schedule_time,t.completionActionsEnabled=e.features.completion_actions,t.defaultWarningDays=e.defaultWarningDays,t.openCreate()})(),!0):!1}function Xr(a,r){let e=J(Wi);if(!Z(e))return!1;let t=Qe();return t?((async()=>{try{let[i,n]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:a}),Vi(t)]),o=(i.tasks||[]).find(c=>c.id===r);if(!o){console.warn(`openEditTaskDialog: task ${r} not found in entry ${a}`);return}let p=e;p.checklistsEnabled=n.features.checklists,p.scheduleTimeEnabled=n.features.schedule_time,p.completionActionsEnabled=n.features.completion_actions,p.defaultWarningDays=n.defaultWarningDays,await p.openEdit(a,o)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function vt(a){let r=J(Br);return Z(r)?(r.openEdit(a),!0):!1}function es(a){let r=J(Wr);return Z(r)?(r.entryId=a.entry_id,r.taskId=a.task_id,r.taskName=a.task_name,r.checklist=a.checklist??[],r.adaptiveEnabled=!!a.adaptive_enabled,r.requiredFields=a.required_completion_fields??[],r.lang=Qe()?.language||"en",r.open(),!0):!1}function ts(a){let r=J(Vr);return Z(r)?(r.openForTask(a.entry_id,a.task_id,a.object_name,a.task_name),!0):!1}function yt(a,r){let e=J(Kr);return Z(e)?(e.openFor(a,r),!0):!1}function is(a){let r=J(Gr);return Z(r)?(r.openFor(a),!0):!1}var Bi,Wi,Br,Wr,Vr,Kr,Gr,Ui,Ye,B=w(()=>{"use strict";gi();wi();$i();ki();Ti();Oi();Fi();R();Bi="maintenance-object-dialog",Wi="maintenance-task-dialog",Br="maintenance-history-edit-dialog",Wr="maintenance-complete-dialog",Vr="maintenance-qr-dialog",Kr="maintenance-task-quick-actions-dialog",Gr="maintenance-object-quick-actions-dialog";Ui={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7},Ye=null});P();U();var ur={days:1,weeks:7,months:30.4368,years:365.25};function Gt(a,r){return!a||a<=0?0:a*(ur[r||"days"]??1)}var Yt=5;function Te(a){let r=a.getFullYear(),e=String(a.getMonth()+1).padStart(2,"0"),t=String(a.getDate()).padStart(2,"0");return`${r}-${e}-${t}`}function _r(a,r){let e=[];for(let t=0;t<r;t++){let i=new Date(a);i.setDate(i.getDate()+t),i.setHours(0,0,0,0),e.push(Te(i))}return e}function Fe(a,r){let[e,t,i]=a.split("-").map(Number),n=new Date(e,t-1,i);return n.setDate(n.getDate()+r),Te(n)}function hr(a){if(!a||a.length===0)return null;let r=a.map(e=>e.cost).filter(e=>typeof e=="number");return r.length===0?null:r.reduce((e,t)=>e+t,0)/r.length}function gr(a){let{windowStart:r,windowEnd:e,task:t,entryId:i,objectName:n}=a,o=[],p=(m,y)=>({date:m,entry_id:i,task_id:t.id,task_name:t.name,object_name:n,status:y&&(t.status==="overdue"||t.status==="triggered")?"ok":t.status,days_until_due:y?null:t.days_until_due??null,projected:y,schedule_type:t.schedule_type,interval_days:t.interval_days??null,interval_unit:t.interval_unit??null,responsible_user_id:t.responsible_user_id??null,avg_cost:hr(t.history),adaptive_enabled:!!t.adaptive_config?.enabled,prediction_confidence:t.threshold_prediction_confidence??null}),c=Math.max(1,Math.round(Gt(t.interval_days,t.interval_unit)));if(t.status==="overdue"||t.status==="triggered"){if(o.push(p(r,!1)),t.schedule_type==="time_based"&&t.interval_days&&t.interval_days>0){let m=Fe(r,c),y=1;for(;m<=e&&y<Yt;)o.push(p(m,!0)),y++,m=Fe(m,c)}return o}let u=t.next_due;if(typeof u!="string"||!u)return o;let f=u.slice(0,10);if(f>=r&&f<=e)o.push(p(f, Line truncated
.cal-controls {
display: flex;
gap: 12px;
@@ -3985,22 +3954,22 @@ ${c?`<div class="sub">${c}</div>`:""}
.cal-pill-day { font-size: 17px; }
.cal-user-filter { margin-left: 0; width: 100%; }
}
`;R();function ui(a){let r=window;r.customCards=r.customCards||[],r.customCards.some(e=>e.type===a.type)||r.customCards.push(a)}B();var q=class extends A{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"};this._objects=[];this._stats=null;this._windowDays=30;this._pastDays=0;this._userFilter="";this._objectFilter="";this._configuredObjects=[];this._unsub=null;this._dataLoaded=!1;this._lastConnection=null}static getConfigElement(){return document.createElement("maintenance-supporter-calendar-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-calendar-card",window_days:30,show_window_chips:!0,show_user_filter:!0}}setConfig(e){if(this._config={...e},e.past_days&&[30,90].includes(e.past_days)?this._pastDays=e.past_days:e.window_days&&[7,14,30,365].includes(e.window_days)&&(this._windowDays=e.window_days,this._pastDays=0),typeof e.user_filter=="string"&&(this._userFilter=e.user_filter),typeof e.object_filter=="string")this._objectFilter=e.object_filter,this._configuredObjects=[];else if(Array.isArray(e.object_filter)){let t=e.object_filter.filter(i=>typeof i=="string"&&i!=="");this._objectFilter=t.length===1?t[0]:"",this._configuredObjects=t.length>1?t:[]}}getCardSize(){return 6}get _lang(){return H(this.hass)}disconnectedCallback(){if(super.disconnectedCallback(),this._unsub){try{this._unsub()}catch{}this._unsub=null}this._dataLoaded=!1,this._lastConnection=null}updated(e){super.updated(e),e.has("hass")&&ai(this.hass?.locale);let t=this.hass?.language;if(t&&!Re(t)&&je(t).then(()=>this.requestUpdate()),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t}catch{}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}_onEventClick(e){if(e.history_timestamp){this._openHistoryEntry(e);return}yt(e.entry_id,e.task_id)||this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:open-task",entry_id:e.entry_id,task_id:e.task_id},bubbles:!0,composed:!0}))}async _openHistoryEntry(e){try{let i=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:e.entry_id})).tasks?.find(o=>o.id===e.task_id)?.history?.find(o=>o.timestamp===e.history_timestamp);if(!i||vt({entry_id:e.entry_id,task_id:e.task_id,original_timestamp:e.history_timestamp,type:i.type||"completed",timestamp:i.timestamp||e.history_timestamp,notes:i.notes??null,cost:i.cost??null,duration:i.duration??null,completed_by:i.completed_by??null,used_parts:i.used_parts??null}))return}catch{}this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:edit-history",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:e.history_timestamp},bubbles:!0,composed:!0}))}render(){if(!this.hass)return h;let e=this._lang,t=this._config.show_window_chips!==!1,i=this._config.show_user_filter!==!1,n=this._config.title,o=null;this._userFilter&&(o=this._userFilter==="current_user"?this.hass?.user?.id??null:this._userFilter);let p=v=>{let F=v.toLowerCase();return this._objects.find(I=>I.entry_id===v||I.object.name.toLowerCase()===F)?.entry_id??null},c=new Set(this._configuredObjects.map(p).filter(v=>v!==null)),_=c.size?this._objects.filter(v=>c.has(v.entry_id)):this._objects,f=this._config.show_object_filter!==!1&&_.length>1,m=this._objectFilter?p(this._objectFilter):null,y=m&&_.some(v=>v.entry_id===m)?_.filter(v=>v.entry_id===m):_,b=new Date;b.setHours(0,0,0,0);let k=this._pastDays>0,E=k?Zt(y,b,this._pastDays,o):Jt(y,b,this._windowDays,o),D=Te(b),V=this._windowDays===365||k,M=V?E.filter(v=>v.events.length>0):E,le=v=>{let F=`cal-status-${v.status}`,ce=v.projected?"cal-event-projected":"",I=v.status==="overdue"&&v.days_until_due!=null?` (${li(v.days_until_due,e)})`:"",L=v.projected&&v.interval_days?l`<span class="cal-event-recur">${v.interval_unit&&v.interval_unit!=="days"?`${v.interval_days} ${s("unit_"+v.interval_unit,e)}`:s("cal_every_n_days",e).replace("{n}",String(v.interval_days))}</span>`:h,te=v.schedule_type==="sensor_based",fe=te?l`<ha-icon class="cal-event-icon cal-source-sensor"
`;R();function hi(a){let r=window;r.customCards=r.customCards||[],r.customCards.some(e=>e.type===a.type)||r.customCards.push(a)}B();var q=class extends A{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"};this._objects=[];this._stats=null;this._windowDays=30;this._pastDays=0;this._userFilter="";this._objectFilter="";this._configuredObjects=[];this._unsub=null;this._dataLoaded=!1;this._lastConnection=null}static getConfigElement(){return document.createElement("maintenance-supporter-calendar-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-calendar-card",window_days:30,show_window_chips:!0,show_user_filter:!0}}setConfig(e){if(this._config={...e},e.past_days&&[30,90].includes(e.past_days)?this._pastDays=e.past_days:e.window_days&&[7,14,30,365].includes(e.window_days)&&(this._windowDays=e.window_days,this._pastDays=0),typeof e.user_filter=="string"&&(this._userFilter=e.user_filter),typeof e.object_filter=="string")this._objectFilter=e.object_filter,this._configuredObjects=[];else if(Array.isArray(e.object_filter)){let t=e.object_filter.filter(i=>typeof i=="string"&&i!=="");this._objectFilter=t.length===1?t[0]:"",this._configuredObjects=t.length>1?t:[]}}getCardSize(){return 6}get _lang(){return j(this.hass)}disconnectedCallback(){if(super.disconnectedCallback(),this._unsub){try{this._unsub()}catch{}this._unsub=null}this._dataLoaded=!1,this._lastConnection=null}updated(e){if(super.updated(e),oi(this,e),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t}catch{}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}_onEventClick(e){if(e.history_timestamp){this._openHistoryEntry(e);return}yt(e.entry_id,e.task_id)||this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:open-task",entry_id:e.entry_id,task_id:e.task_id},bubbles:!0,composed:!0}))}async _openHistoryEntry(e){try{let i=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:e.entry_id})).tasks?.find(o=>o.id===e.task_id)?.history?.find(o=>o.timestamp===e.history_timestamp);if(!i||vt({entry_id:e.entry_id,task_id:e.task_id,original_timestamp:e.history_timestamp,type:i.type||"completed",timestamp:i.timestamp||e.history_timestamp,notes:i.notes??null,cost:i.cost??null,duration:i.duration??null,completed_by:i.completed_by??null,used_parts:i.used_parts??null}))return}catch{}this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:edit-history",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:e.history_timestamp},bubbles:!0,composed:!0}))}render(){if(!this.hass)return h;let e=this._lang,t=this._config.show_window_chips!==!1,i=this._config.show_user_filter!==!1,n=this._config.title,o=null;this._userFilter&&(o=this._userFilter==="current_user"?this.hass?.user?.id??null:this._userFilter);let p=v=>{let F=v.toLowerCase();return this._objects.find(I=>I.entry_id===v||I.object.name.toLowerCase()===F)?.entry_id??null},c=new Set(this._configuredObjects.map(p).filter(v=>v!==null)),u=c.size?this._objects.filter(v=>c.has(v.entry_id)):this._objects,f=this._config.show_object_filter!==!1&&u.length>1,m=this._objectFilter?p(this._objectFilter):null,y=m&&u.some(v=>v.entry_id===m)?u.filter(v=>v.entry_id===m):u,b=new Date;b.setHours(0,0,0,0);let k=this._pastDays>0,E=k?Zt(y,b,this._pastDays,o):Jt(y,b,this._windowDays,o),D=Te(b),V=this._windowDays===365||k,M=V?E.filter(v=>v.events.length>0):E,le=v=>{let F=`cal-status-${v.status}`,ce=v.projected?"cal-event-projected":"",I=v.status==="overdue"&&v.days_until_due!=null?` (${ci(v.days_until_due,e)})`:"",L=v.projected&&v.interval_days?l`<span class="cal-event-recur">${v.interval_unit&&v.interval_unit!=="days"?`${v.interval_days} ${s("unit_"+v.interval_unit,e)}`:s("cal_every_n_days",e).replace("{n}",String(v.interval_days))}</span>`:h,te=v.schedule_type==="sensor_based",fe=te?l`<ha-icon class="cal-event-icon cal-source-sensor"
title="${s("cal_source_sensor",e)}" icon="mdi:trending-up"></ha-icon>`:l`<ha-icon class="cal-event-icon cal-source-time"
title="${v.adaptive_enabled?s("cal_source_time_adaptive",e):s("cal_source_time",e)}"
icon="${v.adaptive_enabled?"mdi:clock-time-four-outline":"mdi:clock-outline"}"></ha-icon>`,ve=te&&v.prediction_confidence&&v.status!=="triggered"&&!v.projected?l`<span class="cal-event-prediction cal-conf-${v.prediction_confidence}">
${s("cal_predicted",e)} · ${s(`cal_confidence_${v.prediction_confidence}`,e)}
</span>`:h,Ui=this._stats?.budget?.currency_symbol||ri,Bi=v.history_type?s(v.history_type,e):s(v.status,e);return l`
</span>`:h,Ki=this._stats?.budget?.currency_symbol||ai,Gi=v.history_type?s(v.history_type,e):s(v.status,e);return l`
<div class="cal-event ${ce}"
@click=${()=>this._onEventClick(v)}>
${fe}
<span class="cal-status-pill ${F}">${Bi}</span>
<span class="cal-status-pill ${F}">${Gi}</span>
<div class="cal-event-body">
<div class="cal-event-title">${v.object_name} · ${v.task_name}${I}</div>
${ve}
${L}
</div>
${v.avg_cost!=null&&v.avg_cost>0?l`<span class="cal-event-cost">${v.avg_cost.toFixed(0)} ${Ui}</span>`:h}
${v.avg_cost!=null&&v.avg_cost>0?l`<span class="cal-event-cost">${v.avg_cost.toFixed(0)} ${Ki}</span>`:h}
</div>
`},de=v=>{let[F,ce,I]=v.date.split("-").map(Number),L=new Date(F,ce-1,I),te=v.date===D,fe=L.toLocaleDateString(e,{weekday:"short"}),ve=L.toLocaleDateString(e,{month:"long"});return l`
<div class="cal-day-row">
@@ -4052,7 +4021,7 @@ ${c?`<div class="sub">${c}</div>`:""}
.value=${m??""}
@change=${v=>{this._objectFilter=v.target.value}}>
<option value="">${s("all_objects",e)}</option>
${[..._].sort((v,F)=>v.object.name.localeCompare(F.object.name)).map(v=>l`<option value=${v.entry_id} ?selected=${v.entry_id===m}>${v.object.name}</option>`)}
${[...u].sort((v,F)=>v.object.name.localeCompare(F.object.name)).map(v=>l`<option value=${v.entry_id} ?selected=${v.entry_id===m}>${v.object.name}</option>`)}
</select>
`:h}
</div>
@@ -4064,7 +4033,7 @@ ${c?`<div class="sub">${c}</div>`:""}
`}};q.styles=[Ve,Xt,S`
:host { display: block; }
ha-card { padding: 0; overflow: hidden; }
`],d([x({attribute:!1})],q.prototype,"hass",2),d([u()],q.prototype,"_config",2),d([u()],q.prototype,"_objects",2),d([u()],q.prototype,"_stats",2),d([u()],q.prototype,"_windowDays",2),d([u()],q.prototype,"_pastDays",2),d([u()],q.prototype,"_userFilter",2),d([u()],q.prototype,"_objectFilter",2),d([u()],q.prototype,"_unsub",2);var Jr=[{value:7,key:"cal_editor_window_week"},{value:14,key:"cal_editor_window_fortnight"},{value:30,key:"cal_editor_window_month"},{value:365,key:"cal_editor_window_year"}],me=class extends A{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"}}get _lang(){return H(this.hass)}setConfig(e){this._config={...e}}updated(){let e=this._lang;e&&!Re(e)&&je(e).then(()=>this.requestUpdate())}_valueChanged(e,t){let i={...this._config,[e]:t};e==="show_window_chips"&&t===!0&&delete i.show_window_chips,e==="show_user_filter"&&t===!0&&delete i.show_user_filter,e==="show_object_filter"&&t===!0&&delete i.show_object_filter,e==="title"&&(!t||typeof t=="string"&&t.trim()==="")&&delete i.title,e==="user_filter"&&t===""&&delete i.user_filter,this._config=i,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:i},bubbles:!0,composed:!0}))}render(){let e=this._lang,t=this._config.window_days??30,i=this._config.show_window_chips!==!1,n=this._config.show_user_filter!==!1,o=this._config.user_filter??"",p=this._config.title??"";return l`
`],d([x({attribute:!1})],q.prototype,"hass",2),d([_()],q.prototype,"_config",2),d([_()],q.prototype,"_objects",2),d([_()],q.prototype,"_stats",2),d([_()],q.prototype,"_windowDays",2),d([_()],q.prototype,"_pastDays",2),d([_()],q.prototype,"_userFilter",2),d([_()],q.prototype,"_objectFilter",2),d([_()],q.prototype,"_unsub",2);var rs=[{value:7,key:"cal_editor_window_week"},{value:14,key:"cal_editor_window_fortnight"},{value:30,key:"cal_editor_window_month"},{value:365,key:"cal_editor_window_year"}],me=class extends A{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"}}get _lang(){return j(this.hass)}setConfig(e){this._config={...e}}updated(){let e=this._lang;e&&!Re(e)&&Ne(e).then(()=>this.requestUpdate())}_valueChanged(e,t){let i={...this._config,[e]:t};e==="show_window_chips"&&t===!0&&delete i.show_window_chips,e==="show_user_filter"&&t===!0&&delete i.show_user_filter,e==="show_object_filter"&&t===!0&&delete i.show_object_filter,e==="title"&&(!t||typeof t=="string"&&t.trim()==="")&&delete i.title,e==="user_filter"&&t===""&&delete i.user_filter,this._config=i,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:i},bubbles:!0,composed:!0}))}render(){let e=this._lang,t=this._config.window_days??30,i=this._config.show_window_chips!==!1,n=this._config.show_user_filter!==!1,o=this._config.user_filter??"",p=this._config.title??"";return l`
<div class="editor">
<div class="row">
<label for="title">${s("card_title",e)}</label>
@@ -4081,7 +4050,7 @@ ${c?`<div class="sub">${c}</div>`:""}
id="window"
@change=${c=>this._valueChanged("window_days",Number(c.target.value))}
>
${Jr.map(c=>l`<option value="${c.value}" ?selected=${c.value===t}>${s(c.key,e)}</option>`)}
${rs.map(c=>l`<option value="${c.value}" ?selected=${c.value===t}>${s(c.key,e)}</option>`)}
</select>
</div>
<div class="row toggle">
@@ -4150,7 +4119,7 @@ ${c?`<div class="sub">${c}</div>`:""}
font-size: 12px;
color: var(--secondary-text-color, #666);
}
`,d([x({attribute:!1})],me.prototype,"hass",2),d([u()],me.prototype,"_config",2);customElements.get("maintenance-supporter-calendar-card")||customElements.define("maintenance-supporter-calendar-card",q);customElements.get("maintenance-supporter-calendar-card-editor")||customElements.define("maintenance-supporter-calendar-card-editor",me);ui({type:"maintenance-supporter-calendar-card",name:"Maintenance Supporter \u2014 Calendar",description:"Rolling calendar of maintenance tasks with 7/14/30/365 day windows, source icons, and prediction-confidence pills.",preview:!0});export{q as MaintenanceCalendarCard};
`,d([x({attribute:!1})],me.prototype,"hass",2),d([_()],me.prototype,"_config",2);customElements.get("maintenance-supporter-calendar-card")||customElements.define("maintenance-supporter-calendar-card",q);customElements.get("maintenance-supporter-calendar-card-editor")||customElements.define("maintenance-supporter-calendar-card-editor",me);hi({type:"maintenance-supporter-calendar-card",name:"Maintenance Supporter \u2014 Calendar",description:"Rolling calendar of maintenance tasks with 7/14/30/365 day windows, source icons, and prediction-confidence pills.",preview:!0});export{q as MaintenanceCalendarCard};
/*! Bundled license information:
@lit/reactive-element/css-tag.js: