251 files

This commit is contained in:
Home Assistant Version Control committed 2026-10-16 12:38:25 +00:00
1 parent 3acf0cdf8d
commit 64eb0c647c
251 files changed
+6380 -14560

No files matched your search

@@ -1,9 +1,9 @@
/*! maintenance_supporter frontend 2.103.0 */
var tr=Object.defineProperty;var oo=Object.getOwnPropertyDescriptor;var y=(r,s,e)=>()=>{if(e)throw e[0];try{return r&&(s=r(r=0)),s}catch(t){throw e=[t],t}};var lo=(r,s)=>{for(var e in s)tr(r,e,{get:s[e],enumerable:!0})};var c=(r,s,e,t)=>{for(var i=t>1?void 0:t?oo(s,e):s,a=r.length-1,o;a>=0;a--)(o=r[a])&&(i=(t?o(s,e,i):o(i))||i);return t&&i&&tr(s,e,i),i};var Ut,Bt,ji,ir,_t,sr,$,rr,Di,qi=y(()=>{Ut=globalThis,Bt=Ut.ShadowRoot&&(Ut.ShadyCSS===void 0||Ut.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ji=Symbol(),ir=new WeakMap,_t=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==ji)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=e}get styleSheet(){let s=this.o,e=this.t;if(Bt&&s===void 0){let t=e!==void 0&&e.length===1;t&&(s=ir.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&&ir.set(e,s))}return s}toString(){return this.cssText}},sr=r=>new _t(typeof r=="string"?r:r+"",void 0,ji),$=(r,...s)=>{let e=r.length===1?r[0]:s.reduce((t,i,a)=>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)+r[a+1],r[0]);return new _t(e,r,ji)},rr=(r,s)=>{if(Bt)r.adoptedStyleSheets=s.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of s){let t=document.createElement("style"),i=Ut.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,r.appendChild(t)}},Di=Bt?r=>r:r=>r instanceof CSSStyleSheet?(s=>{let e="";for(let t of s.cssRules)e+=t.cssText;return sr(e)})(r):r});var co,po,uo,ho,_o,mo,Wt,nr,go,fo,mt,gt,Vt,ar,de,ft=y(()=>{qi();qi();({is:co,defineProperty:po,getOwnPropertyDescriptor:uo,getOwnPropertyNames:ho,getOwnPropertySymbols:_o,getPrototypeOf:mo}=Object),Wt=globalThis,nr=Wt.trustedTypes,go=nr?nr.emptyScript:"",fo=Wt.reactiveElementPolyfillSupport,mt=(r,s)=>r,gt={toAttribute(r,s){switch(s){case Boolean:r=r?go:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,s){let e=r;switch(s){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},Vt=(r,s)=>!co(r,s),ar={attribute:!0,type:String,converter:gt,reflect:!1,useDefault:!1,hasChanged:Vt};Symbol.metadata??=Symbol("metadata"),Wt.litPropertyMetadata??=new WeakMap;de=class extends HTMLElement{static addInitializer(s){this._$Ei(),(this.l??=[]).push(s)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(s,e=ar){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(s)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(s,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(s,t,e);i!==void 0&&po(this.prototype,s,i)}}static getPropertyDescriptor(s,e,t){let{get:i,set:a}=uo(this.prototype,s)??{get(){return this[e]},set(o){this[e]=o}};return{get:i,set(o){let d=i?.call(this);a?.call(this,o),this.requestUpdate(s,d,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(s){return this.elementProperties.get(s)??ar}static _$Ei(){if(this.hasOwnProperty(mt("elementProperties")))return;let s=mo(this);s.finalize(),s.l!==void 0&&(this.l=[...s.l]),this.elementProperties=new Map(s.elementProperties)}static finalize(){if(this.hasOwnProperty(mt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(mt("properties"))){let e=this.properties,t=[...ho(e),..._o(e)];for(let i of t)this.createProperty(i,e[i])}let s=this[Symbol.metadata];if(s!==null){let e=litPropertyMetadata.get(s);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(s){let e=[];if(Array.isArray(s)){let t=new Set(s.flat(1/0).reverse());for(let i of t)e.unshift(Di(i))}else s!==void 0&&e.push(Di(s));return e}static _$Eu(s,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof s=="string"?s.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(s=>this.enableUpdating=s),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(s=>s(this))}addController(s){(this._$EO??=new Set).add(s),this.renderRoot!==void 0&&this.isConnected&&s.hostConnected?.()}removeController(s){this._$EO?.delete(s)}_$E_(){let s=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(s.set(t,this[t]),delete this[t]);s.size>0&&(this._$Ep=s)}createRenderRoot(){let s=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return rr(s,this.constructor.elementStyles),s}connectedCallback(){this.renderRoot??=tLine truncated
\f\r]`,vt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,cr=/-->/g,dr=/>/g,Re=RegExp(`>|${Mi}(?:([^\\s"'>=/]+)(${Mi}*=${Mi}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),pr=/'/g,ur=/"/g,mr=/^(?:script|style|textarea|title)$/i,Wi=r=>(s,...e)=>({_$litType$:r,strings:s,values:e}),l=Wi(1),We=Wi(2),Sc=Wi(3),Le=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),hr=new WeakMap,Ie=Pe.createTreeWalker(Pe,129);fr=(r,s)=>{let e=r.length-1,t=[],i,a=s===2?"<svg>":s===3?"<math>":"",o=vt;for(let d=0;d<e;d++){let h=r[d],_,m,b=-1,k=0;for(;k<h.length&&(o.lastIndex=k,m=o.exec(h),m!==null);)k=o.lastIndex,o===vt?m[1]==="!--"?o=cr:m[1]!==void 0?o=dr:m[2]!==void 0?(mr.test(m[2])&&(i=RegExp("</"+m[2],"g")),o=Re):m[3]!==void 0&&(o=Re):o===Re?m[0]===">"?(o=i??vt,b=-1):m[1]===void 0?b=-2:(b=o.lastIndex-m[2].length,_=m[1],o=m[3]===void 0?Re:m[3]==='"'?ur:pr):o===ur||o===pr?o=Re:o===cr||o===dr?o=vt:(o=Re,i=void 0);let w=o===Re&&r[d+1].startsWith("/>")?" ":"";a+=o===vt?h+vo:b>=0?(t.push(_),h.slice(0,b)+Fi+h.slice(b)+pe+w):h+pe+(b===-2?d:w)}return[gr(r,a+(r[e]||"<?>")+(s===2?"</svg>":s===3?"</math>":"")),t]},xt=class r{constructor({strings:s,_$litType$:e},t){let i;this.parts=[];let a=0,o=0,d=s.length-1,h=this.parts,[_,m]=fr(s,e);if(this.el=r.createElement(_,t),Ie.currentNode=this.el.content,e===2||e===3){let b=this.el.content.firstChild;b.replaceWith(...b.childNodes)}for(;(i=Ie.nextNode())!==null&&h.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let b of i.getAttributeNames())if(b.endsWith(Fi)){let k=m[o++],w=i.getAttribute(b).split(pe),v=/([.?@])?(.*)/.exec(k);h.push({type:1,index:a,name:v[2],strings:w,ctor:v[1]==="."?Yt:v[1]==="?"?Qt:v[1]==="@"?Zt:Oe}),i.removeAttribute(b)}else b.startsWith(pe)&&(h.push({type:6,index:a}),i.removeAttribute(b));if(mr.test(i.tagName)){let b=i.textContent.split(pe),k=b.length-1;if(k>0){i.textContent=Gt?Gt.emptyScript:"";for(let w=0;w<k;w++)i.append(b[w],bt()),Ie.nextNode(),h.push({type:2,index:++a});i.append(b[k],bt())}}}else if(i.nodeType===8)if(i.data===Ui)h.push({type:2,index:a});else{let b=-1;for(;(b=i.data.indexOf(pe,b+1))!==-1;)h.push({type:7,index:a}),b+=pe.length-1}a++}}static createElement(s,e){let t=Pe.createElement("template");return t.innerHTML=s,t}};Kt=class{constructor(s,e){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){let{el:{content:e},parts:t}=this._$AD,i=(s?.creationScope??Pe).importNode(e,!0);Ie.currentNode=i;let a=Ie.nextNode(),o=0,d=0,h=t[0];for(;h!==void 0;){if(o===h.index){let _;h.type===2?_=new Be(a,a.nextSibling,this,s):h.type===1?_=new h.ctor(a,h.name,h.strings,this,s):h.type===6&&(_=new Jt(a,this,s)),this._$AV.push(_),h=t[++d]}o!==h?.index&&(a=Ie.nextNode(),o++)}return Ie.currentNode=Pe,i}p(s){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(s,t,e),e+=t.strings.length-2):t._$AI(s[e])),e++}},Be=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(s,e,t,i){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=s,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let s=this._$AA.parentNode,e=this._$AM;return e!==void 0&&s?.nodeType===11&&(s=e.parentNode),s}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(s,e=this){s=Ne(this,s,e),yt(s)?s===p||s==null||s===""?(this._$AH!==p&&this._$AR(),this._$AH=p):s!==this._$AH&&s!==Le&&this._(s):s._$litType$!==void 0?this.$(s):s.nodeType!==void 0?this.T(s):_r(s)?this.k(s):this._(s)}O(s){return this._$AA.parentNode.insertBefore(s,this._$AB)}T(s){this._$AH!==s&&(this._$AR(),this._$AH=this.O(s))}_(s){this._$AH!==p&&yt(this._$AH)?this._$AA.nextSibling.data=s:this.T(Pe.createTextNode(s)),this._$AH=s}$(s){let{values:e,_$litType$:t}=s,i=typeof t=="number"?this._$AC(s):(t.el===void 0&&(t.el=xt.createElement(gr(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new Kt(i,this),o=a.u(this.options);a.p(e),this.T(o),this._$AH=a}}_$AC(s){let e=hr.get(s.strings);return e===void 0&&hr.set(s.strings,e=new xt(s)),e}k(s){Bi(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let a of s)i===e.length?e.push(t=new r(this.O(bt()),this.O(bt()),this,this.options)):t=e[i],t._$AI(a),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(s=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);s!==this._$AB;){let t=or(s).nextSibling;or(s).remove(),s=t}}setConnected(s){this._$AM===void 0&&(this._$Cv=s,this._$AP?.(s))}},Oe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(s,e,t,i,a){this.type=1,this._$AH=p,this._$AN=void 0,this.element=s,this.name=e,this._$AM=i,this.options=a,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=p}_$AI(s,e=this,t,i){let a=this.strings,o=!1;if(a===void 0)s=Ne(this,s,e,0),o=!yt(s)||s!==this._$AH&&s!==Le,o&&(this._$AH=s);else{let d=s,h,_;for(s=a[0],h=0;h<a.length-1;h++)_=Ne(this,d[t+h],e,h),_===Le&&(_=this._$AH[h]),o||=!yt(_)||_!==this._$AH[h],_===p?s=p:s!==p&&(s+=(_??"")+a[h+1]),this._$AH[h]=_}o&&!i&&this.j(s)}j(s){s===p?this.element.removeAttribute(this.naLine truncated
/*! maintenance_supporter frontend 2.103.4 */
var tr=Object.defineProperty;var ao=Object.getOwnPropertyDescriptor;var y=(r,s,e)=>()=>{if(e)throw e[0];try{return r&&(s=r(r=0)),s}catch(t){throw e=[t],t}};var oo=(r,s)=>{for(var e in s)tr(r,e,{get:s[e],enumerable:!0})};var c=(r,s,e,t)=>{for(var i=t>1?void 0:t?ao(s,e):s,a=r.length-1,o;a>=0;a--)(o=r[a])&&(i=(t?o(s,e,i):o(i))||i);return t&&i&&tr(s,e,i),i};var Ut,Bt,ji,ir,mt,sr,$,rr,Di,qi=y(()=>{Ut=globalThis,Bt=Ut.ShadowRoot&&(Ut.ShadyCSS===void 0||Ut.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ji=Symbol(),ir=new WeakMap,mt=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==ji)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=e}get styleSheet(){let s=this.o,e=this.t;if(Bt&&s===void 0){let t=e!==void 0&&e.length===1;t&&(s=ir.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&&ir.set(e,s))}return s}toString(){return this.cssText}},sr=r=>new mt(typeof r=="string"?r:r+"",void 0,ji),$=(r,...s)=>{let e=r.length===1?r[0]:s.reduce((t,i,a)=>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)+r[a+1],r[0]);return new mt(e,r,ji)},rr=(r,s)=>{if(Bt)r.adoptedStyleSheets=s.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of s){let t=document.createElement("style"),i=Ut.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,r.appendChild(t)}},Di=Bt?r=>r:r=>r instanceof CSSStyleSheet?(s=>{let e="";for(let t of s.cssRules)e+=t.cssText;return sr(e)})(r):r});var lo,co,po,uo,ho,_o,Wt,nr,mo,go,gt,ft,Vt,ar,de,vt=y(()=>{qi();qi();({is:lo,defineProperty:co,getOwnPropertyDescriptor:po,getOwnPropertyNames:uo,getOwnPropertySymbols:ho,getPrototypeOf:_o}=Object),Wt=globalThis,nr=Wt.trustedTypes,mo=nr?nr.emptyScript:"",go=Wt.reactiveElementPolyfillSupport,gt=(r,s)=>r,ft={toAttribute(r,s){switch(s){case Boolean:r=r?mo:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,s){let e=r;switch(s){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},Vt=(r,s)=>!lo(r,s),ar={attribute:!0,type:String,converter:ft,reflect:!1,useDefault:!1,hasChanged:Vt};Symbol.metadata??=Symbol("metadata"),Wt.litPropertyMetadata??=new WeakMap;de=class extends HTMLElement{static addInitializer(s){this._$Ei(),(this.l??=[]).push(s)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(s,e=ar){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(s)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(s,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(s,t,e);i!==void 0&&co(this.prototype,s,i)}}static getPropertyDescriptor(s,e,t){let{get:i,set:a}=po(this.prototype,s)??{get(){return this[e]},set(o){this[e]=o}};return{get:i,set(o){let d=i?.call(this);a?.call(this,o),this.requestUpdate(s,d,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(s){return this.elementProperties.get(s)??ar}static _$Ei(){if(this.hasOwnProperty(gt("elementProperties")))return;let s=_o(this);s.finalize(),s.l!==void 0&&(this.l=[...s.l]),this.elementProperties=new Map(s.elementProperties)}static finalize(){if(this.hasOwnProperty(gt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(gt("properties"))){let e=this.properties,t=[...uo(e),...ho(e)];for(let i of t)this.createProperty(i,e[i])}let s=this[Symbol.metadata];if(s!==null){let e=litPropertyMetadata.get(s);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(s){let e=[];if(Array.isArray(s)){let t=new Set(s.flat(1/0).reverse());for(let i of t)e.unshift(Di(i))}else s!==void 0&&e.push(Di(s));return e}static _$Eu(s,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof s=="string"?s.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(s=>this.enableUpdating=s),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(s=>s(this))}addController(s){(this._$EO??=new Set).add(s),this.renderRoot!==void 0&&this.isConnected&&s.hostConnected?.()}removeController(s){this._$EO?.delete(s)}_$E_(){let s=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(s.set(t,this[t]),delete this[t]);s.size>0&&(this._$Ep=s)}createRenderRoot(){let s=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return rr(s,this.constructor.elementStyles),s}connectedCallback(){this.renderRoot??=tLine truncated
\f\r]`,bt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,cr=/-->/g,dr=/>/g,Re=RegExp(`>|${Mi}(?:([^\\s"'>=/]+)(${Mi}*=${Mi}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),pr=/'/g,ur=/"/g,mr=/^(?:script|style|textarea|title)$/i,Wi=r=>(s,...e)=>({_$litType$:r,strings:s,values:e}),l=Wi(1),We=Wi(2),Tc=Wi(3),Le=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),hr=new WeakMap,Ie=Pe.createTreeWalker(Pe,129);fr=(r,s)=>{let e=r.length-1,t=[],i,a=s===2?"<svg>":s===3?"<math>":"",o=bt;for(let d=0;d<e;d++){let h=r[d],_,m,b=-1,k=0;for(;k<h.length&&(o.lastIndex=k,m=o.exec(h),m!==null);)k=o.lastIndex,o===bt?m[1]==="!--"?o=cr:m[1]!==void 0?o=dr:m[2]!==void 0?(mr.test(m[2])&&(i=RegExp("</"+m[2],"g")),o=Re):m[3]!==void 0&&(o=Re):o===Re?m[0]===">"?(o=i??bt,b=-1):m[1]===void 0?b=-2:(b=o.lastIndex-m[2].length,_=m[1],o=m[3]===void 0?Re:m[3]==='"'?ur:pr):o===ur||o===pr?o=Re:o===cr||o===dr?o=bt:(o=Re,i=void 0);let w=o===Re&&r[d+1].startsWith("/>")?" ":"";a+=o===bt?h+fo:b>=0?(t.push(_),h.slice(0,b)+Fi+h.slice(b)+pe+w):h+pe+(b===-2?d:w)}return[gr(r,a+(r[e]||"<?>")+(s===2?"</svg>":s===3?"</math>":"")),t]},wt=class r{constructor({strings:s,_$litType$:e},t){let i;this.parts=[];let a=0,o=0,d=s.length-1,h=this.parts,[_,m]=fr(s,e);if(this.el=r.createElement(_,t),Ie.currentNode=this.el.content,e===2||e===3){let b=this.el.content.firstChild;b.replaceWith(...b.childNodes)}for(;(i=Ie.nextNode())!==null&&h.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let b of i.getAttributeNames())if(b.endsWith(Fi)){let k=m[o++],w=i.getAttribute(b).split(pe),v=/([.?@])?(.*)/.exec(k);h.push({type:1,index:a,name:v[2],strings:w,ctor:v[1]==="."?Yt:v[1]==="?"?Qt:v[1]==="@"?Zt:Oe}),i.removeAttribute(b)}else b.startsWith(pe)&&(h.push({type:6,index:a}),i.removeAttribute(b));if(mr.test(i.tagName)){let b=i.textContent.split(pe),k=b.length-1;if(k>0){i.textContent=Gt?Gt.emptyScript:"";for(let w=0;w<k;w++)i.append(b[w],yt()),Ie.nextNode(),h.push({type:2,index:++a});i.append(b[k],yt())}}}else if(i.nodeType===8)if(i.data===Ui)h.push({type:2,index:a});else{let b=-1;for(;(b=i.data.indexOf(pe,b+1))!==-1;)h.push({type:7,index:a}),b+=pe.length-1}a++}}static createElement(s,e){let t=Pe.createElement("template");return t.innerHTML=s,t}};Kt=class{constructor(s,e){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){let{el:{content:e},parts:t}=this._$AD,i=(s?.creationScope??Pe).importNode(e,!0);Ie.currentNode=i;let a=Ie.nextNode(),o=0,d=0,h=t[0];for(;h!==void 0;){if(o===h.index){let _;h.type===2?_=new Be(a,a.nextSibling,this,s):h.type===1?_=new h.ctor(a,h.name,h.strings,this,s):h.type===6&&(_=new Jt(a,this,s)),this._$AV.push(_),h=t[++d]}o!==h?.index&&(a=Ie.nextNode(),o++)}return Ie.currentNode=Pe,i}p(s){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(s,t,e),e+=t.strings.length-2):t._$AI(s[e])),e++}},Be=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(s,e,t,i){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=s,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let s=this._$AA.parentNode,e=this._$AM;return e!==void 0&&s?.nodeType===11&&(s=e.parentNode),s}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(s,e=this){s=Ne(this,s,e),xt(s)?s===p||s==null||s===""?(this._$AH!==p&&this._$AR(),this._$AH=p):s!==this._$AH&&s!==Le&&this._(s):s._$litType$!==void 0?this.$(s):s.nodeType!==void 0?this.T(s):_r(s)?this.k(s):this._(s)}O(s){return this._$AA.parentNode.insertBefore(s,this._$AB)}T(s){this._$AH!==s&&(this._$AR(),this._$AH=this.O(s))}_(s){this._$AH!==p&&xt(this._$AH)?this._$AA.nextSibling.data=s:this.T(Pe.createTextNode(s)),this._$AH=s}$(s){let{values:e,_$litType$:t}=s,i=typeof t=="number"?this._$AC(s):(t.el===void 0&&(t.el=wt.createElement(gr(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new Kt(i,this),o=a.u(this.options);a.p(e),this.T(o),this._$AH=a}}_$AC(s){let e=hr.get(s.strings);return e===void 0&&hr.set(s.strings,e=new wt(s)),e}k(s){Bi(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let a of s)i===e.length?e.push(t=new r(this.O(yt()),this.O(yt()),this,this.options)):t=e[i],t._$AI(a),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(s=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);s!==this._$AB;){let t=or(s).nextSibling;or(s).remove(),s=t}}setConnected(s){this._$AM===void 0&&(this._$Cv=s,this._$AP?.(s))}},Oe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(s,e,t,i,a){this.type=1,this._$AH=p,this._$AN=void 0,this.element=s,this.name=e,this._$AM=i,this.options=a,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=p}_$AI(s,e=this,t,i){let a=this.strings,o=!1;if(a===void 0)s=Ne(this,s,e,0),o=!xt(s)||s!==this._$AH&&s!==Le,o&&(this._$AH=s);else{let d=s,h,_;for(s=a[0],h=0;h<a.length-1;h++)_=Ne(this,d[t+h],e,h),_===Le&&(_=this._$AH[h]),o||=!xt(_)||_!==this._$AH[h],_===p?s=p:s!==p&&(s+=(_??"")+a[h+1]),this._$AH[h]=_}o&&!i&&this.j(s)}j(s){s===p?this.element.removeAttribute(this.naLine 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",ws_err_not_found:"Not found \u2014 it may have been deleted meanwhile",ws_err_invalid_input:"Invalid input",ws_err_invalid_date:"Invalid date",ws_err_invalid_format:"Invalid format",ws_err_invalid_url:"Invalid link",ws_err_invalid_mirror_todo:"Invalid to-do list",ws_err_not_configured:"Not set up yet",ws_err_not_loaded:"Not loaded yet \u2014 try again in a moment",ws_err_limit_reached:"Limit reached",ws_err_too_many:"Too many entries",ws_err_too_large:"Too large",ws_err_not_archived:"Not archived",ws_err_invalid_target:"Invalid target",ws_err_create_failed:"Could not be created",ws_err_archived:"Archived \u2014 restore it first",ws_err_already_archived:"Already archived",ws_err_unavailable:"Currently unavailable",ws_err_unauthorized:"Not permitted for your user",ws_err_too_many_views:"Too many saved views",ws_err_storage_unavailable:"Storage is not available",ws_err_replace_failed:"Replacement failed",ws_err_not_paused:"Not paused",ws_err_not_available:"Nothing available",ws_err_no_url:"No link given",ws_err_no_phases:"This task has no phases",ws_err_invalid_view:"Invalid view",ws_err_invalid_user:"Unknown user",ws_err_invalid_range:"Invalid range",ws_err_invalid_parent:"Invalid parent object",ws_err_invalid_device:"Unknown device",ws_err_empty_csv:"The CSV file is empty",ws_err_empty:"Nothing to import",ws_err_duplicate_failed:"Could not duplicate",ws_err_already_paused:"Already paused",ws_err_invalid_cursor:"Invalid phase position",ws_err_invalid_entity_slug:"Invalid entity name",ws_err_invalid_trigger_config:"Invalid trigger configuration",ws_err_no_defaults:"No quick-complete defaults set",ws_err_self_link_device:"An object cannot be linked to itself",ws_err_too_early:"Too early \u2014 this task can only be completed closer to its due date",ws_err_invalid_search_template:"The search link must be an http(s) URL containing {q}",ws_err_invalid_icon:"The notification icon must be an mdi: name, e.g. mdi:air-filter",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_toggle:"Due at a specific time",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",notes_markdown_hint:"Markdown is supported \u2014 **bold**, lists, [links](\u2026)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",completed_at_optional:"Completed at (optional, empty = now)",completed_at_pick:"Set date & time",completed_at_future_error:"The completion date cannot be in the future.",ha_time_zone_hint:"Time in Home Assistant's time zone ({zone})",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",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.",task_mirror_todo:"Mirror into to-do lists",task_mirror_todo_hint:"The task appears in these lists while it is due; checking it off there completes it here.",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)",interval_anchor_hint:"From completion date: the next due date counts from the day the task is marked done, so doing it early or late moves the schedule. From planned date: the schedule keeps its dates, for example when a bill is paid weeks before it is due.",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",object_replaces:"Replaces",object_replaced_by:"Replaced by",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Obj 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",ws_err_not_found:"Not found \u2014 it may have been deleted meanwhile",ws_err_invalid_input:"Invalid input",ws_err_invalid_date:"Invalid date",ws_err_invalid_format:"Invalid format",ws_err_invalid_url:"Invalid link",ws_err_invalid_mirror_todo:"Invalid to-do list",ws_err_not_configured:"Not set up yet",ws_err_not_loaded:"Not loaded yet \u2014 try again in a moment",ws_err_limit_reached:"Limit reached",ws_err_too_many:"Too many entries",ws_err_too_large:"Too large",ws_err_not_archived:"Not archived",ws_err_invalid_target:"Invalid target",ws_err_create_failed:"Could not be created",ws_err_archived:"Archived \u2014 restore it first",ws_err_already_archived:"Already archived",ws_err_unavailable:"Currently unavailable",ws_err_unauthorized:"Not permitted for your user",ws_err_too_many_views:"Too many saved views",ws_err_storage_unavailable:"Storage is not available",ws_err_replace_failed:"Replacement failed",ws_err_not_paused:"Not paused",ws_err_not_available:"Nothing available",ws_err_no_url:"No link given",ws_err_no_phases:"This task has no phases",ws_err_invalid_view:"Invalid view",ws_err_invalid_user:"Unknown user",ws_err_invalid_range:"Invalid range",ws_err_invalid_parent:"Invalid parent object",ws_err_invalid_device:"Unknown device",ws_err_empty_csv:"The CSV file is empty",ws_err_empty:"Nothing to import",ws_err_duplicate_failed:"Could not duplicate",ws_err_already_paused:"Already paused",ws_err_invalid_cursor:"Invalid phase position",ws_err_invalid_entity_slug:"Invalid entity name",ws_err_invalid_trigger_config:"Invalid trigger configuration",ws_err_no_defaults:"No quick-complete defaults set",ws_err_self_link_device:"An object cannot be linked to itself",ws_err_too_early:"Too early \u2014 this task can only be completed closer to its due date",ws_err_invalid_search_template:"The search link must be an http(s) URL containing {q}",ws_err_invalid_icon:"The notification icon must be an mdi: name, e.g. mdi:air-filter",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_toggle:"Due at a specific time",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",notes_markdown_hint:"Markdown is supported \u2014 **bold**, lists, [links](\u2026)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",completed_at_optional:"Completed at (optional, empty = now)",completed_at_pick:"Set date & time",completed_at_future_error:"The completion date cannot be in the future.",ha_time_zone_hint:"Time in Home Assistant's time zone ({zone})",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",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.",task_mirror_todo:"Mirror into to-do lists",task_mirror_todo_hint:"The task appears in these lists while it is due; checking it off there completes it here.",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)",interval_anchor_hint:"From completion date: the next due date counts from the day the task is marked done, so doing it early or late moves the schedule. From planned date: the schedule keeps its dates, for example when a bill is paid weeks before it is due.",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",object_replaces:"Replaces",object_replaced_by:"Replaced by",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Obj Line truncated
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; color: var(--secondary-text-color); }
.field-input {
@@ -14,7 +14,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
font-family: inherit; width: 100%; box-sizing: border-box;
}
.field-input:focus { outline: none; border-color: var(--primary-color); }
`,Fo=$`
`,zo=$`
.person-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; vertical-align: middle; }
.person-avatar {
width: 22px; height: 22px; border-radius: 50%; flex: none;
@@ -24,7 +24,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
font-variant-numeric: tabular-nums;
}
.person-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
`,Uo=$`
`,Fo=$`
.ref-chip {
display: inline-block; font-size: 11.5px; font-weight: 500; line-height: 1; padding: 3px 6px;
border-radius: 6px; border: 1px solid var(--divider-color); color: var(--secondary-text-color);
@@ -34,8 +34,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
/* #189: "· Residual waste, Paper" after a calendar-driven task's name. */
.event-titles { color: var(--secondary-text-color); font-weight: 400; }
`,ci=$`
${zo}
${Fo}
${Uo}
:host {
--maint-ok-color: var(--success-color, #4caf50);
--maint-due-soon-color: var(--warning-color, #ff9800);
@@ -73,6 +73,9 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.status-badge.triggered { background-color: var(--maint-triggered-color); }
/* Completed one-time task ("done") — muted blue-grey. */
.status-badge.done { background-color: var(--maint-done-color, #78909c); }
/* D#203: a manual task without a due date — an outline in the muted grey of
its "done 23 d ago", so it does not read as a green, on-schedule OK. */
.status-badge.no_due { background-color: var(--maint-no-due-background, transparent); color: var(--secondary-text-color, #727272); box-shadow: inset 0 0 0 1px currentColor; }
/* v2.10.0: archived (retire-but-retain) — neutral grey, clearly inert. */
.status-badge.archived { background-color: var(--disabled-color, #9e9e9e); color: #000; }
/* v2.20 (N3): paused — frozen but present, info blue. */
@@ -589,6 +592,10 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
}
.due-text { font-size: 13px; }
/* The cell is right-aligned; a date that wraps in a narrow column
("63 d / overdue") ends flush right like the bar and the value under it,
instead of starting each line at a different spot from row to row. */
.due-cell .due-text { text-align: end; }
/* D#203: a task without a due date shows when it was last done — muted,
so it never reads as a status. */
.due-text.last-done { color: var(--secondary-text-color); }
@@ -1290,7 +1297,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; hyphens: auto; overflow-wrap: anywhere; }
.stat-value { font-size: 20px; }
}
`});function on(r,s,e){let t=new Blob([r],{type:e}),i=URL.createObjectURL(t),a=document.createElement("a");a.href=i,a.download=s,a.target="_blank",a.rel="noopener",a.style.display="none",document.body.appendChild(a),a.dispatchEvent(new MouseEvent("click")),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(i),6e4)}var ds=y(()=>{"use strict"});async function Bo(r,s,e=300){return(await r.connection.sendMessagePromise({type:"auth/sign_path",path:s,expires:e})).path}async function ps(r,s,e=300){return Bo(r,`/api/maintenance_supporter/document/${s}`,e)}async function ln(r,s,e=""){let t=window.open("about:blank","_blank");try{let i=await ps(r,s);t&&(t.location.href=new URL(i+e,window.location.origin).href)}catch(i){throw t&&t.close(),i}}var us=y(()=>{"use strict";ds()});function hs(r){return r.replace(/[\t\n\r]/g,"").replace(/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,"")}function _s(r){let s=/^([a-z][a-z0-9+.-]+):/i.exec(hs(r||""));return s?s[1].toLowerCase():null}function Ze(r){let s=_s(r);return s!==null&&!Wo.has(s)}function dn(r){return!!r&&/^https?:\/\//i.test(r)}var Wo,di=y(()=>{"use strict";Wo=new Set(["about","blob","data","file","filesystem","javascript","livescript","ms-appinstaller","ms-cxh","ms-cxh-full","ms-msdt","ms-officecmd","search","search-ms","view-source","vbscript"])});function Ko(r){let s=(r||"").split(/\s+/).filter(Boolean);return s.length===0?"?":s.length===1?s[0][0].toUpperCase():(s[0][0]+s[s.length-1][0]).toUpperCase()}function Yo(r){let s=0;for(let e of r)s=s*31+e.charCodeAt(0)>>>0;return hn[s%hn.length]}function ui(r){return r?{id:r.id,name:r.name,initials:r.initials||Ko(r.name),color:r.color||Yo(r.id)}:null}function gs(r){return r?l`<span class="person-avatar" style="--person-color: ${r.color}" title=${r.name}>${r.initials}</span>`:p}var hn,fs=y(()=>{"use strict";R();hn=["#c62828","#ad1457","#6a1b9a","#4527a0","#283593","#1565c0","#00838f","#2e7d32","#558b2f","#ef6c00","#6d4c41","#546e7a"]});var Xe,vs=y(()=>{"use strict";fs();Xe=class{constructor(s){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=s}updateHass(s){this.hass=s}async getUsers(s=!1){let e=Date.now();if(!s&&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(s,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:s,task_id:e,user_id:t})}async getTasksByUser(s){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:s})).tasks}getUserName(s){return!s||!this.usersCache?null:this.usersCache.find(t=>t.id===s)?.name||null}getPerson(s){return ui(this.getUser(s))}getUser(s){return!s||!this.usersCache?null:this.usersCache.find(e=>e.id===s)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(s){return s?s===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function Qo(r,s){if(s<=0)return 0;let e=typeof r=="number"&&Number.isFinite(r)?Math.trunc(r):0;return e<0?0:e%s}function Zo(r){return!!(r?.phases&&r.phase_sequence&&r.phase_sequence.length>0)}function bs(r){if(!r||!Zo(r))return null;let s=r.phase_sequence,e=Qo(r.phase_cursor,s.length),t=s[e],i=r.phases?.[t];return i?{id:t,name:i.name,index:e,count:s.length,notes:i.notes,checklist:i.checklist!==void 0?i.checklist:r.checklist??[],consumesParts:i.consumes_parts!==void 0?i.consumes_parts:r.consumes_parts??[],requiredFields:i.required_completion_fields!==void 0?i.required_completion_fields:r.required_completion_fields??[]}:null}function ke(r){let s=bs(r);return s?`${s.index+1}/${s.count} \xB7 ${s.name}`:""}var hi=y(()=>{"use strict"});function mn(){let r=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:s=>s.map(()=>Math.floor(Math.random()*256))}).getRandomValues(r),Array.from(r,s=>s.toString(16).padStart(2,"0")).join("")}function $e(r){let s=r?.reading_values;if(!Array.isArray(s))return[];let e=[],t=new Set;for(let i of s){if(!i||typeof i!="object")continue;let a=i;typeof a.id!="string"||!a.id||t.has(a.id)||typeof a.value!="number"||!Number.isFinite(a.value)||(t.add(a.id),e.push({id:a.id,name:typeof a.name=="string"?a.name:a.id,unit:typeof a.unit=="string"?a.unit:null,value:a.value}))}return e}function gn(r){return r.filter(s=>s.type==="completed"&&(s.reading_value!=null||$e(s).length>0)).sort((s,e)=>s.timestamp.localeCompare(e.timestamp))}function fn(r){return gn(r??[]).map(s=>({timestamp:s.timestamp,values:$e(s)})).filter(s=>s.values.length>0)}function vn(r,s,e){let t;for(let i of r){if(e!==void 0){let o=K(i.timestamp);if(!isNaN(o)&&o>=e)break}let a=i.values.find(o=>o.id===s);a&&(t=a)}return t}function bn(r,s,e){let t=$e(s).find(a=>a.id===e);if(!t)return null;let i=null;for(let a of gn(r)){if(aLine truncated
`});function on(r,s,e){let t=new Blob([r],{type:e}),i=URL.createObjectURL(t),a=document.createElement("a");a.href=i,a.download=s,a.target="_blank",a.rel="noopener",a.style.display="none",document.body.appendChild(a),a.dispatchEvent(new MouseEvent("click")),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(i),6e4)}var ps=y(()=>{"use strict"});async function Uo(r,s,e=300){return(await r.connection.sendMessagePromise({type:"auth/sign_path",path:s,expires:e})).path}async function us(r,s,e=300){return Uo(r,`/api/maintenance_supporter/document/${s}`,e)}async function ln(r,s,e=""){let t=window.open("about:blank","_blank");try{let i=await us(r,s);t&&(t.location.href=new URL(i+e,window.location.origin).href)}catch(i){throw t&&t.close(),i}}var hs=y(()=>{"use strict";ps()});function _s(r){return r.replace(/[\t\n\r]/g,"").replace(/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,"")}function ms(r){let s=/^([a-z][a-z0-9+.-]+):/i.exec(_s(r||""));return s?s[1].toLowerCase():null}function Ze(r){let s=ms(r);return s!==null&&!Bo.has(s)}function dn(r){return!!r&&/^https?:\/\//i.test(r)}var Bo,di=y(()=>{"use strict";Bo=new Set(["about","blob","data","file","filesystem","javascript","livescript","ms-appinstaller","ms-cxh","ms-cxh-full","ms-msdt","ms-officecmd","search","search-ms","view-source","vbscript"])});function Go(r){let s=(r||"").split(/\s+/).filter(Boolean);return s.length===0?"?":s.length===1?s[0][0].toUpperCase():(s[0][0]+s[s.length-1][0]).toUpperCase()}function Ko(r){let s=0;for(let e of r)s=s*31+e.charCodeAt(0)>>>0;return hn[s%hn.length]}function ui(r){return r?{id:r.id,name:r.name,initials:r.initials||Go(r.name),color:r.color||Ko(r.id)}:null}function fs(r){return r?l`<span class="person-avatar" style="--person-color: ${r.color}" title=${r.name}>${r.initials}</span>`:p}var hn,vs=y(()=>{"use strict";R();hn=["#c62828","#ad1457","#6a1b9a","#4527a0","#283593","#1565c0","#00838f","#2e7d32","#558b2f","#ef6c00","#6d4c41","#546e7a"]});var Xe,bs=y(()=>{"use strict";vs();Xe=class{constructor(s){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=s}updateHass(s){this.hass=s}async getUsers(s=!1){let e=Date.now();if(!s&&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(s,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:s,task_id:e,user_id:t})}async getTasksByUser(s){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:s})).tasks}getUserName(s){return!s||!this.usersCache?null:this.usersCache.find(t=>t.id===s)?.name||null}getPerson(s){return ui(this.getUser(s))}getUser(s){return!s||!this.usersCache?null:this.usersCache.find(e=>e.id===s)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(s){return s?s===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function Yo(r,s){if(s<=0)return 0;let e=typeof r=="number"&&Number.isFinite(r)?Math.trunc(r):0;return e<0?0:e%s}function Qo(r){return!!(r?.phases&&r.phase_sequence&&r.phase_sequence.length>0)}function ys(r){if(!r||!Qo(r))return null;let s=r.phase_sequence,e=Yo(r.phase_cursor,s.length),t=s[e],i=r.phases?.[t];return i?{id:t,name:i.name,index:e,count:s.length,notes:i.notes,checklist:i.checklist!==void 0?i.checklist:r.checklist??[],consumesParts:i.consumes_parts!==void 0?i.consumes_parts:r.consumes_parts??[],requiredFields:i.required_completion_fields!==void 0?i.required_completion_fields:r.required_completion_fields??[]}:null}function ke(r){let s=ys(r);return s?`${s.index+1}/${s.count} \xB7 ${s.name}`:""}var hi=y(()=>{"use strict"});function mn(){let r=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:s=>s.map(()=>Math.floor(Math.random()*256))}).getRandomValues(r),Array.from(r,s=>s.toString(16).padStart(2,"0")).join("")}function $e(r){let s=r?.reading_values;if(!Array.isArray(s))return[];let e=[],t=new Set;for(let i of s){if(!i||typeof i!="object")continue;let a=i;typeof a.id!="string"||!a.id||t.has(a.id)||typeof a.value!="number"||!Number.isFinite(a.value)||(t.add(a.id),e.push({id:a.id,name:typeof a.name=="string"?a.name:a.id,unit:typeof a.unit=="string"?a.unit:null,value:a.value}))}return e}function gn(r){return r.filter(s=>s.type==="completed"&&(s.reading_value!=null||$e(s).length>0)).sort((s,e)=>s.timestamp.localeCompare(e.timestamp))}function fn(r){return gn(r??[]).map(s=>({timestamp:s.timestamp,values:$e(s)})).filter(s=>s.values.length>0)}function vn(r,s,e){let t;for(let i of r){if(e!==void 0){let o=K(i.timestamp);if(!isNaN(o)&&o>=e)break}let a=i.values.find(o=>o.id===s);a&&(t=a)}return t}function bn(r,s,e){let t=$e(s).find(a=>a.id===e);if(!t)return null;let i=null;for(let a of gn(r)){if(aLine truncated
<div class="field">
${this.label?l`<span class="label">${this.label}${this.required?l`<span class="req">*</span>`:p}</span>`:p}
<div class="row">
@@ -1303,7 +1310,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
@blur=${this._commitTyped} />`:l`<ha-selector
.hass=${this.hass}
.selector=${this._selector()}
.value=${_l(this.kind,this.value)}
.value=${fl(this.kind,this.value)}
.required=${this.required}
.disabled=${this.disabled}
@value-changed=${this._onSelectorChange}
@@ -1376,7 +1383,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
}
input.typed[aria-invalid="true"] { border-color: var(--error-color, #f44336); }
input.typed:focus { outline: 2px solid var(--primary-color); outline-offset: -1px; }
`,c([f({attribute:!1})],M.prototype,"hass",2),c([f()],M.prototype,"kind",2),c([f()],M.prototype,"label",2),c([f()],M.prototype,"value",2),c([f()],M.prototype,"helper",2),c([f({type:Boolean})],M.prototype,"clearable",2),c([f({type:Boolean})],M.prototype,"disabled",2),c([f({type:Boolean})],M.prototype,"required",2),c([f()],M.prototype,"lang",2),c([u()],M.prototype,"_typing",2),c([u()],M.prototype,"_typed",2),c([u()],M.prototype,"_typedInvalid",2);customElements.get("ms-date-field")||customElements.define("ms-date-field",M)});var Te,xi=y(()=>{"use strict";R();j();C();Te=class extends E{constructor(){super(...arguments);this.value="";this.lang="en";this._credit=!1;this._amount=""}willUpdate(e){if(!e.has("value"))return;let t=(this.value??"").trim();if(t===this._signed())return;let i=parseFloat(t);if(t===""||Number.isNaN(i)){this._amount="",this._credit=!1;return}this._credit=i<0,this._amount=String(Math.abs(i))}_signed(){let e=this._amount.trim();return e===""?"":this._credit?`-${e}`:e}_emit(){this.value=this._signed(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value},bubbles:!0,composed:!0}))}_setCredit(e){this._credit!==e&&(this._credit=e,this._emit())}_onInput(e){let t=e.target.value;t.startsWith("-")&&(this._credit=!0),this._amount=t.replace(/^-+/,""),this._emit()}render(){let e=this.lang;return l`
`,c([f({attribute:!1})],M.prototype,"hass",2),c([f()],M.prototype,"kind",2),c([f()],M.prototype,"label",2),c([f()],M.prototype,"value",2),c([f()],M.prototype,"helper",2),c([f({type:Boolean})],M.prototype,"clearable",2),c([f({type:Boolean})],M.prototype,"disabled",2),c([f({type:Boolean})],M.prototype,"required",2),c([f()],M.prototype,"lang",2),c([u()],M.prototype,"_typing",2),c([u()],M.prototype,"_typed",2),c([u()],M.prototype,"_typedInvalid",2);customElements.get("ms-date-field")||customElements.define("ms-date-field",M)});var Te,wi=y(()=>{"use strict";R();j();C();Te=class extends E{constructor(){super(...arguments);this.value="";this.lang="en";this._credit=!1;this._amount=""}willUpdate(e){if(!e.has("value"))return;let t=(this.value??"").trim();if(t===this._signed())return;let i=parseFloat(t);if(t===""||Number.isNaN(i)){this._amount="",this._credit=!1;return}this._credit=i<0,this._amount=String(Math.abs(i))}_signed(){let e=this._amount.trim();return e===""?"":this._credit?`-${e}`:e}_emit(){this.value=this._signed(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value},bubbles:!0,composed:!0}))}_setCredit(e){this._credit!==e&&(this._credit=e,this._emit())}_onInput(e){let t=e.target.value;t.startsWith("-")&&(this._credit=!0),this._amount=t.replace(/^-+/,""),this._emit()}render(){let e=this.lang;return l`
<div class="wrap">
<div class="sign" role="group">
<button type="button" class="kind cost ${this._credit?"":"on"}" aria-pressed=${String(!this._credit)}
@@ -1411,8 +1418,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.kind.credit.on { background: var(--success-color, #43a047); }
.amount { flex: 1; min-width: 0; }
.hint { margin-top: 4px; font-size: 12px; color: var(--secondary-text-color); }
`],c([f()],Te.prototype,"value",2),c([f()],Te.prototype,"lang",2),c([u()],Te.prototype,"_credit",2),c([u()],Te.prototype,"_amount",2);customElements.get("ms-cost-input")||customElements.define("ms-cost-input",Te)});function wi(){if(window.externalApp!==void 0)return!0;let s=typeof navigator<"u"&&navigator.userAgent||"";return/Home Assistant\//.test(s)&&/Android/.test(s)}var Ts=y(()=>{"use strict"});function jt(r){try{return localStorage.getItem(r)}catch{return null}}function Dt(r,s){try{localStorage.setItem(r,s)}catch{}}var Ae,As=y(()=>{"use strict";Ae={objectSections:"msp-object-sections",printOptions:"msp-print-options",batteryRosterOpen:"msp-bf-roster-open",docSort:"msp-doc-sort",cameraLabel:"msp-camera-label",overviewTab:"msp-overview-tab",collapsedSections:"msp-collapsed-sections",chartRange:"msp-chart-range",chartHideOutliers:"msp-chart-hide-outliers",taskSort:"maintenance_supporter_sort",objectSort:"maintenance_supporter_object_sort",groupBy:"maintenance_supporter_groupby",objectView:"maintenance_supporter_object_view",objectsCache:"msp-objects-cache",gettingStartedDismissed:"msp-gs-dismissed",batteryRosterSort:"ms_bf_roster_sort",areaSort:"msp-area-sort"}});function Vn(){if(!wi())return!1;let r=typeof navigator<"u"?navigator.mediaDevices:void 0;return!!r&&typeof r.getUserMedia=="function"}function Un(r){let s=/camera2?\s*(\d+)/i.exec(r);return s?Number(s[1]):Number.MAX_SAFE_INTEGER}function Bn(r,s){if(s){let t=r.find(i=>i.label===s);if(t)return t}return r.filter(t=>t.label&&Gn.test(t.label)).sort((t,i)=>Un(t.label)-Un(i.label))[0]??null}var gl,fl,vl,bl,zn,Gn,Fn,Wn,yl,Y,Cs=y(()=>{"use strict";R();j();C();Ts();As();gl=1920,fl=.88,vl={retryMs:500,windowMs:5e3},bl=new Set(["NotReadableError","AbortError","TrackStartError"]),zn=80,Gn=/back|rear|environment|rück|hinten/i,Fn=/front|user|selfie|vorne/i;Wn=r=>r?.name||"Error",yl=r=>r?.message||"",Y=class extends E{constructor(){super(...arguments);this.lang="en";this._open=!1;this._busy=!1;this._switching=!1;this._devices=[];this._deviceIndex=-1;this._switchFailed=!1;this._copied=!1;this.timing={...vl};this._facing="environment";this._stream=null;this._opening=!1;this._gen=0;this._refused=new Set;this._log=[];this._t0=0;this._lastError=""}async open(){if(this._open||this._opening)return;this._opening=!0;let e=++this._gen;try{await this._acquireAndShow(e)}finally{this._opening=!1}}_live(e){return e===this._gen&&this.isConnected}async _acquireAndShow(e){let t=typeof navigator<"u"?navigator.mediaDevices:void 0;if(!t||typeof t.getUserMedia!="function"){this._unavailable("no_media_devices");return}this._log=[],this._t0=Date.now(),this._lastError="",this._refused.clear(),this._switchFailed=!1,this._copied=!1,this._note(navigator.userAgent);let i=jt(Ae.cameraLabel),a=await this._enumerate(t);if(!this._live(e))return;let o=Bn(a,i),d="refused";if(o&&(d=await this._openPatiently(t,e,this._byDevice(o))),d==="cancelled")return;if(d!=="ok"){if(d=await this._openPatiently(t,e,{video:{facingMode:{ideal:"environment"}},what:"facing environment"}),d==="cancelled")return;if(d!=="ok"){this._unavailable(this._lastError||"camera_unavailable");return}if(a=await this._enumerate(t),!this._live(e)){this._stopStream();return}}if(this._devices=a,this._deviceIndex=this._indexOfCurrent(),this._facing=this._currentFacing(),this._open=!0,await this.updateComplete,!this._live(e)){this._stopStream(),this._open=!1;return}await this._attach();let h=o?null:Bn(a,i),_=this._deviceIndex>=0?a[this._deviceIndex]:void 0;if(!h||h.deviceId===_?.deviceId)return;let m=await this._replace(t,e,[this._byDevice(h)],this._restoreCandidates(_));if(m!=="cancelled"){if(m==="lost"){this._unavailable("camera_lost");return}this._settle(m)}}async _openPatiently(e,t,i){let a=Date.now();for(;;){let o;try{o=await e.getUserMedia({video:i.video,audio:!1})}catch(d){let h=Wn(d),_=yl(d);if(this._lastError=h,this._note(`${i.what} \u2192 ${h}${_&&_!==h?`: ${_}`:""}`),!this._live(t))return"cancelled";if(!bl.has(h))return"refused";if(Date.now()-a+this.timing.retryMs>this.timing.windowMs)return"busy";if(await new Promise(m=>setTimeout(m,this.timing.retryMs)),!this._live(t))return"cancelled";continue}if(!this._live(t)){for(let d of o.getTracks())d.stop();return"cancelled"}return this._stream=o,this._note(`${i.what} \u2192 ok (${this._describeTrack()})`),"ok"}}async _replace(e,t,i,a){this._switching=!0,this._stopStream();try{for(let o of i){let d=await this._openPatiently(e,t,o);if(d==="ok")return o;if(d==="cancelled")return d;if(d==="busy"){o.deviceId&&this._refused.add(o.deviceId);break}}for(let o of a){let d=await this._openPatiently(e,t,o);if(d==="ok")return"restored";if(d==="cancelled")return d}return"lost"}finally{this._switching=!1}}_settle(e){if(e==="restored"){this._switchFailed=!0;let i=this._indexOfCurrent();return i>=0&&(this._deviceIndex=i),this._attach(),!1}this._switchFailed=!1;let t=e.deviceId?this._devices.findIndex(i=>i.deviceId===e.deviceId):-1;return this._deviceIndex=t>=0?t:this._indexOfCurrent(),this._ Line truncated
`),t=!1;try{navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(e),t=!0)}catch{}if(!t){let i=this.shadowRoot?.querySelector(".details textarea");if(i){i.focus(),i.select();try{t=document.execCommand("copy")}catch{t=!1}}}this._copied=t}async _shoot(){let e=this._video;if(!(!e||this._busy||this._switching)){this._busy=!0;try{let t=e.videoWidth||640,i=e.videoHeight||480,a=Math.min(1,gl/Math.max(t,i)),o=document.createElement("canvas");o.width=Math.round(t*a),o.height=Math.round(i*a);let d=o.getContext("2d");if(!d)throw new Error("no_canvas");d.drawImage(e,0,0,o.width,o.height);let h=await new Promise(b=>o.toBlob(b,"image/jpeg",fl));if(!h)throw new Error("no_blob");let _=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),m=new File([h],`photo-${_}.jpg`,{type:"image/jpeg"});this.close(),this.dispatchEvent(new CustomEvent("photo-captured",{detail:{file:m},bubbles:!0,composed:!0}))}catch(t){this._unavailable(t instanceof Error?t.message:String(t))}finally{this._busy=!1}}}render(){if(!this._open)return p;let e=this.lang,t=this._busy||this._switching;return l`
`],c([f()],Te.prototype,"value",2),c([f()],Te.prototype,"lang",2),c([u()],Te.prototype,"_credit",2),c([u()],Te.prototype,"_amount",2);customElements.get("ms-cost-input")||customElements.define("ms-cost-input",Te)});function ki(){if(window.externalApp!==void 0)return!0;let s=typeof navigator<"u"&&navigator.userAgent||"";return/Home Assistant\//.test(s)&&/Android/.test(s)}var Cs=y(()=>{"use strict"});function Dt(r){try{return localStorage.getItem(r)}catch{return null}}function qt(r,s){try{localStorage.setItem(r,s)}catch{}}var Ae,Rs=y(()=>{"use strict";Ae={objectSections:"msp-object-sections",printOptions:"msp-print-options",batteryRosterOpen:"msp-bf-roster-open",docSort:"msp-doc-sort",cameraLabel:"msp-camera-label",overviewTab:"msp-overview-tab",collapsedSections:"msp-collapsed-sections",chartRange:"msp-chart-range",chartHideOutliers:"msp-chart-hide-outliers",taskSort:"maintenance_supporter_sort",objectSort:"maintenance_supporter_object_sort",groupBy:"maintenance_supporter_groupby",objectView:"maintenance_supporter_object_view",objectsCache:"msp-objects-cache",gettingStartedDismissed:"msp-gs-dismissed",batteryRosterSort:"ms_bf_roster_sort",areaSort:"msp-area-sort"}});function Gn(){if(!ki())return!1;let r=typeof navigator<"u"?navigator.mediaDevices:void 0;return!!r&&typeof r.getUserMedia=="function"}function Bn(r){let s=/camera2?\s*(\d+)/i.exec(r);return s?Number(s[1]):Number.MAX_SAFE_INTEGER}function Wn(r,s){if(s){let t=r.find(i=>i.label===s);if(t)return t}return r.filter(t=>t.label&&Kn.test(t.label)).sort((t,i)=>Bn(t.label)-Bn(i.label))[0]??null}var bl,yl,xl,wl,Fn,Kn,Un,Vn,kl,Y,Is=y(()=>{"use strict";R();j();C();Cs();Rs();bl=1920,yl=.88,xl={retryMs:500,windowMs:5e3},wl=new Set(["NotReadableError","AbortError","TrackStartError"]),Fn=80,Kn=/back|rear|environment|rück|hinten/i,Un=/front|user|selfie|vorne/i;Vn=r=>r?.name||"Error",kl=r=>r?.message||"",Y=class extends E{constructor(){super(...arguments);this.lang="en";this._open=!1;this._busy=!1;this._switching=!1;this._devices=[];this._deviceIndex=-1;this._switchFailed=!1;this._copied=!1;this.timing={...xl};this._facing="environment";this._stream=null;this._opening=!1;this._gen=0;this._refused=new Set;this._log=[];this._t0=0;this._lastError=""}async open(){if(this._open||this._opening)return;this._opening=!0;let e=++this._gen;try{await this._acquireAndShow(e)}finally{this._opening=!1}}_live(e){return e===this._gen&&this.isConnected}async _acquireAndShow(e){let t=typeof navigator<"u"?navigator.mediaDevices:void 0;if(!t||typeof t.getUserMedia!="function"){this._unavailable("no_media_devices");return}this._log=[],this._t0=Date.now(),this._lastError="",this._refused.clear(),this._switchFailed=!1,this._copied=!1,this._note(navigator.userAgent);let i=Dt(Ae.cameraLabel),a=await this._enumerate(t);if(!this._live(e))return;let o=Wn(a,i),d="refused";if(o&&(d=await this._openPatiently(t,e,this._byDevice(o))),d==="cancelled")return;if(d!=="ok"){if(d=await this._openPatiently(t,e,{video:{facingMode:{ideal:"environment"}},what:"facing environment"}),d==="cancelled")return;if(d!=="ok"){this._unavailable(this._lastError||"camera_unavailable");return}if(a=await this._enumerate(t),!this._live(e)){this._stopStream();return}}if(this._devices=a,this._deviceIndex=this._indexOfCurrent(),this._facing=this._currentFacing(),this._open=!0,await this.updateComplete,!this._live(e)){this._stopStream(),this._open=!1;return}await this._attach();let h=o?null:Wn(a,i),_=this._deviceIndex>=0?a[this._deviceIndex]:void 0;if(!h||h.deviceId===_?.deviceId)return;let m=await this._replace(t,e,[this._byDevice(h)],this._restoreCandidates(_));if(m!=="cancelled"){if(m==="lost"){this._unavailable("camera_lost");return}this._settle(m)}}async _openPatiently(e,t,i){let a=Date.now();for(;;){let o;try{o=await e.getUserMedia({video:i.video,audio:!1})}catch(d){let h=Vn(d),_=kl(d);if(this._lastError=h,this._note(`${i.what} \u2192 ${h}${_&&_!==h?`: ${_}`:""}`),!this._live(t))return"cancelled";if(!wl.has(h))return"refused";if(Date.now()-a+this.timing.retryMs>this.timing.windowMs)return"busy";if(await new Promise(m=>setTimeout(m,this.timing.retryMs)),!this._live(t))return"cancelled";continue}if(!this._live(t)){for(let d of o.getTracks())d.stop();return"cancelled"}return this._stream=o,this._note(`${i.what} \u2192 ok (${this._describeTrack()})`),"ok"}}async _replace(e,t,i,a){this._switching=!0,this._stopStream();try{for(let o of i){let d=await this._openPatiently(e,t,o);if(d==="ok")return o;if(d==="cancelled")return d;if(d==="busy"){o.deviceId&&this._refused.add(o.deviceId);break}}for(let o of a){let d=await this._openPatiently(e,t,o);if(d==="ok")return"restored";if(d==="cancelled")return d}return"lost"}finally{this._switching=!1}}_settle(e){if(e==="restored"){this._switchFailed=!0;let i=this._indexOfCurrent();return i>=0&&(this._deviceIndex=i),this._attach(),!1}this._switchFailed=!1;let t=e.deviceId?this._devices.findIndex(i=>i.deviceId===e.deviceId):-1;return this._deviceIndex=t>=0?t:this._indexOfCurrent(),this._ Line truncated
`),t=!1;try{navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(e),t=!0)}catch{}if(!t){let i=this.shadowRoot?.querySelector(".details textarea");if(i){i.focus(),i.select();try{t=document.execCommand("copy")}catch{t=!1}}}this._copied=t}async _shoot(){let e=this._video;if(!(!e||this._busy||this._switching)){this._busy=!0;try{let t=e.videoWidth||640,i=e.videoHeight||480,a=Math.min(1,bl/Math.max(t,i)),o=document.createElement("canvas");o.width=Math.round(t*a),o.height=Math.round(i*a);let d=o.getContext("2d");if(!d)throw new Error("no_canvas");d.drawImage(e,0,0,o.width,o.height);let h=await new Promise(b=>o.toBlob(b,"image/jpeg",yl));if(!h)throw new Error("no_blob");let _=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),m=new File([h],`photo-${_}.jpg`,{type:"image/jpeg"});this.close(),this.dispatchEvent(new CustomEvent("photo-captured",{detail:{file:m},bubbles:!0,composed:!0}))}catch(t){this._unavailable(t instanceof Error?t.message:String(t))}finally{this._busy=!1}}}render(){if(!this._open)return p;let e=this.lang,t=this._busy||this._switching;return l`
<div class="overlay" role="dialog" aria-modal="true" aria-label=${n("doc_camera",e)}>
<video autoplay playsinline muted></video>
${this._switching?l`<div class="switching" role="status">${n("camera_switching",e)}</div>`:p}
@@ -1477,7 +1484,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.shoot { background: var(--primary-color, #03a9f4); color: #fff; border: none; font-weight: 600; }
.shoot[disabled] { opacity: 0.6; cursor: default; }
.shoot ha-icon { --mdc-icon-size: 22px; }
`,c([f({type:String})],Y.prototype,"lang",2),c([u()],Y.prototype,"_open",2),c([u()],Y.prototype,"_busy",2),c([u()],Y.prototype,"_switching",2),c([u()],Y.prototype,"_devices",2),c([u()],Y.prototype,"_deviceIndex",2),c([u()],Y.prototype,"_switchFailed",2),c([u()],Y.prototype,"_copied",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",Y)});var ki,Q,qt=y(()=>{"use strict";R();j();C();Ts();Cs();Cs();ki=$`
`,c([f({type:String})],Y.prototype,"lang",2),c([u()],Y.prototype,"_open",2),c([u()],Y.prototype,"_busy",2),c([u()],Y.prototype,"_switching",2),c([u()],Y.prototype,"_devices",2),c([u()],Y.prototype,"_deviceIndex",2),c([u()],Y.prototype,"_switchFailed",2),c([u()],Y.prototype,"_copied",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",Y)});var $i,Q,Mt=y(()=>{"use strict";R();j();C();Cs();Is();Is();$i=$`
ms-photo-picker { display: contents; }
.photo-pickers {
display: flex;
@@ -1506,7 +1513,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
color: var(--secondary-text-color);
margin-top: 4px;
}
`,Q=class extends E{constructor(){super(...arguments);this.lang="en";this.disabled=!1;this.busy=!1;this.accept="image/*";this.showCamera=!0;this.showGallery=!0;this.compact=!1;this.remaining=1/0;this._singlePick=wi();this._inAppCamera=Vn()}createRenderRoot(){return this}get _locked(){return this.disabled||this.busy}_emit(e){e.length!==0&&this.dispatchEvent(new CustomEvent("files-picked",{detail:{files:e},bubbles:!0,composed:!0}))}_onInput(e){let t=e.target,i=Array.from(t.files??[]);t.value="",this._emit(i)}_onCameraClick(e){!this._inAppCamera||this._locked||(e.preventDefault(),this.querySelector("ms-camera-capture")?.open())}_onCameraUnavailable(){this._inAppCamera=!1,this.querySelector(".photo-pick-camera input")?.click()}_onKeydown(e){e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),!this._locked&&e.currentTarget.click())}render(){if(this.remaining<=0||!this.showCamera&&!this.showGallery)return p;let e=this.lang,t=this._locked?"disabled":"",i=this.busy?n("uploading",e):n("doc_camera",e),a=n(this._singlePick?"choose_photo":"choose_photos",e);return l`
`,Q=class extends E{constructor(){super(...arguments);this.lang="en";this.disabled=!1;this.busy=!1;this.accept="image/*";this.showCamera=!0;this.showGallery=!0;this.compact=!1;this.remaining=1/0;this._singlePick=ki();this._inAppCamera=Gn()}createRenderRoot(){return this}get _locked(){return this.disabled||this.busy}_emit(e){e.length!==0&&this.dispatchEvent(new CustomEvent("files-picked",{detail:{files:e},bubbles:!0,composed:!0}))}_onInput(e){let t=e.target,i=Array.from(t.files??[]);t.value="",this._emit(i)}_onCameraClick(e){!this._inAppCamera||this._locked||(e.preventDefault(),this.querySelector("ms-camera-capture")?.open())}_onCameraUnavailable(){this._inAppCamera=!1,this.querySelector(".photo-pick-camera input")?.click()}_onKeydown(e){e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),!this._locked&&e.currentTarget.click())}render(){if(this.remaining<=0||!this.showCamera&&!this.showGallery)return p;let e=this.lang,t=this._locked?"disabled":"",i=this.busy?n("uploading",e):n("doc_camera",e),a=n(this._singlePick?"choose_photo":"choose_photos",e);return l`
<div class="photo-pickers">
${this.showCamera?l`<label class="photo-pick photo-pick-camera ${t}" role="button" tabindex="0"
aria-label=${i} title=${this.compact?i:p}
@@ -1529,7 +1536,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
${this.showCamera&&this._inAppCamera?l`<ms-camera-capture .lang=${e}
@photo-captured=${o=>this._emit([o.detail.file])}
@capture-unavailable=${this._onCameraUnavailable}></ms-camera-capture>`:p}
`}};c([f({type:String})],Q.prototype,"lang",2),c([f({type:Boolean})],Q.prototype,"disabled",2),c([f({type:Boolean})],Q.prototype,"busy",2),c([f({type:String})],Q.prototype,"accept",2),c([f({type:Boolean})],Q.prototype,"showCamera",2),c([f({type:Boolean})],Q.prototype,"showGallery",2),c([f({type:Boolean})],Q.prototype,"compact",2),c([f({type:Number})],Q.prototype,"remaining",2),c([u()],Q.prototype,"_inAppCamera",2);customElements.get("ms-photo-picker")||customElements.define("ms-photo-picker",Q)});var lt,S,Rs=y(()=>{"use strict";R();j();De();C();Se();ee();Ot();_i();ws();$s();Ss();yi();ot();xi();qt();qt();lt=Ee,S=class extends E{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.readings=[];this.readingHistory=[];this.restockDefault=null;this.restockUnitCost=null;this.restockPackage="";this.currencySymbol="";this.partsCostMode="purchase";this.parts=[];this.consumesParts=[];this.consumesInfo=[];this.requiredFields=[];this.phaseLabel="";this.requireTagScan=!1;this.viaTagScan=!1;this._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photos=new rt(this,{entryId:()=>this.entryId,hass:()=>this.hass});this._readingValue="";this._readingValues={};this._restockQty="";this._completedAt="";this._usedParts={};this._usedQtyText={};this.checklistPrefill={}}open(e={}){this._open||(this._open=!0,this.viaTagScan=!!e.viaTagScan,this._notes="",this._cost="",this._duration="",this._error="",this._checklistState=Object.fromEntries(this.checklist.map((t,i)=>[String(i),!!this.checklistPrefill[t]]).filter(([,t])=>t)),this._feedback="needed",this._photos.reset(),this._readingValue="",this._readingValues={},this._restockQty=this.restockDefault!==null?String(this.restockDefault):"",this._completedAt="",this._usedParts=Object.fromEntries(this.consumesParts.map(t=>[ne(t),{...t}])),this._usedQtyText={})}_rangeError(e,t){let i=this.lang;return n("settings_value_out_of_range",i).replace("{min}",I(e,i,{maximumFractionDigits:2})).replace("{max}",I(t,i,{maximumFractionDigits:2}))}_toggleCheck(e){let t=String(e);this._checklistState={...this._checklistState,[t]:!this._checklistState[t]}}_setFeedback(e){this._feedback=e}async _complete(){if(this._loading||this._photos.uploading)return;this._error="",this._photos.clearError();let e={type:"maintenance_supporter/task/complete",entry_id:this.entryId,task_id:this.taskId},t=this._notes.trim();if(t&&(e.notes=t),this._cost){let d=parseFloat(this._cost);isNaN(d)||(e.cost=d)}let i=nt(this._duration);if(i!==null&&(e.duration=i),this.checklist.length>0&&(e.checklist_state=this._checklistState),this.adaptiveEnabled&&(e.feedback=this._feedback),this._photos.photos.length>0&&(e.photo_doc_ids=this._photos.ids),this.viaTagScan&&(e.via_tag_scan=!0),this._completedAt){if(K(this._completedAt)>Date.now()){this._error=n("completed_at_future_error",this.lang);return}e.completed_at=this._completedAt.length===16?`${this._completedAt}:00`:this._completedAt}if(this.readings.length>0){let d={};for(let h of this.readings){let _=(this._readingValues[h.id]??"").trim();if(_==="")continue;let m=parseFloat(_.replace(",","."));isNaN(m)||(d[h.id]=m)}Object.keys(d).length>0&&(e.reading_values=d)}else if(this._readingValue!==""){let d=parseFloat(this._readingValue);isNaN(d)||(e.reading_value=d)}if(this.restockDefault!==null&&this._restockQty.trim()!==""){let d=parseFloat(this._restockQty.replace(",","."));if(!Number.isFinite(d)||d<tt[0]||d>tt[1]){this._error=this._rangeError(...tt);return}e.restock_quantity=d}if(this.parts.length>0){let d=[];for(let[h,_]of Object.entries(this._usedParts)){let m=this._usedQtyText[h],b=m===void 0?_.quantity:parseFloat(m.replace(",","."));if(!Number.isFinite(b)||b<lt[0]||b>lt[1]){this._error=this._rangeError(...lt);return}d.push({..._,quantity:b})}e.used_parts=d.map(h=>h.entry_id?{part_id:h.part_id,quantity:h.quantity,entry_id:h.entry_id}:{part_id:h.part_id,quantity:h.quantity})}let a=await D(this,e,{busy:d=>{this._loading=d},lang:this.lang,fallbackKey:"save_error",onError:d=>{this._error=d}});if(a===void 0)return;this._photos.markAttached(),this._open=!1;let o={entryId:this.entryId,taskId:this.taskId,taskName:this.taskName,undo:a?.undo===!0};this.dispatchEvent(new CustomEvent("task-completed",{detail:o}))}_renderReadingField(e,t){let i=this._completedAt?K(this._completedAt):NaN,a=vn(this.readingHistory,e.id,isNaN(i)?void 0:i),o=e.unit||this.readingUnit,d=(this._readingValues[e.id]??"").trim(),h=d===""?NaN:parseFloat(d.replace(",",".")),_=a!==void 0&&!isNaN(h)&&h<a.value,m=a!==void 0?I(a.value,t,{maximumFractionDigits:3}):"";return l`
`}};c([f({type:String})],Q.prototype,"lang",2),c([f({type:Boolean})],Q.prototype,"disabled",2),c([f({type:Boolean})],Q.prototype,"busy",2),c([f({type:String})],Q.prototype,"accept",2),c([f({type:Boolean})],Q.prototype,"showCamera",2),c([f({type:Boolean})],Q.prototype,"showGallery",2),c([f({type:Boolean})],Q.prototype,"compact",2),c([f({type:Number})],Q.prototype,"remaining",2),c([u()],Q.prototype,"_inAppCamera",2);customElements.get("ms-photo-picker")||customElements.define("ms-photo-picker",Q)});var ct,S,Ps=y(()=>{"use strict";R();j();De();C();Se();ee();Ot();_i();ks();Ss();As();xi();lt();wi();Mt();Mt();ct=Ee,S=class extends E{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.readings=[];this.readingHistory=[];this.restockDefault=null;this.restockUnitCost=null;this.restockPackage="";this.currencySymbol="";this.partsCostMode="purchase";this.parts=[];this.consumesParts=[];this.consumesInfo=[];this.requiredFields=[];this.phaseLabel="";this.requireTagScan=!1;this.viaTagScan=!1;this._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photos=new nt(this,{entryId:()=>this.entryId,hass:()=>this.hass});this._readingValue="";this._readingValues={};this._restockQty="";this._completedAt="";this._usedParts={};this._usedQtyText={};this.checklistPrefill={}}open(e={}){this._open||(this._open=!0,this.viaTagScan=!!e.viaTagScan,this._notes="",this._cost="",this._duration="",this._error="",this._checklistState=Object.fromEntries(this.checklist.map((t,i)=>[String(i),!!this.checklistPrefill[t]]).filter(([,t])=>t)),this._feedback="needed",this._photos.reset(),this._readingValue="",this._readingValues={},this._restockQty=this.restockDefault!==null?String(this.restockDefault):"",this._completedAt="",this._usedParts=Object.fromEntries(this.consumesParts.map(t=>[ne(t),{...t}])),this._usedQtyText={})}_rangeError(e,t){let i=this.lang;return n("settings_value_out_of_range",i).replace("{min}",I(e,i,{maximumFractionDigits:2})).replace("{max}",I(t,i,{maximumFractionDigits:2}))}_toggleCheck(e){let t=String(e);this._checklistState={...this._checklistState,[t]:!this._checklistState[t]}}_setFeedback(e){this._feedback=e}async _complete(){if(this._loading||this._photos.uploading)return;this._error="",this._photos.clearError();let e={type:"maintenance_supporter/task/complete",entry_id:this.entryId,task_id:this.taskId},t=this._notes.trim();if(t&&(e.notes=t),this._cost){let d=parseFloat(this._cost);isNaN(d)||(e.cost=d)}let i=at(this._duration);if(i!==null&&(e.duration=i),this.checklist.length>0&&(e.checklist_state=this._checklistState),this.adaptiveEnabled&&(e.feedback=this._feedback),this._photos.photos.length>0&&(e.photo_doc_ids=this._photos.ids),this.viaTagScan&&(e.via_tag_scan=!0),this._completedAt){if(K(this._completedAt)>Date.now()){this._error=n("completed_at_future_error",this.lang);return}e.completed_at=this._completedAt.length===16?`${this._completedAt}:00`:this._completedAt}if(this.readings.length>0){let d={};for(let h of this.readings){let _=(this._readingValues[h.id]??"").trim();if(_==="")continue;let m=parseFloat(_.replace(",","."));isNaN(m)||(d[h.id]=m)}Object.keys(d).length>0&&(e.reading_values=d)}else if(this._readingValue!==""){let d=parseFloat(this._readingValue);isNaN(d)||(e.reading_value=d)}if(this.restockDefault!==null&&this._restockQty.trim()!==""){let d=parseFloat(this._restockQty.replace(",","."));if(!Number.isFinite(d)||d<tt[0]||d>tt[1]){this._error=this._rangeError(...tt);return}e.restock_quantity=d}if(this.parts.length>0){let d=[];for(let[h,_]of Object.entries(this._usedParts)){let m=this._usedQtyText[h],b=m===void 0?_.quantity:parseFloat(m.replace(",","."));if(!Number.isFinite(b)||b<ct[0]||b>ct[1]){this._error=this._rangeError(...ct);return}d.push({..._,quantity:b})}e.used_parts=d.map(h=>h.entry_id?{part_id:h.part_id,quantity:h.quantity,entry_id:h.entry_id}:{part_id:h.part_id,quantity:h.quantity})}let a=await D(this,e,{busy:d=>{this._loading=d},lang:this.lang,fallbackKey:"save_error",onError:d=>{this._error=d}});if(a===void 0)return;this._photos.markAttached(),this._open=!1;let o={entryId:this.entryId,taskId:this.taskId,taskName:this.taskName,undo:a?.undo===!0};this.dispatchEvent(new CustomEvent("task-completed",{detail:o}))}_renderReadingField(e,t){let i=this._completedAt?K(this._completedAt):NaN,a=vn(this.readingHistory,e.id,isNaN(i)?void 0:i),o=e.unit||this.readingUnit,d=(this._readingValues[e.id]??"").trim(),h=d===""?NaN:parseFloat(d.replace(",",".")),_=a!==void 0&&!isNaN(h)&&h<a.value,m=a!==void 0?I(a.value,t,{maximumFractionDigits:3}):"";return l`
<label class="field reading-field">
<span class="field-label">${e.name}${o?` (${o})`:""}</span>
<input type="text" inputmode="decimal" class="field-input"
@@ -1579,9 +1586,9 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
>${i.name}${i.owner_name?l`<span class="used-part-owner"> (${i.owner_name})</span>`:p}${i.stock!==null&&i.stock!==void 0?` (${Ye(i.stock,i.unit,e)})`:""}</span
>
</label>
${d?l`<input class="used-part-qty" type="number" min=${lt[0]} max=${lt[1]} step="0.01"
${d?l`<input class="used-part-qty" type="number" min=${ct[0]} max=${ct[1]} step="0.01"
.value=${this._usedQtyText[a]??String(o.quantity)}
@input=${_=>{let m=_.target.value;this._usedQtyText={...this._usedQtyText,[a]:m};let b=parseFloat(m.replace(",","."));Number.isFinite(b)&&b>=lt[0]&&(this._usedParts={...this._usedParts,[a]:{...h,quantity:b}})}} />`:p}
@input=${_=>{let m=_.target.value;this._usedQtyText={...this._usedQtyText,[a]:m};let b=parseFloat(m.replace(",","."));Number.isFinite(b)&&b>=ct[0]&&(this._usedParts={...this._usedParts,[a]:{...h,quantity:b}})}} />`:p}
</div>`})}
</div>`:this.consumesInfo.length?l`<div class="consumes-hint">
${this.consumesInfo.map(i=>l`<div>${i}</div>`)}
@@ -1675,13 +1682,13 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
<ha-button
@click=${this._complete}
.disabled=${this._loading||this._photos.uploading||this._missingRequired.length>0}
title=${this._photos.uploading?n("uploading",e):this._missingRequired.length?this._missingRequired.map(i=>n("err_required",e).replace("{field}",n(Ht[i]??i,e))).join(" \xB7 "):""}
title=${this._photos.uploading?n("uploading",e):this._missingRequired.length?this._missingRequired.map(i=>n("err_required",e).replace("{field}",n(jt[i]??i,e))).join(" \xB7 "):""}
>
${this._loading?n("completing",e):n("complete",e)}
</ha-button>
</div>
</ha-dialog>
`}};S.styles=[Qe,ki,$`
`}};S.styles=[Qe,$i,$`
.req-mark {
color: var(--error-color, #f44336);
margin-left: 2px;
@@ -1897,7 +1904,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);
}
`],c([f({attribute:!1})],S.prototype,"hass",2),c([f()],S.prototype,"entryId",2),c([f()],S.prototype,"taskId",2),c([f()],S.prototype,"taskName",2),c([f()],S.prototype,"lang",2),c([f({type:Array})],S.prototype,"checklist",2),c([f({type:Boolean})],S.prototype,"adaptiveEnabled",2),c([f()],S.prototype,"taskType",2),c([f()],S.prototype,"readingUnit",2),c([f({attribute:!1})],S.prototype,"readings",2),c([f({attribute:!1})],S.prototype,"readingHistory",2),c([f({attribute:!1})],S.prototype,"restockDefault",2),c([f({attribute:!1})],S.prototype,"restockUnitCost",2),c([f({attribute:!1})],S.prototype,"restockPackage",2),c([f()],S.prototype,"currencySymbol",2),c([f({attribute:!1})],S.prototype,"partsCostMode",2),c([f({attribute:!1})],S.prototype,"parts",2),c([f({attribute:!1})],S.prototype,"consumesParts",2),c([f({type:Array})],S.prototype,"consumesInfo",2),c([f({type:Array})],S.prototype,"requiredFields",2),c([f()],S.prototype,"phaseLabel",2),c([f({type:Boolean})],S.prototype,"requireTagScan",2),c([f({type:Boolean})],S.prototype,"viaTagScan",2),c([u()],S.prototype,"_open",2),c([u()],S.prototype,"_notes",2),c([u()],S.prototype,"_cost",2),c([u()],S.prototype,"_duration",2),c([u()],S.prototype,"_loading",2),c([u()],S.prototype,"_error",2),c([u()],S.prototype,"_checklistState",2),c([u()],S.prototype,"_feedback",2),c([u()],S.prototype,"_readingValue",2),c([u()],S.prototype,"_readingValues",2),c([u()],S.prototype,"_restockQty",2),c([u()],S.prototype,"_completedAt",2),c([u()],S.prototype,"_usedParts",2),c([u()],S.prototype,"_usedQtyText",2),c([f({attribute:!1})],S.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",S)});function A(r){return r.toFixed(1)}var $i=y(()=>{"use strict";C();ee()});var q,Ps=y(()=>{"use strict";R();j();q=class extends E{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1;this.multiline=!1;this.rows=3}_onInput(e){let t=e.target.value;this.value=t,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){return l`
`],c([f({attribute:!1})],S.prototype,"hass",2),c([f()],S.prototype,"entryId",2),c([f()],S.prototype,"taskId",2),c([f()],S.prototype,"taskName",2),c([f()],S.prototype,"lang",2),c([f({type:Array})],S.prototype,"checklist",2),c([f({type:Boolean})],S.prototype,"adaptiveEnabled",2),c([f()],S.prototype,"taskType",2),c([f()],S.prototype,"readingUnit",2),c([f({attribute:!1})],S.prototype,"readings",2),c([f({attribute:!1})],S.prototype,"readingHistory",2),c([f({attribute:!1})],S.prototype,"restockDefault",2),c([f({attribute:!1})],S.prototype,"restockUnitCost",2),c([f({attribute:!1})],S.prototype,"restockPackage",2),c([f()],S.prototype,"currencySymbol",2),c([f({attribute:!1})],S.prototype,"partsCostMode",2),c([f({attribute:!1})],S.prototype,"parts",2),c([f({attribute:!1})],S.prototype,"consumesParts",2),c([f({type:Array})],S.prototype,"consumesInfo",2),c([f({type:Array})],S.prototype,"requiredFields",2),c([f()],S.prototype,"phaseLabel",2),c([f({type:Boolean})],S.prototype,"requireTagScan",2),c([f({type:Boolean})],S.prototype,"viaTagScan",2),c([u()],S.prototype,"_open",2),c([u()],S.prototype,"_notes",2),c([u()],S.prototype,"_cost",2),c([u()],S.prototype,"_duration",2),c([u()],S.prototype,"_loading",2),c([u()],S.prototype,"_error",2),c([u()],S.prototype,"_checklistState",2),c([u()],S.prototype,"_feedback",2),c([u()],S.prototype,"_readingValue",2),c([u()],S.prototype,"_readingValues",2),c([u()],S.prototype,"_restockQty",2),c([u()],S.prototype,"_completedAt",2),c([u()],S.prototype,"_usedParts",2),c([u()],S.prototype,"_usedQtyText",2),c([f({attribute:!1})],S.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",S)});function A(r){return r.toFixed(1)}var Ei=y(()=>{"use strict";C();ee()});var q,Ns=y(()=>{"use strict";R();j();q=class extends E{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1;this.multiline=!1;this.rows=3}_onInput(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>`:p}</span>`:p}
${this.multiline?l`
@@ -1974,7 +1981,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
color: var(--secondary-text-color);
font-style: italic;
}
`,c([f()],q.prototype,"label",2),c([f()],q.prototype,"value",2),c([f()],q.prototype,"placeholder",2),c([f()],q.prototype,"type",2),c([f({type:Boolean})],q.prototype,"required",2),c([f({type:Boolean})],q.prototype,"disabled",2),c([f()],q.prototype,"step",2),c([f()],q.prototype,"min",2),c([f()],q.prototype,"max",2),c([f()],q.prototype,"pattern",2),c([f()],q.prototype,"helper",2),c([f({type:Boolean})],q.prototype,"multiline",2),c([f({type:Number})],q.prototype,"rows",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",q)});var L,Yn=y(()=>{"use strict";R();j();C();Se();Ps();ot();L=class extends E{constructor(){super(...arguments);this.objects=[];this.placesEnabled=!1;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._place="";this._remindOnSite=!1;this._entryId=null;this._replacing=!1;this._oldDeviceId="";this._replaceDevice="keep"}get _lang(){return P(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._place="",this._remindOnSite=!1,this._replacing=!1,this._error="",this._open=!0}openReplace(e,t){this._entryId=e,this._replacing=!0,this._name=t.name||"",this._oldDeviceId=t.ha_device_id||"",this._haDeviceId="",this._replaceDevice="keep",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._place=t.place||"",this._remindOnSite=!!t.remind_on_site,this._replacing=!1,this._error="",this._open=!0}async _replace(){if(this._loading||!this._entryId)return;let e={type:"maintenance_supporter/object/replace",entry_id:this._entryId,name:this._name.trim()||null};this._oldDeviceId?(this._replaceDevice==="other"&&(e.ha_device_id=this._haDeviceId),this._replaceDevice==="none"&&(e.ha_device_id=null)):this._haDeviceId&&(e.ha_device_id=this._haDeviceId);let t=await D(this,e,{busy:i=>{this._loading=i},fallbackKey:"save_error",onError:i=>{this._error=i}});t!==void 0&&(this._open=!1,this.dispatchEvent(new CustomEvent("object-replaced",{detail:{entry_id:t?.entry_id,device_swap:t?.device_swap}})))}_deviceName(e){let i=this.hass?.devices?.[e];return i?.name_by_user||i?.name||e}_deviceSelector(e){return l`<ha-form
`,c([f()],q.prototype,"label",2),c([f()],q.prototype,"value",2),c([f()],q.prototype,"placeholder",2),c([f()],q.prototype,"type",2),c([f({type:Boolean})],q.prototype,"required",2),c([f({type:Boolean})],q.prototype,"disabled",2),c([f()],q.prototype,"step",2),c([f()],q.prototype,"min",2),c([f()],q.prototype,"max",2),c([f()],q.prototype,"pattern",2),c([f()],q.prototype,"helper",2),c([f({type:Boolean})],q.prototype,"multiline",2),c([f({type:Number})],q.prototype,"rows",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",q)});var L,Qn=y(()=>{"use strict";R();j();C();Se();Ns();lt();L=class extends E{constructor(){super(...arguments);this.objects=[];this.placesEnabled=!1;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._place="";this._remindOnSite=!1;this._entryId=null;this._replacing=!1;this._oldDeviceId="";this._replaceDevice="keep"}get _lang(){return P(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._place="",this._remindOnSite=!1,this._replacing=!1,this._error="",this._open=!0}openReplace(e,t){this._entryId=e,this._replacing=!0,this._name=t.name||"",this._oldDeviceId=t.ha_device_id||"",this._haDeviceId="",this._replaceDevice="keep",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._place=t.place||"",this._remindOnSite=!!t.remind_on_site,this._replacing=!1,this._error="",this._open=!0}async _replace(){if(this._loading||!this._entryId)return;let e={type:"maintenance_supporter/object/replace",entry_id:this._entryId,name:this._name.trim()||null};this._oldDeviceId?(this._replaceDevice==="other"&&(e.ha_device_id=this._haDeviceId),this._replaceDevice==="none"&&(e.ha_device_id=null)):this._haDeviceId&&(e.ha_device_id=this._haDeviceId);let t=await D(this,e,{busy:i=>{this._loading=i},fallbackKey:"save_error",onError:i=>{this._error=i}});t!==void 0&&(this._open=!1,this.dispatchEvent(new CustomEvent("object-replaced",{detail:{entry_id:t?.entry_id,device_swap:t?.device_swap}})))}_deviceName(e){let i=this.hass?.devices?.[e];return i?.name_by_user||i?.name||e}_deviceSelector(e){return l`<ha-form
.hass=${this.hass}
.data=${{device:this._haDeviceId||void 0}}
.schema=${[{name:"device",selector:{device:{}}}]}
@@ -2228,9 +2235,9 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.radio-row input {
margin: 0;
}
`,c([f({attribute:!1})],L.prototype,"hass",2),c([f({attribute:!1})],L.prototype,"objects",2),c([f({type:Boolean})],L.prototype,"placesEnabled",2),c([u()],L.prototype,"_open",2),c([u()],L.prototype,"_loading",2),c([u()],L.prototype,"_error",2),c([u()],L.prototype,"_name",2),c([u()],L.prototype,"_manufacturer",2),c([u()],L.prototype,"_model",2),c([u()],L.prototype,"_serialNumber",2),c([u()],L.prototype,"_areaId",2),c([u()],L.prototype,"_installationDate",2),c([u()],L.prototype,"_warrantyExpiry",2),c([u()],L.prototype,"_documentationUrl",2),c([u()],L.prototype,"_notes",2),c([u()],L.prototype,"_haDeviceId",2),c([u()],L.prototype,"_parentEntryId",2),c([u()],L.prototype,"_place",2),c([u()],L.prototype,"_remindOnSite",2),c([u()],L.prototype,"_entryId",2),c([u()],L.prototype,"_replacing",2),c([u()],L.prototype,"_oldDeviceId",2),c([u()],L.prototype,"_replaceDevice",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",L)});var Ls,Qn,Zn,Jn=y(()=>{"use strict";Ls=["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","plant"],Qn=["sensor"],Zn=["temperature","humidity","pressure"]});var wl,kl,Ns,Xn=y(()=>{"use strict";wl={cleaning:"mdi:broom",inspection:"mdi:magnify",replacement:"mdi:swap-horizontal",calibration:"mdi:tune",service:"mdi:wrench",reading:"mdi:counter",custom:"mdi:wrench-clock"},kl="mdi:wrench-clock",Ns=r=>r&&wl[r]||kl});function Ei(r){return r?Array.isArray(r.entity_ids)&&r.entity_ids.length>0?[...r.entity_ids]:r.entity_id?[r.entity_id]:[]:[]}function ea(r){if(!(!r||r.type==="compound"))return Ei(r)[0]}var ta=y(()=>{"use strict"});function ra(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",daysBefore:"0",carry:{}}}function aa(r){return{type:r.type||"threshold",attribute:r.attribute||"",above:r.trigger_above?.toString()??"",below:r.trigger_below?.toString()??"",equals:r.trigger_equals?.toString()??"",notEquals:r.trigger_not_equals?.toString()??"",forMinutes:r.trigger_for_minutes?.toString()??"0",targetValue:r.trigger_target_value?.toString()??"",deltaMode:r.trigger_delta_mode||!1,fromState:r.trigger_from_state||"",toState:r.trigger_to_state||"",targetChanges:r.trigger_target_changes?.toString()??"",runtimeHours:r.trigger_runtime_hours?.toString()??"",onStates:(r.trigger_on_states||[]).join(", "),daysBefore:r.trigger_days_before?.toString()??"0"}}function oa(r,s){s.attribute&&(r.attribute=s.attribute);let e=parseInt(s.forMinutes,10);if(s.type==="threshold"){let t=parseFloat(s.above);isNaN(t)||(r.trigger_above=t);let i=parseFloat(s.below);isNaN(i)||(r.trigger_below=i);let a=parseFloat(s.equals);isNaN(a)||(r.trigger_equals=a);let o=parseFloat(s.notEquals);isNaN(o)||(r.trigger_not_equals=o),isNaN(e)||(r.trigger_for_minutes=e)}else if(s.type==="counter"){let t=parseFloat(s.targetValue);isNaN(t)||(r.trigger_target_value=t),r.trigger_delta_mode=s.deltaMode}else if(s.type==="state_change"){s.fromState&&(r.trigger_from_state=s.fromState),s.toState&&(r.trigger_to_state=s.toState);let t=parseInt(s.targetChanges,10);isNaN(t)||(r.trigger_target_changes=t),isNaN(e)||(r.trigger_for_minutes=e)}else if(s.type==="runtime"){let t=parseFloat(s.runtimeHours);isNaN(t)||(r.trigger_runtime_hours=t);let i=(s.onStates||"").split(",").map(a=>a.trim()).filter(Boolean);i.length>0&&(r.trigger_on_states=i)}else if(s.type==="due_date"){let t=parseInt(s.daysBefore,10);r.trigger_days_before=isNaN(t)?0:t}}function Cl(r){return{entityIds:Ei(r).join(", "),...aa(r),carry:Object.fromEntries(Object.entries(r).filter(([e])=>!Al.has(e)&&!e.startsWith("_")))}}function Rl(r){let s=r.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(s.length===0)return null;let e={...r.carry||{},entity_id:s[0],entity_ids:s,type:r.type};return oa(e,r),e}function Il(r){return Array.from({length:7},(s,e)=>It(e,r,"short"))}function Pl(r){return Array.from({length:12},(s,e)=>rn(e,r,"short"))}var $l,El,Sl,Si,ia,na,sa,Tl,_e,qe,Al,g,Os,la=y(()=>{"use strict";R();j();C();vs();_i();De();Jn();Se();Ot();yi();$s();Ps();Xn();ta();ot();xi();$l=["cleaning","inspection","replacement","calibration","service","reading","custom"],El=["low","normal","high"],Sl=["time_based","weekdays","nth_weekday","day_of_month","calendar","sensor_based","one_time","manual"],Si=["weekdays","nth_weekday","day_of_month","calendar"],ia=["time_based","one_time",...Si],na=["threshold","counter","state_change","runtime","due_date"],sa=(r,s)=>n(r==="due_date"?"trigger_type_due_date":r,s),Tl=[...na,"compound"],_e={alpha:"0.3",min:"7",max:"365"},qe=Ee;Al=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_equals","trigger_not_equals","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger Line truncated
`,c([f({attribute:!1})],L.prototype,"hass",2),c([f({attribute:!1})],L.prototype,"objects",2),c([f({type:Boolean})],L.prototype,"placesEnabled",2),c([u()],L.prototype,"_open",2),c([u()],L.prototype,"_loading",2),c([u()],L.prototype,"_error",2),c([u()],L.prototype,"_name",2),c([u()],L.prototype,"_manufacturer",2),c([u()],L.prototype,"_model",2),c([u()],L.prototype,"_serialNumber",2),c([u()],L.prototype,"_areaId",2),c([u()],L.prototype,"_installationDate",2),c([u()],L.prototype,"_warrantyExpiry",2),c([u()],L.prototype,"_documentationUrl",2),c([u()],L.prototype,"_notes",2),c([u()],L.prototype,"_haDeviceId",2),c([u()],L.prototype,"_parentEntryId",2),c([u()],L.prototype,"_place",2),c([u()],L.prototype,"_remindOnSite",2),c([u()],L.prototype,"_entryId",2),c([u()],L.prototype,"_replacing",2),c([u()],L.prototype,"_oldDeviceId",2),c([u()],L.prototype,"_replaceDevice",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",L)});var Os,Zn,Jn=y(()=>{"use strict";Os=["sensor","binary_sensor","number","input_number","input_boolean","counter","switch","climate","vacuum","cover","fan","light","water_heater","humidifier","media_player","weather","air_quality","valve","lawn_mower","lock","plant","input_select","select","input_datetime","date","datetime","timer","update"],Zn=["sensor"]});var El,Sl,Hs,Xn=y(()=>{"use strict";El={cleaning:"mdi:broom",inspection:"mdi:magnify",replacement:"mdi:swap-horizontal",calibration:"mdi:tune",service:"mdi:wrench",reading:"mdi:counter",custom:"mdi:wrench-clock"},Sl="mdi:wrench-clock",Hs=r=>r&&El[r]||Sl});function Si(r){return r?Array.isArray(r.entity_ids)&&r.entity_ids.length>0?[...r.entity_ids]:r.entity_id?[r.entity_id]:[]:[]}function ea(r){if(!(!r||r.type==="compound"))return Si(r)[0]}var ta=y(()=>{"use strict"});function ra(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",daysBefore:"0",carry:{}}}function aa(r){return{type:r.type||"threshold",attribute:r.attribute||"",above:r.trigger_above?.toString()??"",below:r.trigger_below?.toString()??"",equals:r.trigger_equals?.toString()??"",notEquals:r.trigger_not_equals?.toString()??"",forMinutes:r.trigger_for_minutes?.toString()??"0",targetValue:r.trigger_target_value?.toString()??"",deltaMode:r.trigger_delta_mode||!1,fromState:r.trigger_from_state||"",toState:r.trigger_to_state||"",targetChanges:r.trigger_target_changes?.toString()??"",runtimeHours:r.trigger_runtime_hours?.toString()??"",onStates:(r.trigger_on_states||[]).join(", "),daysBefore:r.trigger_days_before?.toString()??"0"}}function oa(r,s){s.attribute&&(r.attribute=s.attribute);let e=parseInt(s.forMinutes,10);if(s.type==="threshold"){let t=parseFloat(s.above);isNaN(t)||(r.trigger_above=t);let i=parseFloat(s.below);isNaN(i)||(r.trigger_below=i);let a=parseFloat(s.equals);isNaN(a)||(r.trigger_equals=a);let o=parseFloat(s.notEquals);isNaN(o)||(r.trigger_not_equals=o),isNaN(e)||(r.trigger_for_minutes=e)}else if(s.type==="counter"){let t=parseFloat(s.targetValue);isNaN(t)||(r.trigger_target_value=t),r.trigger_delta_mode=s.deltaMode}else if(s.type==="state_change"){s.fromState&&(r.trigger_from_state=s.fromState),s.toState&&(r.trigger_to_state=s.toState);let t=parseInt(s.targetChanges,10);isNaN(t)||(r.trigger_target_changes=t),isNaN(e)||(r.trigger_for_minutes=e)}else if(s.type==="runtime"){let t=parseFloat(s.runtimeHours);isNaN(t)||(r.trigger_runtime_hours=t);let i=(s.onStates||"").split(",").map(a=>a.trim()).filter(Boolean);i.length>0&&(r.trigger_on_states=i)}else if(s.type==="due_date"){let t=parseInt(s.daysBefore,10);r.trigger_days_before=isNaN(t)?0:t}}function Pl(r){return{entityIds:Si(r).join(", "),...aa(r),carry:Object.fromEntries(Object.entries(r).filter(([e])=>!Il.has(e)&&!e.startsWith("_")))}}function Ll(r){let s=r.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(s.length===0)return null;let e={...r.carry||{},entity_id:s[0],entity_ids:s,type:r.type};return oa(e,r),e}function Nl(r){return Array.from({length:7},(s,e)=>It(e,r,"short"))}function Ol(r){return Array.from({length:12},(s,e)=>rn(e,r,"short"))}var Tl,Al,Cl,Ti,ia,na,sa,Rl,_e,qe,Il,g,js,la=y(()=>{"use strict";R();j();C();bs();_i();De();Jn();Se();Ot();xi();Ss();Ns();Xn();ta();lt();wi();Tl=["cleaning","inspection","replacement","calibration","service","reading","custom"],Al=["low","normal","high"],Cl=["time_based","weekdays","nth_weekday","day_of_month","calendar","sensor_based","one_time","manual"],Ti=["weekdays","nth_weekday","day_of_month","calendar"],ia=["time_based","one_time",...Ti],na=["threshold","counter","state_change","runtime","due_date"],sa=(r,s)=>n(r==="due_date"?"trigger_type_due_date":r,s),Rl=[...na,"compound"],_e={alpha:"0.3",min:"7",max:"365"},qe=Ee;Il=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_equals","trigger_not_equals","trigger_for_minutes","trigger_t Line truncated
`),this._phaseDefs=Object.entries(t.phases||{}).map(([_,m])=>{let{name:b,checklist:k,consumes_parts:w,required_completion_fields:v,...x}=m,T=m.consumes_parts||[],O=T.findIndex(ce=>!ce.entry_id),G=O>=0?T[O]:void 0;return{id:_,name:m.name||_,checklistText:(m.checklist||[]).join(`
`),partId:G?.part_id||"",partQty:G?.quantity!=null?String(G.quantity):"",reqOverride:m.required_completion_fields!==void 0,reqFields:[...m.required_completion_fields||[]],extraParts:T.filter((ce,Ue)=>Ue!==O).map(ce=>({...ce})),carry:x}}),this._phaseSeq=[...t.phase_sequence||[]],this._requiredCompletion=[...t.required_completion_fields||[]],this._scheduleTime=t.schedule_time||"",this._scheduleTimeOn=!!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._actionTargetStored=o.target&&typeof o.target=="object"?JSON.parse(JSON.stringify(o.target)):null,this._actionTargetInitial=this._actionTargetEntity,this._actionData=o.data&&typeof o.data=="object"?{...o.data}:{},this._actionDataJsonFallback="",this._actionSkipAuto=o.skip_auto===!0,this._actionPresent=!0}else this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1;let d=t.quick_complete_defaults;this._qcNotes=d?.notes||"",this._qcCost=d?.cost!=null?String(d.cost):"",this._qcDuration=d?.duration!=null?String(d.duration):"",this._qcFeedback=d?.feedback||"";let h=t.adaptive_config||{};if(this._environmentalEntity=h.environmental_entity||"",this._environmentalAttribute=h.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!h.enabled,this._adaptiveAlpha=h.ewa_alpha?.toString()??_e.alpha,this._adaptiveMin=h.min_interval_days?.toString()??_e.min,this._adaptiveMax=h.max_interval_days?.toString()??_e.max,this._adaptiveSeasonal=h.seasonal_enabled!==!1,this._adaptivePrediction=h.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=this._adaptiveEnabled,t.trigger_config){let _=t.trigger_config;this._triggerEntityId=ea(_)||"",this._triggerEntityIds=Ei(_),this._triggerEntityLogic=_.entity_logic||"any",this._setTypeFields(aa(_)),this._triggerCombinator=_.trigger_combinator==="all"?"all":"any",this._triggerBaselineValue=_.trigger_baseline_value?.toString()||"",this._liveBaselineValue=t.trigger_baseline_value??null,this._autoCompleteOnRecovery=_.auto_complete_on_recovery||!1,this._triggerRuntimeMaxSession=_.trigger_runtime_max_session_seconds?.toString()||"",_.type==="compound"?(this._compoundLogic=_.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(_.conditions||[]).map(Cl)):(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._notifyIcon="",this._priority="normal",this._labels="",this._mirrorTodoEntities=[],this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._requireTagScan=!1,this._allowSkip=!0,this._readingUnit="",this._readings=[],this._consumesParts={},this._consumesQtyText={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._phaseDefs=[],this._phaseSeq=[],this._requiredCompletion=[],this._scheduleTime="",this._scheduleTimeOn=!1,this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=_e.alpha,this._adaptiveMin=_e.min,this._adaptiveMax=_e.max,this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=!1,this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1,this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_typeFields(){return{type:this._triggerType,attribute:this._triggerAttribute,above:this._triggerAbove,below:this._triggerBelow,equals:this._triggerEquals,notEquals:this._triggerNotEquals,forMinutes:this._triggerForMinutes,targetValue:this._triggerTargetValue,deltaMode:this._triggerDeltaMode,fromState:this._triggerFromState,toState:this._triggerToState,targetChanges:this._trig Line truncated
`),partId:G?.part_id||"",partQty:G?.quantity!=null?String(G.quantity):"",reqOverride:m.required_completion_fields!==void 0,reqFields:[...m.required_completion_fields||[]],extraParts:T.filter((ce,Ue)=>Ue!==O).map(ce=>({...ce})),carry:x}}),this._phaseSeq=[...t.phase_sequence||[]],this._requiredCompletion=[...t.required_completion_fields||[]],this._scheduleTime=t.schedule_time||"",this._scheduleTimeOn=!!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._actionTargetStored=o.target&&typeof o.target=="object"?JSON.parse(JSON.stringify(o.target)):null,this._actionTargetInitial=this._actionTargetEntity,this._actionData=o.data&&typeof o.data=="object"?{...o.data}:{},this._actionDataJsonFallback="",this._actionSkipAuto=o.skip_auto===!0,this._actionPresent=!0}else this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1;let d=t.quick_complete_defaults;this._qcNotes=d?.notes||"",this._qcCost=d?.cost!=null?String(d.cost):"",this._qcDuration=d?.duration!=null?String(d.duration):"",this._qcFeedback=d?.feedback||"";let h=t.adaptive_config||{};if(this._environmentalEntity=h.environmental_entity||"",this._environmentalAttribute=h.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!h.enabled,this._adaptiveAlpha=h.ewa_alpha?.toString()??_e.alpha,this._adaptiveMin=h.min_interval_days?.toString()??_e.min,this._adaptiveMax=h.max_interval_days?.toString()??_e.max,this._adaptiveSeasonal=h.seasonal_enabled!==!1,this._adaptivePrediction=h.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=this._adaptiveEnabled,t.trigger_config){let _=t.trigger_config;this._triggerEntityId=ea(_)||"",this._triggerEntityIds=Si(_),this._triggerEntityLogic=_.entity_logic||"any",this._setTypeFields(aa(_)),this._triggerCombinator=_.trigger_combinator==="all"?"all":"any",this._triggerBaselineValue=_.trigger_baseline_value?.toString()||"",this._liveBaselineValue=t.trigger_baseline_value??null,this._autoCompleteOnRecovery=_.auto_complete_on_recovery||!1,this._triggerRuntimeMaxSession=_.trigger_runtime_max_session_seconds?.toString()||"",_.type==="compound"?(this._compoundLogic=_.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(_.conditions||[]).map(Pl)):(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._notifyIcon="",this._priority="normal",this._labels="",this._mirrorTodoEntities=[],this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._requireTagScan=!1,this._allowSkip=!0,this._readingUnit="",this._readings=[],this._consumesParts={},this._consumesQtyText={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._phaseDefs=[],this._phaseSeq=[],this._requiredCompletion=[],this._scheduleTime="",this._scheduleTimeOn=!1,this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=_e.alpha,this._adaptiveMin=_e.min,this._adaptiveMax=_e.max,this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=!1,this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1,this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_typeFields(){return{type:this._triggerType,attribute:this._triggerAttribute,above:this._triggerAbove,below:this._triggerBelow,equals:this._triggerEquals,notEquals:this._triggerNotEquals,forMinutes:this._triggerForMinutes,targetValue:this._triggerTargetValue,deltaMode:this._triggerDeltaMode,fromState:this._triggerFromState,toState:this._triggerToState,targetChanges:this._trig Line truncated
<details class="ca-section">
<summary>${n("on_complete_action_title",e)}</summary>
<p class="field-help">${n("on_complete_action_desc",e)}</p>
@@ -2356,7 +2363,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
</ha-icon-button>
</div>
`)}
${this._readings.length<ys?l`
${this._readings.length<xs?l`
<ha-button appearance="plain" class="reading-add"
@click=${()=>this._readings=[...this._readings,{id:mn(),name:"",unit:this._readings.length?this._readings[this._readings.length-1].unit:this._readingUnit}]}>
<ha-icon icon="mdi:plus"></ha-icon> ${n("reading_add",e)}
@@ -2413,14 +2420,14 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
</label>
${i.reqOverride?l`
<div class="required-completion phase-req-fields">
${ks.map(a=>l`
${Es.map(a=>l`
<label class="req-option">
<input
type="checkbox"
.checked=${i.reqFields.includes(a)}
@change=${o=>{let d=o.target.checked,h=new Set(i.reqFields);d?h.add(a):h.delete(a),this._patchPhaseDef(i.id,{reqFields:[...h]})}}
/>
<span>${n(Ht[a],e)}</span>
<span>${n(jt[a],e)}</span>
</label>
`)}
</div>
@@ -2449,9 +2456,9 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
</select>
</div>
`:p}
`}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=`${n("adaptive_min_interval",this._lang)} > ${n("adaptive_max_interval",this._lang)}`;return}}if(this._triggerType==="threshold"&&this._thresholdLimitsOverlap()){this._error=n("trigger_hint_overlap",this._lang);return}if(this._scheduleType==="calendar"&&!this._calendarEntity.trim().startsWith("calendar.")){this._error=n("calendar_entity_required",this._lang);return}if(this._applyConsumesQtyText()){this._loading=!0,this._error="";try{let e=await D(this,()=>this.hass.connection.sendMessagePromise(this._savePayload()),{fallbackKey:"save_error",onError:o=>{this._error=o}});if(e===void 0)return;let t=this._taskId||e?.task_id,i=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;this._warning="";let a=o=>{this._warning=n("subsave_warning",this._lang).replace("{detail}",o)};if(t&&this._scheduleType==="sensor_based"&&i&&await D(this,{type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:t,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null},{onError:a})!==void 0&&(this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute),t&&this._adaptiveSnapshot()!==this._adaptiveInitial){let o=parseFloat(this._adaptiveAlpha),d=parseInt(this._adaptiveMin,10),h=parseInt(this._adaptiveMax,10);await D(this,{type:"maintenance_supporter/task/set_adaptive",entry_id:this._entryId,task_id:t,enabled:this._adaptiveEnabled,...o>=Nt[0]&&o<=Nt[1]?{ewa_alpha:o}:{},...!isNaN(d)&&d>=1?{min_interval_days:d}:{},...!isNaN(h)&&h>=1?{max_interval_days:h}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction},{onError:a})!==void 0&&(this._adaptiveInitial=this._adaptiveSnapshot())}this._warning?t&&(this._taskId=t):this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}finally{this._loading=!1}}}}_savePayload(){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();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):Si.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.notify_icon=this._notifyIcon.trim()||null,e.priority=this._priority,e.labels=this._labels.split(",").map(i=>i.trim()).filter(Boolean),e.mirror_todo_entities=this._mirrorTodoEntities.filter(Boolean),e.enabled=this._enabled,(!this._taskId||this._lastPerformed!==this._loadedLastPerformed)&&(e.last_performed=this._lastPerformed||null),e.nfc_tag_id=this._nfcTagId||null,e.require_tag_scan=this._requireTagScan,e.allow_skip=this._allowSkip,e.notify_enabled=this._notifyEnabled,e.reading_unit=this._readingUnit.trim()||null,e.readings=xn(this._readings);{let i={};for(let o of this._phaseDefs){if(!o.name.trim())continue;let d={...o.carry,name:o.name.trim()},h=o.checklistText.split(`
`).map(m=>m.trim()).filter(Boolean);h.length&&(d.checklist=h);let _=[];if(o.partId){let m=parseFloat(o.partQty);_.push({part_id:o.partId,quantity:Number.isFinite(m)&&m>0?m:1})}for(let m of o.extraParts)_.push(m.entry_id?{part_id:m.part_id,quantity:m.quantity,entry_id:m.entry_id}:{part_id:m.part_id,quantity:m.quantity});_.length&&(d.consumes_parts=_),o.reqOverride&&(d.required_completion_fields=[...o.reqFields]),i[o.id]=d}let a=this._phaseSeq.filter(o=>o in i);e.phases=Object.keys(i).length&&a.length?i:null,e.phase_sequence=e.phases?a:null}if((this.parts.length||this._foreignOwners.length)&&(e.consumes_parts=Object.values(this._consumesParts).map(i=>i.entry_id?{part_id:i.part_id,quantity:i.quantity,entry_id:i.entry_id}:{part_id:i.part_id,quantity:i.quantity})),(!this._taskId||this._responsibleUserId!==this._loadedResponsibleUserId)&&(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 i=this._compoundConditions.map(Rl).filter(a=>a!==null);if(i.length>0){let a={type:"compound",compound_logic:this._compoundLogic,conditions:i};this._autoCompleteOnRecovery&&(a.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(a.trigger_combinator="all"),e.trigger_config=a}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let i=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],a={entity_id:i[0],entity_ids:i,type:this._triggerType};if(oa(a,this._typeFields()),this._autoCompleteOnRecovery&&(a.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(a.trigger_combinator="all"),i.length>1&&(a.entity_logic=this._triggerEntityLogic),this._triggerType==="counter"&&this._triggerDeltaMode&&this._triggerBaselineValue){let o=parseFloat(this._triggerBaselineValue);!isNaN(o)&&o>=0&&(a.trigger_baseline_value=o)}else if(this._triggerType==="runtime"&&this._triggerRuntimeMaxSession){let o=parseInt(this._triggerRuntimeMaxSession,10);!isNaN(o)&&o>0&&(a.trigger_runtime_max_session_seconds=o)}e.trigger_config=a}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&ia.includes(this._scheduleType)){let i=this._scheduleTimeOn?this._scheduleTime.trim():"";e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(i)?i:null}if(this.checklistsEnabled){let i=this._checklistText.split(`
`).map(a=>a.trim()).filter(Boolean).slice(0,100);e.checklist=i.length?i:null}if(this.completionActionsEnabled||this._actionPresent){let i=this._actionService.trim();if(i&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(i)){let a={service:i},o=this._actionTargetEntity.trim();this._actionTargetStored&&o===this._actionTargetInitial?a.target=JSON.parse(JSON.stringify(this._actionTargetStored)):o&&(a.target={entity_id:o});let d=this._buildActionData();Object.keys(d).length>0&&(a.data=d),this._actionSkipAuto&&(a.skip_auto=!0),e.on_complete_action=a}else e.on_complete_action=null}if(this.completionActionsEnabled){let i={};this._qcNotes.trim()&&(i.notes=this._qcNotes.trim());let a=parseFloat(this._qcCost);isNaN(a)||(i.cost=a);let o=nt(this._qcDuration);o!==null&&(i.duration=o),this._qcFeedback&&(i.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(i).length?i:null}return e}_close(){this._open=!1,this._warning="",this._pickerProbeTimer!==void 0&&(clearTimeout(this._pickerProbeTimer),this._pickerProbeTimer=void 0),this._pickerProbeStrikes=0}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return p;let e=this._lang,t=this._triggerType==="compound";return l`
`}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=`${n("adaptive_min_interval",this._lang)} > ${n("adaptive_max_interval",this._lang)}`;return}}if(this._triggerType==="threshold"&&this._thresholdLimitsOverlap()){this._error=n("trigger_hint_overlap",this._lang);return}if(this._scheduleType==="calendar"&&!this._calendarEntity.trim().startsWith("calendar.")){this._error=n("calendar_entity_required",this._lang);return}if(this._applyConsumesQtyText()){this._loading=!0,this._error="";try{let e=await D(this,()=>this.hass.connection.sendMessagePromise(this._savePayload()),{fallbackKey:"save_error",onError:o=>{this._error=o}});if(e===void 0)return;let t=this._taskId||e?.task_id,i=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;this._warning="";let a=o=>{this._warning=n("subsave_warning",this._lang).replace("{detail}",o)};if(t&&this._scheduleType==="sensor_based"&&i&&await D(this,{type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:t,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null},{onError:a})!==void 0&&(this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute),t&&this._adaptiveSnapshot()!==this._adaptiveInitial){let o=parseFloat(this._adaptiveAlpha),d=parseInt(this._adaptiveMin,10),h=parseInt(this._adaptiveMax,10);await D(this,{type:"maintenance_supporter/task/set_adaptive",entry_id:this._entryId,task_id:t,enabled:this._adaptiveEnabled,...o>=Nt[0]&&o<=Nt[1]?{ewa_alpha:o}:{},...!isNaN(d)&&d>=1?{min_interval_days:d}:{},...!isNaN(h)&&h>=1?{max_interval_days:h}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction},{onError:a})!==void 0&&(this._adaptiveInitial=this._adaptiveSnapshot())}this._warning?t&&(this._taskId=t):this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}finally{this._loading=!1}}}}_savePayload(){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();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):Ti.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.notify_icon=this._notifyIcon.trim()||null,e.priority=this._priority,e.labels=this._labels.split(",").map(i=>i.trim()).filter(Boolean),e.mirror_todo_entities=this._mirrorTodoEntities.filter(Boolean),e.enabled=this._enabled,(!this._taskId||this._lastPerformed!==this._loadedLastPerformed)&&(e.last_performed=this._lastPerformed||null),e.nfc_tag_id=this._nfcTagId||null,e.require_tag_scan=this._requireTagScan,e.allow_skip=this._allowSkip,e.notify_enabled=this._notifyEnabled,e.reading_unit=this._readingUnit.trim()||null,e.readings=xn(this._readings);{let i={};for(let o of this._phaseDefs){if(!o.name.trim())continue;let d={...o.carry,name:o.name.trim()},h=o.checklistText.split(`
`).map(m=>m.trim()).filter(Boolean);h.length&&(d.checklist=h);let _=[];if(o.partId){let m=parseFloat(o.partQty);_.push({part_id:o.partId,quantity:Number.isFinite(m)&&m>0?m:1})}for(let m of o.extraParts)_.push(m.entry_id?{part_id:m.part_id,quantity:m.quantity,entry_id:m.entry_id}:{part_id:m.part_id,quantity:m.quantity});_.length&&(d.consumes_parts=_),o.reqOverride&&(d.required_completion_fields=[...o.reqFields]),i[o.id]=d}let a=this._phaseSeq.filter(o=>o in i);e.phases=Object.keys(i).length&&a.length?i:null,e.phase_sequence=e.phases?a:null}if((this.parts.length||this._foreignOwners.length)&&(e.consumes_parts=Object.values(this._consumesParts).map(i=>i.entry_id?{part_id:i.part_id,quantity:i.quantity,entry_id:i.entry_id}:{part_id:i.part_id,quantity:i.quantity})),(!this._taskId||this._responsibleUserId!==this._loadedResponsibleUserId)&&(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 i=this._compoundConditions.map(Ll).filter(a=>a!==null);if(i.length>0){let a={type:"compound",compound_logic:this._compoundLogic,conditions:i};this._autoCompleteOnRecovery&&(a.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(a.trigger_combinator="all"),e.trigger_config=a}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let i=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],a={entity_id:i[0],entity_ids:i,type:this._triggerType};if(oa(a,this._typeFields()),this._autoCompleteOnRecovery&&(a.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(a.trigger_combinator="all"),i.length>1&&(a.entity_logic=this._triggerEntityLogic),this._triggerType==="counter"&&this._triggerDeltaMode&&this._triggerBaselineValue){let o=parseFloat(this._triggerBaselineValue);!isNaN(o)&&o>=0&&(a.trigger_baseline_value=o)}else if(this._triggerType==="runtime"&&this._triggerRuntimeMaxSession){let o=parseInt(this._triggerRuntimeMaxSession,10);!isNaN(o)&&o>0&&(a.trigger_runtime_max_session_seconds=o)}e.trigger_config=a}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&ia.includes(this._scheduleType)){let i=this._scheduleTimeOn?this._scheduleTime.trim():"";e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(i)?i:null}if(this.checklistsEnabled){let i=this._checklistText.split(`
`).map(a=>a.trim()).filter(Boolean).slice(0,100);e.checklist=i.length?i:null}if(this.completionActionsEnabled||this._actionPresent){let i=this._actionService.trim();if(i&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(i)){let a={service:i},o=this._actionTargetEntity.trim();this._actionTargetStored&&o===this._actionTargetInitial?a.target=JSON.parse(JSON.stringify(this._actionTargetStored)):o&&(a.target={entity_id:o});let d=this._buildActionData();Object.keys(d).length>0&&(a.data=d),this._actionSkipAuto&&(a.skip_auto=!0),e.on_complete_action=a}else e.on_complete_action=null}if(this.completionActionsEnabled){let i={};this._qcNotes.trim()&&(i.notes=this._qcNotes.trim());let a=parseFloat(this._qcCost);isNaN(a)||(i.cost=a);let o=at(this._qcDuration);o!==null&&(i.duration=o),this._qcFeedback&&(i.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(i).length?i:null}return e}_close(){this._open=!1,this._warning="",this._pickerProbeTimer!==void 0&&(clearTimeout(this._pickerProbeTimer),this._pickerProbeTimer=void 0),this._pickerProbeStrikes=0}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return p;let e=this._lang,t=this._triggerType==="compound";return l`
<h3>${n("trigger_configuration",e)}</h3>
<div class="select-row">
<label>${n("trigger_type",e)}</label>
@@ -2459,7 +2466,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}
>
${Tl.map(i=>l`<option value=${i} ?selected=${i===this._triggerType}>${sa(i,e)}</option>`)}
${Rl.map(i=>l`<option value=${i} ?selected=${i===this._triggerType}>${sa(i,e)}</option>`)}
</select>
</div>
${t?this._renderCompoundEditor():l`
@@ -2473,7 +2480,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:"trigger_entities",selector:{entity:{multiple:!0,domain:Ls}}}]}
.schema=${[{name:"trigger_entities",selector:{entity:{multiple:!0,domain:Os}}}]}
.data=${{trigger_entities:this._triggerEntityIds.length>0?this._triggerEntityIds:this._triggerEntityId?[this._triggerEntityId]:[]}}
.computeLabel=${()=>n("entity_id",e)}
@value-changed=${i=>{let a=(i.detail.value.trigger_entities||[]).filter(Boolean);this._triggerEntityId=a[0]||"",this._triggerEntityIds=a,a[0]?this._fetchEntityAttributes(a[0]):this._fetchEntityAttributes("")}}
@@ -2558,7 +2565,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:"condition_entities",selector:{entity:{multiple:!0,domain:Ls}}}]}
.schema=${[{name:"condition_entities",selector:{entity:{multiple:!0,domain:Os}}}]}
.data=${{condition_entities:e.entityIds.split(",").map(o=>o.trim()).filter(Boolean)}}
.computeLabel=${()=>n("entity_id",i)}
@value-changed=${o=>{let d=(o.detail.value.condition_entities||[]).filter(Boolean);this._patchCondition(t,{entityIds:d.join(", ")})}}
@@ -2720,12 +2727,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}>${n("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(this._scheduleType==="calendar"&&!this._calendarEntity.trim())return null;if(Si.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=(h,_,m=0)=>{if(!(!h||m>10)){(h.tagName?.toLowerCase()??"")==="ha-entity-picker"&&_.push(h);for(let b of[h.shadowRoot,h])if(b)for(let k of Array.from(b.children??[]))i(k,_,m+1)}},a=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],o=[];for(let h of a)i(h,o);let d=o.length===0||o.some(h=>h.offsetHeight===0);if(e.offsetHeight===0||d){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 p;let e=this._lang,t=this.scheduleTimeEnabled&&this._scheduleTimeOn&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((o,d)=>{let h=new Date(`${o}T12:00:00`).getDay();return`${It(h===0?6:h-1,e,"short")} ${H(o,e)}${d===0?t:""}`}).join(" \xB7 "),a=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?l`<div class="field-help">${n("schedule_preview_ontime",e)}</div>`:p;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(this._scheduleType==="calendar"&&!this._calendarEntity.trim())return null;if(Ti.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=(h,_,m=0)=>{if(!(!h||m>10)){(h.tagName?.toLowerCase()??"")==="ha-entity-picker"&&_.push(h);for(let b of[h.shadowRoot,h])if(b)for(let k of Array.from(b.children??[]))i(k,_,m+1)}},a=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],o=[];for(let h of a)i(h,o);let d=o.length===0||o.some(h=>h.offsetHeight===0);if(e.offsetHeight===0||d){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 p;let e=this._lang,t=this.scheduleTimeEnabled&&this._scheduleTimeOn&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((o,d)=>{let h=new Date(`${o}T12:00:00`).getDay();return`${It(h===0?6:h-1,e,"short")} ${H(o,e)}${d===0?t:""}`}).join(" \xB7 "),a=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?l`<div class="field-help">${n("schedule_preview_ontime",e)}</div>`:p;return l`
<div class="trigger-live-hint schedule-preview">
${n("schedule_preview_title",e)}: ${i}${this._schedulePreviewEnded?l` <span class="field-help">${n("schedule_preview_ends",e)}</span>`:p}
${a}
</div>
`}_buildSchedule(){let e=i=>{let a=parseInt(this._calOffset,10)||0;return a&&(i.offset=Math.max(-Lt,Math.min(a,Lt))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,a)=>i-a)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});if(this._scheduleType==="calendar")return e({kind:"calendar",entity_id:this._calendarEntity.trim()});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"||Si.includes(this._scheduleType)))return p;let i=Pl(e);return l`
`}_buildSchedule(){let e=i=>{let a=parseInt(this._calOffset,10)||0;return a&&(i.offset=Math.max(-Lt,Math.min(a,Lt))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,a)=>i-a)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});if(this._scheduleType==="calendar")return e({kind:"calendar",entity_id:this._calendarEntity.trim()});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"||Ti.includes(this._scheduleType)))return p;let i=Ol(e);return l`
<label class="field-label">${n("season_window_label",e)}</label>
<div class="field-help">${n("season_window_hint",e)}</div>
<div class="weekday-chips season-chips">
@@ -2762,7 +2769,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.value=${this._endsUntil}
@value-changed=${a=>this._endsUntil=a.detail.value}
></ms-date-field>`:p}
`}_renderCalendarFields(){let e=this._lang,t=Il(e);if(this._scheduleType==="weekdays")return l`
`}_renderCalendarFields(){let e=this._lang,t=Nl(e);if(this._scheduleType==="weekdays")return l`
<label class="field-label">${n("recurrence_on_days",e)}</label>
<div class="weekday-chips">
${t.map((i,a)=>l`
@@ -2977,7 +2984,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}
>
${$l.map(i=>l`<option value=${i} ?selected=${i===this._type}>${n(i,e)}</option>`)}
${Tl.map(i=>l`<option value=${i} ?selected=${i===this._type}>${n(i,e)}</option>`)}
</select>
</div>
${this._type==="reading"?l`
@@ -3012,7 +3019,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}
>
${El.map(i=>l`<option value=${i} ?selected=${i===this._priority}>${n("priority_"+i,e)}</option>`)}
${Al.map(i=>l`<option value=${i} ?selected=${i===this._priority}>${n("priority_"+i,e)}</option>`)}
</select>
</div>
<div class="field">
@@ -3050,7 +3057,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}
>
${Sl.map(i=>l`<option value=${i} ?selected=${i===this._scheduleType}>${n(i,e)}</option>`)}
${Cl.map(i=>l`<option value=${i} ?selected=${i===this._scheduleType}>${n(i,e)}</option>`)}
</select>
</div>
${this._scheduleType==="time_based"?l`
@@ -3106,8 +3113,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
<ms-textfield
label="${n("warning_days",e)}"
type="number"
min=${xs[0]}
max=${xs[1]}
min=${ws[0]}
max=${ws[1]}
.value=${this._warningDays}
@input=${i=>this._warningDays=i.target.value}
></ms-textfield>
@@ -3133,14 +3140,14 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
${this._renderPhasesEditor(e)}
<h3>${n("require_on_completion",e)}</h3>
<div class="required-completion">
${ks.map(i=>l`
${Es.map(i=>l`
<label class="req-option">
<input
type="checkbox"
.checked=${this._requiredCompletion.includes(i)}
@change=${a=>this._toggleRequired(i,a.target.checked)}
/>
<span>${n(Ht[i],e)}</span>
<span>${n(jt[i],e)}</span>
</label>
`)}
</div>
@@ -3202,7 +3209,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:Qn,device_class:Zn}}}]}
.schema=${[{name:"environmental_entity",selector:{entity:{domain:Zn}}}]}
.data=${{environmental_entity:this._environmentalEntity}}
.computeLabel=${()=>n("environmental_entity_optional",e)}
.computeHelper=${()=>n("environmental_entity_helper",e)}
@@ -3238,8 +3245,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
@value-changed=${i=>this._notifyIcon=i.detail.value||""}
></ha-icon-picker>
<div class="field-help notify-icon-help">
<ha-icon icon=${this._notifyIcon.trim()||Ns(this._type)}></ha-icon>
${n("notify_icon_hint",e).replace("{default}",Ns(this._type))}
<ha-icon icon=${this._notifyIcon.trim()||Hs(this._type)}></ha-icon>
${n("notify_icon_hint",e).replace("{default}",Hs(this._type))}
</div>
${this._availableTags.length>0?l`
<div class="select-row">
@@ -3717,11 +3724,11 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
font-size: 14px;
cursor: pointer;
}
`,c([f({attribute:!1})],g.prototype,"hass",2),c([f({type:Boolean,attribute:"checklists-enabled"})],g.prototype,"checklistsEnabled",2),c([f({type:Boolean,attribute:"schedule-time-enabled"})],g.prototype,"scheduleTimeEnabled",2),c([f({type:Boolean,attribute:"completion-actions-enabled"})],g.prototype,"completionActionsEnabled",2),c([f({type:Boolean,attribute:"adaptive-feature"})],g.prototype,"adaptiveFeature",2),c([f({type:Boolean,attribute:"seasonal-feature"})],g.prototype,"seasonalFeature",2),c([f({type:Boolean,attribute:"environmental-feature"})],g.prototype,"environmentalFeature",2),c([f({type:Number,attribute:"default-warning-days"})],g.prototype,"defaultWarningDays",2),c([u()],g.prototype,"parts",2),c([u()],g.prototype,"_foreignOwners",2),c([u()],g.prototype,"_open",2),c([u()],g.prototype,"_entityPickerFallback",2),c([u()],g.prototype,"_loading",2),c([u()],g.prototype,"_error",2),c([u()],g.prototype,"_warning",2),c([u()],g.prototype,"_entryId",2),c([u()],g.prototype,"_taskId",2),c([u()],g.prototype,"_isFleetTask",2),c([u()],g.prototype,"_objectChoices",2),c([u()],g.prototype,"_name",2),c([u()],g.prototype,"_type",2),c([u()],g.prototype,"_scheduleType",2),c([u()],g.prototype,"_intervalDays",2),c([u()],g.prototype,"_intervalUnit",2),c([u()],g.prototype,"_dueDate",2),c([u()],g.prototype,"_warningDays",2),c([u()],g.prototype,"_earliestCompletionDays",2),c([u()],g.prototype,"_intervalAnchor",2),c([u()],g.prototype,"_weekdays",2),c([u()],g.prototype,"_nth",2),c([u()],g.prototype,"_nthWeekday",2),c([u()],g.prototype,"_domDay",2),c([u()],g.prototype,"_domLastDay",2),c([u()],g.prototype,"_domBusiness",2),c([u()],g.prototype,"_calOffset",2),c([u()],g.prototype,"_calendarEntity",2),c([u()],g.prototype,"_seasonMonths",2),c([u()],g.prototype,"_endsMode",2),c([u()],g.prototype,"_endsCount",2),c([u()],g.prototype,"_endsUntil",2),c([u()],g.prototype,"_schedulePreview",2),c([u()],g.prototype,"_schedulePreviewEnded",2),c([u()],g.prototype,"_notes",2),c([u()],g.prototype,"_documentationUrl",2),c([u()],g.prototype,"_customIcon",2),c([u()],g.prototype,"_notifyIcon",2),c([u()],g.prototype,"_priority",2),c([u()],g.prototype,"_labels",2),c([u()],g.prototype,"_mirrorTodoEntities",2),c([u()],g.prototype,"_enabled",2),c([u()],g.prototype,"_triggerEntityId",2),c([u()],g.prototype,"_triggerEntityIds",2),c([u()],g.prototype,"_triggerEntityLogic",2),c([u()],g.prototype,"_triggerAttribute",2),c([u()],g.prototype,"_triggerType",2),c([u()],g.prototype,"_triggerAbove",2),c([u()],g.prototype,"_triggerBelow",2),c([u()],g.prototype,"_triggerEquals",2),c([u()],g.prototype,"_triggerNotEquals",2),c([u()],g.prototype,"_triggerForMinutes",2),c([u()],g.prototype,"_triggerCombinator",2),c([u()],g.prototype,"_triggerTargetValue",2),c([u()],g.prototype,"_triggerDeltaMode",2),c([u()],g.prototype,"_triggerBaselineValue",2),c([u()],g.prototype,"_liveBaselineValue",2),c([u()],g.prototype,"_autoCompleteOnRecovery",2),c([u()],g.prototype,"_triggerFromState",2),c([u()],g.prototype,"_triggerToState",2),c([u()],g.prototype,"_triggerTargetChanges",2),c([u()],g.prototype,"_triggerRuntimeHours",2),c([u()],g.prototype,"_triggerDaysBefore",2),c([u()],g.prototype,"_triggerRuntimeMaxSession",2),c([u()],g.prototype,"_triggerOnStates",2),c([u()],g.prototype,"_compoundLogic",2),c([u()],g.prototype,"_compoundConditions",2),c([u()],g.prototype,"_suggestedAttributes",2),c([u()],g.prototype,"_availableAttributes",2),c([u()],g.prototype,"_entityDomain",2),c([u()],g.prototype,"_lastPerformed",2),c([u()],g.prototype,"_nfcTagId",2),c([u()],g.prototype,"_requireTagScan",2),c([u()],g.prototype,"_allowSkip",2),c([u()],g.prototype,"_notifyEnabled",2),c([u()],g.prototype,"_readingUnit",2),c([u()],g.prototype,"_readings",2),c([u()],g.prototype,"_consumesParts",2),c([u()],g.prototype,"_consumesQtyText",2),c([u()],g.prototype,"_partsLoadFailed",2),c([u()],g.prototype,"_availableTags",2),c([u()],g.prototype,"_responsibleUserId",2),c([u()],g.prototype,"_assigneePool",2),c([u()],g.prototype,"_rotationStrategy",2),c([u()],g.prototype,"_availableUsers",2),c([u()],g.prototype,"_checklistText",2),c([u()],g.prototype,"_phaseDefs",2),c([u()],g.prototype,"_phaseSeq",2),c([u()],g.prototype,"_requiredCompletion",2),c([u()],g.prototype,"_scheduleTime",2),c([u()],g.prototype,"_scheduleTimeOn",2),c([u()],g.prototype,"_actionService",2),c([u()],g.prototype,"_actionTargetEntity",2),c([u()],g.prototype,"_actionSkipAuto",2),c([u()],g.prototype,"_actionPresent",2),c([u()],g.prototype,"_actionData",2),c([u()],g.prototype,"_actionDataJsonFallback",2),c([u()],g.prototype,"_actionTesting",2),c([u()],g.prototype,"_actionTestResult",2),c([u()],g.prototype,"_actionTestError",2),c([u()],g.prototype,"_qcNotes",2),c([u()],g.prototype,"_qcCost",2),c([u()],g.prototype,"_qcDuration",2),c([u()],g.prototype,"_qcFeedback",2),c([u()],g.prototype,"_environmentalEntity",2),c([u()],g.prototype,"_environmentalAttribute",2),c([u()],g.prototype,"_adaptiveEnabled",2),c([u()],g.prototype,"_adaptiveAlpha",2),c([u()],g.prototy Line truncated
`,c([f({attribute:!1})],g.prototype,"hass",2),c([f({type:Boolean,attribute:"checklists-enabled"})],g.prototype,"checklistsEnabled",2),c([f({type:Boolean,attribute:"schedule-time-enabled"})],g.prototype,"scheduleTimeEnabled",2),c([f({type:Boolean,attribute:"completion-actions-enabled"})],g.prototype,"completionActionsEnabled",2),c([f({type:Boolean,attribute:"adaptive-feature"})],g.prototype,"adaptiveFeature",2),c([f({type:Boolean,attribute:"seasonal-feature"})],g.prototype,"seasonalFeature",2),c([f({type:Boolean,attribute:"environmental-feature"})],g.prototype,"environmentalFeature",2),c([f({type:Number,attribute:"default-warning-days"})],g.prototype,"defaultWarningDays",2),c([u()],g.prototype,"parts",2),c([u()],g.prototype,"_foreignOwners",2),c([u()],g.prototype,"_open",2),c([u()],g.prototype,"_entityPickerFallback",2),c([u()],g.prototype,"_loading",2),c([u()],g.prototype,"_error",2),c([u()],g.prototype,"_warning",2),c([u()],g.prototype,"_entryId",2),c([u()],g.prototype,"_taskId",2),c([u()],g.prototype,"_isFleetTask",2),c([u()],g.prototype,"_objectChoices",2),c([u()],g.prototype,"_name",2),c([u()],g.prototype,"_type",2),c([u()],g.prototype,"_scheduleType",2),c([u()],g.prototype,"_intervalDays",2),c([u()],g.prototype,"_intervalUnit",2),c([u()],g.prototype,"_dueDate",2),c([u()],g.prototype,"_warningDays",2),c([u()],g.prototype,"_earliestCompletionDays",2),c([u()],g.prototype,"_intervalAnchor",2),c([u()],g.prototype,"_weekdays",2),c([u()],g.prototype,"_nth",2),c([u()],g.prototype,"_nthWeekday",2),c([u()],g.prototype,"_domDay",2),c([u()],g.prototype,"_domLastDay",2),c([u()],g.prototype,"_domBusiness",2),c([u()],g.prototype,"_calOffset",2),c([u()],g.prototype,"_calendarEntity",2),c([u()],g.prototype,"_seasonMonths",2),c([u()],g.prototype,"_endsMode",2),c([u()],g.prototype,"_endsCount",2),c([u()],g.prototype,"_endsUntil",2),c([u()],g.prototype,"_schedulePreview",2),c([u()],g.prototype,"_schedulePreviewEnded",2),c([u()],g.prototype,"_notes",2),c([u()],g.prototype,"_documentationUrl",2),c([u()],g.prototype,"_customIcon",2),c([u()],g.prototype,"_notifyIcon",2),c([u()],g.prototype,"_priority",2),c([u()],g.prototype,"_labels",2),c([u()],g.prototype,"_mirrorTodoEntities",2),c([u()],g.prototype,"_enabled",2),c([u()],g.prototype,"_triggerEntityId",2),c([u()],g.prototype,"_triggerEntityIds",2),c([u()],g.prototype,"_triggerEntityLogic",2),c([u()],g.prototype,"_triggerAttribute",2),c([u()],g.prototype,"_triggerType",2),c([u()],g.prototype,"_triggerAbove",2),c([u()],g.prototype,"_triggerBelow",2),c([u()],g.prototype,"_triggerEquals",2),c([u()],g.prototype,"_triggerNotEquals",2),c([u()],g.prototype,"_triggerForMinutes",2),c([u()],g.prototype,"_triggerCombinator",2),c([u()],g.prototype,"_triggerTargetValue",2),c([u()],g.prototype,"_triggerDeltaMode",2),c([u()],g.prototype,"_triggerBaselineValue",2),c([u()],g.prototype,"_liveBaselineValue",2),c([u()],g.prototype,"_autoCompleteOnRecovery",2),c([u()],g.prototype,"_triggerFromState",2),c([u()],g.prototype,"_triggerToState",2),c([u()],g.prototype,"_triggerTargetChanges",2),c([u()],g.prototype,"_triggerRuntimeHours",2),c([u()],g.prototype,"_triggerDaysBefore",2),c([u()],g.prototype,"_triggerRuntimeMaxSession",2),c([u()],g.prototype,"_triggerOnStates",2),c([u()],g.prototype,"_compoundLogic",2),c([u()],g.prototype,"_compoundConditions",2),c([u()],g.prototype,"_suggestedAttributes",2),c([u()],g.prototype,"_availableAttributes",2),c([u()],g.prototype,"_entityDomain",2),c([u()],g.prototype,"_lastPerformed",2),c([u()],g.prototype,"_nfcTagId",2),c([u()],g.prototype,"_requireTagScan",2),c([u()],g.prototype,"_allowSkip",2),c([u()],g.prototype,"_notifyEnabled",2),c([u()],g.prototype,"_readingUnit",2),c([u()],g.prototype,"_readings",2),c([u()],g.prototype,"_consumesParts",2),c([u()],g.prototype,"_consumesQtyText",2),c([u()],g.prototype,"_partsLoadFailed",2),c([u()],g.prototype,"_availableTags",2),c([u()],g.prototype,"_responsibleUserId",2),c([u()],g.prototype,"_assigneePool",2),c([u()],g.prototype,"_rotationStrategy",2),c([u()],g.prototype,"_availableUsers",2),c([u()],g.prototype,"_checklistText",2),c([u()],g.prototype,"_phaseDefs",2),c([u()],g.prototype,"_phaseSeq",2),c([u()],g.prototype,"_requiredCompletion",2),c([u()],g.prototype,"_scheduleTime",2),c([u()],g.prototype,"_scheduleTimeOn",2),c([u()],g.prototype,"_actionService",2),c([u()],g.prototype,"_actionTargetEntity",2),c([u()],g.prototype,"_actionSkipAuto",2),c([u()],g.prototype,"_actionPresent",2),c([u()],g.prototype,"_actionData",2),c([u()],g.prototype,"_actionDataJsonFallback",2),c([u()],g.prototype,"_actionTesting",2),c([u()],g.prototype,"_actionTestResult",2),c([u()],g.prototype,"_actionTestError",2),c([u()],g.prototype,"_qcNotes",2),c([u()],g.prototype,"_qcCost",2),c([u()],g.prototype,"_qcDuration",2),c([u()],g.prototype,"_qcFeedback",2),c([u()],g.prototype,"_environmentalEntity",2),c([u()],g.prototype,"_environmentalAttribute",2),c([u()],g.prototype,"_adaptiveEnabled",2),c([u()],g.prototype,"_adaptiveAlpha",2),c([u()],g.prototy Line truncated
<div class="backdrop" @click=${r}></div>
<div class="dialog" role="dialog" aria-modal="true" tabindex="-1"
@keydown=${e=>Ll(e,r)}>${s}</div>
`}function ut(r){r?.querySelector(".dialog")?.focus({preventScroll:!0})}var dt,Ti=y(()=>{"use strict";R();dt=$`
@keydown=${e=>Hl(e,r)}>${s}</div>
`}function ht(r){r?.querySelector(".dialog")?.focus({preventScroll:!0})}var pt,Ai=y(()=>{"use strict";R();pt=$`
.backdrop {
position: fixed; inset: 0; z-index: var(--ms-modal-z, 100);
background: rgba(0,0,0,0.5);
@@ -3812,7 +3819,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
ha-button.danger {
--mdc-theme-primary: var(--error-color, #f44336);
}
`],c([f({attribute:!1})],U.prototype,"hass",2),c([u()],U.prototype,"_open",2),c([u()],U.prototype,"_title",2),c([u()],U.prototype,"_message",2),c([u()],U.prototype,"_confirmText",2),c([u()],U.prototype,"_danger",2),c([u()],U.prototype,"_inputLabel",2),c([u()],U.prototype,"_inputType",2),c([u()],U.prototype,"_options",2),c([u()],U.prototype,"_inputValue",2);customElements.get("maintenance-confirm-dialog")||customElements.define("maintenance-confirm-dialog",U)});function Nl(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function Me(r,s){let e=Nl(),t=e.querySelector(`${da}[${pa}]`);return t||(t=document.createElement(da),t.setAttribute(pa,""),e.appendChild(t)),t.hass=r,t.confirm(s)}var da,pa,Ai=y(()=>{"use strict";ca();da="maintenance-confirm-dialog",pa="data-ms-lovelace-confirm"});var Ce,Hs=y(()=>{"use strict";R();j();us();Ce=class extends E{constructor(){super(...arguments);this.docId="";this._url="";this._failed=!1;this._signedFor=""}updated(){this.hass&&this.docId&&this._signedFor!==this.docId&&(this._signedFor=this.docId,this._url="",this._failed=!1,this._sign())}async _sign(){try{this._url=await ps(this.hass,this.docId)}catch{this._failed=!0}}render(){return this._failed||!this.docId?p:this._url?l`
`],c([f({attribute:!1})],U.prototype,"hass",2),c([u()],U.prototype,"_open",2),c([u()],U.prototype,"_title",2),c([u()],U.prototype,"_message",2),c([u()],U.prototype,"_confirmText",2),c([u()],U.prototype,"_danger",2),c([u()],U.prototype,"_inputLabel",2),c([u()],U.prototype,"_inputType",2),c([u()],U.prototype,"_options",2),c([u()],U.prototype,"_inputValue",2);customElements.get("maintenance-confirm-dialog")||customElements.define("maintenance-confirm-dialog",U)});function jl(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function Me(r,s){let e=jl(),t=e.querySelector(`${da}[${pa}]`);return t||(t=document.createElement(da),t.setAttribute(pa,""),e.appendChild(t)),t.hass=r,t.confirm(s)}var da,pa,Ci=y(()=>{"use strict";ca();da="maintenance-confirm-dialog",pa="data-ms-lovelace-confirm"});var Ce,Ds=y(()=>{"use strict";R();j();hs();Ce=class extends E{constructor(){super(...arguments);this.docId="";this._url="";this._failed=!1;this._signedFor=""}updated(){this.hass&&this.docId&&this._signedFor!==this.docId&&(this._signedFor=this.docId,this._url="",this._failed=!1,this._sign())}async _sign(){try{this._url=await us(this.hass,this.docId)}catch{this._failed=!0}}render(){return this._failed||!this.docId?p:this._url?l`
<a href=${this._url} target="_blank" rel="noopener" class="wrap">
<img src=${this._url} alt="" loading="lazy"
@error=${()=>this._failed=!0} />
@@ -3836,7 +3843,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
background: var(--secondary-background-color, rgba(0,0,0,0.06));
margin-top: 4px;
}
`,c([f({attribute:!1})],Ce.prototype,"hass",2),c([f()],Ce.prototype,"docId",2),c([u()],Ce.prototype,"_url",2),c([u()],Ce.prototype,"_failed",2);customElements.get("maintenance-history-photo")||customElements.define("maintenance-history-photo",Ce)});var W,ua=y(()=>{"use strict";R();j();C();Se();ee();Ot();Ti();Ss();yi();Ai();ot();xi();Hs();qt();qt();W=class extends E{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null;this._partOptions=null;this._partQty={};this._partQtyOriginal="";this._openGen=0;this._photos=new rt(this,{entryId:()=>this._draft?.entry_id??"",hass:()=>this.hass});this._photosOriginal="";this._readingRows=[];this._readingText={};this._readingsOriginal=""}get _lang(){return P(this.hass)}openEdit(e){this._openGen++,this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._photos.reset(e.photo_doc_ids??[]),this._photosOriginal=JSON.stringify(this._photos.ids),this._seedReadings(e),this._loadPartOptions()}_seedReadings(e){let t=[],i=new Set;for(let o of e.readings??[])i.has(o.id)||(i.add(o.id),t.push({id:o.id,name:o.name,unit:o.unit??null}));for(let o of e.reading_values??[])i.has(o.id)||(i.add(o.id),t.push({id:o.id,name:o.name,unit:o.unit??null}));this._readingRows=t;let a={};for(let o of e.reading_values??[])a[o.id]=String(o.value);this._readingText=a,this._readingsOriginal=JSON.stringify(this._readingNumbers())}_readingNumbers(){let e={};for(let t of this._readingRows){let i=(this._readingText[t.id]??"").trim();if(i==="")continue;let a=parseFloat(i.replace(",","."));isNaN(a)||(e[t.id]=a)}return e}async _loadPartOptions(){let e=this._draft;if(!e)return;let t=this._openGen;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"});if(t!==this._openGen)return;let a=[];for(let d of i.parts||[]){let h=d.entry_id===e.entry_id,_=d.consumers.some(m=>m.entry_id===e.entry_id&&m.task_id===e.task_id);!h&&!_||a.push({part_id:d.part_id,name:d.name,entry_id:d.entry_id,foreign:!h,object_name:d.object_name})}for(let d of e.used_parts||[]){let h=d.entry_id||e.entry_id;a.some(_=>_.part_id===d.part_id&&_.entry_id===h)||a.push({part_id:d.part_id,name:d.name||d.part_id,entry_id:h,foreign:h!==e.entry_id,object_name:null})}let o={};for(let d of e.used_parts||[])o[`${d.entry_id||e.entry_id}:${d.part_id}`]=d.quantity??1;this._partOptions=a,this._partQty=o,this._partQtyOriginal=this._partSelectionKey()}catch{if(t!==this._openGen)return;this._partOptions=[]}}_partSelectionKey(){return JSON.stringify(Object.entries(this._partQty).filter(([,e])=>e>0).sort(([e],[t])=>e.localeCompare(t)))}close(){this._openGen++,this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null,this._photos.discardOrphans()}_set(e,t){this._draft&&(this._draft={...this._draft,[e]:t})}async _delete(){if(!this._draft||!this._originalSnapshot)return;let e=this._lang,i=(this._originalSnapshot.used_parts||[]).filter(h=>h.quantity>0).map(h=>`${I(h.quantity,e)}\xD7 ${h.name||h.part_id}`).join(", ");if(!await Me(this.hass,{title:n("history_delete_entry",e),message:i?`${n("history_delete_confirm_entry",e)} ${n("history_delete_returns_parts",e).replace("{parts}",i)}`:n("history_delete_confirm_entry",e),confirmText:n("delete",e),danger:!0})||!this._draft||!this._originalSnapshot)return;let o=this._draft;this._error="",await this._runWs({type:"maintenance_supporter/task/history/delete",entry_id:o.entry_id,task_id:o.task_id,timestamp:this._originalSnapshot.original_timestamp})!==void 0&&(this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:o.entry_id,task_id:o.task_id,deleted:!0},bubbles:!0,composed:!0})),this.close())}_runWs(e){return D(this,e,{busy:t=>{this._saving=t},onError:t=>{this._error=t}})}async _save(){if(!this._draft||!this._originalSnapshot||this._saving||this._photos.uploading)return;this._error="",this._photos.clearError();let e=this._draft,t=this._originalSnapshot,i={type:"maintenance_supporter/task/history/update",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:t.original_timestamp};if(e.timestamp!==t.timestamp&&(i.timestamp=e.timestamp),e.notes!==t.notes&&(i.notes=e.notes),e.cost!==t.cost&&(i.cost=e.cost),e.duration!==t.duration&&(i.duration=e.duration),e.completed_by!==t.completed_by&&(i.completed_by=e.completed_by),this._partOptions!==null&&this._partSelectionKey()!==this._partQtyOriginal&&(i.used_parts=(this._partOptions||[]).filter(o=>(this._partQty[`${o.entry_id}:${o.part_id}`]||0)>0).map(o=>({part_id:o.part_id,quantity:this._partQty[`${o.entry_id}:${o.part_id}`],...o.foreign?{entry_id:o.entry_id}:{}}))),e.reading_value!==t.reading_value&&(i.reading_value=e.reading_value??null),this._readingRows.length>0&&JSON.stringify(this._readingNumbers())!==this._readingsOriginal){let o=this._readingNumbers(),d={};for(let h of this._readingRows)d[h.id]=o[h.id]??null;i.reading_values=d}if(JSON.stringify Line truncated
`,c([f({attribute:!1})],Ce.prototype,"hass",2),c([f()],Ce.prototype,"docId",2),c([u()],Ce.prototype,"_url",2),c([u()],Ce.prototype,"_failed",2);customElements.get("maintenance-history-photo")||customElements.define("maintenance-history-photo",Ce)});var W,ua=y(()=>{"use strict";R();j();C();Se();ee();Ot();Ai();As();xi();Ci();lt();wi();Ds();Mt();Mt();W=class extends E{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null;this._partOptions=null;this._partQty={};this._partQtyOriginal="";this._openGen=0;this._photos=new nt(this,{entryId:()=>this._draft?.entry_id??"",hass:()=>this.hass});this._photosOriginal="";this._readingRows=[];this._readingText={};this._readingsOriginal=""}get _lang(){return P(this.hass)}openEdit(e){this._openGen++,this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._photos.reset(e.photo_doc_ids??[]),this._photosOriginal=JSON.stringify(this._photos.ids),this._seedReadings(e),this._loadPartOptions()}_seedReadings(e){let t=[],i=new Set;for(let o of e.readings??[])i.has(o.id)||(i.add(o.id),t.push({id:o.id,name:o.name,unit:o.unit??null}));for(let o of e.reading_values??[])i.has(o.id)||(i.add(o.id),t.push({id:o.id,name:o.name,unit:o.unit??null}));this._readingRows=t;let a={};for(let o of e.reading_values??[])a[o.id]=String(o.value);this._readingText=a,this._readingsOriginal=JSON.stringify(this._readingNumbers())}_readingNumbers(){let e={};for(let t of this._readingRows){let i=(this._readingText[t.id]??"").trim();if(i==="")continue;let a=parseFloat(i.replace(",","."));isNaN(a)||(e[t.id]=a)}return e}async _loadPartOptions(){let e=this._draft;if(!e)return;let t=this._openGen;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"});if(t!==this._openGen)return;let a=[];for(let d of i.parts||[]){let h=d.entry_id===e.entry_id,_=d.consumers.some(m=>m.entry_id===e.entry_id&&m.task_id===e.task_id);!h&&!_||a.push({part_id:d.part_id,name:d.name,entry_id:d.entry_id,foreign:!h,object_name:d.object_name})}for(let d of e.used_parts||[]){let h=d.entry_id||e.entry_id;a.some(_=>_.part_id===d.part_id&&_.entry_id===h)||a.push({part_id:d.part_id,name:d.name||d.part_id,entry_id:h,foreign:h!==e.entry_id,object_name:null})}let o={};for(let d of e.used_parts||[])o[`${d.entry_id||e.entry_id}:${d.part_id}`]=d.quantity??1;this._partOptions=a,this._partQty=o,this._partQtyOriginal=this._partSelectionKey()}catch{if(t!==this._openGen)return;this._partOptions=[]}}_partSelectionKey(){return JSON.stringify(Object.entries(this._partQty).filter(([,e])=>e>0).sort(([e],[t])=>e.localeCompare(t)))}close(){this._openGen++,this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null,this._photos.discardOrphans()}_set(e,t){this._draft&&(this._draft={...this._draft,[e]:t})}async _delete(){if(!this._draft||!this._originalSnapshot)return;let e=this._lang,i=(this._originalSnapshot.used_parts||[]).filter(h=>h.quantity>0).map(h=>`${I(h.quantity,e)}\xD7 ${h.name||h.part_id}`).join(", ");if(!await Me(this.hass,{title:n("history_delete_entry",e),message:i?`${n("history_delete_confirm_entry",e)} ${n("history_delete_returns_parts",e).replace("{parts}",i)}`:n("history_delete_confirm_entry",e),confirmText:n("delete",e),danger:!0})||!this._draft||!this._originalSnapshot)return;let o=this._draft;this._error="",await this._runWs({type:"maintenance_supporter/task/history/delete",entry_id:o.entry_id,task_id:o.task_id,timestamp:this._originalSnapshot.original_timestamp})!==void 0&&(this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:o.entry_id,task_id:o.task_id,deleted:!0},bubbles:!0,composed:!0})),this.close())}_runWs(e){return D(this,e,{busy:t=>{this._saving=t},onError:t=>{this._error=t}})}async _save(){if(!this._draft||!this._originalSnapshot||this._saving||this._photos.uploading)return;this._error="",this._photos.clearError();let e=this._draft,t=this._originalSnapshot,i={type:"maintenance_supporter/task/history/update",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:t.original_timestamp};if(e.timestamp!==t.timestamp&&(i.timestamp=e.timestamp),e.notes!==t.notes&&(i.notes=e.notes),e.cost!==t.cost&&(i.cost=e.cost),e.duration!==t.duration&&(i.duration=e.duration),e.completed_by!==t.completed_by&&(i.completed_by=e.completed_by),this._partOptions!==null&&this._partSelectionKey()!==this._partQtyOriginal&&(i.used_parts=(this._partOptions||[]).filter(o=>(this._partQty[`${o.entry_id}:${o.part_id}`]||0)>0).map(o=>({part_id:o.part_id,quantity:this._partQty[`${o.entry_id}:${o.part_id}`],...o.foreign?{entry_id:o.entry_id}:{}}))),e.reading_value!==t.reading_value&&(i.reading_value=e.reading_value??null),this._readingRows.length>0&&JSON.stringify(this._readingNumbers())!==this._readingsOriginal){let o=this._readingNumbers(),d={};for(let h of this._readingRows)d[h.id]=o[h.id]??null;i.reading_values=d}if(JSON.stringify Line truncated
<h2>${n("history_edit_title",e)}</h2>
<div class="entry-type">
<ha-icon icon="mdi:tag-outline"></ha-icon>
@@ -3869,7 +3876,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
<span>${n("duration",e)}</span>
<input type="number" min="0" step="1" inputmode="numeric"
.value=${t.duration!=null?String(t.duration):""}
@input=${a=>{this._set("duration",nt(a.target.value))}} />
@input=${a=>{this._set("duration",at(a.target.value))}} />
</label>
</div>
${this._renderReadings(t,e)}
@@ -3919,7 +3926,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
${this._saving?n("saving",e):n("save",e)}
</button>
</div>
`)}updated(e){e.has("_open")&&this._open&&ut(this.shadowRoot)}_renderReadings(e,t){return this._readingRows.length>0?l`
`)}updated(e){e.has("_open")&&this._open&&ht(this.shadowRoot)}_renderReadings(e,t){return this._readingRows.length>0?l`
<div class="readings-block">
<span class="parts-title">${n("readings_section",t)}</span>
${this._readingRows.map(i=>l`
@@ -3936,7 +3943,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
<input type="number" step="any"
.value=${e.reading_value!=null?String(e.reading_value):""}
@input=${i=>{let a=i.target.value,o=a===""?NaN:Number(a);this._set("reading_value",isNaN(o)?null:o)}} />
</label>`}};W.styles=[ki,dt,$`
</label>`}};W.styles=[$i,pt,$`
:host { display: contents; --ms-modal-max-height: 90vh; --ms-modal-gap: 12px; }
h2 { margin: 0; font-size: 18px; }
.entry-type {
@@ -4026,7 +4033,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
}
/* the camera / gallery pickers come from photoPickerStyles (ms-photo-picker) */
.photos-hint { font-size: 12px; color: var(--secondary-text-color); }
`],c([f({attribute:!1})],W.prototype,"hass",2),c([u()],W.prototype,"_open",2),c([u()],W.prototype,"_saving",2),c([u()],W.prototype,"_error",2),c([u()],W.prototype,"_draft",2),c([u()],W.prototype,"_partOptions",2),c([u()],W.prototype,"_partQty",2),c([u()],W.prototype,"_readingRows",2),c([u()],W.prototype,"_readingText",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",W)});function ze(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function js(r){return!r.startsWith("data:image/svg+xml,")&&!r.startsWith("data:image/png;base64,")?"":ze(r)}function Ol(r){return r.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var V,ha=y(()=>{"use strict";R();j();C();ds();V=class extends E{constructor(){super(...arguments);this.lang="";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._quickResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}get _dialogLang(){return this.lang||P(this.hass)}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._quickResult=null,this._open=!0,this._generate()}openForTask(e,t,i,a){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=a,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=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"})),await this._hasQuickCompleteDefaults()&&i.push(this.hass.connection.sendMessagePromise({...t,action:"quick_complete"})));let a=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=a[0],a.length>1&&(this._completeResult=a[1]),a.length>2&&(this._quickResult=a[2])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,a=t?.message;this._error=i==="no_url"||typeof a=="string"&&a.includes("No Home Assistant URL")?n("qr_error_no_url",this._dialogLang):n("qr_error",this._dialogLang)}finally{e===this._generateSeq&&(this._loading=!1)}}async _hasQuickCompleteDefaults(){try{let t=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId})).tasks||[]).find(i=>i.id===this._taskId);return!!t?.quick_complete_defaults&&Object.keys(t.quick_complete_defaults).length>0}catch{return!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(" "),a=window.open("","_blank","width=600,height=500");if(!a)return;let o=this._dialogLang,d=ze(t),h=ze(i),_=!!this._completeResult,m=!!this._quickResult,b=ze(n("qr_action_view",o)),k=ze(n("qr_action_complete",o)),w=ze(n("qr_action_quick_complete",o));a.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
`],c([f({attribute:!1})],W.prototype,"hass",2),c([u()],W.prototype,"_open",2),c([u()],W.prototype,"_saving",2),c([u()],W.prototype,"_error",2),c([u()],W.prototype,"_draft",2),c([u()],W.prototype,"_partOptions",2),c([u()],W.prototype,"_partQty",2),c([u()],W.prototype,"_readingRows",2),c([u()],W.prototype,"_readingText",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",W)});function ze(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function qs(r){return!r.startsWith("data:image/svg+xml,")&&!r.startsWith("data:image/png;base64,")?"":ze(r)}function Dl(r){return r.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var V,ha=y(()=>{"use strict";R();j();C();ps();V=class extends E{constructor(){super(...arguments);this.lang="";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._quickResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}get _dialogLang(){return this.lang||P(this.hass)}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._quickResult=null,this._open=!0,this._generate()}openForTask(e,t,i,a){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=a,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=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"})),await this._hasQuickCompleteDefaults()&&i.push(this.hass.connection.sendMessagePromise({...t,action:"quick_complete"})));let a=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=a[0],a.length>1&&(this._completeResult=a[1]),a.length>2&&(this._quickResult=a[2])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,a=t?.message;this._error=i==="no_url"||typeof a=="string"&&a.includes("No Home Assistant URL")?n("qr_error_no_url",this._dialogLang):n("qr_error",this._dialogLang)}finally{e===this._generateSeq&&(this._loading=!1)}}async _hasQuickCompleteDefaults(){try{let t=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId})).tasks||[]).find(i=>i.id===this._taskId);return!!t?.quick_complete_defaults&&Object.keys(t.quick_complete_defaults).length>0}catch{return!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(" "),a=window.open("","_blank","width=600,height=500");if(!a)return;let o=this._dialogLang,d=ze(t),h=ze(i),_=!!this._completeResult,m=!!this._quickResult,b=ze(n("qr_action_view",o)),k=ze(n("qr_action_complete",o)),w=ze(n("qr_action_quick_complete",o));a.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
<meta name="color-scheme" content="light">
<title>${d}</title>
<style>
@@ -4048,21 +4055,21 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
${h?`<div class="sub">${h}</div>`:""}
<div class="qr-row">
<div class="qr-col">
<img src="${js(this._viewResult.svg_data_uri)}" alt="QR Info" />
<img src="${qs(this._viewResult.svg_data_uri)}" alt="QR Info" />
<div class="qr-label">${b}</div>
</div>
${_?`<div class="qr-col">
<img src="${js(this._completeResult.svg_data_uri)}" alt="QR Complete" />
<img src="${qs(this._completeResult.svg_data_uri)}" alt="QR Complete" />
<div class="qr-label">${k}</div>
</div>`:""}
${m?`<div class="qr-col">
<img src="${js(this._quickResult.svg_data_uri)}" alt="QR Quick-complete" />
<img src="${qs(this._quickResult.svg_data_uri)}" alt="QR Quick-complete" />
<div class="qr-label">${w}</div>
</div>`:""}
</div>
<div class="url">${ze(this._viewResult.url)}</div>
<script>setTimeout(()=>window.print(),300)<\/script>
</body></html>`),a.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),a=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;on(i,`qr-${Ol(a)}-${t}.svg`,"image/svg+xml")}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._quickResult=null,this._error="",this._loading=!1}render(){if(!this._open)return l``;let e=this._dialogLang,t=this._taskName?`${n("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${n("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return l`
</body></html>`),a.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),a=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;on(i,`qr-${Dl(a)}-${t}.svg`,"image/svg+xml")}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._quickResult=null,this._error="",this._loading=!1}render(){if(!this._open)return l``;let e=this._dialogLang,t=this._taskName?`${n("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${n("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">
@@ -4258,14 +4265,14 @@ ${h?`<div class="sub">${h}</div>`:""}
color: var(--text-primary-color, #fff);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
`,c([f({attribute:!1})],V.prototype,"hass",2),c([f()],V.prototype,"lang",2),c([u()],V.prototype,"_open",2),c([u()],V.prototype,"_loading",2),c([u()],V.prototype,"_error",2),c([u()],V.prototype,"_viewResult",2),c([u()],V.prototype,"_completeResult",2),c([u()],V.prototype,"_quickResult",2),c([u()],V.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",V)});function _a(r,s,e=new Date){let t=r?.hours,i=K(r?.snoozed_until);if(typeof t!="number"||!Number.isFinite(i))return n("snoozed",s);let a=ye(),d=xe(i,a)===xe(e,a)?ni(new Date(i),s):ai(r.snoozed_until,s);return(t===1?n("snoozed_for_one",s):n("snoozed_for",s).replace("{hours}",I(t,s))).replace("{until}",d)}var ma=y(()=>{"use strict";C();ee()});var v_,ga,fa=y(()=>{Ve();({I:v_}=vr),ga=r=>r.strings===void 0});var va,Ds,Ci,Ri=y(()=>{va={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ds=r=>(...s)=>({_$litDirective$:r,values:s}),Ci=class{constructor(s){}get _$AU(){return this._$AM._$AU}_$AT(s,e,t){this._$Ct=s,this._$AM=e,this._$Ci=t}_$AS(s,e){return this.update(s,e)}update(s,e){return this.render(...e)}}});function Hl(r){this._$AN!==void 0?(Ii(this),this._$AM=r,ba(this)):this._$AM=r}function jl(r,s=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(s)if(Array.isArray(t))for(let a=e;a<t.length;a++)Mt(t[a],!1),Ii(t[a]);else t!=null&&(Mt(t,!1),Ii(t));else Mt(this,r)}var Mt,Ii,ba,Dl,Pi,ya=y(()=>{fa();Ri();Ri();Mt=(r,s)=>{let e=r._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(s,!1),Mt(t,s);return!0},Ii=r=>{let s,e;do{if((s=r._$AM)===void 0)break;e=s._$AN,e.delete(r),r=s}while(e?.size===0)},ba=r=>{for(let s;s=r._$AM;r=s){let e=s._$AN;if(e===void 0)s._$AN=e=new Set;else if(e.has(r))break;e.add(r),Dl(s)}};Dl=r=>{r.type==va.CHILD&&(r._$AP??=jl,r._$AQ??=Hl)},Pi=class extends Ci{constructor(){super(...arguments),this._$AN=void 0}_$AT(s,e,t){super._$AT(s,e,t),ba(this),this.isConnected=s._$AU}_$AO(s,e=!0){s!==this.isConnected&&(this.isConnected=s,s?this.reconnected?.():this.disconnected?.()),e&&(Mt(this,s),Ii(this))}setValue(s){if(ga(this._$Ct))this._$Ct._$AI(s,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=s,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}});var qs,xa,wa=y(()=>{Ve();ya();Ri();qs=new WeakMap,xa=Ds(class extends Pi{render(r){return p}update(r,[s]){let e=s!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=s,this.ht=r.options?.host,this.rt(this.ct=r.element)),p}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let s=this.ht??globalThis,e=qs.get(s);e===void 0&&(e=new WeakMap,qs.set(s,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,r),r!==void 0&&this.G.call(this.ht,r)}else this.G.value=r}get lt(){return typeof this.G=="function"?qs.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}})});var ka=y(()=>{wa()});function Ni(r){if(!r)return p;if(customElements.get("ha-markdown")){let{content:s,links:e}=zl(r);return l`<ha-markdown
`,c([f({attribute:!1})],V.prototype,"hass",2),c([f()],V.prototype,"lang",2),c([u()],V.prototype,"_open",2),c([u()],V.prototype,"_loading",2),c([u()],V.prototype,"_error",2),c([u()],V.prototype,"_viewResult",2),c([u()],V.prototype,"_completeResult",2),c([u()],V.prototype,"_quickResult",2),c([u()],V.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",V)});function _a(r,s,e=new Date){let t=r?.hours,i=K(r?.snoozed_until);if(typeof t!="number"||!Number.isFinite(i))return n("snoozed",s);let a=ye(),d=xe(i,a)===xe(e,a)?ni(new Date(i),s):ai(r.snoozed_until,s);return(t===1?n("snoozed_for_one",s):n("snoozed_for",s).replace("{hours}",I(t,s))).replace("{until}",d)}var ma=y(()=>{"use strict";C();ee()});var k_,ga,fa=y(()=>{Ve();({I:k_}=vr),ga=r=>r.strings===void 0});var va,Ms,Ri,Ii=y(()=>{va={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ms=r=>(...s)=>({_$litDirective$:r,values:s}),Ri=class{constructor(s){}get _$AU(){return this._$AM._$AU}_$AT(s,e,t){this._$Ct=s,this._$AM=e,this._$Ci=t}_$AS(s,e){return this.update(s,e)}update(s,e){return this.render(...e)}}});function ql(r){this._$AN!==void 0?(Pi(this),this._$AM=r,ba(this)):this._$AM=r}function Ml(r,s=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(s)if(Array.isArray(t))for(let a=e;a<t.length;a++)zt(t[a],!1),Pi(t[a]);else t!=null&&(zt(t,!1),Pi(t));else zt(this,r)}var zt,Pi,ba,zl,Li,ya=y(()=>{fa();Ii();Ii();zt=(r,s)=>{let e=r._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(s,!1),zt(t,s);return!0},Pi=r=>{let s,e;do{if((s=r._$AM)===void 0)break;e=s._$AN,e.delete(r),r=s}while(e?.size===0)},ba=r=>{for(let s;s=r._$AM;r=s){let e=s._$AN;if(e===void 0)s._$AN=e=new Set;else if(e.has(r))break;e.add(r),zl(s)}};zl=r=>{r.type==va.CHILD&&(r._$AP??=Ml,r._$AQ??=ql)},Li=class extends Ri{constructor(){super(...arguments),this._$AN=void 0}_$AT(s,e,t){super._$AT(s,e,t),ba(this),this.isConnected=s._$AU}_$AO(s,e=!0){s!==this.isConnected&&(this.isConnected=s,s?this.reconnected?.():this.disconnected?.()),e&&(zt(this,s),Pi(this))}setValue(s){if(ga(this._$Ct))this._$Ct._$AI(s,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=s,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}});var zs,xa,wa=y(()=>{Ve();ya();Ii();zs=new WeakMap,xa=Ms(class extends Li{render(r){return p}update(r,[s]){let e=s!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=s,this.ht=r.options?.host,this.rt(this.ct=r.element)),p}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let s=this.ht??globalThis,e=zs.get(s);e===void 0&&(e=new WeakMap,zs.set(s,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,r),r!==void 0&&this.G.call(this.ht,r)}else this.G.value=r}get lt(){return typeof this.G=="function"?zs.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}})});var ka=y(()=>{wa()});function Oi(r){if(!r)return p;if(customElements.get("ha-markdown")){let{content:s,links:e}=Bl(r);return l`<ha-markdown
class="notes-md"
.content=${s}
breaks
${xa(t=>Fl(t,e))}
></ha-markdown>`}return l`${r}`}function zl(r){let s=[],e=a=>{let o=_s(a);return!o||ql.has(o)||!Ze(a)?null:(s.push(hs(a)),`${zs}${s.length-1}`)},t=a=>a.replace(new RegExp(`(!?)(\\[[^\\]\\n]*\\]\\(\\s*)<(${Li}[^>\\n]*)>`,"g"),(o,d,h,_)=>{let m=d?null:e(_);return m?`${h}${m}`:o}).replace(new RegExp(`(!?)(\\[[^\\]\\n]*\\]\\(\\s*)(${Li}[^\\s)]*)`,"g"),(o,d,h,_)=>{let m=d?null:e(_);return m?`${h}${m}`:o}).replace(new RegExp(`(^|[^(])<(${Li}[^\\s<>]*)>`,"gm"),(o,d,h)=>{let _=e(h);return _?`${d}[${h.replace(/([\\[\]])/g,"\\$1")}](${_})`:o}).replace(new RegExp(`^( {0,3}\\[[^\\]\\n]+\\]:[ \\t]*)<?(${Li}[^\\s>]*)>?`,"gm"),(o,d,h)=>{let _=e(h);return _?`${d}${_}`:o});return{content:r.split(Ml).map((a,o)=>o%2?a:t(a)).join(""),links:s}}function Ms(r,s){for(let e of r.querySelectorAll(`a[href^="${zs}"]`)){let t=s[Number(e.getAttribute("href").slice(zs.length))];t&&e.setAttribute("href",t)}}function Fl(r,s){if(!r)return;let e=$a.get(r);if(!e&&s.length===0)return;if(e){e.links=s,r.shadowRoot&&Ms(r.shadowRoot,s);return}let t={links:s};$a.set(r,t),(async()=>{await r.updateComplete;let i=r.shadowRoot;i&&(new MutationObserver(()=>Ms(i,t.links)).observe(i,{childList:!0,subtree:!0}),Ms(i,t.links))})()}var zs,ql,Ml,Li,$a,Fs=y(()=>{"use strict";R();ka();di();zs="https://app-link.invalid/",ql=new Set(["http","https","mailto","tel","ftp"]),Ml=/(```[\s\S]*?```|~~~[\s\S]*?~~~|`[^`\n]*`)/,Li="[a-zA-Z][a-zA-Z0-9+.-]+:";$a=new WeakMap});function Ea(r,s,e,t){let i=e,a=h=>typeof h=="string"?h:null,o=h=>typeof h=="number"?h:null,d=a(i.timestamp)??"";return{entry_id:r,task_id:s,original_timestamp:d,type:a(i.type)||"completed",timestamp:d,notes:a(i.notes),cost:o(i.cost),duration:o(i.duration),completed_by:a(i.completed_by),used_parts:Array.isArray(i.used_parts)?i.used_parts:null,photo_doc_ids:vi(i),reading_value:o(i.reading_value),reading_values:$e(i),readings:t?.readings??[],task_type:t?.type??null,reading_unit:t?.reading_unit??null}}var Sa=y(()=>{"use strict";bi();De()});function Ul(r){return r&&Ta(r.ref_no)?String(r.ref_no):null}function Aa(r,s){let e=Ul(r);return e&&s&&Ta(s.ref_no)?`${e}.${s.ref_no}`:null}function Ca(r,s){return r?l`<span class="ref-chip" title=${s??""}>#${r}</span>`:p}var Ta,Us=y(()=>{"use strict";R();Ta=r=>typeof r=="number"&&Number.isInteger(r)&&r>0});var Ra=y(()=>{"use strict"});function Ia(r,s){if(!r)return"";let e=Bl[r.trim()];if(e)return n(e,s);for(let[t,i,a]of Wl){let o=r.trim().match(t);if(o){let d=a(o,s);return n(i,s).replace(/\{(\w+)\}/g,(h,_)=>d[_]??h)}}return r}var Bl,Wl,Pa=y(()=>{"use strict";C();Bl={"Completed from dashboard button":"hist_note_button","Completed from the To-do list":"hist_note_todo","Completed by voice":"hist_note_voice","Completed from the notification":"hist_note_notification","Completed via NFC tag":"hist_note_nfc","Completed from the shopping list":"hist_note_shopping_list","Completed from a mirrored to-do list":"hist_note_todo_mirror","Skipped from notification":"hist_note_skipped_notification","Skipped from dashboard button":"hist_note_skipped_button","Sensor trigger activated":"hist_note_sensor_triggered","Initial value set during task creation":"hist_note_initial"},Wl=[[/^Auto-completed: sensor recovered \((.+)\)$/,"hist_note_auto_recovered",r=>({value:r[1]})],[/^Reset to (\d{4}-\d{2}-\d{2})$/,"hist_note_reset",(r,s)=>({date:H(r[1],s)})],[/^Trigger entity replaced: (.+) → (.+)$/,"hist_note_trigger_replaced",r=>({old:r[1],new:r[2]})],[/^Sensor trigger removed \(entity was: (.+)\)\. Schedule converted to (\w+)\.$/,"hist_note_trigger_removed",(r,s)=>({entity:r[1],schedule:n(r[2],s)})],[/^Entity (.+) removed from compound trigger; (\d+) conditions remain\.$/,"hist_note_compound_removed",r=>({entity:r[1],count:r[2]})]]});function La(r){let s=e=>{let t=K(e.timestamp);return Number.isNaN(t)?-1/0:t};return(r??[]).map((e,t)=>({entry:e,index:t,at:s(e)})).sort((e,t)=>t.at-e.at||t.index-e.index).map(e=>e.entry)}function Gl(r,s){return r.taskRef&&s.ref_no?`${r.taskRef}-${s.ref_no}`:null}function Kl(r,s){let e=vi(s);return e.length>0?l`<div class="history-photos">
${xa(t=>Wl(t,e))}
></ha-markdown>`}return l`${r}`}function Bl(r){let s=[],e=a=>{let o=ms(a);return!o||Fl.has(o)||!Ze(a)?null:(s.push(_s(a)),`${Us}${s.length-1}`)},t=a=>a.replace(new RegExp(`(!?)(\\[[^\\]\\n]*\\]\\(\\s*)<(${Ni}[^>\\n]*)>`,"g"),(o,d,h,_)=>{let m=d?null:e(_);return m?`${h}${m}`:o}).replace(new RegExp(`(!?)(\\[[^\\]\\n]*\\]\\(\\s*)(${Ni}[^\\s)]*)`,"g"),(o,d,h,_)=>{let m=d?null:e(_);return m?`${h}${m}`:o}).replace(new RegExp(`(^|[^(])<(${Ni}[^\\s<>]*)>`,"gm"),(o,d,h)=>{let _=e(h);return _?`${d}[${h.replace(/([\\[\]])/g,"\\$1")}](${_})`:o}).replace(new RegExp(`^( {0,3}\\[[^\\]\\n]+\\]:[ \\t]*)<?(${Ni}[^\\s>]*)>?`,"gm"),(o,d,h)=>{let _=e(h);return _?`${d}${_}`:o});return{content:r.split(Ul).map((a,o)=>o%2?a:t(a)).join(""),links:s}}function Fs(r,s){for(let e of r.querySelectorAll(`a[href^="${Us}"]`)){let t=s[Number(e.getAttribute("href").slice(Us.length))];t&&e.setAttribute("href",t)}}function Wl(r,s){if(!r)return;let e=$a.get(r);if(!e&&s.length===0)return;if(e){e.links=s,r.shadowRoot&&Fs(r.shadowRoot,s);return}let t={links:s};$a.set(r,t),(async()=>{await r.updateComplete;let i=r.shadowRoot;i&&(new MutationObserver(()=>Fs(i,t.links)).observe(i,{childList:!0,subtree:!0}),Fs(i,t.links))})()}var Us,Fl,Ul,Ni,$a,Bs=y(()=>{"use strict";R();ka();di();Us="https://app-link.invalid/",Fl=new Set(["http","https","mailto","tel","ftp"]),Ul=/(```[\s\S]*?```|~~~[\s\S]*?~~~|`[^`\n]*`)/,Ni="[a-zA-Z][a-zA-Z0-9+.-]+:";$a=new WeakMap});function Ea(r,s,e,t){let i=e,a=h=>typeof h=="string"?h:null,o=h=>typeof h=="number"?h:null,d=a(i.timestamp)??"";return{entry_id:r,task_id:s,original_timestamp:d,type:a(i.type)||"completed",timestamp:d,notes:a(i.notes),cost:o(i.cost),duration:o(i.duration),completed_by:a(i.completed_by),used_parts:Array.isArray(i.used_parts)?i.used_parts:null,photo_doc_ids:bi(i),reading_value:o(i.reading_value),reading_values:$e(i),readings:t?.readings??[],task_type:t?.type??null,reading_unit:t?.reading_unit??null}}var Sa=y(()=>{"use strict";yi();De()});function Vl(r){return r&&Ta(r.ref_no)?String(r.ref_no):null}function Aa(r,s){let e=Vl(r);return e&&s&&Ta(s.ref_no)?`${e}.${s.ref_no}`:null}function Ca(r,s){return r?l`<span class="ref-chip" title=${s??""}>#${r}</span>`:p}var Ta,Ws=y(()=>{"use strict";R();Ta=r=>typeof r=="number"&&Number.isInteger(r)&&r>0});var Ra=y(()=>{"use strict"});function Ia(r,s){if(!r)return"";let e=Gl[r.trim()];if(e)return n(e,s);for(let[t,i,a]of Kl){let o=r.trim().match(t);if(o){let d=a(o,s);return n(i,s).replace(/\{(\w+)\}/g,(h,_)=>d[_]??h)}}return r}var Gl,Kl,Pa=y(()=>{"use strict";C();Gl={"Completed from dashboard button":"hist_note_button","Completed from the To-do list":"hist_note_todo","Completed by voice":"hist_note_voice","Completed from the notification":"hist_note_notification","Completed via NFC tag":"hist_note_nfc","Completed from the shopping list":"hist_note_shopping_list","Completed from a mirrored to-do list":"hist_note_todo_mirror","Skipped from notification":"hist_note_skipped_notification","Skipped from dashboard button":"hist_note_skipped_button","Sensor trigger activated":"hist_note_sensor_triggered","Initial value set during task creation":"hist_note_initial"},Kl=[[/^Auto-completed: sensor recovered \((.+)\)$/,"hist_note_auto_recovered",r=>({value:r[1]})],[/^Reset to (\d{4}-\d{2}-\d{2})$/,"hist_note_reset",(r,s)=>({date:H(r[1],s)})],[/^Trigger entity replaced: (.+) → (.+)$/,"hist_note_trigger_replaced",r=>({old:r[1],new:r[2]})],[/^Sensor trigger removed \(entity was: (.+)\)\. Schedule converted to (\w+)\.$/,"hist_note_trigger_removed",(r,s)=>({entity:r[1],schedule:n(r[2],s)})],[/^Entity (.+) removed from compound trigger; (\d+) conditions remain\.$/,"hist_note_compound_removed",r=>({entity:r[1],count:r[2]})]]});function La(r){let s=e=>{let t=K(e.timestamp);return Number.isNaN(t)?-1/0:t};return(r??[]).map((e,t)=>({entry:e,index:t,at:s(e)})).sort((e,t)=>t.at-e.at||t.index-e.index).map(e=>e.entry)}function Ql(r,s){return r.taskRef&&s.ref_no?`${r.taskRef}-${s.ref_no}`:null}function Zl(r,s){let e=bi(s);return e.length>0?l`<div class="history-photos">
${e.map(t=>l`<maintenance-history-photo .hass=${r} .docId=${t}></maintenance-history-photo>`)}
</div>`:p}function Yl(r,s){let e=s.lang,t=o=>I(o,e,{maximumFractionDigits:3}),i=o=>o==null?"":` (${o>=0?"+":""}${t(o)})`,a=$e(r);return a.length>0?l`<div class="history-readings">
</div>`:p}function Jl(r,s){let e=s.lang,t=o=>I(o,e,{maximumFractionDigits:3}),i=o=>o==null?"":` (${o>=0?"+":""}${t(o)})`,a=$e(r);return a.length>0?l`<div class="history-readings">
${a.map(o=>l`<span class="history-reading">
<span class="history-reading-name">${o.name}</span>
<span class="history-reading-value">${t(o.value)}${o.unit?` ${o.unit}`:""}${i(s.readingSlotDelta?.(r,o.id))}</span>
@@ -4273,7 +4280,7 @@ ${h?`<div class="sub">${h}</div>`:""}
</div>`:r.reading_value!=null?l`<div class="history-readings"><span class="history-reading">
<span class="history-reading-name">${n("reading_label",e)}</span>
<span class="history-reading-value">${t(r.reading_value)}${s.readingUnit?` ${s.readingUnit}`:""}${i(s.readingDelta?.(r))}</span>
</span></div>`:p}function Na(r,s,e={}){let t=s.lang,{compact:i=!1,showRef:a=!0,showBadges:o=!0,showEdit:d=!0}=e,h=s.openEdit,_=d&&!!h&&Vl.includes(r.type),m=typeof r.parts_cost=="number"?r.parts_cost:null,b=r.cost_basis==="use",k=b&&!!r.purchase;return l`
</span></div>`:p}function Na(r,s,e={}){let t=s.lang,{compact:i=!1,showRef:a=!0,showBadges:o=!0,showEdit:d=!0}=e,h=s.openEdit,_=d&&!!h&&Yl.includes(r.type),m=typeof r.parts_cost=="number"?r.parts_cost:null,b=r.cost_basis==="use",k=b&&!!r.purchase;return l`
<div class="history-entry${i?" compact":""}">
${i?p:l`<div class="history-icon ${r.type}">
<ha-icon .icon=${$t[r.type]||"mdi:circle"}></ha-icon>
@@ -4281,7 +4288,7 @@ ${h?`<div class="sub">${h}</div>`:""}
<div class="history-content">
<div class="history-row">
<strong>${n(r.type,t)}</strong>
${a?Ca(Gl(s,r),n("ref_number",t)):p}
${a?Ca(Ql(s,r),n("ref_number",t)):p}
${o&&r.phase_id?l`<span class="history-phase-badge">${s.phaseNames?.[r.phase_id]||r.phase_id}</span>`:p}
${o&&r.auto?l`<span class="history-auto-badge">${n("history_auto",t)}</span>`:p}
${_?l`<button class="history-edit-btn"
@@ -4292,8 +4299,8 @@ ${h?`<div class="sub">${h}</div>`:""}
</div>
<div class="history-date">${ai(r.timestamp,t)}</div>
${r.notes?l`<div class="history-notes">${Ia(r.notes,t)}</div>`:p}
${Kl(s.hass,r)}
${Yl(r,s)}
${Zl(s.hass,r)}
${Jl(r,s)}
${r.cost!=null||r.duration!=null||r.trigger_value!=null||m!=null?l`<div class="history-details">
${r.cost!=null?k?l`<span>${n("history_purchase_stock",t).replace("{amount}",re(r.cost,s.currencySymbol,t))}</span>`:r.cost<0?l`<span class="history-credit">${n("cost_kind_credit",t)}: ${re(-r.cost,s.currencySymbol,t)}</span>`:l`<span>${n("cost",t)}: ${re(r.cost,s.currencySymbol,t)}</span>`:p}
${m!=null?l`<span title=${n(b?"history_parts_counted_hint":"history_parts_info_hint",t)}>${n(b?"history_parts_counted":"history_parts_info",t).replace("{amount}",re(m,s.currencySymbol,t))}</span>`:p}
@@ -4302,26 +4309,26 @@ ${h?`<div class="sub">${h}</div>`:""}
</div>`:p}
</div>
</div>
`}var Vl,Oa=y(()=>{"use strict";R();C();Hs();bi();Us();De();Ra();Pa();ee();Vl=["completed","reset","skipped"]});function zt(r){return r.archived?"archived":r.is_done?"done":r.status||"ok"}function Bs(r,s){return n(r==="done"?"completed":r,s)}function Oi(r){let s=zt(r);return s==="done"?Ql:kt[s]||"var(--disabled-color, #9e9e9e)"}function Zl(r){return $t[r==="done"?"completed":r]||"mdi:circle-medium"}function Ha(r,s,e="pill"){let t=zt(r),i=Bs(t,s);return e==="chip"?l`<span class="status-chip ${t}">${i}</span>`:l`<span class="status-badge ${t}" role="img" title="${i}" aria-label="${i}"><ha-icon icon="${Zl(t)}"></ha-icon><span class="status-label">${i}</span></span>`}var Ql,Ws=y(()=>{"use strict";R();C();Et();Ql="var(--maint-done-color, #78909c)"});var Hi,ja=y(()=>{"use strict";Hi=class{constructor(){this._handle=null}schedule(s,e=4e3){this.clear(),this._handle=setTimeout(()=>{this._handle=null,s()},e)}clear(){this._handle!==null&&(clearTimeout(this._handle),this._handle=null)}get pending(){return this._handle!==null}}});function Da(r,s){let e=r.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return p;let a=r.interval_days??0,o=r.suggested_interval??a;return l`
`}var Yl,Oa=y(()=>{"use strict";R();C();Ds();yi();Ws();De();Ra();Pa();ee();Yl=["completed","reset","skipped"]});var Hi,Ha=y(()=>{"use strict";Hi=class{constructor(){this._handle=null}schedule(s,e=4e3){this.clear(),this._handle=setTimeout(()=>{this._handle=null,s()},e)}clear(){this._handle!==null&&(clearTimeout(this._handle),this._handle=null)}get pending(){return this._handle!==null}}});function ja(r,s){let e=r.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return p;let a=r.interval_days??0,o=r.suggested_interval??a;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>
${n("weibull_reliability_curve",s)}
${Jl(t,s)}
${Xl(t,s)}
</div>
${Xl(t,i,a,o,s)}
${ec(e,s)}
${e?.confidence_interval_low!=null?tc(e,r,s):p}
${ec(t,i,a,o,s)}
${tc(e,s)}
${e?.confidence_interval_low!=null?ic(e,r,s):p}
</div>
`}function Jl(r,s){let e,t,i;return r<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):r<=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"):r<=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 Xl(r,s){let e,t,i;return r<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):r<=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"):r<=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>
${n(i,s)} (\u03B2=${I(r,s,2)})
</span>
`}function Xl(r,s,e,t,i){let w=Math.max(e,t,s,1)*1.3,v=50,x=[];for(let Z=0;Z<=v;Z++){let se=Z/v*w,ro=1-Math.exp(-Math.pow(se/s,r)),no=32+se/w*260,ao=136-ro*128;x.push([no,ao])}let T=x.map(([Z,se])=>`${A(Z)},${A(se)}`).join(" "),O="M32,136 "+x.map(([Z,se])=>`L${A(Z)},${A(se)}`).join(" ")+` L${A(x[v][0])},136 Z`,G=32+e/w*260,ce=1-Math.exp(-Math.pow(e/s,r)),Ue=136-ce*128,io=I((1-ce)*100,i,0),er=32+t/w*260,so=[0,.25,.5,.75,1];return l`
`}function ec(r,s,e,t,i){let w=Math.max(e,t,s,1)*1.3,v=50,x=[];for(let Z=0;Z<=v;Z++){let se=Z/v*w,so=1-Math.exp(-Math.pow(se/s,r)),ro=32+se/w*260,no=136-so*128;x.push([ro,no])}let T=x.map(([Z,se])=>`${A(Z)},${A(se)}`).join(" "),O="M32,136 "+x.map(([Z,se])=>`L${A(Z)},${A(se)}`).join(" ")+` L${A(x[v][0])},136 Z`,G=32+e/w*260,ce=1-Math.exp(-Math.pow(e/s,r)),Ue=136-ce*128,to=I((1-ce)*100,i,0),er=32+t/w*260,io=[0,.25,.5,.75,1];return l`
<div class="weibull-chart">
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${n("chart_weibull",i)}">
${so.map(Z=>{let se=136-Z*128;return We`
${io.map(Z=>{let se=136-Z*128;return We`
<line x1="${32}" y1="${A(se)}" x2="${292}" y2="${A(se)}"
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${Z===.5?"4,3":p}" />
<text x="${28}" y="${A(se+3)}" fill="var(--secondary-text-color)"
@@ -4342,7 +4349,7 @@ ${h?`<div class="sub">${h}</div>`:""}
<circle cx="${A(G)}" cy="${A(Ue)}" r="3"
fill="var(--primary-color, #03a9f4)" />
<text x="${A(G+4)}" y="${A(Ue-6)}" fill="var(--primary-color, #03a9f4)"
font-size="9" font-weight="600">R=${io}%</text>
font-size="9" font-weight="600">R=${to}%</text>
`:p}
${t>0&&t!==e?We`
@@ -4361,7 +4368,7 @@ ${h?`<div class="sub">${h}</div>`:""}
${e>0?l`<span class="legend-item"><span class="legend-swatch" style="background:var(--primary-color, #03a9f4); opacity:0.5"></span> ${n("current_interval_marker",i)}</span>`:p}
${t>0&&t!==e?l`<span class="legend-item"><span class="legend-swatch" style="background:var(--success-color, #4caf50)"></span> ${n("recommended_marker",i)}</span>`:p}
</div>
`}function ec(r,s){return l`
`}function tc(r,s){return l`
<div class="weibull-info-row">
<div class="weibull-info-item">
<span>${n("characteristic_life",s)}</span>
@@ -4374,7 +4381,7 @@ ${h?`<div class="sub">${h}</div>`:""}
</div>
`:p}
</div>
`}function tc(r,s,e){let t=r.confidence_interval_low,i=r.confidence_interval_high,a=s.suggested_interval??s.interval_days??0,o=s.interval_days??0,d=Math.max(0,t-5),_=i+5-d,m=(t-d)/_*100,b=(i-t)/_*100,k=(a-d)/_*100,w=o>0?(o-d)/_*100:-1;return l`
`}function ic(r,s,e){let t=r.confidence_interval_low,i=r.confidence_interval_high,a=s.suggested_interval??s.interval_days??0,o=s.interval_days??0,d=Math.max(0,t-5),_=i+5-d,m=(t-d)/_*100,b=(i-t)/_*100,k=(a-d)/_*100,w=o>0?(o-d)/_*100:-1;return l`
<div class="confidence-range">
<div class="confidence-range-title">
${n("confidence_interval",e)}: ${a} ${n("days",e)} (${t}\u2013${i})
@@ -4389,7 +4396,7 @@ ${h?`<div class="sub">${h}</div>`:""}
<span class="confidence-text high">${n("confidence_aggressive",e)} (${i}${n("days",e).charAt(0)})</span>
</div>
</div>
`}var qa=y(()=>{"use strict";R();C();$i()});function Ma(r,s,e){let t=r.degradation_trend!=null&&r.degradation_trend!=="insufficient_data",i=r.days_until_threshold!=null,a=r.environmental_factor!=null&&r.environmental_factor!==1;if(!t&&!i&&!a)return p;let o=r.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":r.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 Da=y(()=>{"use strict";R();C();Ei()});function qa(r,s,e){let t=r.degradation_trend!=null&&r.degradation_trend!=="insufficient_data",i=r.days_until_threshold!=null,a=r.environmental_factor!=null&&r.environmental_factor!==1;if(!t&&!i&&!a)return p;let o=r.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":r.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">
${r.sensor_prediction_urgency?l`
<div class="prediction-urgency-banner">
@@ -4430,7 +4437,7 @@ ${h?`<div class="sub">${h}</div>`:""}
`:p}
</div>
</div>
`}var za=y(()=>{"use strict";R();C()});function Fa(r,s,e,t){let i=Math.max(r||1,s);return l`
`}var Ma=y(()=>{"use strict";R();C()});function za(r,s,e,t){let i=Math.max(r||1,s);return l`
<div class="interval-comparison">
<div class="interval-bar">
<div class="interval-label">
@@ -4448,7 +4455,7 @@ ${h?`<div class="sub">${h}</div>`:""}
style="width: ${Math.min(s/i*100,100)}%"></div>
</div>
</div>
`}var Ua=y(()=>{"use strict";R();C()});function Wa(){return Number(we().slice(5,7))-1}function Va(r,s,e){if(!e.seasonal||!r.seasonal_factor||r.seasonal_factor===1)return p;let t=Ba.map(d=>n(d,s)),i=Wa(),a=r.seasonal_factors||r.interval_analysis?.seasonal_factors||null,o=a&&a.length===12?a:t.map((d,h)=>{let _=r.seasonal_factor||1,m=Math.sin((h-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,_+m))});return l`
`}var Fa=y(()=>{"use strict";R();C()});function Ba(){return Number(we().slice(5,7))-1}function Wa(r,s,e){if(!e.seasonal||!r.seasonal_factor||r.seasonal_factor===1)return p;let t=Ua.map(d=>n(d,s)),i=Ba(),a=r.seasonal_factors||r.interval_analysis?.seasonal_factors||null,o=a&&a.length===12?a:t.map((d,h)=>{let _=r.seasonal_factor||1,m=Math.sin((h-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,_+m))});return l`
<div class="seasonal-card-compact">
<h4>${n("seasonal_awareness",s)}</h4>
<div class="seasonal-mini-chart">
@@ -4465,7 +4472,7 @@ ${h?`<div class="sub">${h}</div>`:""}
<span class="legend-item"><span class="dot high"></span> ${n("longer",s)}</span>
</div>
</div>
`}function Ga(r,s){return ic(r,s)}function ic(r,s){let e=r.seasonal_factors??r.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return p;let t=r.interval_analysis?.seasonal_reason,i=Wa(),a=300,o=100,d=8,_=o-d-4,m=Math.max(...e,1.5),b=a/12,k=b*.65,w=d+_-1/m*_;return l`
`}function Va(r,s){return sc(r,s)}function sc(r,s){let e=r.seasonal_factors??r.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return p;let t=r.interval_analysis?.seasonal_reason,i=Ba(),a=300,o=100,d=8,_=o-d-4,m=Math.max(...e,1.5),b=a/12,k=b*.65,w=d+_-1/m*_;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>
@@ -4482,13 +4489,13 @@ ${h?`<div class="sub">${h}</div>`:""}
`})}
</svg>
<div class="seasonal-labels">
${Ba.map((v,x)=>l`<span class="seasonal-label ${x===i?"active-month":""}">${n(v,s)}</span>`)}
${Ua.map((v,x)=>l`<span class="seasonal-label ${x===i?"active-month":""}">${n(v,s)}</span>`)}
</div>
</div>
`}var Ba,Ka=y(()=>{"use strict";R();C();$i();ee();Ba=["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 N,Ya=y(()=>{"use strict";R();j();C();Se();ma();Ti();ee();fi();hi();Fs();Sa();De();Us();Oa();Ws();st();et();Ai();ja();qa();za();Ua();ot();Ka();N=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._taskRef=null;this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showPostpone=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._postponeDate="";this._features={adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1,places:!1};this._toast="";this._toastTimer=new Hi;this._access=he;this._currencySymbol="";this._partsCostMode="purchase";this._loadSeq=0}get _lang(){return P(this.hass)}async openFor(e,t){(e!==this._entryId||t!==this._taskId)&&(this._task=null),this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showPostpone=!1,this._showAdaptive=!1,this._skipReason="",this._postponeDate="",this._resetDate=we(),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){let e=await B(this.hass);this._features={...this._features,...e.features},this._access=e.access,this._currencySymbol=je(e.budget??void 0),ri(e.budget??void 0),this._partsCostMode=e.partsCostMode}close(){this._loadSeq++,this._open=!1,this._task=null,this._error="",this._toastTimer.clear(),this._toast=""}_showToast(e,t){this._toast=e,this._toastTimer.schedule(()=>{this._toast=""},t)}async _loadTask(){let e=this._entryId,t=this._taskId;if(!e||!t)return;let i=++this._loadSeq,a="",o=await D(this,{type:"maintenance_supporter/object",entry_id:e},{onError:h=>{a=h}});if(i!==this._loadSeq)return;if(o===void 0){this._error=a;return}this._objectName=o?.object?.name||"";let d=(o?.tasks||[]).find(h=>h.id===t);this._task=d??null,this._taskRef=Aa(o?.object,d),d||(this._error=n("ws_err_not_found",this._lang))}_runWs(e){return this._error="",D(this,e,{busy:t=>{this._busy=t},onError:t=>{this._error=t}})}_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(()=>(le(),me)).then(async({openCompleteDialog:e})=>{let t=this._task,i=[];try{i=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0})).objects||[]}catch{}e(mi({entryId:this._entryId,taskId:this._taskId,taskName:t.name,task:t,objects:i,lang:this._lang,features:this._features,currencySymbol:this._currencySymbol,partsCostMode:this._partsCostMode}))&&(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})!==void 0&&(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})!==void 0&&(this._notifyChanged("reset"),this.close())}async _onPostponeConfirm(){if(!this._entryId||!this._taskId||!this._postponeDate)return;await this._runWs({type:"maintenance_supporter/task/postpone",entry_id:this._entryId,task_id:this._taskId,until:this._postponeDate})!==void 0&&(this._notifyChanged("postpone"),this.close())}async _onSnooze(){if(!this._entryId||!this._taskId)return;let e=await this._runWs({type:"maintenance_supporter/task/snooze",entry_id:this._entryId,task_id:this._taskId});e!==void 0&&(this._notifyChanged("snooze"),this.dispatchEvent(new CustomEvent("hass-notification",{detail:{message:_a(e,this._lang)},bubbles:!0,composed:!0})),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(le(),me)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(le(),me)).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||!await Me(this.hass,{title:n("delete",this._lang),message:n("delete_task_confirm",this._lang),confirmText:n("delete",this._lang),danger:!0}))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})!==void 0&&(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})!==void 0& Line truncated
`}var Ua,Ga=y(()=>{"use strict";R();C();Ei();ee();Ua=["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 N,Ka=y(()=>{"use strict";R();j();C();Se();ma();Ai();ee();fi();hi();Bs();Sa();De();Ws();Oa();vi();st();et();Ci();Ha();Da();Ma();Fa();lt();Ga();N=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._taskRef=null;this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showPostpone=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._postponeDate="";this._features={adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1,places:!1};this._toast="";this._toastTimer=new Hi;this._access=he;this._currencySymbol="";this._partsCostMode="purchase";this._loadSeq=0}get _lang(){return P(this.hass)}async openFor(e,t){(e!==this._entryId||t!==this._taskId)&&(this._task=null),this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showPostpone=!1,this._showAdaptive=!1,this._skipReason="",this._postponeDate="",this._resetDate=we(),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){let e=await B(this.hass);this._features={...this._features,...e.features},this._access=e.access,this._currencySymbol=je(e.budget??void 0),ri(e.budget??void 0),this._partsCostMode=e.partsCostMode}close(){this._loadSeq++,this._open=!1,this._task=null,this._error="",this._toastTimer.clear(),this._toast=""}_showToast(e,t){this._toast=e,this._toastTimer.schedule(()=>{this._toast=""},t)}async _loadTask(){let e=this._entryId,t=this._taskId;if(!e||!t)return;let i=++this._loadSeq,a="",o=await D(this,{type:"maintenance_supporter/object",entry_id:e},{onError:h=>{a=h}});if(i!==this._loadSeq)return;if(o===void 0){this._error=a;return}this._objectName=o?.object?.name||"";let d=(o?.tasks||[]).find(h=>h.id===t);this._task=d??null,this._taskRef=Aa(o?.object,d),d||(this._error=n("ws_err_not_found",this._lang))}_runWs(e){return this._error="",D(this,e,{busy:t=>{this._busy=t},onError:t=>{this._error=t}})}_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(()=>(le(),me)).then(async({openCompleteDialog:e})=>{let t=this._task,i=[];try{i=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0})).objects||[]}catch{}e(mi({entryId:this._entryId,taskId:this._taskId,taskName:t.name,task:t,objects:i,lang:this._lang,features:this._features,currencySymbol:this._currencySymbol,partsCostMode:this._partsCostMode}))&&(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})!==void 0&&(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})!==void 0&&(this._notifyChanged("reset"),this.close())}async _onPostponeConfirm(){if(!this._entryId||!this._taskId||!this._postponeDate)return;await this._runWs({type:"maintenance_supporter/task/postpone",entry_id:this._entryId,task_id:this._taskId,until:this._postponeDate})!==void 0&&(this._notifyChanged("postpone"),this.close())}async _onSnooze(){if(!this._entryId||!this._taskId)return;let e=await this._runWs({type:"maintenance_supporter/task/snooze",entry_id:this._entryId,task_id:this._taskId});e!==void 0&&(this._notifyChanged("snooze"),this.dispatchEvent(new CustomEvent("hass-notification",{detail:{message:_a(e,this._lang)},bubbles:!0,composed:!0})),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(le(),me)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(le(),me)).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||!await Me(this.hass,{title:n("delete",this._lang),message:n("delete_task_confirm",this._lang),confirmText:n("delete",this._lang),danger:!0}))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})!==void 0&&(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})!==void 0& Line truncated
<div class="recommendation-card">
<h4>${n("suggested_interval",t)}</h4>
${Fa(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
${za(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
<div class="recommendation-actions">
${ae(this.hass?.user,this._access)?l`<button class="btn primary qa-apply-suggestion"
@click=${this._applySuggestion} ?disabled=${this._busy}>
@@ -4508,11 +4515,11 @@ ${h?`<div class="sub">${h}</div>`:""}
<div class="adaptive-stack">
${this._toast?l`<div class="toast">${this._toast}</div>`:p}
${i?this._renderRecommendation(e):p}
${a?Ma(e,t,this._features):p}
${o?Da(e,t):p}
${a?qa(e,t,this._features):p}
${o?ja(e,t):p}
${d?l`
${Va(e,t,this._features)}
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?Ga(e,t):p}
${Wa(e,t,this._features)}
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?Va(e,t):p}
`:p}
</div>
`}_renderDetails(e){let t=this._lang,i=e.history||[],a=e.history_count??i.length,o=La(i).slice(0,20);return l`
@@ -4542,13 +4549,13 @@ ${h?`<div class="sub">${h}</div>`:""}
</div>
`}
</div>
`}render(){if(!this._open)return p;let e=this._lang,t=this._task,i=ae(this.hass?.user,this._access),a=!!t&&(!!t.archived||t.enabled===!1||t.status==="paused");return pt(()=>this.close(),l`
`}render(){if(!this._open)return p;let e=this._lang,t=this._task,i=ae(this.hass?.user,this._access),a=!!t&&(!!t.archived||t.enabled===!1||t.status==="paused");return ut(()=>this.close(),l`
${t?l`
<div class="header">
<div class="title">
<span class="status-dot" style="background: ${Oi(t)}"></span>
<span class="status-dot" style="background: ${rt(t)}"></span>
<span class="task-name">${t.name}</span>
${Ha(t,e)}
${Ln(t,e)}
</div>
<div class="object">
<button class="link-inline" @click=${()=>{this._entryId&&Promise.resolve().then(()=>(le(),me)).then(({openObjectQuickActions:o})=>{o(this._entryId),this.close()})}}>${this._objectName}</button>
@@ -4559,7 +4566,7 @@ ${h?`<div class="sub">${h}</div>`:""}
${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?l`<span><strong>${n("interval",e)}:</strong> ${nn(t,e)}</span>`:p}
${ke(t)?l`<span><strong>${n("phase_current",e)}:</strong> ${ke(t)}</span>`:p}
</div>
${t.notes?l`<div class="notes-body">${Ni(t.notes)}</div>`:p}
${t.notes?l`<div class="notes-body">${Oi(t.notes)}</div>`:p}
</div>
${this._error?l`<div class="error">${this._error}</div>`:p}
@@ -4686,7 +4693,7 @@ ${h?`<div class="sub">${h}</div>`:""}
</div>
`}
`:this._error?l`<div class="error">${this._error}</div>`:l`<div class="loading">${n("loading",e)}</div>`}
`)}updated(e){e.has("_open")&&this._open&&ut(this.shadowRoot)}};N.styles=[ci,dt,$`
`)}updated(e){e.has("_open")&&this._open&&ht(this.shadowRoot)}};N.styles=[ci,pt,$`
:host { display: contents; --ms-modal-max-width: 460px; }
.header { display: flex; flex-direction: column; gap: 6px; }
.title { display: flex; align-items: center; gap: 10px; }
@@ -4844,7 +4851,7 @@ ${h?`<div class="sub">${h}</div>`:""}
.weibull-section, .seasonal-card-compact { max-width: 100%; }
.weibull-chart svg { max-width: 100%; height: auto; }
.details-toggle { gap: 12px; flex-wrap: wrap; }
`],c([f({attribute:!1})],N.prototype,"hass",2),c([u()],N.prototype,"_open",2),c([u()],N.prototype,"_entryId",2),c([u()],N.prototype,"_taskId",2),c([u()],N.prototype,"_task",2),c([u()],N.prototype,"_objectName",2),c([u()],N.prototype,"_taskRef",2),c([u()],N.prototype,"_busy",2),c([u()],N.prototype,"_error",2),c([u()],N.prototype,"_showSkip",2),c([u()],N.prototype,"_showReset",2),c([u()],N.prototype,"_showPostpone",2),c([u()],N.prototype,"_showDetails",2),c([u()],N.prototype,"_showAdaptive",2),c([u()],N.prototype,"_skipReason",2),c([u()],N.prototype,"_resetDate",2),c([u()],N.prototype,"_postponeDate",2),c([u()],N.prototype,"_features",2),c([u()],N.prototype,"_toast",2),c([u()],N.prototype,"_access",2),c([u()],N.prototype,"_partsCostMode",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",N)});var ie,Qa=y(()=>{"use strict";R();di();Fs();j();C();Se();Ws();st();et();Ai();Ti();ie=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error="";this._access=he}get _lang(){return P(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await Promise.all([this._load(),B(this.hass).then(t=>{this._access=t.access})])}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(!this._entryId)return;let e=await D(this,{type:"maintenance_supporter/object",entry_id:this._entryId},{onError:t=>{this._error=t}});e!==void 0&&(this._data=e)}_runWs(e){return this._error="",D(this,e,{busy:t=>{this._busy=t},onError:t=>{this._error=t}})}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(le(),me)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(le(),me)).then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data||!await Me(this.hass,{title:n("delete",this._lang),message:n("delete_object_confirm",this._lang),confirmText:n("delete",this._lang),danger:!0}))return;let t=this._entryId;await this._runWs({type:"maintenance_supporter/object/delete",entry_id:t})!==void 0&&(this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:t},bubbles:!0,composed:!0})),this.close())}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e&&!await Me(this.hass,{title:n("archive_object",this._lang),message:n("confirm_archive_object",this._lang),confirmText:n("archive_object",this._lang)}))return;let t=this._entryId;await this._runWs({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:t})!==void 0&&(this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:t},bubbles:!0,composed:!0})),this.close())}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(le(),me)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return p;let e=this._lang,t=this._data,i=t?.object,a=t?.tasks||[],o=ae(this.hass?.user,this._access);return pt(()=>this.close(),l`
`],c([f({attribute:!1})],N.prototype,"hass",2),c([u()],N.prototype,"_open",2),c([u()],N.prototype,"_entryId",2),c([u()],N.prototype,"_taskId",2),c([u()],N.prototype,"_task",2),c([u()],N.prototype,"_objectName",2),c([u()],N.prototype,"_taskRef",2),c([u()],N.prototype,"_busy",2),c([u()],N.prototype,"_error",2),c([u()],N.prototype,"_showSkip",2),c([u()],N.prototype,"_showReset",2),c([u()],N.prototype,"_showPostpone",2),c([u()],N.prototype,"_showDetails",2),c([u()],N.prototype,"_showAdaptive",2),c([u()],N.prototype,"_skipReason",2),c([u()],N.prototype,"_resetDate",2),c([u()],N.prototype,"_postponeDate",2),c([u()],N.prototype,"_features",2),c([u()],N.prototype,"_toast",2),c([u()],N.prototype,"_access",2),c([u()],N.prototype,"_partsCostMode",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",N)});var ie,Ya=y(()=>{"use strict";R();di();Bs();j();C();Se();vi();st();et();Ci();Ai();ie=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error="";this._access=he}get _lang(){return P(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await Promise.all([this._load(),B(this.hass).then(t=>{this._access=t.access})])}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(!this._entryId)return;let e=await D(this,{type:"maintenance_supporter/object",entry_id:this._entryId},{onError:t=>{this._error=t}});e!==void 0&&(this._data=e)}_runWs(e){return this._error="",D(this,e,{busy:t=>{this._busy=t},onError:t=>{this._error=t}})}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(le(),me)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(le(),me)).then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data||!await Me(this.hass,{title:n("delete",this._lang),message:n("delete_object_confirm",this._lang),confirmText:n("delete",this._lang),danger:!0}))return;let t=this._entryId;await this._runWs({type:"maintenance_supporter/object/delete",entry_id:t})!==void 0&&(this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:t},bubbles:!0,composed:!0})),this.close())}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e&&!await Me(this.hass,{title:n("archive_object",this._lang),message:n("confirm_archive_object",this._lang),confirmText:n("archive_object",this._lang)}))return;let t=this._entryId;await this._runWs({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:t})!==void 0&&(this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:t},bubbles:!0,composed:!0})),this.close())}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(le(),me)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return p;let e=this._lang,t=this._data,i=t?.object,a=t?.tasks||[],o=ae(this.hass?.user,this._access);return ut(()=>this.close(),l`
${t&&i?l`
<div class="header">
<div class="title">${i.name}</div>
@@ -4862,9 +4869,9 @@ ${h?`<div class="sub">${h}</div>`:""}
<div class="task-list">
${a.map(d=>l`
<div class="task-row" @click=${()=>this._onTaskClick(d.id)}>
<span class="status-dot" style="background: ${Oi(d)}"></span>
<span class="status-dot" style="background: ${rt(d)}"></span>
<span class="task-name">${d.name}</span>
<span class="task-status ${zt(d)}">${Bs(zt(d),e)}</span>
<span class="task-status ${Ht(d)}">${$s(Ht(d),e)}</span>
</div>
`)}
</div>
@@ -4874,7 +4881,7 @@ ${h?`<div class="sub">${h}</div>`:""}
${i.notes?l`
<div class="notes-section">
<strong>${n("object_notes_label",e)}</strong>
<div class="notes-body">${Ni(i.notes)}</div>
<div class="notes-body">${Oi(i.notes)}</div>
</div>
`:p}
@@ -4899,7 +4906,7 @@ ${h?`<div class="sub">${h}</div>`:""}
</div>
`:p}
`:l`<div class="loading">${n("loading",e)}</div>`}
`)}updated(e){e.has("_open")&&this._open&&ut(this.shadowRoot)}_renderMetaRow(e){let t=this._lang,i=[];return e.area_id&&i.push([n("area",t),e.area_id]),e.manufacturer&&i.push([n("manufacturer",t),e.manufacturer]),e.model&&i.push([n("model",t),e.model]),e.serial_number&&i.push([n("serial_number_label",t),e.serial_number]),e.installation_date&&i.push([n("installed",t),e.installation_date]),e.warranty_expiry&&i.push([n("warranty",t),e.warranty_expiry]),e.documentation_url&&i.push([n("documentation_url_label",t),e.documentation_url,Ze(e.documentation_url)]),i.length===0?p:l`
`)}updated(e){e.has("_open")&&this._open&&ht(this.shadowRoot)}_renderMetaRow(e){let t=this._lang,i=[];return e.area_id&&i.push([n("area",t),e.area_id]),e.manufacturer&&i.push([n("manufacturer",t),e.manufacturer]),e.model&&i.push([n("model",t),e.model]),e.serial_number&&i.push([n("serial_number_label",t),e.serial_number]),e.installation_date&&i.push([n("installed",t),e.installation_date]),e.warranty_expiry&&i.push([n("warranty",t),e.warranty_expiry]),e.documentation_url&&i.push([n("documentation_url_label",t),e.documentation_url,Ze(e.documentation_url)]),i.length===0?p:l`
<div class="meta">
${i.map(([a,o,d])=>l`
<div class="meta-item">
@@ -4908,7 +4915,7 @@ ${h?`<div class="sub">${h}</div>`:""}
</div>
`)}
</div>
`}};ie.styles=[dt,$`
`}};ie.styles=[pt,$`
:host { display: contents; }
.header { display: flex; flex-direction: column; gap: 6px; }
.title { font-size: 20px; font-weight: 600; }
@@ -4953,7 +4960,7 @@ ${h?`<div class="sub">${h}</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; }
`],c([f({attribute:!1})],ie.prototype,"hass",2),c([u()],ie.prototype,"_open",2),c([u()],ie.prototype,"_entryId",2),c([u()],ie.prototype,"_data",2),c([u()],ie.prototype,"_busy",2),c([u()],ie.prototype,"_error",2),c([u()],ie.prototype,"_access",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",ie)});var me={};lo(me,{__resetSettingsCacheForTests:()=>dc,getRowActionStyle:()=>cc,openCompleteDialog:()=>_c,openCreateObjectDialog:()=>Vs,openCreateTaskDialog:()=>Gs,openEditObjectDialog:()=>pc,openEditTaskDialog:()=>uc,openHistoryEditDialog:()=>hc,openObjectQuickActions:()=>gc,openQrDialog:()=>mc,openTaskQuickActions:()=>Ks});function Ft(){return document.querySelector("home-assistant")?.hass}function lc(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function ge(r){let s=lc(),e=s.querySelector(r)??document.body.querySelector(r);return e?e.parentNode!==s&&s.appendChild(e):(e=document.createElement(r),s.appendChild(e)),e}function fe(r){let s=Ft();if(!s)return!1;r.hass=s;let e=P(s);return Tt(e)||ue(e).then(()=>{r.requestUpdate?.()}),ls(s.locale,s.config?.country,s.config?.time_zone),!0}function cc(r){return B(r).then(s=>s.rowActionStyle)}function dc(){Pn()}function Vs(){let r=ge(Za);return fe(r)?(r.openCreate(),Xa(r),!0):!1}async function Xa(r){let s=Ft();s&&(r.placesEnabled=(await B(s)).features.places)}function pc(r,s){let e=ge(Za);return fe(e)?(e.openEdit(r,s),Xa(e),!0):!1}function Gs(r="",s){let e=ge(Ja);if(!fe(e))return!1;let t=Ft();return t?((async()=>{let i=await B(t),a=e;eo(a,i),a.openCreate(r,s)})(),!0):!1}function eo(r,s){r.checklistsEnabled=s.features.checklists,r.scheduleTimeEnabled=s.features.schedule_time,r.completionActionsEnabled=s.features.completion_actions,r.adaptiveFeature=s.features.adaptive,r.seasonalFeature=s.features.seasonal,r.environmentalFeature=s.features.environmental,r.defaultWarningDays=s.defaultWarningDays}function uc(r,s){let e=ge(Ja);if(!fe(e))return!1;let t=Ft();return t?((async()=>{try{let[i,a]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:r}),B(t)]),o=(i.tasks||[]).find(h=>h.id===s);if(!o){console.warn(`openEditTaskDialog: task ${s} not found in entry ${r}`);return}let d=e;eo(d,a),await d.openEdit(r,o)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function hc(r){let s=ge(sc);return fe(s)?(s.openEdit(r),!0):!1}function _c(r){let s=ge(rc);return fe(s)?(gi(s,r,P(Ft())),!0):!1}function mc(r){let s=ge(nc);return fe(s)?(s.openForTask(r.entry_id,r.task_id,r.object_name,r.task_name),!0):!1}function Ks(r,s){let e=ge(ac);return fe(e)?(e.openFor(r,s),!0):!1}function gc(r){let s=ge(oc);return fe(s)?(s.openFor(r),!0):!1}var Za,Ja,sc,rc,nc,ac,oc,le=y(()=>{"use strict";Yn();la();Rs();ua();ha();Ya();Qa();C();fi();st();Za="maintenance-object-dialog",Ja="maintenance-task-dialog",sc="maintenance-history-edit-dialog",rc="maintenance-complete-dialog",nc="maintenance-qr-dialog",ac="maintenance-task-quick-actions-dialog",oc="maintenance-object-quick-actions-dialog"});R();var xo=["assignee_pool","required_completion_fields","checklist","labels","mirror_todo_entities","next_event_titles","history","readings"],wo=["checklist_progress"],ko=["tasks","parts"],$o=["manual_docs","battery_fleet_excluded"];function Gi(r,s,e=[]){for(let t of s)r[t]===void 0&&(r[t]=[]);for(let t of e)r[t]===void 0&&(r[t]={})}function Eo(r){let s=r;Gi(s,ko),s.object&&typeof s.object=="object"&&Gi(s.object,$o);for(let e of s.tasks)Gi(e,xo,wo);return r}function wt(r){for(let s of r)Eo(s);return r}function So(r,s){if(s.objects)return s.objects;let e=s.delta||[],t=s.removed||[];if(!e.length&&!t.length)return null;let i=new Map(r.map(a=>[a.entry_id,a]));for(let a of e)i.set(a.entry_id,a);for(let a of t)i.delete(a);return[...i.values()]}function wr(r,s){return s.objects&&wt(s.objects),s.delta&&wt(s.delta),So(r,s)}function To(r){return r.responsible_user_id?[r.responsible_user_id]:[...new Set((r.assignee_pool||[]).filter(s=>typeof s=="string"&&s))]}function kr(r,s){return!!s&&To(r).includes(s)}j();C();us();function cn(r){return(r.tags||[]).includes("photo")}di();function pn(){return window.customCards??[]}function Je(r){let s=window;s.customCards=s.customCards||[],s.customCards.some(e=>e.type===r.type)||s.customCards.push(r)}function un(r,s,e=t=>import(t)){let t=window,i;try{let m=new URL(s);i=m.origin+m.pathname}catch{return}let a=`__msCardHeal:${r[0]}:${i}`;if(t[a])return;t[a]=!0;let o=0,d=0,h=!1,_=()=>{if(o+=1,r.some(b=>!customElements.get(b))&&d<3&&!h){d+=1,h=!0;try{let b=new URL(s);b.searchParams.set("heal",`${Date.now()}`),e(b.href).catch(()=>{}).finally(()=>{h=!1})}catch{return}}o<20&&window.setTimeout(_,o<8?500:2e3)};window.setTimeout(_,250)}At();var Vo={"maintenance-supporter-card":[null,"picker_desc_card"],"maintenance-supporter-calendar-card":["picker_name_calendar","picker_desc_calendar"],"maintenance-supporter-panel-card":["pic Line truncated
`],c([f({attribute:!1})],ie.prototype,"hass",2),c([u()],ie.prototype,"_open",2),c([u()],ie.prototype,"_entryId",2),c([u()],ie.prototype,"_data",2),c([u()],ie.prototype,"_busy",2),c([u()],ie.prototype,"_error",2),c([u()],ie.prototype,"_access",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",ie)});var me={};oo(me,{__resetSettingsCacheForTests:()=>pc,getRowActionStyle:()=>dc,openCompleteDialog:()=>mc,openCreateObjectDialog:()=>Vs,openCreateTaskDialog:()=>Gs,openEditObjectDialog:()=>uc,openEditTaskDialog:()=>hc,openHistoryEditDialog:()=>_c,openObjectQuickActions:()=>fc,openQrDialog:()=>gc,openTaskQuickActions:()=>Ks});function Ft(){return document.querySelector("home-assistant")?.hass}function cc(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function ge(r){let s=cc(),e=s.querySelector(r)??document.body.querySelector(r);return e?e.parentNode!==s&&s.appendChild(e):(e=document.createElement(r),s.appendChild(e)),e}function fe(r){let s=Ft();if(!s)return!1;r.hass=s;let e=P(s);return Tt(e)||ue(e).then(()=>{r.requestUpdate?.()}),cs(s.locale,s.config?.country,s.config?.time_zone),!0}function dc(r){return B(r).then(s=>s.rowActionStyle)}function pc(){Pn()}function Vs(){let r=ge(Qa);return fe(r)?(r.openCreate(),Ja(r),!0):!1}async function Ja(r){let s=Ft();s&&(r.placesEnabled=(await B(s)).features.places)}function uc(r,s){let e=ge(Qa);return fe(e)?(e.openEdit(r,s),Ja(e),!0):!1}function Gs(r="",s){let e=ge(Za);if(!fe(e))return!1;let t=Ft();return t?((async()=>{let i=await B(t),a=e;Xa(a,i),a.openCreate(r,s)})(),!0):!1}function Xa(r,s){r.checklistsEnabled=s.features.checklists,r.scheduleTimeEnabled=s.features.schedule_time,r.completionActionsEnabled=s.features.completion_actions,r.adaptiveFeature=s.features.adaptive,r.seasonalFeature=s.features.seasonal,r.environmentalFeature=s.features.environmental,r.defaultWarningDays=s.defaultWarningDays}function hc(r,s){let e=ge(Za);if(!fe(e))return!1;let t=Ft();return t?((async()=>{try{let[i,a]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:r}),B(t)]),o=(i.tasks||[]).find(h=>h.id===s);if(!o){console.warn(`openEditTaskDialog: task ${s} not found in entry ${r}`);return}let d=e;Xa(d,a),await d.openEdit(r,o)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function _c(r){let s=ge(rc);return fe(s)?(s.openEdit(r),!0):!1}function mc(r){let s=ge(nc);return fe(s)?(gi(s,r,P(Ft())),!0):!1}function gc(r){let s=ge(ac);return fe(s)?(s.openForTask(r.entry_id,r.task_id,r.object_name,r.task_name),!0):!1}function Ks(r,s){let e=ge(oc);return fe(e)?(e.openFor(r,s),!0):!1}function fc(r){let s=ge(lc);return fe(s)?(s.openFor(r),!0):!1}var Qa,Za,rc,nc,ac,oc,lc,le=y(()=>{"use strict";Qn();la();Ps();ua();ha();Ka();Ya();C();fi();st();Qa="maintenance-object-dialog",Za="maintenance-task-dialog",rc="maintenance-history-edit-dialog",nc="maintenance-complete-dialog",ac="maintenance-qr-dialog",oc="maintenance-task-quick-actions-dialog",lc="maintenance-object-quick-actions-dialog"});R();var yo=["assignee_pool","required_completion_fields","checklist","labels","mirror_todo_entities","next_event_titles","history","readings"],xo=["checklist_progress"],wo=["tasks","parts"],ko=["manual_docs","battery_fleet_excluded"];function Gi(r,s,e=[]){for(let t of s)r[t]===void 0&&(r[t]=[]);for(let t of e)r[t]===void 0&&(r[t]={})}function $o(r){let s=r;Gi(s,wo),s.object&&typeof s.object=="object"&&Gi(s.object,ko);for(let e of s.tasks)Gi(e,yo,xo);return r}function kt(r){for(let s of r)$o(s);return r}function Eo(r,s){if(s.objects)return s.objects;let e=s.delta||[],t=s.removed||[];if(!e.length&&!t.length)return null;let i=new Map(r.map(a=>[a.entry_id,a]));for(let a of e)i.set(a.entry_id,a);for(let a of t)i.delete(a);return[...i.values()]}function wr(r,s){return s.objects&&kt(s.objects),s.delta&&kt(s.delta),Eo(r,s)}function So(r){return r.responsible_user_id?[r.responsible_user_id]:[...new Set((r.assignee_pool||[]).filter(s=>typeof s=="string"&&s))]}function kr(r,s){return!!s&&So(r).includes(s)}j();C();hs();function cn(r){return(r.tags||[]).includes("photo")}di();function pn(){return window.customCards??[]}function Je(r){let s=window;s.customCards=s.customCards||[],s.customCards.some(e=>e.type===r.type)||s.customCards.push(r)}function un(r,s,e=t=>import(t)){let t=window,i;try{let m=new URL(s);i=m.origin+m.pathname}catch{return}let a=`__msCardHeal:${r[0]}:${i}`;if(t[a])return;t[a]=!0;let o=0,d=0,h=!1,_=()=>{if(o+=1,r.some(b=>!customElements.get(b))&&d<3&&!h){d+=1,h=!0;try{let b=new URL(s);b.searchParams.set("heal",`${Date.now()}`),e(b.href).catch(()=>{}).finally(()=>{h=!1})}catch{return}}o<20&&window.setTimeout(_,o<8?500:2e3)};window.setTimeout(_,250)}At();var Wo={"maintenance-supporter-card":[null,"picker_desc_card"],"maintenance-supporter-calendar-card":["picker_name_calendar","picker_desc_calendar"],"maintenance-supporter-panel-card":["pic Line truncated
<div class="editor">
<ha-textfield
label="${n("card_title",e)}"
@@ -5212,7 +5219,7 @@ ${h?`<div class="sub">${h}</div>`:""}
font-size: 14px;
max-width: 320px;
}
`,c([f({attribute:!1})],oe.prototype,"hass",2),c([u()],oe.prototype,"_config",2),c([u()],oe.prototype,"_objects",2),c([u()],oe.prototype,"_loadingObjects",2),c([u()],oe.prototype,"_loadError",2),c([u()],oe.prototype,"_views",2);customElements.get("maintenance-supporter-card-editor")||customElements.define("maintenance-supporter-card-editor",oe);Rs();C();async function xl(r,s,e,t){try{let i=await r.connection.sendMessagePromise({type:"maintenance_supporter/task/undo",entry_id:s,task_id:e});return{ok:!0,message:n(i?.action_ran?"undo_done_action_ran":"undo_done",t)}}catch(i){let a=i?.code;return a==="changed_since"?{ok:!1,message:n("undo_changed",t)}:a==="nothing_to_undo"?{ok:!1,message:n("undo_nothing",t)}:{ok:!1,message:n("action_error",t)}}}function Kn(r,s,e,t,i){let a=(o,d)=>r.dispatchEvent(new CustomEvent("hass-notification",{detail:d?{message:o,action:d,duration:1e4}:{message:o},bubbles:!0,composed:!0}));a(n("task_completed_named",t).replace("{task}",e.taskName),{text:n("undo",t),action:()=>{xl(s,e.entryId,e.taskId,t).then(o=>{a(o.message),o.ok&&i()})}})}R();j();R();j();C();As();Se();et();st();ee();$i();var z=class z extends E{constructor(){super(...arguments);this.flat=!1;this._ov=null;this._loading=!1;this._marking=!1;this._error="";this._history=null;this._rosterSort=z._storedSort();this._typeFilter=null;this._recorded=[];this._access=he;this._historyRequested=!1;this._localeReady=!1;this._markAll=async()=>{await this._mark(void 0)};this._repair=async()=>{await this._act({type:"maintenance_supporter/battery_fleet/setup",language:this._lang})};this._loadHistory=async e=>{let t=e.target.open;if(Dt(Ae.batteryRosterOpen,t?"1":"0"),!(!t||this._historyRequested)){this._historyRequested=!0;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/battery_fleet/overview_history"});this._history=i.series}catch{this._history=null}}}}get _lang(){return P(this.hass)}get _canWrite(){return ae(this.hass?.user,this._access)}connectedCallback(){super.connectedCallback(),this.hass&&this._load()}updated(e){si(this,e),e.has("hass")&&this.hass&&!this._localeReady&&(this._localeReady=!0,ue(this._lang).then(()=>this.requestUpdate()),B(this.hass).then(t=>{this._access=t.access}),this._ov===null&&!this._loading&&this._load())}async _load(){this._error="";let e=await D(this,{type:"maintenance_supporter/battery_fleet/overview"},{busy:t=>{this._loading=t},onError:t=>{this._error=t}});e!==void 0&&(this._ov=e)}async _act(e,t){this._marking||(this._error="",await D(this,e,{busy:i=>{this._marking=i},reload:async()=>{t?.(),await this._load()},onError:i=>{this._error=i}}))}async _mark(e){await this._act({type:"maintenance_supporter/battery_fleet/mark_replaced",...e?{entity_ids:e}:{}})}async _setExcluded(e,t){await this._act({type:"maintenance_supporter/battery_fleet/set_excluded",entity_id:e,excluded:t})}async _addBattery(e){let t=e.detail?.value;t&&await this._act({type:"maintenance_supporter/battery_fleet/set_included",entity_id:t,included:!0})}async _setTrackSelf(e){await this._setFleetOption("set_track_self_charging",e.target.checked)}async _setDueWithoutSensor(e){await this._setFleetOption("set_due_without_sensor",e.target.checked)}async _setFleetOption(e,t){await this._act({type:`maintenance_supporter/battery_fleet/${e}`,enabled:t})}_rosterOpen(){return jt(Ae.batteryRosterOpen)!=="0"}_predictedTitle(e,t){if(e.forecast_overdue)return n("battery_fleet_forecast_overdue",t);let i=this._predictedDate(e.days_until??0);if(e.predicted_source==="trend")return n("battery_fleet_predicted_trend",t).replace("{date}",i).replace("{confidence}",n("cal_confidence_"+(e.prediction_confidence||"medium"),t));if(e.lifetime_months!=null&&e.lifetime_source){let a=n("lifetime_source_"+e.lifetime_source,t).replace("{n}",String(e.lifetime_samples??0));return n("battery_fleet_predicted_typical",t).replace("{date}",i).replace("{months}",String(e.lifetime_months)).replace("{type}",e.battery_type).replace("{source}",a)}return n("battery_fleet_predicted_on",t).replace("{date}",i)}_sparkline(e){let t=this._history?.[e.entity_id];if(!t||t.points.length<2)return p;let i=110,a=24,o=2,d=t.points[0][0],h=t.points[t.points.length-1][0],_=Date.now()/1e3,m=e.status!=="low"&&e.predicted_source==="trend"&&e.days_until!=null?_+e.days_until*86400:null,b=Math.max(h,m??h),k=O=>b===d?o:o+(O-d)/(b-d)*(i-2*o),w=O=>o+(1-Math.min(100,Math.max(0,O))/100)*(a-2*o),v=t.points.map(([O,G])=>`${A(k(O))},${A(w(G))}`).join(" "),x=t.points[t.points.length-1][1],T=A(w(t.threshold));return l`<svg
`,c([f({attribute:!1})],oe.prototype,"hass",2),c([u()],oe.prototype,"_config",2),c([u()],oe.prototype,"_objects",2),c([u()],oe.prototype,"_loadingObjects",2),c([u()],oe.prototype,"_loadError",2),c([u()],oe.prototype,"_views",2);customElements.get("maintenance-supporter-card-editor")||customElements.define("maintenance-supporter-card-editor",oe);Ps();C();async function $l(r,s,e,t){try{let i=await r.connection.sendMessagePromise({type:"maintenance_supporter/task/undo",entry_id:s,task_id:e});return{ok:!0,message:n(i?.action_ran?"undo_done_action_ran":"undo_done",t)}}catch(i){let a=i?.code;return a==="changed_since"?{ok:!1,message:n("undo_changed",t)}:a==="nothing_to_undo"?{ok:!1,message:n("undo_nothing",t)}:{ok:!1,message:n("action_error",t)}}}function Yn(r,s,e,t,i){let a=(o,d)=>r.dispatchEvent(new CustomEvent("hass-notification",{detail:d?{message:o,action:d,duration:1e4}:{message:o},bubbles:!0,composed:!0}));a(n("task_completed_named",t).replace("{task}",e.taskName),{text:n("undo",t),action:()=>{$l(s,e.entryId,e.taskId,t).then(o=>{a(o.message),o.ok&&i()})}})}R();j();R();j();C();Rs();Se();et();st();ee();Ei();var z=class z extends E{constructor(){super(...arguments);this.flat=!1;this._ov=null;this._loading=!1;this._marking=!1;this._error="";this._history=null;this._rosterSort=z._storedSort();this._typeFilter=null;this._recorded=[];this._access=he;this._historyRequested=!1;this._localeReady=!1;this._markAll=async()=>{await this._mark(void 0)};this._repair=async()=>{await this._act({type:"maintenance_supporter/battery_fleet/setup",language:this._lang})};this._loadHistory=async e=>{let t=e.target.open;if(qt(Ae.batteryRosterOpen,t?"1":"0"),!(!t||this._historyRequested)){this._historyRequested=!0;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/battery_fleet/overview_history"});this._history=i.series}catch{this._history=null}}}}get _lang(){return P(this.hass)}get _canWrite(){return ae(this.hass?.user,this._access)}connectedCallback(){super.connectedCallback(),this.hass&&this._load()}updated(e){si(this,e),e.has("hass")&&this.hass&&!this._localeReady&&(this._localeReady=!0,ue(this._lang).then(()=>this.requestUpdate()),B(this.hass).then(t=>{this._access=t.access}),this._ov===null&&!this._loading&&this._load())}async _load(){this._error="";let e=await D(this,{type:"maintenance_supporter/battery_fleet/overview"},{busy:t=>{this._loading=t},onError:t=>{this._error=t}});e!==void 0&&(this._ov=e)}async _act(e,t){this._marking||(this._error="",await D(this,e,{busy:i=>{this._marking=i},reload:async()=>{t?.(),await this._load()},onError:i=>{this._error=i}}))}async _mark(e){await this._act({type:"maintenance_supporter/battery_fleet/mark_replaced",...e?{entity_ids:e}:{}})}async _setExcluded(e,t){await this._act({type:"maintenance_supporter/battery_fleet/set_excluded",entity_id:e,excluded:t})}async _addBattery(e){let t=e.detail?.value;t&&await this._act({type:"maintenance_supporter/battery_fleet/set_included",entity_id:t,included:!0})}async _setTrackSelf(e){await this._setFleetOption("set_track_self_charging",e.target.checked)}async _setDueWithoutSensor(e){await this._setFleetOption("set_due_without_sensor",e.target.checked)}async _setFleetOption(e,t){await this._act({type:`maintenance_supporter/battery_fleet/${e}`,enabled:t})}_rosterOpen(){return Dt(Ae.batteryRosterOpen)!=="0"}_predictedTitle(e,t){if(e.forecast_overdue)return n("battery_fleet_forecast_overdue",t);let i=this._predictedDate(this._forecastDays(e)??0);if(e.predicted_source==="trend")return n("battery_fleet_predicted_trend",t).replace("{date}",i).replace("{confidence}",n("cal_confidence_"+(e.prediction_confidence||"medium"),t));if(e.lifetime_months!=null&&e.lifetime_source){let a=n("lifetime_source_"+e.lifetime_source,t).replace("{n}",String(e.lifetime_samples??0));return n("battery_fleet_predicted_typical",t).replace("{date}",i).replace("{months}",String(e.lifetime_months)).replace("{type}",e.battery_type).replace("{source}",a)}return n("battery_fleet_predicted_on",t).replace("{date}",i)}_sparkline(e){let t=this._history?.[e.entity_id];if(!t||t.points.length<2)return p;let i=110,a=24,o=2,d=t.points[0][0],h=t.points[t.points.length-1][0],_=Date.now()/1e3,m=e.status!=="low"&&e.predicted_source==="trend"&&e.days_until!=null?_+e.days_until*86400:null,b=Math.max(h,m??h),k=O=>b===d?o:o+(O-d)/(b-d)*(i-2*o),w=O=>o+(1-Math.min(100,Math.max(0,O))/100)*(a-2*o),v=t.points.map(([O,G])=>`${A(k(O))},${A(w(G))}`).join(" "),x=t.points[t.points.length-1][1],T=A(w(t.threshold));return l`<svg
class="bf-spark"
viewBox="0 0 ${i} ${a}"
role="img"
@@ -5228,14 +5235,14 @@ ${h?`<div class="sub">${h}</div>`:""}
x2=${A(k(m))}
y2=${T}
></line>`:p}
</svg>`}static _storedSort(){return jt(Ae.batteryRosterSort)==="name"?"name":"urgency"}_setSort(e){this._rosterSort=e,Dt(Ae.batteryRosterSort,e)}_sortedRoster(e){let t=this._typeFilter===null?e:e.filter(a=>a.battery_type===this._typeFilter);if(this._rosterSort==="name")return t;let i=a=>a.status==="low"?-1e3+(a.level??101)/101:a.days_until??1/0;return[...t].sort((a,o)=>i(a)-i(o)||a.device_name.localeCompare(o.device_name))}_predictedDate(e){return H(Qr(we(),e),this._lang)}_fmtDate(e){return Number.isFinite(e)?H(new Date(e).toISOString(),this._lang):"\u2014"}_shoppingLine(e){return Object.entries(e).map(([t,i])=>l`<button
</svg>`}static _storedSort(){return Dt(Ae.batteryRosterSort)==="name"?"name":"urgency"}_setSort(e){this._rosterSort=e,qt(Ae.batteryRosterSort,e)}_sortedRoster(e){let t=this._typeFilter===null?e:e.filter(a=>a.battery_type===this._typeFilter);if(this._rosterSort==="name")return t;let i=a=>a.status==="low"?-1e3+(a.level??101)/101:a.days_until??1/0;return[...t].sort((a,o)=>i(a)-i(o)||a.device_name.localeCompare(o.device_name))}_predictedDate(e){return H(Qr(we(),e),this._lang)}_forecastDays(e){return e.forecast_days!==void 0?e.forecast_days:e.days_until}_fmtDate(e){return Number.isFinite(e)?H(new Date(e).toISOString(),this._lang):"\u2014"}_shoppingLine(e){return Object.entries(e).map(([t,i])=>l`<button
class="bf-type-chip ${this._typeFilter===t?"bf-type-chip-active":""}"
title=${n("battery_fleet_filter_type",this._lang)}
@click=${()=>this._toggleTypeFilter(t)}
>
${i}× ${t}
</button>`)}_toggleTypeFilter(e){if(this._typeFilter=this._typeFilter===e?null:e,this._typeFilter!==null){let t=this.shadowRoot?.querySelector("details.bf-roster");t&&!t.open&&(t.open=!0)}}async _recordJump(e,t){await this._act({type:"maintenance_supporter/battery_fleet/record_replacement",entity_id:e,replaced_at:new Date(t.at*1e3).toISOString()},()=>{this._recorded=[...this._recorded,e]})}_levelBar(e){let t=e.level;if(t==null)return p;let i=e.low_threshold??20,a=t<=i?"bad":t<=i+20?"warn":"good";return l`<span class="bf-bar" aria-hidden="true"
><span class="bf-bar-fill bf-bar-${a}" style="width: ${Math.min(100,Math.max(0,t))}%"></span
</button>`)}_toggleTypeFilter(e){if(this._typeFilter=this._typeFilter===e?null:e,this._typeFilter!==null){let t=this.shadowRoot?.querySelector("details.bf-roster");t&&!t.open&&(t.open=!0)}}async _recordJump(e,t){await this._act({type:"maintenance_supporter/battery_fleet/record_replacement",entity_id:e,replaced_at:new Date(t.at*1e3).toISOString()},()=>{this._recorded=[...this._recorded,e]})}_levelTone(e,t){let i=t.low_threshold??20;return e<=i?"bad":e<=i+20?"warn":"good"}_levelBar(e){let t=e.level;return t==null?p:l`<span class="bf-bar" aria-hidden="true"
><span class="bf-bar-fill bf-bar-${this._levelTone(t,e)}" style="width: ${Math.min(100,Math.max(0,t))}%"></span
></span>`}_jumpButton(e,t){let i=this._history?.[e.entity_id]?.jump;return!i||this._recorded.includes(e.entity_id)?p:l`<button
class="bf-mark bf-jump"
title=${n("battery_fleet_record_replacement",t).replace("{date}",this._fmtDate(i.at*1e3))}
@@ -5243,7 +5250,7 @@ ${h?`<div class="sub">${h}</div>`:""}
@click=${()=>this._recordJump(e.entity_id,i)}
>
<ha-icon icon="mdi:calendar-sync"></ha-icon>
</button>`}_renderRow(e,t,i){let a=e.available===!1?l`<span class="bf-offline">${n("battery_fleet_offline",t)}</span>`:e.no_sensor?l`<span class="bf-offline bf-nosensor">${n("battery_fleet_no_sensor",t)}</span>`:p,o=`${e.quantity}\xD7 ${e.battery_type}`,d=l`<span class="bf-type" title=${o}>${o}</span>`,h=this._canWrite,_=h&&(i.mark==="always"||e.no_sensor||e.can_mark_replaced);return l`
</button>`}_renderRow(e,t,i){let a=e.available===!1?l`<span class="bf-offline">${n("battery_fleet_offline",t)}</span>`:e.no_sensor?l`<span class="bf-offline bf-nosensor">${n("battery_fleet_no_sensor",t)}</span>`:p,o=`${e.quantity}\xD7 ${e.battery_type}`,d=l`<span class="bf-type" title=${o}>${o}</span>`,h=this._canWrite,_=h&&(i.mark==="always"||e.no_sensor||e.can_mark_replaced),m=this._forecastDays(e);return l`
<div class="bf-row">
<span class="bf-dev">${e.device_name}</span>
${i.status?l`<span class="bf-status bf-${e.status}"
@@ -5254,7 +5261,7 @@ ${h?`<div class="sub">${h}</div>`:""}
></span>`:p}
${i.sparkline?this._sparkline(e):p}
${this._levelBar(e)}
${e.level!=null?l`<span class="bf-level">${e.level}%</span>`:p}
${e.level!=null?l`<span class="bf-level bf-level-${this._levelTone(e.level,e)}">${e.level}%</span>`:p}
${_?l`<button
class="bf-mark${i.mark==="replaced"?" bf-replaced":""}"
title=${e.rechargeable?n("battery_fleet_mark_recharged",t):n("battery_fleet_mark_one",t)}
@@ -5264,10 +5271,10 @@ ${h?`<div class="sub">${h}</div>`:""}
<ha-icon icon="mdi:battery-sync"></ha-icon>
</button>`:p}
${i.jump&&h?this._jumpButton(e,t):p}
${i.predicted&&e.days_until!=null?l`<span
${i.predicted&&m!=null?l`<span
class="bf-predicted ${e.predicted_source==="trend"?"bf-trend":""} ${e.forecast_overdue?"bf-overdue":""}"
title=${this._predictedTitle(e,t)}
>${e.forecast_overdue?l`<ha-icon icon="mdi:calendar-alert"></ha-icon>`:p}~${this._predictedDate(e.days_until)}</span
>${e.forecast_overdue?l`<ha-icon icon="mdi:calendar-alert"></ha-icon>`:p}~${this._predictedDate(m)}</span
>`:p}
${i.exclude&&h?l`<button
class="bf-mark bf-exclude"
@@ -5540,7 +5547,14 @@ ${h?`<div class="sub">${h}</div>`:""}
* has no status chip, no sparkline, no date). */
.bf-rows {
display: grid;
grid-template-columns: minmax(0, 1fr) repeat(9, max-content);
/* The right-hand columns (percentage, action, date, eye) have a
* minimum width, so they line up across the three lists ("Buy now",
* "Needed soon", the roster) although each list is a grid of its own
* and fills different columns - only the roster has the eye, and its
* dates used to end 32 px left of the soon list's. */
grid-template-columns:
minmax(0, 1fr) repeat(5, max-content)
minmax(40px, max-content) minmax(32px, max-content) minmax(92px, max-content) minmax(32px, max-content);
column-gap: 8px;
}
.bf-row {
@@ -5586,24 +5600,16 @@ ${h?`<div class="sub">${h}</div>`:""}
grid-column: 7;
justify-self: end;
}
/* Every row action, the Replaced one included, sits in column 8. The
* Replaced action used to take the empty percentage slot on sensorless
* rows (D#162, while nothing else filled column 8) and column 8 on rows
* with a percentage (since 2.79), so it jumped 40 px between
* neighbouring rows (prod report 2026-10-13). Rows with a percentage
* fill column 8 anyway, so one column for all costs no width. The
* narrow layout below gives Replaced a slot of its own. */
.bf-row .bf-mark {
grid-column: 8;
}
/* D#162: the sensorless row's Replaced action sits in the percentage
* slot (always empty for such a row) instead of the row-action column
* - a new max-content track there widens EVERY row via the subgrid
* and pushed the phone roster 34 px past its edge. */
.bf-row .bf-mark.bf-replaced {
grid-column: 7;
justify-self: end;
}
/* D#162 (maisun's iPhone): since 2.79 rows WITH a level offer Replaced
* too — level and button shared column 7 and overlapped. With a
* percentage present the button takes the row-action column instead. */
.bf-row .bf-level + .bf-mark.bf-replaced {
grid-column: 8;
justify-self: start;
}
.bf-predicted {
grid-column: 9;
justify-self: end;
@@ -5722,7 +5728,7 @@ ${h?`<div class="sub">${h}</div>`:""}
.bf-soon-rows .bf-row:has(.bf-level) .bf-dev {
grid-column: 1 / 9;
}
.bf-row .bf-level + .bf-mark.bf-replaced {
.bf-row .bf-mark.bf-replaced {
grid-row: 2;
grid-column: 7;
justify-self: end;
@@ -5809,10 +5815,19 @@ ${h?`<div class="sub">${h}</div>`:""}
border-color: var(--primary-color);
color: var(--primary-color);
}
/* The number takes the bar's colour. It was red on every row, from the
* days it only showed in the low list; the soon list and the roster
* show it too, and a full battery read as an alarm there (prod report
* 2026-10-13). A healthy level is plain text. */
.bf-level {
font-size: 12px;
}
.bf-level-bad {
color: var(--error-color, #f44336);
}
.bf-level-warn {
color: var(--warning-color, #ff9800);
}
.bf-mark {
background: transparent;
border: none;
@@ -5925,24 +5940,24 @@ ${h?`<div class="sub">${h}</div>`:""}
accent-color: var(--primary-color);
margin: 0;
}
`,c([f({attribute:!1})],z.prototype,"hass",2),c([f({type:Boolean})],z.prototype,"flat",2),c([u()],z.prototype,"_ov",2),c([u()],z.prototype,"_loading",2),c([u()],z.prototype,"_marking",2),c([u()],z.prototype,"_error",2),c([u()],z.prototype,"_history",2),c([u()],z.prototype,"_rosterSort",2),c([u()],z.prototype,"_typeFilter",2),c([u()],z.prototype,"_recorded",2),c([u()],z.prototype,"_access",2);var Is=z;customElements.get("maintenance-battery-fleet-section")||customElements.define("maintenance-battery-fleet-section",Is);var ct=class extends E{constructor(){super(...arguments);this._config={type:"custom:maintenance-battery-fleet-card"}}static getStubConfig(){return{type:"custom:maintenance-battery-fleet-card"}}setConfig(e){this._config=e}getCardSize(){return 6}render(){return this.hass?l`
`,c([f({attribute:!1})],z.prototype,"hass",2),c([f({type:Boolean})],z.prototype,"flat",2),c([u()],z.prototype,"_ov",2),c([u()],z.prototype,"_loading",2),c([u()],z.prototype,"_marking",2),c([u()],z.prototype,"_error",2),c([u()],z.prototype,"_history",2),c([u()],z.prototype,"_rosterSort",2),c([u()],z.prototype,"_typeFilter",2),c([u()],z.prototype,"_recorded",2),c([u()],z.prototype,"_access",2);var Ls=z;customElements.get("maintenance-battery-fleet-section")||customElements.define("maintenance-battery-fleet-section",Ls);var dt=class extends E{constructor(){super(...arguments);this._config={type:"custom:maintenance-battery-fleet-card"}}static getStubConfig(){return{type:"custom:maintenance-battery-fleet-card"}}setConfig(e){this._config=e}getCardSize(){return 6}render(){return this.hass?l`
<ha-card .header=${this._config.title||void 0}>
<div class="content">
<maintenance-battery-fleet-section flat .hass=${this.hass}></maintenance-battery-fleet-section>
</div>
</ha-card>
`:p}};ct.styles=$`
`:p}};dt.styles=$`
ha-card {
overflow: hidden;
}
.content {
padding: 12px 16px 14px;
}
`,c([f({attribute:!1})],ct.prototype,"hass",2),c([u()],ct.prototype,"_config",2);customElements.get("maintenance-battery-fleet-card")||customElements.define("maintenance-battery-fleet-card",ct);Je({type:"maintenance-battery-fleet-card",name:"Battery Fleet",description:"All tracked batteries: what is low now, what runs out soon, and what to buy.",preview:!1});le();R();j();var Ys=["today","dashboard","calendar","settings"];C();var ht="maintenance-supporter-panel-card",Qs="maintenance-supporter-panel",Js="maintenance-supporter",Zs=870,fc=320,vc=480;function bc(r){let e=r?.panels?.[Js]?.config?._panel_custom?.module_url;return typeof e=="string"&&e.startsWith("/")?e:null}function yc(r){if(r==null||r===""||r==="fill")return null;if(typeof r=="number")return r>0?`${Math.round(r)}px`:null;let s=String(r).trim();return/^\d+(\.\d+)?$/.test(s)?`${s}px`:s||null}var Xs=class extends HTMLElement{constructor(){super();this._config={type:`custom:${ht}`};this._panel=null;this._loading=null;this._observer=null;this._lastWidth=-1;this._preview=!1;this._onResize=()=>this._layout(!0);let e=this.attachShadow({mode:"open"}),t=document.createElement("style");t.textContent=`
`,c([f({attribute:!1})],dt.prototype,"hass",2),c([u()],dt.prototype,"_config",2);customElements.get("maintenance-battery-fleet-card")||customElements.define("maintenance-battery-fleet-card",dt);Je({type:"maintenance-battery-fleet-card",name:"Battery Fleet",description:"All tracked batteries: what is low now, what runs out soon, and what to buy.",preview:!1});le();R();j();var Ys=["today","dashboard","calendar","settings"];C();var _t="maintenance-supporter-panel-card",Qs="maintenance-supporter-panel",Js="maintenance-supporter",Zs=870,vc=320,bc=480;function yc(r){let e=r?.panels?.[Js]?.config?._panel_custom?.module_url;return typeof e=="string"&&e.startsWith("/")?e:null}function xc(r){if(r==null||r===""||r==="fill")return null;if(typeof r=="number")return r>0?`${Math.round(r)}px`:null;let s=String(r).trim();return/^\d+(\.\d+)?$/.test(s)?`${s}px`:s||null}var Xs=class extends HTMLElement{constructor(){super();this._config={type:`custom:${_t}`};this._panel=null;this._loading=null;this._observer=null;this._lastWidth=-1;this._preview=!1;this._onResize=()=>this._layout(!0);let e=this.attachShadow({mode:"open"}),t=document.createElement("style");t.textContent=`
:host { display: block; box-sizing: border-box; overflow: hidden; border-radius: var(--ha-card-border-radius, 12px); }
.status { padding: 16px; color: var(--secondary-text-color); font-size: 14px; }
${Qs} { display: block; height: 100%; }
`,e.appendChild(t),this._status=document.createElement("div"),this._status.className="status",this._status.hidden=!0,e.appendChild(this._status)}static getConfigElement(){return document.createElement("maintenance-supporter-panel-card-editor")}static getStubConfig(){return{type:`custom:${ht}`}}set preview(e){this._preview=!!e,this._layout(!0)}get preview(){return this._preview}_inEditorPreview(){if(this._preview)return!0;let e=this;for(let t=0;e&&t<40;t++){let i=e;if(i.tagName==="HUI-CARD-PREVIEW"||i.tagName==="HUI-DIALOG-EDIT-CARD")return!0;e=i.parentElement??i.getRootNode().host??null}return!1}setConfig(e){this._config={...e},this._panel&&(this._panel.presets=this._presets()),this._layout(!0)}getCardSize(){return 12}getGridOptions(){return{columns:"full",rows:"auto"}}set hass(e){this._hass=e,this._panel?this._panel.hass=e:this._mount()}get hass(){return this._hass}connectedCallback(){typeof ResizeObserver<"u"&&!this._observer&&(this._observer=new ResizeObserver(()=>this._layout(!1)),this._observer.observe(this)),window.addEventListener("resize",this._onResize),this._layout(!0),this._hass&&this._mount()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,window.removeEventListener("resize",this._onResize)}_presets(){let e={};return Ys.includes(this._config.tab??"")&&(e.tab=this._config.tab),typeof this._config.view=="string"&&this._config.view.trim()&&(e.view=this._config.view.trim()),e}_setStatus(e){this._status.textContent=e,this._status.hidden=!1}async _mount(){if(this._panel||this._loading||!this._hass||!this.isConnected)return;let e=P(this._hass);if(!customElements.get(Qs)){let i=bc(this._hass);if(!i){this._setStatus(n("panel_card_not_registered",e));return}this._loading=import(i).then(()=>{},()=>{throw this._setStatus(n("panel_card_load_failed",e)),new Error("panel bundle failed to load")});try{await this._loading}catch{return}finally{this._loading=null}if(this._panel||!this._hass||!this.isConnected)return}let t=document.createElement(Qs);t.embedded=!0,t.panel=this._hass.panels?.[Js]??{url_path:Js},t.presets=this._presets(),t.narrow=this._narrow(),t.hass=this._hass,this._status.hidden=!0,this.shadowRoot.appendChild(t),this._panel=t,this._layout(!0)}_narrow(){let e=this.getBoundingClientRect().width;return e>0?e<Zs:window.innerWidth<Zs}_layout(e){let t=this.getBoundingClientRect(),i=Math.round(t.width)!==this._lastWidth;if(!e&&!i)return;this._lastWidth=Math.round(t.width),this._panel&&t.width>0&&(this._panel.narrow=t.width<Zs);let a=yc(this._config.height);if(a){this.style.height=a;return}if(!this.isConnected)return;if(this._inEditorPreview()){this.style.height=`${vc}px`;return}let o=Math.max(0,this._unscrolledTop(t)),d=Math.max(fc,Math.floor(window.innerHeight-o));this.style.height=`${d}px`}_unscrolledTop(e){let t=e.top+window.scrollY,i=this.ownerDocument,a=this.parentElement??this.getRootNode().host??null;for(let o=0;a&&o<100;o++){let d=a;d!==i.documentElement&&d!==i.body&&typeof d.scrollTop=="number"&&d.scrollTop>0&&(t+=d.scrollTop),a=d.parentElement??d.getRootNode().host??null}return t}},Fe=class extends E{constructor(){super(...arguments);this._config={type:`custom:${ht}`};this._views=[];this._viewsLoaded=!1}setConfig(e){this._config={...e}}updated(e){super.updated(e),e.has("hass")&&this.hass&&!this._viewsLoaded&&(this._viewsLoaded=!0,this._loadViews())}async _loadViews(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"});this._views=e?.views||[]}catch{this._views=[]}}_set(e,t){let i={...this._config};t===""||t===void 0?delete i[e]:i[e]=t,this._config=i,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:i},bubbles:!0,composed:!0}))}render(){let e=P(this.hass),t=i=>n(i==="today"?"tab_today":i==="calendar"?"tab_calendar":i,e);return l`
`,e.appendChild(t),this._status=document.createElement("div"),this._status.className="status",this._status.hidden=!0,e.appendChild(this._status)}static getConfigElement(){return document.createElement("maintenance-supporter-panel-card-editor")}static getStubConfig(){return{type:`custom:${_t}`}}set preview(e){this._preview=!!e,this._layout(!0)}get preview(){return this._preview}_inEditorPreview(){if(this._preview)return!0;let e=this;for(let t=0;e&&t<40;t++){let i=e;if(i.tagName==="HUI-CARD-PREVIEW"||i.tagName==="HUI-DIALOG-EDIT-CARD")return!0;e=i.parentElement??i.getRootNode().host??null}return!1}setConfig(e){this._config={...e},this._panel&&(this._panel.presets=this._presets()),this._layout(!0)}getCardSize(){return 12}getGridOptions(){return{columns:"full",rows:"auto"}}set hass(e){this._hass=e,this._panel?this._panel.hass=e:this._mount()}get hass(){return this._hass}connectedCallback(){typeof ResizeObserver<"u"&&!this._observer&&(this._observer=new ResizeObserver(()=>this._layout(!1)),this._observer.observe(this)),window.addEventListener("resize",this._onResize),this._layout(!0),this._hass&&this._mount()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,window.removeEventListener("resize",this._onResize)}_presets(){let e={};return Ys.includes(this._config.tab??"")&&(e.tab=this._config.tab),typeof this._config.view=="string"&&this._config.view.trim()&&(e.view=this._config.view.trim()),e}_setStatus(e){this._status.textContent=e,this._status.hidden=!1}async _mount(){if(this._panel||this._loading||!this._hass||!this.isConnected)return;let e=P(this._hass);if(!customElements.get(Qs)){let i=yc(this._hass);if(!i){this._setStatus(n("panel_card_not_registered",e));return}this._loading=import(i).then(()=>{},()=>{throw this._setStatus(n("panel_card_load_failed",e)),new Error("panel bundle failed to load")});try{await this._loading}catch{return}finally{this._loading=null}if(this._panel||!this._hass||!this.isConnected)return}let t=document.createElement(Qs);t.embedded=!0,t.panel=this._hass.panels?.[Js]??{url_path:Js},t.presets=this._presets(),t.narrow=this._narrow(),t.hass=this._hass,this._status.hidden=!0,this.shadowRoot.appendChild(t),this._panel=t,this._layout(!0)}_narrow(){let e=this.getBoundingClientRect().width;return e>0?e<Zs:window.innerWidth<Zs}_layout(e){let t=this.getBoundingClientRect(),i=Math.round(t.width)!==this._lastWidth;if(!e&&!i)return;this._lastWidth=Math.round(t.width),this._panel&&t.width>0&&(this._panel.narrow=t.width<Zs);let a=xc(this._config.height);if(a){this.style.height=a;return}if(!this.isConnected)return;if(this._inEditorPreview()){this.style.height=`${bc}px`;return}let o=Math.max(0,this._unscrolledTop(t)),d=Math.max(vc,Math.floor(window.innerHeight-o));this.style.height=`${d}px`}_unscrolledTop(e){let t=e.top+window.scrollY,i=this.ownerDocument,a=this.parentElement??this.getRootNode().host??null;for(let o=0;a&&o<100;o++){let d=a;d!==i.documentElement&&d!==i.body&&typeof d.scrollTop=="number"&&d.scrollTop>0&&(t+=d.scrollTop),a=d.parentElement??d.getRootNode().host??null}return t}},Fe=class extends E{constructor(){super(...arguments);this._config={type:`custom:${_t}`};this._views=[];this._viewsLoaded=!1}setConfig(e){this._config={...e}}updated(e){super.updated(e),e.has("hass")&&this.hass&&!this._viewsLoaded&&(this._viewsLoaded=!0,this._loadViews())}async _loadViews(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"});this._views=e?.views||[]}catch{this._views=[]}}_set(e,t){let i={...this._config};t===""||t===void 0?delete i[e]:i[e]=t,this._config=i,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:i},bubbles:!0,composed:!0}))}render(){let e=P(this.hass),t=i=>n(i==="today"?"tab_today":i==="calendar"?"tab_calendar":i,e);return l`
<div class="editor">
<div class="field">
<div class="field-label">${n("panel_card_tab",e)}</div>
@@ -5973,8 +5988,8 @@ ${h?`<div class="sub">${h}</div>`:""}
.field-label { font-size: 13px; color: var(--secondary-text-color); font-weight: 500; }
.field-help { font-size: 12px; color: var(--secondary-text-color); }
select { padding: 8px; border-radius: 4px; border: 1px solid var(--divider-color); background: var(--card-background-color); color: var(--primary-text-color); font-size: 14px; max-width: 320px; }
`,c([f({attribute:!1})],Fe.prototype,"hass",2),c([u()],Fe.prototype,"_config",2),c([u()],Fe.prototype,"_views",2);customElements.get(ht)||customElements.define(ht,Xs);customElements.get("maintenance-supporter-panel-card-editor")||customElements.define("maintenance-supporter-panel-card-editor",Fe);Je({type:ht,name:"Maintenance Supporter \u2014 Panel",description:"The complete Maintenance Supporter panel as a card \u2014 for a panel view / dashboard subview without the sidebar entry.",preview:!1});pi();var to=2,F=class extends E{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._globalRowStyle="buttons_compact";this._settings=it;this._firstLoadDone=!1;this._objects=[];this._stats=null;this._unsub=null;this._viewFilters=null;this._userNames={};this._userPersons={};this._userService=null;this._userNamesLoaded=!1;this._taskDocs={};this._docsLoadedFor=new Set;this._dataLoaded=!1;this._lastConnection=null;this._onCompleted=async e=>{await this._loadData();let t=e.detail;t?.undo&&Kn(this,this.hass,t,this._lang,()=>{this._loadData()})}}get _lang(){return P(this.hass)}static getConfigElement(){return document.createElement("maintenance-supporter-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-card",show_header:!0,show_actions:!0,filter_status:[...Yi],max_items:10}}setConfig(e){let t=e.view_id!==this._config.view_id;this._config=e,t&&this._dataLoaded&&this.hass&&this._loadViewFilters()}getCardSize(){return 3}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub(),this._unsub=null),this._dataLoaded=!1,this._lastConnection=null}updated(e){if(super.updated(e),si(this,e),this.hass&&!this._userNamesLoaded&&this._config.show_assignee!==!1&&this._objects.some(t=>t.tasks.some(i=>i.responsible_user_id))&&this._loadUserNames(),this.hass&&this._config.show_documents!==!1)for(let t of this._objects)this._docsLoadedFor.has(t.entry_id)||t.tasks.some(i=>(i.document_count??0)>0)&&this._loadDocuments(t.entry_id);if(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(){B(this.hass).then(t=>{this._settings=t,this._globalRowStyle=t.rowActionStyle}).catch(()=>{});let e=this._loadViewFilters();try{let[t,i]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);await e,this._objects=wt(t.objects),this._stats=i,ri(this._stats.budget)}catch{}await e,this._firstLoadDone=!0}_lastDone(e,t){let i=sn(e.last_performed,t);return i?l`<span class="last-done" title="${n("last_performed",t)}: ${H(e.last_performed,t)}">${i}</span>`:"\u2014"}_assigneeName(e){if(this._config.show_assignee===!1)return"";let t=e.responsible_user_id;return t&&this._userNames[t]||""}async _loadUserNames(){this._userNamesLoaded=!0,this._userService?this._userService.updateHass(this.hass):this._userService=new Xe(this.hass);try{let e=await this._userService.getUsers();this._userPersons=Object.fromEntries(e.map(t=>[t.id,ui(t)])),this._userNames=Object.fromEntries(e.map(t=>[t.id,t.name]))}catch{}}async _loadDocuments(e){this._docsLoadedFor.add(e);try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/list",entry_id:e}),i={};for(let a of t.documents||[])if(!cn(a))for(let o of a.task_ids||[])(i[o]||=[]).push({id:a.id,title:a.title,kind:a.kind,url:a.url});this._taskDocs={...this._taskDocs,[e]:i}}catch{}}_docsFor(e,t){if(this._config.show_documents===!1)return[];let a=[...this._taskDocs[e]?.[t.id]||[]];return t.documentation_url&&a.push({id:`url:${t.id}`,title:n("documentation_label",this._lang),kind:"weblink",url:t.documentation_url}),a}_renderDocChips(e,t){let i=this._docsFor(e,t);if(!i.length)return p;let a=i.slice(to);return l`<div class="doc-chips">
${i.slice(0,to).map(o=>l`
`,c([f({attribute:!1})],Fe.prototype,"hass",2),c([u()],Fe.prototype,"_config",2),c([u()],Fe.prototype,"_views",2);customElements.get(_t)||customElements.define(_t,Xs);customElements.get("maintenance-supporter-panel-card-editor")||customElements.define("maintenance-supporter-panel-card-editor",Fe);Je({type:_t,name:"Maintenance Supporter \u2014 Panel",description:"The complete Maintenance Supporter panel as a card \u2014 for a panel view / dashboard subview without the sidebar entry.",preview:!1});pi();var eo=2,F=class extends E{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._globalRowStyle="buttons_compact";this._settings=it;this._firstLoadDone=!1;this._objects=[];this._stats=null;this._unsub=null;this._viewFilters=null;this._userNames={};this._userPersons={};this._userService=null;this._userNamesLoaded=!1;this._taskDocs={};this._docsLoadedFor=new Set;this._dataLoaded=!1;this._lastConnection=null;this._onCompleted=async e=>{await this._loadData();let t=e.detail;t?.undo&&Yn(this,this.hass,t,this._lang,()=>{this._loadData()})}}get _lang(){return P(this.hass)}static getConfigElement(){return document.createElement("maintenance-supporter-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-card",show_header:!0,show_actions:!0,filter_status:[...Qi],max_items:10}}setConfig(e){let t=e.view_id!==this._config.view_id;this._config=e,t&&this._dataLoaded&&this.hass&&this._loadViewFilters()}getCardSize(){return 3}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub(),this._unsub=null),this._dataLoaded=!1,this._lastConnection=null}updated(e){if(super.updated(e),si(this,e),this.hass&&!this._userNamesLoaded&&this._config.show_assignee!==!1&&this._objects.some(t=>t.tasks.some(i=>i.responsible_user_id))&&this._loadUserNames(),this.hass&&this._config.show_documents!==!1)for(let t of this._objects)this._docsLoadedFor.has(t.entry_id)||t.tasks.some(i=>(i.document_count??0)>0)&&this._loadDocuments(t.entry_id);if(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(){B(this.hass).then(t=>{this._settings=t,this._globalRowStyle=t.rowActionStyle}).catch(()=>{});let e=this._loadViewFilters();try{let[t,i]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);await e,this._objects=kt(t.objects),this._stats=i,ri(this._stats.budget)}catch{}await e,this._firstLoadDone=!0}_lastDone(e,t){let i=sn(e.last_performed,t);return i?l`<span class="last-done" title="${n("last_performed",t)}: ${H(e.last_performed,t)}">${i}</span>`:"\u2014"}_assigneeName(e){if(this._config.show_assignee===!1)return"";let t=e.responsible_user_id;return t&&this._userNames[t]||""}async _loadUserNames(){this._userNamesLoaded=!0,this._userService?this._userService.updateHass(this.hass):this._userService=new Xe(this.hass);try{let e=await this._userService.getUsers();this._userPersons=Object.fromEntries(e.map(t=>[t.id,ui(t)])),this._userNames=Object.fromEntries(e.map(t=>[t.id,t.name]))}catch{}}async _loadDocuments(e){this._docsLoadedFor.add(e);try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/list",entry_id:e}),i={};for(let a of t.documents||[])if(!cn(a))for(let o of a.task_ids||[])(i[o]||=[]).push({id:a.id,title:a.title,kind:a.kind,url:a.url});this._taskDocs={...this._taskDocs,[e]:i}}catch{}}_docsFor(e,t){if(this._config.show_documents===!1)return[];let a=[...this._taskDocs[e]?.[t.id]||[]];return t.documentation_url&&a.push({id:`url:${t.id}`,title:n("documentation_label",this._lang),kind:"weblink",url:t.documentation_url}),a}_renderDocChips(e,t){let i=this._docsFor(e,t);if(!i.length)return p;let a=i.slice(eo);return l`<div class="doc-chips">
${i.slice(0,eo).map(o=>l`
<button
type="button"
class="doc-chip"
@@ -5987,7 +6002,7 @@ ${h?`<div class="sub">${h}</div>`:""}
`)}
${a.length?l`<span class="doc-chip doc-more" title="${a.map(o=>o.title).join(`
`)}">+${a.length}</span>`:p}
</div>`}async _openDoc(e){if(e.kind==="weblink"&&e.url){Ze(e.url)&&window.open(e.url,"_blank","noopener");return}try{await ln(this.hass,e.id)}catch{}}async _loadViewFilters(){if(!this._config.view_id){this._viewFilters=null;return}try{let t=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"})).views||[]).find(i=>i.id===this._config.view_id);this._viewFilters=t?t.filters:null}catch{this._viewFilters=null}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=wr(this._objects,t);i!==null&&(this._objects=i)},{type:"maintenance_supporter/subscribe",deltas:!0,compact:!0});if(!this.isConnected){e();return}this._unsub=e}catch{}}get _selectedTasks(){let e=[],{filter_status:t,filter_objects:i,entity_ids:a,filter_due_min_days:o,filter_due_max_days:d,filter_labels:h,filter_priority:_,filter_areas:m}=this._config,b=a?.length?new Set(a):null,k=o!==void 0||d!==void 0,w=this._viewFilters,v=w?.user_id==="current_user"?this.hass.user?.id??null:w?.user_id??null;for(let x of this._objects)if(!(i?.length&&!i.includes(x.object.name))){if(m?.length){let T=x.object.area_id;if(!T||!m.includes(T))continue}for(let T of x.tasks)if(!T.is_done&&!(T.archived||x.object.archived)&&!(t?.length&&!t.includes(T.status))&&!(h?.length&&!(T.labels||[]).some(O=>h.includes(O)))&&!(_?.length&&!_.includes(T.priority||"normal"))&&!(b&&!(T.sensor_entity_id&&b.has(T.sensor_entity_id)||T.binary_sensor_entity_id&&b.has(T.binary_sensor_entity_id)))){if(k){let O=T.days_until_due;if(O==null||o!==void 0&&O<o||d!==void 0&&O>d)continue}w&&(w.status&&T.status!==w.status||w.label&&!(T.labels||[]).includes(w.label)||w.priority&&(T.priority||"normal")!==w.priority||v&&!kr(T,v))||e.push({entry_id:x.entry_id,object_name:x.object.name,task:T})}}return e.sort((x,T)=>{let O=Qi(x.task.status)-Qi(T.task.status);return O!==0?O:(x.task.days_until_due??1/0)-(T.task.days_until_due??1/0)}),e}_openComplete(e,t){let i=this.shadowRoot.querySelector("maintenance-complete-dialog");gi(i,mi({entryId:e,taskId:t.id,taskName:t.name,task:t,objects:this._objects,lang:this._lang,features:this._settings.features,currencySymbol:je(this._stats?.budget),partsCostMode:this._settings.partsCostMode}),this._lang)}_headerCounts(e){let t={overdue:0,due_soon:0,triggered:0};for(let{task:i}of e)Nr(i.status)&&(t[i.status]+=1);return t}_openTaskDetail(e,t){Ks(e,t)}render(){let e=this._lang,t=this._config.title||n("maintenance",e),i=this._config.show_header!==!1,a=(this._config.action_style??(this._globalRowStyle==="icons"?"icons":"buttons"))==="buttons",o=this._config.show_actions!==!1,d=o&&ae(this.hass?.user,this._settings.access),h=this._config.compact||!1,_=this._selectedTasks,{max_items:m}=this._config,b=m&&m>0?_.slice(0,m):_,k=this._objects.length||this._stats?this._headerCounts(_):null;return l`
</div>`}async _openDoc(e){if(e.kind==="weblink"&&e.url){Ze(e.url)&&window.open(e.url,"_blank","noopener");return}try{await ln(this.hass,e.id)}catch{}}async _loadViewFilters(){if(!this._config.view_id){this._viewFilters=null;return}try{let t=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"})).views||[]).find(i=>i.id===this._config.view_id);this._viewFilters=t?t.filters:null}catch{this._viewFilters=null}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=wr(this._objects,t);i!==null&&(this._objects=i)},{type:"maintenance_supporter/subscribe",deltas:!0,compact:!0});if(!this.isConnected){e();return}this._unsub=e}catch{}}get _selectedTasks(){let e=[],{filter_status:t,filter_objects:i,entity_ids:a,filter_due_min_days:o,filter_due_max_days:d,filter_labels:h,filter_priority:_,filter_areas:m}=this._config,b=a?.length?new Set(a):null,k=o!==void 0||d!==void 0,w=this._viewFilters,v=w?.user_id==="current_user"?this.hass.user?.id??null:w?.user_id??null;for(let x of this._objects)if(!(i?.length&&!i.includes(x.object.name))){if(m?.length){let T=x.object.area_id;if(!T||!m.includes(T))continue}for(let T of x.tasks)if(!T.is_done&&!(T.archived||x.object.archived)&&!(t?.length&&!t.includes(T.status))&&!(h?.length&&!(T.labels||[]).some(O=>h.includes(O)))&&!(_?.length&&!_.includes(T.priority||"normal"))&&!(b&&!(T.sensor_entity_id&&b.has(T.sensor_entity_id)||T.binary_sensor_entity_id&&b.has(T.binary_sensor_entity_id)))){if(k){let O=T.days_until_due;if(O==null||o!==void 0&&O<o||d!==void 0&&O>d)continue}w&&(w.status&&T.status!==w.status||w.label&&!(T.labels||[]).includes(w.label)||w.priority&&(T.priority||"normal")!==w.priority||v&&!kr(T,v))||e.push({entry_id:x.entry_id,object_name:x.object.name,task:T})}}return e.sort((x,T)=>{let O=Zi(x.task.status)-Zi(T.task.status);return O!==0?O:(x.task.days_until_due??1/0)-(T.task.days_until_due??1/0)}),e}_openComplete(e,t){let i=this.shadowRoot.querySelector("maintenance-complete-dialog");gi(i,mi({entryId:e,taskId:t.id,taskName:t.name,task:t,objects:this._objects,lang:this._lang,features:this._settings.features,currencySymbol:je(this._stats?.budget),partsCostMode:this._settings.partsCostMode}),this._lang)}_headerCounts(e){let t={overdue:0,due_soon:0,triggered:0};for(let{task:i}of e)Nr(i.status)&&(t[i.status]+=1);return t}_openTaskDetail(e,t){Ks(e,t)}render(){let e=this._lang,t=this._config.title||n("maintenance",e),i=this._config.show_header!==!1,a=(this._config.action_style??(this._globalRowStyle==="icons"?"icons":"buttons"))==="buttons",o=this._config.show_actions!==!1,d=o&&ae(this.hass?.user,this._settings.access),h=this._config.compact||!1,_=this._selectedTasks,{max_items:m}=this._config,b=m&&m>0?_.slice(0,m):_,k=this._objects.length||this._stats?this._headerCounts(_):null;return l`
<ha-card>
<div class="card-header">
<h1>${t}</h1>
@@ -6030,7 +6045,7 @@ ${h?`<div class="sub">${h}</div>`:""}
<div class="task-item clickable"
@click=${()=>this._openTaskDetail(w,x.id)}
title="${n("open_task",e)}">
<div class="status-dot" style="background: ${kt[x.status]||"#ccc"}"></div>
<div class="status-dot" style="background: ${rt(x)}"></div>
<div class="task-info">
<div class="task-name">
${x.name}${_n(x.next_event_titles)}
@@ -6041,16 +6056,16 @@ ${h?`<div class="sub">${h}</div>`:""}
></ha-icon>`:p}
</div>
${h?this._assigneeName(x)?l`<div class="task-meta compact-assignee" title="${this._assigneeName(x)}">
${gs(this._userPersons[x.responsible_user_id])}${this._assigneeName(x)}
${fs(this._userPersons[x.responsible_user_id])}${this._assigneeName(x)}
</div>`:p:l`<div class="task-meta">
${v} · ${n(x.type,e)}${ke(x)?l` · ${ke(x)}`:p}${this._assigneeName(x)?l` · <span class="assignee"
>${gs(this._userPersons[x.responsible_user_id])}${this._assigneeName(x)}</span
>${fs(this._userPersons[x.responsible_user_id])}${this._assigneeName(x)}</span
>`:p}
</div>`}
</div>
${this._renderDocChips(w,x)}
<div class="task-due">
${x.days_until_due!==null&&x.days_until_due!==void 0?x.days_until_due<0?l`<span class="overdue-text">${cs(x.days_until_due,e)}</span>`:cs(x.days_until_due,e):x.trigger_active?"\u26A1":this._lastDone(x,e)}
${x.days_until_due!==null&&x.days_until_due!==void 0?x.days_until_due<0?l`<span class="overdue-text">${ds(x.days_until_due,e)}</span>`:ds(x.days_until_due,e):x.trigger_active?"\u26A1":this._lastDone(x,e)}
</div>
${o&&a?l`
<ha-button