291 files

This commit is contained in:
Home Assistant Version Control committed 2026-10-14 18:10:18 +00:00
1 parent c4e0178d8a
commit 280501d2e8
291 files changed
+32540 -3280

No files matched your search

@@ -1,9 +1,9 @@
/*! maintenance_supporter frontend 2.102.0 */
var Hr=Object.defineProperty;var Ba=Object.getOwnPropertyDescriptor;var y=(s,r,e)=>()=>{if(e)throw e[0];try{return s&&(r=s(s=0)),r}catch(t){throw e=[t],t}};var Wa=(s,r)=>{for(var e in r)Hr(s,e,{get:r[e],enumerable:!0})};var c=(s,r,e,t)=>{for(var i=t>1?void 0:t?Ba(r,e):r,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(t?o(r,e,i):o(i))||i);return t&&i&&Hr(r,e,i),i};var Nt,Ht,Ci,qr,pt,Or,E,Dr,Ii,Ri=y(()=>{Nt=globalThis,Ht=Nt.ShadowRoot&&(Nt.ShadyCSS===void 0||Nt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ci=Symbol(),qr=new WeakMap,pt=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Ci)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(Ht&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=qr.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&qr.set(e,r))}return r}toString(){return this.cssText}},Or=s=>new pt(typeof s=="string"?s:s+"",void 0,Ci),E=(s,...r)=>{let e=s.length===1?s[0]:r.reduce((t,i,n)=>t+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[n+1],s[0]);return new pt(e,s,Ci)},Dr=(s,r)=>{if(Ht)s.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=Nt.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,s.appendChild(t)}},Ii=Ht?s=>s:s=>s instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return Or(e)})(s):s});var Va,Ga,Ka,Ya,Qa,Za,qt,jr,Ja,Xa,ut,ht,Ot,Mr,ce,_t=y(()=>{Ri();Ri();({is:Va,defineProperty:Ga,getOwnPropertyDescriptor:Ka,getOwnPropertyNames:Ya,getOwnPropertySymbols:Qa,getPrototypeOf:Za}=Object),qt=globalThis,jr=qt.trustedTypes,Ja=jr?jr.emptyScript:"",Xa=qt.reactiveElementPolyfillSupport,ut=(s,r)=>s,ht={toAttribute(s,r){switch(r){case Boolean:s=s?Ja:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,r){let e=s;switch(r){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},Ot=(s,r)=>!Va(s,r),Mr={attribute:!0,type:String,converter:ht,reflect:!1,useDefault:!1,hasChanged:Ot};Symbol.metadata??=Symbol("metadata"),qt.litPropertyMetadata??=new WeakMap;ce=class extends HTMLElement{static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Mr){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&Ga(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:n}=Ka(this.prototype,r)??{get(){return this[e]},set(o){this[e]=o}};return{get:i,set(o){let d=i?.call(this);n?.call(this,o),this.requestUpdate(r,d,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Mr}static _$Ei(){if(this.hasOwnProperty(ut("elementProperties")))return;let r=Za(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(ut("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ut("properties"))){let e=this.properties,t=[...Ya(e),...Qa(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Ii(i))}else r!==void 0&&e.push(Ii(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Dr(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=tLine truncated
\f\r]`,mt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ur=/-->/g,Br=/>/g,Te=RegExp(`>|${Pi}(?:([^\\s"'>=/]+)(${Pi}*=${Pi}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Wr=/'/g,Vr=/"/g,Yr=/^(?:script|style|textarea|title)$/i,Oi=s=>(r,...e)=>({_$litType$:s,strings:r,values:e}),l=Oi(1),Ve=Oi(2),sc=Oi(3),Ie=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),Gr=new WeakMap,Ae=Ce.createTreeWalker(Ce,129);Zr=(s,r)=>{let e=s.length-1,t=[],i,n=r===2?"<svg>":r===3?"<math>":"",o=mt;for(let d=0;d<e;d++){let p=s[d],_,m,f=-1,x=0;for(;x<p.length&&(o.lastIndex=x,m=o.exec(p),m!==null);)x=o.lastIndex,o===mt?m[1]==="!--"?o=Ur:m[1]!==void 0?o=Br:m[2]!==void 0?(Yr.test(m[2])&&(i=RegExp("</"+m[2],"g")),o=Te):m[3]!==void 0&&(o=Te):o===Te?m[0]===">"?(o=i??mt,f=-1):m[1]===void 0?f=-2:(f=o.lastIndex-m[2].length,_=m[1],o=m[3]===void 0?Te:m[3]==='"'?Vr:Wr):o===Vr||o===Wr?o=Te:o===Ur||o===Br?o=mt:(o=Te,i=void 0);let w=o===Te&&s[d+1].startsWith("/>")?" ":"";n+=o===mt?p+eo:f>=0?(t.push(_),p.slice(0,f)+Ni+p.slice(f)+de+w):p+de+(f===-2?d:w)}return[Qr(s,n+(s[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},vt=class s{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let n=0,o=0,d=r.length-1,p=this.parts,[_,m]=Zr(r,e);if(this.el=s.createElement(_,t),Ae.currentNode=this.el.content,e===2||e===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Ae.nextNode())!==null&&p.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let f of i.getAttributeNames())if(f.endsWith(Ni)){let x=m[o++],w=i.getAttribute(f).split(de),k=/([.?@])?(.*)/.exec(x);p.push({type:1,index:n,name:k[2],strings:w,ctor:k[1]==="."?Mt:k[1]==="?"?zt:k[1]==="@"?Ft:Pe}),i.removeAttribute(f)}else f.startsWith(de)&&(p.push({type:6,index:n}),i.removeAttribute(f));if(Yr.test(i.tagName)){let f=i.textContent.split(de),x=f.length-1;if(x>0){i.textContent=Dt?Dt.emptyScript:"";for(let w=0;w<x;w++)i.append(f[w],gt()),Ae.nextNode(),p.push({type:2,index:++n});i.append(f[x],gt())}}}else if(i.nodeType===8)if(i.data===Hi)p.push({type:2,index:n});else{let f=-1;for(;(f=i.data.indexOf(de,f+1))!==-1;)p.push({type:7,index:n}),f+=de.length-1}n++}}static createElement(r,e){let t=Ce.createElement("template");return t.innerHTML=r,t}};jt=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Ce).importNode(e,!0);Ae.currentNode=i;let n=Ae.nextNode(),o=0,d=0,p=t[0];for(;p!==void 0;){if(o===p.index){let _;p.type===2?_=new We(n,n.nextSibling,this,r):p.type===1?_=new p.ctor(n,p.name,p.strings,this,r):p.type===6&&(_=new Ut(n,this,r)),this._$AV.push(_),p=t[++d]}o!==p?.index&&(n=Ae.nextNode(),o++)}return Ae.currentNode=Ce,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},We=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Re(this,r,e),ft(r)?r===u||r==null||r===""?(this._$AH!==u&&this._$AR(),this._$AH=u):r!==this._$AH&&r!==Ie&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):Kr(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==u&&ft(this._$AH)?this._$AA.nextSibling.data=r:this.T(Ce.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=vt.createElement(Qr(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new jt(i,this),o=n.u(this.options);n.p(e),this.T(o),this._$AH=n}}_$AC(r){let e=Gr.get(r.strings);return e===void 0&&Gr.set(r.strings,e=new vt(r)),e}k(r){qi(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of r)i===e.length?e.push(t=new s(this.O(gt()),this.O(gt()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=zr(r).nextSibling;zr(r).remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Pe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=u}_$AI(r,e=this,t,i){let n=this.strings,o=!1;if(n===void 0)r=Re(this,r,e,0),o=!ft(r)||r!==this._$AH&&r!==Ie,o&&(this._$AH=r);else{let d=r,p,_;for(r=n[0],p=0;p<n.length-1;p++)_=Re(this,d[t+p],e,p),_===Ie&&(_=this._$AH[p]),o||=!ft(_)||_!==this._$AH[p],_===u?r=u:r!==u&&(r+=(_??"")+n[p+1]),this._$AH[p]=_}o&&!i&&this.j(r)}j(r){r===u?this.element.removeAttribute(this.naLine truncated
/*! maintenance_supporter frontend 2.103.0 */
var qr=Object.defineProperty;var Wa=Object.getOwnPropertyDescriptor;var y=(s,r,e)=>()=>{if(e)throw e[0];try{return s&&(r=s(s=0)),r}catch(t){throw e=[t],t}};var Va=(s,r)=>{for(var e in r)qr(s,e,{get:r[e],enumerable:!0})};var c=(s,r,e,t)=>{for(var i=t>1?void 0:t?Wa(r,e):r,n=s.length-1,o;n>=0;n--)(o=s[n])&&(i=(t?o(r,e,i):o(i))||i);return t&&i&&qr(r,e,i),i};var Nt,Ht,Ci,Or,pt,Dr,E,jr,Ii,Ri=y(()=>{Nt=globalThis,Ht=Nt.ShadowRoot&&(Nt.ShadyCSS===void 0||Nt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ci=Symbol(),Or=new WeakMap,pt=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Ci)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(Ht&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=Or.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Or.set(e,r))}return r}toString(){return this.cssText}},Dr=s=>new pt(typeof s=="string"?s:s+"",void 0,Ci),E=(s,...r)=>{let e=s.length===1?s[0]:r.reduce((t,i,n)=>t+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[n+1],s[0]);return new pt(e,s,Ci)},jr=(s,r)=>{if(Ht)s.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=Nt.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,s.appendChild(t)}},Ii=Ht?s=>s:s=>s instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return Dr(e)})(s):s});var Ga,Ka,Ya,Qa,Za,Ja,qt,Mr,Xa,eo,ut,ht,Ot,zr,ce,_t=y(()=>{Ri();Ri();({is:Ga,defineProperty:Ka,getOwnPropertyDescriptor:Ya,getOwnPropertyNames:Qa,getOwnPropertySymbols:Za,getPrototypeOf:Ja}=Object),qt=globalThis,Mr=qt.trustedTypes,Xa=Mr?Mr.emptyScript:"",eo=qt.reactiveElementPolyfillSupport,ut=(s,r)=>s,ht={toAttribute(s,r){switch(r){case Boolean:s=s?Xa:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,r){let e=s;switch(r){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},Ot=(s,r)=>!Ga(s,r),zr={attribute:!0,type:String,converter:ht,reflect:!1,useDefault:!1,hasChanged:Ot};Symbol.metadata??=Symbol("metadata"),qt.litPropertyMetadata??=new WeakMap;ce=class extends HTMLElement{static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=zr){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&Ka(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:n}=Ya(this.prototype,r)??{get(){return this[e]},set(o){this[e]=o}};return{get:i,set(o){let d=i?.call(this);n?.call(this,o),this.requestUpdate(r,d,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??zr}static _$Ei(){if(this.hasOwnProperty(ut("elementProperties")))return;let r=Ja(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(ut("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ut("properties"))){let e=this.properties,t=[...Qa(e),...Za(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Ii(i))}else r!==void 0&&e.push(Ii(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return jr(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=tLine truncated
\f\r]`,mt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Br=/-->/g,Wr=/>/g,Te=RegExp(`>|${Pi}(?:([^\\s"'>=/]+)(${Pi}*=${Pi}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Vr=/'/g,Gr=/"/g,Qr=/^(?:script|style|textarea|title)$/i,Oi=s=>(r,...e)=>({_$litType$:s,strings:r,values:e}),l=Oi(1),Ve=Oi(2),oc=Oi(3),Ie=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),Kr=new WeakMap,Ae=Ce.createTreeWalker(Ce,129);Jr=(s,r)=>{let e=s.length-1,t=[],i,n=r===2?"<svg>":r===3?"<math>":"",o=mt;for(let d=0;d<e;d++){let p=s[d],_,m,f=-1,x=0;for(;x<p.length&&(o.lastIndex=x,m=o.exec(p),m!==null);)x=o.lastIndex,o===mt?m[1]==="!--"?o=Br:m[1]!==void 0?o=Wr:m[2]!==void 0?(Qr.test(m[2])&&(i=RegExp("</"+m[2],"g")),o=Te):m[3]!==void 0&&(o=Te):o===Te?m[0]===">"?(o=i??mt,f=-1):m[1]===void 0?f=-2:(f=o.lastIndex-m[2].length,_=m[1],o=m[3]===void 0?Te:m[3]==='"'?Gr:Vr):o===Gr||o===Vr?o=Te:o===Br||o===Wr?o=mt:(o=Te,i=void 0);let w=o===Te&&s[d+1].startsWith("/>")?" ":"";n+=o===mt?p+to:f>=0?(t.push(_),p.slice(0,f)+Ni+p.slice(f)+de+w):p+de+(f===-2?d:w)}return[Zr(s,n+(s[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},vt=class s{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let n=0,o=0,d=r.length-1,p=this.parts,[_,m]=Jr(r,e);if(this.el=s.createElement(_,t),Ae.currentNode=this.el.content,e===2||e===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Ae.nextNode())!==null&&p.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let f of i.getAttributeNames())if(f.endsWith(Ni)){let x=m[o++],w=i.getAttribute(f).split(de),k=/([.?@])?(.*)/.exec(x);p.push({type:1,index:n,name:k[2],strings:w,ctor:k[1]==="."?Mt:k[1]==="?"?zt:k[1]==="@"?Ft:Pe}),i.removeAttribute(f)}else f.startsWith(de)&&(p.push({type:6,index:n}),i.removeAttribute(f));if(Qr.test(i.tagName)){let f=i.textContent.split(de),x=f.length-1;if(x>0){i.textContent=Dt?Dt.emptyScript:"";for(let w=0;w<x;w++)i.append(f[w],gt()),Ae.nextNode(),p.push({type:2,index:++n});i.append(f[x],gt())}}}else if(i.nodeType===8)if(i.data===Hi)p.push({type:2,index:n});else{let f=-1;for(;(f=i.data.indexOf(de,f+1))!==-1;)p.push({type:7,index:n}),f+=de.length-1}n++}}static createElement(r,e){let t=Ce.createElement("template");return t.innerHTML=r,t}};jt=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Ce).importNode(e,!0);Ae.currentNode=i;let n=Ae.nextNode(),o=0,d=0,p=t[0];for(;p!==void 0;){if(o===p.index){let _;p.type===2?_=new We(n,n.nextSibling,this,r):p.type===1?_=new p.ctor(n,p.name,p.strings,this,r):p.type===6&&(_=new Ut(n,this,r)),this._$AV.push(_),p=t[++d]}o!==p?.index&&(n=Ae.nextNode(),o++)}return Ae.currentNode=Ce,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},We=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Re(this,r,e),ft(r)?r===u||r==null||r===""?(this._$AH!==u&&this._$AR(),this._$AH=u):r!==this._$AH&&r!==Ie&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):Yr(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==u&&ft(this._$AH)?this._$AA.nextSibling.data=r:this.T(Ce.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=vt.createElement(Zr(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new jt(i,this),o=n.u(this.options);n.p(e),this.T(o),this._$AH=n}}_$AC(r){let e=Kr.get(r.strings);return e===void 0&&Kr.set(r.strings,e=new vt(r)),e}k(r){qi(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of r)i===e.length?e.push(t=new s(this.O(gt()),this.O(gt()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=Fr(r).nextSibling;Fr(r).remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Pe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=u}_$AI(r,e=this,t,i){let n=this.strings,o=!1;if(n===void 0)r=Re(this,r,e,0),o=!ft(r)||r!==this._$AH&&r!==Ie,o&&(this._$AH=r);else{let d=r,p,_;for(r=n[0],p=0;p<n.length-1;p++)_=Re(this,d[t+p],e,p),_===Ie&&(_=this._$AH[p]),o||=!ft(_)||_!==this._$AH[p],_===u?r=u:r!==u&&(r+=(_??"")+n[p+1]),this._$AH[p]=_}o&&!i&&this.j(r)}j(r){r===u?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)",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:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",all_parts:"All parts",all_areas:"All areas",areas_filter:"Filter areas\u2026",areas_filter_none:"No area matches the filter.",area_cost_year:"Cost {year}",area_object_count:"{n} o 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); }
`,So=E`
`,To=E`
.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; }
`,To=E`
`,Ao=E`
.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; }
`,ni=E`
${So}
${To}
${Ao}
:host {
--maint-ok-color: var(--success-color, #4caf50);
--maint-due-soon-color: var(--warning-color, #ff9800);
@@ -1290,7 +1290,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 ai(s){if(!s)return[];let r=[],e=s.photo_doc_id;typeof e=="string"&&r.push(e);let t=s.photo_doc_ids;Array.isArray(t)&&r.push(...t);let i=[];for(let n of r){if(typeof n!="string")continue;let o=n.trim();if(!(!o||i.includes(o))&&(i.push(o),i.length>=10))break}return i}var oi=y(()=>{"use strict"});function Gs(){let s=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:r=>r.map(()=>Math.floor(Math.random()*256))}).getRandomValues(s),Array.from(s,r=>r.toString(16).padStart(2,"0")).join("")}function xe(s){let r=s?.reading_values;if(!Array.isArray(r))return[];let e=[],t=new Set;for(let i of r){if(!i||typeof i!="object")continue;let n=i;typeof n.id!="string"||!n.id||t.has(n.id)||typeof n.value!="number"||!Number.isFinite(n.value)||(t.add(n.id),e.push({id:n.id,name:typeof n.name=="string"?n.name:n.id,unit:typeof n.unit=="string"?n.unit:null,value:n.value}))}return e}function Ks(s){return s.filter(r=>r.type==="completed"&&(r.reading_value!=null||xe(r).length>0)).sort((r,e)=>r.timestamp.localeCompare(e.timestamp))}function Ys(s){return Ks(s??[]).map(r=>({timestamp:r.timestamp,values:xe(r)})).filter(r=>r.values.length>0)}function Qs(s,r,e){let t;for(let i of s){if(e!==void 0){let o=Q(i.timestamp);if(!isNaN(o)&&o>=e)break}let n=i.values.find(o=>o.id===r);n&&(t=n)}return t}function Zs(s,r,e){let t=xe(r).find(n=>n.id===e);if(!t)return null;let i=null;for(let n of Ks(s)){if(n.timestamp>=r.timestamp)break;let o=xe(n).find(d=>d.id===e);o&&(i=o.value)}return i==null?null:t.value-i}function Js(s){let r=new Set,e=new Set;for(let t of s){let i=(t.name||"").trim().toLowerCase();i&&(r.has(i)?e.add(t.id):r.add(i))}return e}function Xs(s){let r=[],e=new Set,t=new Set;for(let i of s){let n=(i.name||"").trim();if(!(!n||e.has(i.id)||t.has(n.toLowerCase()))&&(e.add(i.id),t.add(n.toLowerCase()),r.push({id:i.id,name:n,unit:(i.unit||"").trim()||null}),r.length>=er))break}return r}var er,je=y(()=>{"use strict";Z();er=20});function tr(s,r,e,t){let i=e,n=p=>typeof p=="string"?p:null,o=p=>typeof p=="number"?p:null,d=n(i.timestamp)??"";return{entry_id:s,task_id:r,original_timestamp:d,type:n(i.type)||"completed",timestamp:d,notes:n(i.notes),cost:o(i.cost),duration:o(i.duration),completed_by:n(i.completed_by),used_parts:Array.isArray(i.used_parts)?i.used_parts:null,photo_doc_ids:ai(i),reading_value:o(i.reading_value),reading_values:xe(i),readings:t?.readings??[],task_type:t?.type??null,reading_unit:t?.reading_unit??null}}async function en(s,r,e,t){let n=(await s.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:r})).tasks?.find(d=>d.id===e);if(!n)return null;let o=n.history?.find(d=>d.timestamp===t);return o||(o=(await s.connection.sendMessagePromise({type:"maintenance_supporter/task/history",entry_id:r,task_id:e})).history?.find(p=>p.timestamp===t)),o?tr(r,e,o,n):null}var ir=y(()=>{"use strict";oi();je()});function we(s,r=Me){return s?s.is_admin?!0:r.operatorWriteEnabled&&r.operatorIds.includes(s.id):!1}var Me,wt=y(()=>{"use strict";Me={operatorWriteEnabled:!1,operatorIds:[]}});var tn,rn,sn,kt,$t,Et,rr,ke,Xe,St=y(()=>{"use strict";tn={default_warning_days:[0,365],default_consumable_threshold:[1,90],battery_low_percent:[1,90],battery_recovered_percent:[20,100],archive_oneoff_days:[0,3650],delete_archived_oneoff_days:[0,3650],notify_due_soon_interval_hours:[0,720],notify_overdue_interval_hours:[0,720],notify_triggered_interval_hours:[0,720],max_notifications_per_day:[0,1e3],notification_bundle_threshold:[2,20],snooze_duration_hours:[1,168],warranty_reminder_days:[1,365],budget_alert_threshold:[10,100],currency_decimals:[0,3]},rn=[0,1440],sn=[1,1e4],kt=[0,365],$t=15,Et=[.1,.9],rr=[0,365],ke=[.01,1e4],Xe=[.01,1e5]});function Co(s){let[r,e]=tn.default_warning_days,t=s?.general?.default_warning_days,i=s?.general?.row_action_style;return{features:{...li.features,...s?.features??{}},defaultWarningDays:typeof t=="number"&&Number.isFinite(t)&&t>=r&&t<=e?t:li.defaultWarningDays,rowActionStyle:Ao.includes(i??"")?i:li.rowActionStyle,access:{operatorWriteEnabled:s?.operator_write_enabled===!0,operatorIds:Array.isArray(s?.admin_panel_user_ids)?s.admin_panel_user_ids.filter(n=>typeof n=="string"):[]},budget:s?.budget??null,rowActionNoticePending:s?.general?.row_action_notice_pending===!0,refsInLists:s?.general?.ref_numbers_in_lists===!0,objectsTableColumns:Array.isArray(s?.objects_table_columns)?s.objects_table_columns:void 0,partsCostMode:ds(s?.budget?.parts_cost_mode)}}function nn(){let s=window;return s.__msSettingsCache??={promise:null}}function se(s){let r=nn();if(r.promise)return r.promise;let e=s.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(t=>Co(t)).catch(()=>(r.promise===e&&(r.promise=null),li));return r.promise=e,e}function an(){nn().promise=null}var Ao,li,Tt=y(()=>{"use strict";wt();St();Gt();Ao=["buttons_compact","buttons","icons"];li={features:{adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1,places:!1},def Line truncated
`});function ai(s){if(!s)return[];let r=[],e=s.photo_doc_id;typeof e=="string"&&r.push(e);let t=s.photo_doc_ids;Array.isArray(t)&&r.push(...t);let i=[];for(let n of r){if(typeof n!="string")continue;let o=n.trim();if(!(!o||i.includes(o))&&(i.push(o),i.length>=10))break}return i}var oi=y(()=>{"use strict"});function Ks(){let s=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:r=>r.map(()=>Math.floor(Math.random()*256))}).getRandomValues(s),Array.from(s,r=>r.toString(16).padStart(2,"0")).join("")}function xe(s){let r=s?.reading_values;if(!Array.isArray(r))return[];let e=[],t=new Set;for(let i of r){if(!i||typeof i!="object")continue;let n=i;typeof n.id!="string"||!n.id||t.has(n.id)||typeof n.value!="number"||!Number.isFinite(n.value)||(t.add(n.id),e.push({id:n.id,name:typeof n.name=="string"?n.name:n.id,unit:typeof n.unit=="string"?n.unit:null,value:n.value}))}return e}function Ys(s){return s.filter(r=>r.type==="completed"&&(r.reading_value!=null||xe(r).length>0)).sort((r,e)=>r.timestamp.localeCompare(e.timestamp))}function Qs(s){return Ys(s??[]).map(r=>({timestamp:r.timestamp,values:xe(r)})).filter(r=>r.values.length>0)}function Zs(s,r,e){let t;for(let i of s){if(e!==void 0){let o=Q(i.timestamp);if(!isNaN(o)&&o>=e)break}let n=i.values.find(o=>o.id===r);n&&(t=n)}return t}function Js(s,r,e){let t=xe(r).find(n=>n.id===e);if(!t)return null;let i=null;for(let n of Ys(s)){if(n.timestamp>=r.timestamp)break;let o=xe(n).find(d=>d.id===e);o&&(i=o.value)}return i==null?null:t.value-i}function Xs(s){let r=new Set,e=new Set;for(let t of s){let i=(t.name||"").trim().toLowerCase();i&&(r.has(i)?e.add(t.id):r.add(i))}return e}function en(s){let r=[],e=new Set,t=new Set;for(let i of s){let n=(i.name||"").trim();if(!(!n||e.has(i.id)||t.has(n.toLowerCase()))&&(e.add(i.id),t.add(n.toLowerCase()),r.push({id:i.id,name:n,unit:(i.unit||"").trim()||null}),r.length>=tr))break}return r}var tr,je=y(()=>{"use strict";Z();tr=20});function ir(s,r,e,t){let i=e,n=p=>typeof p=="string"?p:null,o=p=>typeof p=="number"?p:null,d=n(i.timestamp)??"";return{entry_id:s,task_id:r,original_timestamp:d,type:n(i.type)||"completed",timestamp:d,notes:n(i.notes),cost:o(i.cost),duration:o(i.duration),completed_by:n(i.completed_by),used_parts:Array.isArray(i.used_parts)?i.used_parts:null,photo_doc_ids:ai(i),reading_value:o(i.reading_value),reading_values:xe(i),readings:t?.readings??[],task_type:t?.type??null,reading_unit:t?.reading_unit??null}}async function tn(s,r,e,t){let n=(await s.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:r})).tasks?.find(d=>d.id===e);if(!n)return null;let o=n.history?.find(d=>d.timestamp===t);return o||(o=(await s.connection.sendMessagePromise({type:"maintenance_supporter/task/history",entry_id:r,task_id:e})).history?.find(p=>p.timestamp===t)),o?ir(r,e,o,n):null}var rr=y(()=>{"use strict";oi();je()});function we(s,r=Me){return s?s.is_admin?!0:r.operatorWriteEnabled&&r.operatorIds.includes(s.id):!1}var Me,wt=y(()=>{"use strict";Me={operatorWriteEnabled:!1,operatorIds:[]}});var rn,sn,nn,kt,$t,Et,sr,ke,Xe,St=y(()=>{"use strict";rn={default_warning_days:[0,365],default_consumable_threshold:[1,90],battery_low_percent:[1,90],battery_recovered_percent:[20,100],archive_oneoff_days:[0,3650],delete_archived_oneoff_days:[0,3650],notify_due_soon_interval_hours:[0,720],notify_overdue_interval_hours:[0,720],notify_triggered_interval_hours:[0,720],max_notifications_per_day:[0,1e3],notification_bundle_threshold:[2,20],snooze_duration_hours:[1,168],warranty_reminder_days:[1,365],budget_alert_threshold:[10,100],currency_decimals:[0,3]},sn=[0,1440],nn=[1,1e4],kt=[0,365],$t=15,Et=[.1,.9],sr=[0,365],ke=[.01,1e4],Xe=[.01,1e5]});function Io(s){let[r,e]=rn.default_warning_days,t=s?.general?.default_warning_days,i=s?.general?.row_action_style;return{features:{...li.features,...s?.features??{}},defaultWarningDays:typeof t=="number"&&Number.isFinite(t)&&t>=r&&t<=e?t:li.defaultWarningDays,rowActionStyle:Co.includes(i??"")?i:li.rowActionStyle,access:{operatorWriteEnabled:s?.operator_write_enabled===!0,operatorIds:Array.isArray(s?.admin_panel_user_ids)?s.admin_panel_user_ids.filter(n=>typeof n=="string"):[]},budget:s?.budget??null,rowActionNoticePending:s?.general?.row_action_notice_pending===!0,refsInLists:s?.general?.ref_numbers_in_lists===!0,objectsTableColumns:Array.isArray(s?.objects_table_columns)?s.objects_table_columns:void 0,partsCostMode:ps(s?.budget?.parts_cost_mode)}}function an(){let s=window;return s.__msSettingsCache??={promise:null}}function se(s){let r=an();if(r.promise)return r.promise;let e=s.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(t=>Io(t)).catch(()=>(r.promise===e&&(r.promise=null),li));return r.promise=e,e}function on(){an().promise=null}var Co,li,Tt=y(()=>{"use strict";wt();St();Gt();Co=["buttons_compact","buttons","icons"];li={features:{adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1,places:!1},def Line truncated
<label class="field">
${this.label?l`<span class="label">${this.label}${this.required?l`<span class="req">*</span>`:u}</span>`:u}
${this.multiline?l`
@@ -1367,7 +1367,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
color: var(--secondary-text-color);
font-style: italic;
}
`,c([v()],j.prototype,"label",2),c([v()],j.prototype,"value",2),c([v()],j.prototype,"placeholder",2),c([v()],j.prototype,"type",2),c([v({type:Boolean})],j.prototype,"required",2),c([v({type:Boolean})],j.prototype,"disabled",2),c([v()],j.prototype,"step",2),c([v()],j.prototype,"min",2),c([v()],j.prototype,"max",2),c([v()],j.prototype,"pattern",2),c([v()],j.prototype,"helper",2),c([v({type:Boolean})],j.prototype,"multiline",2),c([v({type:Number})],j.prototype,"rows",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",j)});function qo(s){let e=O("2001-02-03",s).match(/\d+/g)||[],t=d=>e.findIndex(p=>Number(p)===d),i=t(2001),n=t(2),o=t(3);return i===0?"YMD":n>=0&&o>=0&&n<o?"MDY":"DMY"}function et(s,r,e){if(s<1e3||s>9999||r<1||r>12||e<1||e>31)return null;let t=new Date(s,r-1,e);return t.getFullYear()!==s||t.getMonth()!==r-1||t.getDate()!==e?null:`${s}-${String(r).padStart(2,"0")}-${String(e).padStart(2,"0")}`}function dn(s,r){let e=s.trim(),t;if(t=e.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return et(+t[1],+t[2],+t[3]);if(t=e.match(/^(\d{4})$/))return et(+t[1],1,1);if(t=e.match(/^(\d{1,2})[./](\d{4})$/))return et(+t[2],+t[1],1);if(t=e.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return et(+t[3],+t[2],+t[1]);if(t=e.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let i=+t[1],n=+t[2],o=+t[3];return qo(r)==="MDY"?et(o,i,n):et(o,n,i)}return null}var pn=y(()=>{"use strict";T()});function Oo(s,r){if(r)switch(s){case"date":return r.split("T")[0];case"time":return r.length===5?`${r}:00`:r;case"datetime":{let[e,t="00:00:00"]=r.split("T");return`${e} ${t.length===5?`${t}:00`:t}`}}}function Do(s,r){if(typeof r!="string"||!r)return"";switch(s){case"date":return r.slice(0,10);case"time":return r.slice(0,5);case"datetime":{let[e,t="00:00:00"]=r.split(" ");return`${e}T${t.length===5?`${t}:00`:t}`}}}var U,tt=y(()=>{"use strict";I();F();T();pn();U=class extends S{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let e=dn(this._typed,this.lang);if(!e){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(e)}_onTypedKey(e){e.key==="Enter"?(e.preventDefault(),this._commitTyped()):e.key==="Escape"&&(e.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(e){e.stopPropagation(),this._emit(Do(this.kind,e.detail?.value))}_clear(){this._emit("")}_emit(e){e!==this.value&&(this.value=e,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:e}})))}render(){return l`
`,c([v()],j.prototype,"label",2),c([v()],j.prototype,"value",2),c([v()],j.prototype,"placeholder",2),c([v()],j.prototype,"type",2),c([v({type:Boolean})],j.prototype,"required",2),c([v({type:Boolean})],j.prototype,"disabled",2),c([v()],j.prototype,"step",2),c([v()],j.prototype,"min",2),c([v()],j.prototype,"max",2),c([v()],j.prototype,"pattern",2),c([v()],j.prototype,"helper",2),c([v({type:Boolean})],j.prototype,"multiline",2),c([v({type:Number})],j.prototype,"rows",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",j)});function jo(s){let e=O("2001-02-03",s).match(/\d+/g)||[],t=d=>e.findIndex(p=>Number(p)===d),i=t(2001),n=t(2),o=t(3);return i===0?"YMD":n>=0&&o>=0&&n<o?"MDY":"DMY"}function et(s,r,e){if(s<1e3||s>9999||r<1||r>12||e<1||e>31)return null;let t=new Date(s,r-1,e);return t.getFullYear()!==s||t.getMonth()!==r-1||t.getDate()!==e?null:`${s}-${String(r).padStart(2,"0")}-${String(e).padStart(2,"0")}`}function pn(s,r){let e=s.trim(),t;if(t=e.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return et(+t[1],+t[2],+t[3]);if(t=e.match(/^(\d{4})$/))return et(+t[1],1,1);if(t=e.match(/^(\d{1,2})[./](\d{4})$/))return et(+t[2],+t[1],1);if(t=e.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return et(+t[3],+t[2],+t[1]);if(t=e.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let i=+t[1],n=+t[2],o=+t[3];return jo(r)==="MDY"?et(o,i,n):et(o,n,i)}return null}var un=y(()=>{"use strict";T()});function Mo(s,r){if(r)switch(s){case"date":return r.split("T")[0];case"time":return r.length===5?`${r}:00`:r;case"datetime":{let[e,t="00:00:00"]=r.split("T");return`${e} ${t.length===5?`${t}:00`:t}`}}}function zo(s,r){if(typeof r!="string"||!r)return"";switch(s){case"date":return r.slice(0,10);case"time":return r.slice(0,5);case"datetime":{let[e,t="00:00:00"]=r.split(" ");return`${e}T${t.length===5?`${t}:00`:t}`}}}var U,tt=y(()=>{"use strict";I();F();T();un();U=class extends S{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let e=pn(this._typed,this.lang);if(!e){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(e)}_onTypedKey(e){e.key==="Enter"?(e.preventDefault(),this._commitTyped()):e.key==="Escape"&&(e.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(e){e.stopPropagation(),this._emit(zo(this.kind,e.detail?.value))}_clear(){this._emit("")}_emit(e){e!==this.value&&(this.value=e,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:e}})))}render(){return l`
<div class="field">
${this.label?l`<span class="label">${this.label}${this.required?l`<span class="req">*</span>`:u}</span>`:u}
<div class="row">
@@ -1380,7 +1380,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=${Oo(this.kind,this.value)}
.value=${Mo(this.kind,this.value)}
.required=${this.required}
.disabled=${this.disabled}
@value-changed=${this._onSelectorChange}
@@ -1453,7 +1453,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([v({attribute:!1})],U.prototype,"hass",2),c([v()],U.prototype,"kind",2),c([v()],U.prototype,"label",2),c([v()],U.prototype,"value",2),c([v()],U.prototype,"helper",2),c([v({type:Boolean})],U.prototype,"clearable",2),c([v({type:Boolean})],U.prototype,"disabled",2),c([v({type:Boolean})],U.prototype,"required",2),c([v()],U.prototype,"lang",2),c([h()],U.prototype,"_typing",2),c([h()],U.prototype,"_typed",2),c([h()],U.prototype,"_typedInvalid",2);customElements.get("ms-date-field")||customElements.define("ms-date-field",U)});var R,un=y(()=>{"use strict";I();F();T();ze();sr();tt();R=class extends S{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 N(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([v({attribute:!1})],U.prototype,"hass",2),c([v()],U.prototype,"kind",2),c([v()],U.prototype,"label",2),c([v()],U.prototype,"value",2),c([v()],U.prototype,"helper",2),c([v({type:Boolean})],U.prototype,"clearable",2),c([v({type:Boolean})],U.prototype,"disabled",2),c([v({type:Boolean})],U.prototype,"required",2),c([v()],U.prototype,"lang",2),c([h()],U.prototype,"_typing",2),c([h()],U.prototype,"_typed",2),c([h()],U.prototype,"_typedInvalid",2);customElements.get("ms-date-field")||customElements.define("ms-date-field",U)});var R,hn=y(()=>{"use strict";I();F();T();ze();nr();tt();R=class extends S{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 N(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:{}}}]}
@@ -1707,7 +1707,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.radio-row input {
margin: 0;
}
`,c([v({attribute:!1})],R.prototype,"hass",2),c([v({attribute:!1})],R.prototype,"objects",2),c([v({type:Boolean})],R.prototype,"placesEnabled",2),c([h()],R.prototype,"_open",2),c([h()],R.prototype,"_loading",2),c([h()],R.prototype,"_error",2),c([h()],R.prototype,"_name",2),c([h()],R.prototype,"_manufacturer",2),c([h()],R.prototype,"_model",2),c([h()],R.prototype,"_serialNumber",2),c([h()],R.prototype,"_areaId",2),c([h()],R.prototype,"_installationDate",2),c([h()],R.prototype,"_warrantyExpiry",2),c([h()],R.prototype,"_documentationUrl",2),c([h()],R.prototype,"_notes",2),c([h()],R.prototype,"_haDeviceId",2),c([h()],R.prototype,"_parentEntryId",2),c([h()],R.prototype,"_place",2),c([h()],R.prototype,"_remindOnSite",2),c([h()],R.prototype,"_entryId",2),c([h()],R.prototype,"_replacing",2),c([h()],R.prototype,"_oldDeviceId",2),c([h()],R.prototype,"_replaceDevice",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",R)});function jo(s){let r=(s||"").split(/\s+/).filter(Boolean);return r.length===0?"?":r.length===1?r[0][0].toUpperCase():(r[0][0]+r[r.length-1][0]).toUpperCase()}function Mo(s){let r=0;for(let e of s)r=r*31+e.charCodeAt(0)>>>0;return hn[r%hn.length]}function _n(s){return s?{id:s.id,name:s.name,initials:s.initials||jo(s.name),color:s.color||Mo(s.id)}:null}var hn,mn=y(()=>{"use strict";I();hn=["#c62828","#ad1457","#6a1b9a","#4527a0","#283593","#1565c0","#00838f","#2e7d32","#558b2f","#ef6c00","#6d4c41","#546e7a"]});var ci,gn=y(()=>{"use strict";mn();ci=class{constructor(r){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=r}updateHass(r){this.hass=r}async getUsers(r=!1){let e=Date.now();if(!r&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(r,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:r,task_id:e,user_id:t})}async getTasksByUser(r){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:r})).tasks}getUserName(r){return!r||!this.usersCache?null:this.usersCache.find(t=>t.id===r)?.name||null}getPerson(r){return _n(this.getUser(r))}getUser(r){return!r||!this.usersCache?null:this.usersCache.find(e=>e.id===r)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(r){return r?r===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function ae(s){return`${s.entry_id??""}\0${s.part_id}`}function fn(s,r,e,t){let i=!!s.entry_id&&s.entry_id!==r,n=i?s.entry_id:r,o=e.find(m=>m.entry_id===n),d=(o?.parts||[]).find(m=>m.id===s.part_id)||null,p=i&&o?.object?.name||"",_=d?.name||a("shared_part_unknown",t);return{part:d,foreign:i,ownerName:p,label:p?`${_} (${p})`:_}}function vn(s,r,e,t){let{part:i,label:n}=fn(s,r,e,t),o=i&&i.stock!==null&&i.stock!==void 0?` (${Ze(i.stock,i.unit,t)})`:"",d=i?.storage_location?` \u2014 ${i.storage_location}`:"";return`${C(s.quantity,t)}\xD7 ${n}${o}${d}`}function yn(s,r,e,t){let n=(e.find(d=>d.entry_id===r)?.parts||[]).map(d=>({...d})),o=new Set(n.map(d=>ae({part_id:d.id})));for(let d of s?.consumes_parts||[]){if(!d.entry_id||d.entry_id===r)continue;let p=ae(d);if(o.has(p))continue;o.add(p);let{part:_,ownerName:m}=fn(d,r,e,t);n.push({id:d.part_id,name:_?.name||a("shared_part_unknown",t),unit:_?.unit,stock:_?.stock??null,storage_location:_?.storage_location,entry_id:d.entry_id,owner_name:m})}return n}var di=y(()=>{"use strict";T()});var nr,bn,xn,wn=y(()=>{"use strict";nr=["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"],bn=["sensor"],xn=["temperature","humidity","pressure"]});function it(s){let r=(s??"").trim();if(r==="")return null;let e=Number(r.replace(",","."));return!Number.isFinite(e)||e<0?null:Math.round(e)}var pi=y(()=>{"use strict"});var ar,At,or=y(()=>{"use strict";ar=["notes","cost","duration","photo","user"],At={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"}});var zo,Fo,lr,kn=y(()=>{"use strict";zo={cleaning:"mdi:broom",inspection:"mdi:magnify",replacement:"mdi:swap-horizontal",calibration:"mdi:tune",service:"mdi:wrench",reading:"mdi:counter",custom:"mdi:wrench-clock"},Fo="mdi:wrench-clock",lr=s=>s&&zo[s]||Fo});function ui(s){return s?Array.isArray(s.entity_ids)&&s.entity_ids.length>0?[...s.entity_ids]:s.entity_id?[s.entity_id]:[]:[]}function $n(s){if(!(!s||s.type==="compound"))return ui(s)[0]}var En=y(()=>{"use strict"});var $e,hi=y(()=>{"use strict";I();F();T();$e=class extends S{constructor(){super(...arguments);this.value="";this.lang="en";th Line truncated
`,c([v({attribute:!1})],R.prototype,"hass",2),c([v({attribute:!1})],R.prototype,"objects",2),c([v({type:Boolean})],R.prototype,"placesEnabled",2),c([h()],R.prototype,"_open",2),c([h()],R.prototype,"_loading",2),c([h()],R.prototype,"_error",2),c([h()],R.prototype,"_name",2),c([h()],R.prototype,"_manufacturer",2),c([h()],R.prototype,"_model",2),c([h()],R.prototype,"_serialNumber",2),c([h()],R.prototype,"_areaId",2),c([h()],R.prototype,"_installationDate",2),c([h()],R.prototype,"_warrantyExpiry",2),c([h()],R.prototype,"_documentationUrl",2),c([h()],R.prototype,"_notes",2),c([h()],R.prototype,"_haDeviceId",2),c([h()],R.prototype,"_parentEntryId",2),c([h()],R.prototype,"_place",2),c([h()],R.prototype,"_remindOnSite",2),c([h()],R.prototype,"_entryId",2),c([h()],R.prototype,"_replacing",2),c([h()],R.prototype,"_oldDeviceId",2),c([h()],R.prototype,"_replaceDevice",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",R)});function Fo(s){let r=(s||"").split(/\s+/).filter(Boolean);return r.length===0?"?":r.length===1?r[0][0].toUpperCase():(r[0][0]+r[r.length-1][0]).toUpperCase()}function Uo(s){let r=0;for(let e of s)r=r*31+e.charCodeAt(0)>>>0;return _n[r%_n.length]}function mn(s){return s?{id:s.id,name:s.name,initials:s.initials||Fo(s.name),color:s.color||Uo(s.id)}:null}var _n,gn=y(()=>{"use strict";I();_n=["#c62828","#ad1457","#6a1b9a","#4527a0","#283593","#1565c0","#00838f","#2e7d32","#558b2f","#ef6c00","#6d4c41","#546e7a"]});var ci,fn=y(()=>{"use strict";gn();ci=class{constructor(r){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=r}updateHass(r){this.hass=r}async getUsers(r=!1){let e=Date.now();if(!r&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(r,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:r,task_id:e,user_id:t})}async getTasksByUser(r){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:r})).tasks}getUserName(r){return!r||!this.usersCache?null:this.usersCache.find(t=>t.id===r)?.name||null}getPerson(r){return mn(this.getUser(r))}getUser(r){return!r||!this.usersCache?null:this.usersCache.find(e=>e.id===r)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(r){return r?r===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function ae(s){return`${s.entry_id??""}\0${s.part_id}`}function vn(s,r,e,t){let i=!!s.entry_id&&s.entry_id!==r,n=i?s.entry_id:r,o=e.find(m=>m.entry_id===n),d=(o?.parts||[]).find(m=>m.id===s.part_id)||null,p=i&&o?.object?.name||"",_=d?.name||a("shared_part_unknown",t);return{part:d,foreign:i,ownerName:p,label:p?`${_} (${p})`:_}}function yn(s,r,e,t){let{part:i,label:n}=vn(s,r,e,t),o=i&&i.stock!==null&&i.stock!==void 0?` (${Ze(i.stock,i.unit,t)})`:"",d=i?.storage_location?` \u2014 ${i.storage_location}`:"";return`${C(s.quantity,t)}\xD7 ${n}${o}${d}`}function bn(s,r,e,t){let n=(e.find(d=>d.entry_id===r)?.parts||[]).map(d=>({...d})),o=new Set(n.map(d=>ae({part_id:d.id})));for(let d of s?.consumes_parts||[]){if(!d.entry_id||d.entry_id===r)continue;let p=ae(d);if(o.has(p))continue;o.add(p);let{part:_,ownerName:m}=vn(d,r,e,t);n.push({id:d.part_id,name:_?.name||a("shared_part_unknown",t),unit:_?.unit,stock:_?.stock??null,storage_location:_?.storage_location,entry_id:d.entry_id,owner_name:m})}return n}var di=y(()=>{"use strict";T()});var ar,xn,wn,kn=y(()=>{"use strict";ar=["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"],xn=["sensor"],wn=["temperature","humidity","pressure"]});function it(s){let r=(s??"").trim();if(r==="")return null;let e=Number(r.replace(",","."));return!Number.isFinite(e)||e<0?null:Math.round(e)}var pi=y(()=>{"use strict"});var or,At,lr=y(()=>{"use strict";or=["notes","cost","duration","photo","user"],At={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"}});var Bo,Wo,cr,$n=y(()=>{"use strict";Bo={cleaning:"mdi:broom",inspection:"mdi:magnify",replacement:"mdi:swap-horizontal",calibration:"mdi:tune",service:"mdi:wrench",reading:"mdi:counter",custom:"mdi:wrench-clock"},Wo="mdi:wrench-clock",cr=s=>s&&Bo[s]||Wo});function ui(s){return s?Array.isArray(s.entity_ids)&&s.entity_ids.length>0?[...s.entity_ids]:s.entity_id?[s.entity_id]:[]:[]}function En(s){if(!(!s||s.type==="compound"))return ui(s)[0]}var Sn=y(()=>{"use strict"});var $e,hi=y(()=>{"use strict";I();F();T();$e=class extends S{constructor(){super(...arguments);this.value="";this.lang="en";th Line truncated
<div class="wrap">
<div class="sign" role="group">
<button type="button" class="kind cost ${this._credit?"":"on"}" aria-pressed=${String(!this._credit)}
@@ -1742,9 +1742,9 @@ 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([v()],$e.prototype,"value",2),c([v()],$e.prototype,"lang",2),c([h()],$e.prototype,"_credit",2),c([h()],$e.prototype,"_amount",2);customElements.get("ms-cost-input")||customElements.define("ms-cost-input",$e)});function An(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",daysBefore:"0",carry:{}}}function In(s){return{type:s.type||"threshold",attribute:s.attribute||"",above:s.trigger_above?.toString()??"",below:s.trigger_below?.toString()??"",equals:s.trigger_equals?.toString()??"",notEquals:s.trigger_not_equals?.toString()??"",forMinutes:s.trigger_for_minutes?.toString()??"0",targetValue:s.trigger_target_value?.toString()??"",deltaMode:s.trigger_delta_mode||!1,fromState:s.trigger_from_state||"",toState:s.trigger_to_state||"",targetChanges:s.trigger_target_changes?.toString()??"",runtimeHours:s.trigger_runtime_hours?.toString()??"",onStates:(s.trigger_on_states||[]).join(", "),daysBefore:s.trigger_days_before?.toString()??"0"}}function Rn(s,r){r.attribute&&(s.attribute=r.attribute);let e=parseInt(r.forMinutes,10);if(r.type==="threshold"){let t=parseFloat(r.above);isNaN(t)||(s.trigger_above=t);let i=parseFloat(r.below);isNaN(i)||(s.trigger_below=i);let n=parseFloat(r.equals);isNaN(n)||(s.trigger_equals=n);let o=parseFloat(r.notEquals);isNaN(o)||(s.trigger_not_equals=o),isNaN(e)||(s.trigger_for_minutes=e)}else if(r.type==="counter"){let t=parseFloat(r.targetValue);isNaN(t)||(s.trigger_target_value=t),s.trigger_delta_mode=r.deltaMode}else if(r.type==="state_change"){r.fromState&&(s.trigger_from_state=r.fromState),r.toState&&(s.trigger_to_state=r.toState);let t=parseInt(r.targetChanges,10);isNaN(t)||(s.trigger_target_changes=t),isNaN(e)||(s.trigger_for_minutes=e)}else if(r.type==="runtime"){let t=parseFloat(r.runtimeHours);isNaN(t)||(s.trigger_runtime_hours=t);let i=(r.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);i.length>0&&(s.trigger_on_states=i)}else if(r.type==="due_date"){let t=parseInt(r.daysBefore,10);s.trigger_days_before=isNaN(t)?0:t}}function Ko(s){return{entityIds:ui(s).join(", "),...In(s),carry:Object.fromEntries(Object.entries(s).filter(([e])=>!Go.has(e)&&!e.startsWith("_")))}}function Yo(s){let r=s.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(r.length===0)return null;let e={...s.carry||{},entity_id:r[0],entity_ids:r,type:s.type};return Rn(e,s),e}function Qo(s){return Array.from({length:7},(r,e)=>Qe(e,s,"short"))}function Zo(s){return Array.from({length:12},(r,e)=>Xi(e,s,"short"))}var Uo,Bo,Wo,_i,Sn,Cn,Tn,Vo,pe,Fe,Go,g,cr,Pn=y(()=>{"use strict";I();F();T();gn();di();je();wn();ze();St();pi();or();sr();kn();En();tt();hi();Uo=["cleaning","inspection","replacement","calibration","service","reading","custom"],Bo=["low","normal","high"],Wo=["time_based","weekdays","nth_weekday","day_of_month","calendar","sensor_based","one_time","manual"],_i=["weekdays","nth_weekday","day_of_month","calendar"],Sn=["time_based","one_time",..._i],Cn=["threshold","counter","state_change","runtime","due_date"],Tn=(s,r)=>a(s==="due_date"?"trigger_type_due_date":s,r),Vo=[...Cn,"compound"],pe={alpha:"0.3",min:"7",max:"365"},Fe=ke;Go=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_equals","trigger_not_equals","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states","trigger_days_before"]);g=class g extends S{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.adaptiveFeature=!1;this.seasonalFeature=!1;this.environmentalFeature=!1;this.defaultWarningDays=7;this.parts=[];this._foreignOwners=[];this._open=!1;this._entityPickerFallback=!1;this._pickerProbeStrikes=0;this._loading=!1;this._error="";this._warning="";this._entryId="";this._taskId=null;this._isFleetTask=!1;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";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._calendarEntity="";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._schedulePreview=[];this._schedulePreviewEnded=!1;this._previewSeq=0;this._notes="";this._documentationUrl="";this._customIcon="";this._notifyIcon="";this._priority="normal";this._labels="";this._mirrorTodoEntities=[];this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerEquals="";this._triggerNotEquals="";this._trigg Line truncated
`],c([v()],$e.prototype,"value",2),c([v()],$e.prototype,"lang",2),c([h()],$e.prototype,"_credit",2),c([h()],$e.prototype,"_amount",2);customElements.get("ms-cost-input")||customElements.define("ms-cost-input",$e)});function Cn(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",daysBefore:"0",carry:{}}}function Rn(s){return{type:s.type||"threshold",attribute:s.attribute||"",above:s.trigger_above?.toString()??"",below:s.trigger_below?.toString()??"",equals:s.trigger_equals?.toString()??"",notEquals:s.trigger_not_equals?.toString()??"",forMinutes:s.trigger_for_minutes?.toString()??"0",targetValue:s.trigger_target_value?.toString()??"",deltaMode:s.trigger_delta_mode||!1,fromState:s.trigger_from_state||"",toState:s.trigger_to_state||"",targetChanges:s.trigger_target_changes?.toString()??"",runtimeHours:s.trigger_runtime_hours?.toString()??"",onStates:(s.trigger_on_states||[]).join(", "),daysBefore:s.trigger_days_before?.toString()??"0"}}function Pn(s,r){r.attribute&&(s.attribute=r.attribute);let e=parseInt(r.forMinutes,10);if(r.type==="threshold"){let t=parseFloat(r.above);isNaN(t)||(s.trigger_above=t);let i=parseFloat(r.below);isNaN(i)||(s.trigger_below=i);let n=parseFloat(r.equals);isNaN(n)||(s.trigger_equals=n);let o=parseFloat(r.notEquals);isNaN(o)||(s.trigger_not_equals=o),isNaN(e)||(s.trigger_for_minutes=e)}else if(r.type==="counter"){let t=parseFloat(r.targetValue);isNaN(t)||(s.trigger_target_value=t),s.trigger_delta_mode=r.deltaMode}else if(r.type==="state_change"){r.fromState&&(s.trigger_from_state=r.fromState),r.toState&&(s.trigger_to_state=r.toState);let t=parseInt(r.targetChanges,10);isNaN(t)||(s.trigger_target_changes=t),isNaN(e)||(s.trigger_for_minutes=e)}else if(r.type==="runtime"){let t=parseFloat(r.runtimeHours);isNaN(t)||(s.trigger_runtime_hours=t);let i=(r.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);i.length>0&&(s.trigger_on_states=i)}else if(r.type==="due_date"){let t=parseInt(r.daysBefore,10);s.trigger_days_before=isNaN(t)?0:t}}function Zo(s){return{entityIds:ui(s).join(", "),...Rn(s),carry:Object.fromEntries(Object.entries(s).filter(([e])=>!Qo.has(e)&&!e.startsWith("_")))}}function Jo(s){let r=s.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(r.length===0)return null;let e={...s.carry||{},entity_id:r[0],entity_ids:r,type:s.type};return Pn(e,s),e}function Xo(s){return Array.from({length:7},(r,e)=>Qe(e,s,"short"))}function el(s){return Array.from({length:12},(r,e)=>er(e,s,"short"))}var Vo,Go,Ko,_i,Tn,In,An,Yo,pe,Fe,Qo,g,dr,Ln=y(()=>{"use strict";I();F();T();fn();di();je();kn();ze();St();pi();lr();nr();$n();Sn();tt();hi();Vo=["cleaning","inspection","replacement","calibration","service","reading","custom"],Go=["low","normal","high"],Ko=["time_based","weekdays","nth_weekday","day_of_month","calendar","sensor_based","one_time","manual"],_i=["weekdays","nth_weekday","day_of_month","calendar"],Tn=["time_based","one_time",..._i],In=["threshold","counter","state_change","runtime","due_date"],An=(s,r)=>a(s==="due_date"?"trigger_type_due_date":s,r),Yo=[...In,"compound"],pe={alpha:"0.3",min:"7",max:"365"},Fe=ke;Qo=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_equals","trigger_not_equals","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states","trigger_days_before"]);g=class g extends S{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.adaptiveFeature=!1;this.seasonalFeature=!1;this.environmentalFeature=!1;this.defaultWarningDays=7;this.parts=[];this._foreignOwners=[];this._open=!1;this._entityPickerFallback=!1;this._pickerProbeStrikes=0;this._loading=!1;this._error="";this._warning="";this._entryId="";this._taskId=null;this._isFleetTask=!1;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";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._calendarEntity="";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._schedulePreview=[];this._schedulePreviewEnded=!1;this._previewSeq=0;this._notes="";this._documentationUrl="";this._customIcon="";this._notifyIcon="";this._priority="normal";this._labels="";this._mirrorTodoEntities=[];this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerEquals="";this._triggerNotEquals="";this._trigg Line truncated
`),this._phaseDefs=Object.entries(t.phases||{}).map(([_,m])=>{let{name:f,checklist:x,consumes_parts:w,required_completion_fields:k,...H}=m,L=m.consumes_parts||[],M=L.findIndex(W=>!W.entry_id),B=M>=0?L[M]:void 0;return{id:_,name:m.name||_,checklistText:(m.checklist||[]).join(`
`),partId:B?.part_id||"",partQty:B?.quantity!=null?String(B.quantity):"",reqOverride:m.required_completion_fields!==void 0,reqFields:[...m.required_completion_fields||[]],extraParts:L.filter((W,b)=>b!==M).map(W=>({...W})),carry:H}}),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 p=t.adaptive_config||{};if(this._environmentalEntity=p.environmental_entity||"",this._environmentalAttribute=p.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!p.enabled,this._adaptiveAlpha=p.ewa_alpha?.toString()??pe.alpha,this._adaptiveMin=p.min_interval_days?.toString()??pe.min,this._adaptiveMax=p.max_interval_days?.toString()??pe.max,this._adaptiveSeasonal=p.seasonal_enabled!==!1,this._adaptivePrediction=p.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=this._adaptiveEnabled,t.trigger_config){let _=t.trigger_config;this._triggerEntityId=$n(_)||"",this._triggerEntityIds=ui(_),this._triggerEntityLogic=_.entity_logic||"any",this._setTypeFields(In(_)),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(Ko)):(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=pe.alpha,this._adaptiveMin=pe.min,this._adaptiveMax=pe.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._triggerTa Line truncated
`),partId:B?.part_id||"",partQty:B?.quantity!=null?String(B.quantity):"",reqOverride:m.required_completion_fields!==void 0,reqFields:[...m.required_completion_fields||[]],extraParts:L.filter((W,b)=>b!==M).map(W=>({...W})),carry:H}}),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 p=t.adaptive_config||{};if(this._environmentalEntity=p.environmental_entity||"",this._environmentalAttribute=p.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!p.enabled,this._adaptiveAlpha=p.ewa_alpha?.toString()??pe.alpha,this._adaptiveMin=p.min_interval_days?.toString()??pe.min,this._adaptiveMax=p.max_interval_days?.toString()??pe.max,this._adaptiveSeasonal=p.seasonal_enabled!==!1,this._adaptivePrediction=p.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=this._adaptiveEnabled,t.trigger_config){let _=t.trigger_config;this._triggerEntityId=En(_)||"",this._triggerEntityIds=ui(_),this._triggerEntityLogic=_.entity_logic||"any",this._setTypeFields(Rn(_)),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(Zo)):(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=pe.alpha,this._adaptiveMin=pe.min,this._adaptiveMax=pe.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._triggerTa Line truncated
<details class="ca-section">
<summary>${a("on_complete_action_title",e)}</summary>
<p class="field-help">${a("on_complete_action_desc",e)}</p>
@@ -1846,7 +1846,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
@input=${d=>{let p=d.target.value;this._consumesQtyText={...this._consumesQtyText,[i]:p};let _=parseFloat(p.replace(",","."));Number.isFinite(_)&&_>=Fe[0]&&(this._consumesParts={...this._consumesParts,[i]:{...o,quantity:_}})}}
/>`:u}
</div>
`}_applyConsumesQtyText(){let e={...this._consumesParts};for(let t of Object.keys(e)){let i=this._consumesQtyText[t];if(i===void 0)continue;let n=parseFloat(i.replace(",","."));if(!Number.isFinite(n)||n<Fe[0]||n>Fe[1]){let o=d=>C(d,this._lang,{maximumFractionDigits:2});return this._error=a("settings_value_out_of_range",this._lang).replace("{min}",o(Fe[0])).replace("{max}",o(Fe[1])),!1}e[t]={...e[t],quantity:n}}return this._consumesParts=e,!0}_toggleRequired(e,t){let i=new Set(this._requiredCompletion);t?i.add(e):i.delete(e),this._requiredCompletion=[...i]}_patchReading(e,t){this._readings=this._readings.map(i=>i.id===e?{...i,...t}:i)}_renderReadingsEditor(e){let t=Js(this._readings);return l`
`}_applyConsumesQtyText(){let e={...this._consumesParts};for(let t of Object.keys(e)){let i=this._consumesQtyText[t];if(i===void 0)continue;let n=parseFloat(i.replace(",","."));if(!Number.isFinite(n)||n<Fe[0]||n>Fe[1]){let o=d=>C(d,this._lang,{maximumFractionDigits:2});return this._error=a("settings_value_out_of_range",this._lang).replace("{min}",o(Fe[0])).replace("{max}",o(Fe[1])),!1}e[t]={...e[t],quantity:n}}return this._consumesParts=e,!0}_toggleRequired(e,t){let i=new Set(this._requiredCompletion);t?i.add(e):i.delete(e),this._requiredCompletion=[...i]}_patchReading(e,t){this._readings=this._readings.map(i=>i.id===e?{...i,...t}:i)}_renderReadingsEditor(e){let t=Xs(this._readings);return l`
<div class="readings-editor">
<div class="field-label">${a("readings_section",e)}</div>
<div class="field-help">${a("readings_hint",e)}</div>
@@ -1870,9 +1870,9 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
</ha-icon-button>
</div>
`)}
${this._readings.length<er?l`
${this._readings.length<tr?l`
<ha-button appearance="plain" class="reading-add"
@click=${()=>this._readings=[...this._readings,{id:Gs(),name:"",unit:this._readings.length?this._readings[this._readings.length-1].unit:this._readingUnit}]}>
@click=${()=>this._readings=[...this._readings,{id:Ks(),name:"",unit:this._readings.length?this._readings[this._readings.length-1].unit:this._readingUnit}]}>
<ha-icon icon="mdi:plus"></ha-icon> ${a("reading_add",e)}
</ha-button>`:u}
</div>
@@ -1927,7 +1927,7 @@ 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">
${ar.map(n=>l`
${or.map(n=>l`
<label class="req-option">
<input
type="checkbox"
@@ -1963,8 +1963,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
</select>
</div>
`:u}
`}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=`${a("adaptive_min_interval",this._lang)} > ${a("adaptive_max_interval",this._lang)}`;return}}if(this._triggerType==="threshold"&&this._thresholdLimitsOverlap()){this._error=a("trigger_hint_overlap",this._lang);return}if(this._scheduleType==="calendar"&&!this._calendarEntity.trim().startsWith("calendar.")){this._error=a("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 n=o=>{this._warning=a("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:n})!==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),p=parseInt(this._adaptiveMax,10);await D(this,{type:"maintenance_supporter/task/set_adaptive",entry_id:this._entryId,task_id:t,enabled:this._adaptiveEnabled,...o>=Et[0]&&o<=Et[1]?{ewa_alpha:o}:{},...!isNaN(d)&&d>=1?{min_interval_days:d}:{},...!isNaN(p)&&p>=1?{max_interval_days:p}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction},{onError:n})!==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):_i.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=Xs(this._readings);{let i={};for(let o of this._phaseDefs){if(!o.name.trim())continue;let d={...o.carry,name:o.name.trim()},p=o.checklistText.split(`
`).map(m=>m.trim()).filter(Boolean);p.length&&(d.checklist=p);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 n=this._phaseSeq.filter(o=>o in i);e.phases=Object.keys(i).length&&n.length?i:null,e.phase_sequence=e.phases?n: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(Yo).filter(n=>n!==null);if(i.length>0){let n={type:"compound",compound_logic:this._compoundLogic,conditions:i};this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),e.trigger_config=n}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],n={entity_id:i[0],entity_ids:i,type:this._triggerType};if(Rn(n,this._typeFields()),this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),i.length>1&&(n.entity_logic=this._triggerEntityLogic),this._triggerType==="counter"&&this._triggerDeltaMode&&this._triggerBaselineValue){let o=parseFloat(this._triggerBaselineValue);!isNaN(o)&&o>=0&&(n.trigger_baseline_value=o)}else if(this._triggerType==="runtime"&&this._triggerRuntimeMaxSession){let o=parseInt(this._triggerRuntimeMaxSession,10);!isNaN(o)&&o>0&&(n.trigger_runtime_max_session_seconds=o)}e.trigger_config=n}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&Sn.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(`
`}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=`${a("adaptive_min_interval",this._lang)} > ${a("adaptive_max_interval",this._lang)}`;return}}if(this._triggerType==="threshold"&&this._thresholdLimitsOverlap()){this._error=a("trigger_hint_overlap",this._lang);return}if(this._scheduleType==="calendar"&&!this._calendarEntity.trim().startsWith("calendar.")){this._error=a("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 n=o=>{this._warning=a("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:n})!==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),p=parseInt(this._adaptiveMax,10);await D(this,{type:"maintenance_supporter/task/set_adaptive",entry_id:this._entryId,task_id:t,enabled:this._adaptiveEnabled,...o>=Et[0]&&o<=Et[1]?{ewa_alpha:o}:{},...!isNaN(d)&&d>=1?{min_interval_days:d}:{},...!isNaN(p)&&p>=1?{max_interval_days:p}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction},{onError:n})!==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):_i.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=en(this._readings);{let i={};for(let o of this._phaseDefs){if(!o.name.trim())continue;let d={...o.carry,name:o.name.trim()},p=o.checklistText.split(`
`).map(m=>m.trim()).filter(Boolean);p.length&&(d.checklist=p);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 n=this._phaseSeq.filter(o=>o in i);e.phases=Object.keys(i).length&&n.length?i:null,e.phase_sequence=e.phases?n: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(Jo).filter(n=>n!==null);if(i.length>0){let n={type:"compound",compound_logic:this._compoundLogic,conditions:i};this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),e.trigger_config=n}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],n={entity_id:i[0],entity_ids:i,type:this._triggerType};if(Pn(n,this._typeFields()),this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),i.length>1&&(n.entity_logic=this._triggerEntityLogic),this._triggerType==="counter"&&this._triggerDeltaMode&&this._triggerBaselineValue){let o=parseFloat(this._triggerBaselineValue);!isNaN(o)&&o>=0&&(n.trigger_baseline_value=o)}else if(this._triggerType==="runtime"&&this._triggerRuntimeMaxSession){let o=parseInt(this._triggerRuntimeMaxSession,10);!isNaN(o)&&o>0&&(n.trigger_runtime_max_session_seconds=o)}e.trigger_config=n}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&Tn.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(n=>n.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 n={service:i},o=this._actionTargetEntity.trim();this._actionTargetStored&&o===this._actionTargetInitial?n.target=JSON.parse(JSON.stringify(this._actionTargetStored)):o&&(n.target={entity_id:o});let d=this._buildActionData();Object.keys(d).length>0&&(n.data=d),this._actionSkipAuto&&(n.skip_auto=!0),e.on_complete_action=n}else e.on_complete_action=null}if(this.completionActionsEnabled){let i={};this._qcNotes.trim()&&(i.notes=this._qcNotes.trim());let n=parseFloat(this._qcCost);isNaN(n)||(i.cost=n);let o=it(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 u;let e=this._lang,t=this._triggerType==="compound";return l`
<h3>${a("trigger_configuration",e)}</h3>
<div class="select-row">
@@ -1973,7 +1973,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}
>
${Vo.map(i=>l`<option value=${i} ?selected=${i===this._triggerType}>${Tn(i,e)}</option>`)}
${Yo.map(i=>l`<option value=${i} ?selected=${i===this._triggerType}>${An(i,e)}</option>`)}
</select>
</div>
${t?this._renderCompoundEditor():l`
@@ -1987,7 +1987,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:nr}}}]}
.schema=${[{name:"trigger_entities",selector:{entity:{multiple:!0,domain:ar}}}]}
.data=${{trigger_entities:this._triggerEntityIds.length>0?this._triggerEntityIds:this._triggerEntityId?[this._triggerEntityId]:[]}}
.computeLabel=${()=>a("entity_id",e)}
@value-changed=${i=>{let n=(i.detail.value.trigger_entities||[]).filter(Boolean);this._triggerEntityId=n[0]||"",this._triggerEntityIds=n,n[0]?this._fetchEntityAttributes(n[0]):this._fetchEntityAttributes("")}}
@@ -2035,7 +2035,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
</select>
</div>
`:u}
`}_patchCondition(e,t){this._compoundConditions=this._compoundConditions.map((i,n)=>n===e?{...i,...t}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,An()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((t,i)=>i!==e)}_renderCompoundEditor(){let e=this._lang;return l`
`}_patchCondition(e,t){this._compoundConditions=this._compoundConditions.map((i,n)=>n===e?{...i,...t}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Cn()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((t,i)=>i!==e)}_renderCompoundEditor(){let e=this._lang;return l`
<div class="select-row">
<label>${a("compound_logic",e)}</label>
<select
@@ -2072,7 +2072,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:nr}}}]}
.schema=${[{name:"condition_entities",selector:{entity:{multiple:!0,domain:ar}}}]}
.data=${{condition_entities:e.entityIds.split(",").map(o=>o.trim()).filter(Boolean)}}
.computeLabel=${()=>a("entity_id",i)}
@value-changed=${o=>{let d=(o.detail.value.condition_entities||[]).filter(Boolean);this._patchCondition(t,{entityIds:d.join(", ")})}}
@@ -2084,7 +2084,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.value=${e.type}
@change=${o=>this._patchCondition(t,{type:o.target.value})}
>
${Cn.map(o=>l`<option value=${o} ?selected=${o===e.type}>${Tn(o,i)}</option>`)}
${In.map(o=>l`<option value=${o} ?selected=${o===e.type}>${An(o,i)}</option>`)}
</select>
</div>
${this._renderConditionTypeFields(e,t)}
@@ -2239,7 +2239,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
${a("schedule_preview_title",e)}: ${i}${this._schedulePreviewEnded?l` <span class="field-help">${a("schedule_preview_ends",e)}</span>`:u}
${n}
</div>
`}_buildSchedule(){let e=i=>{let n=parseInt(this._calOffset,10)||0;return n&&(i.offset=Math.max(-$t,Math.min(n,$t))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});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"||_i.includes(this._scheduleType)))return u;let i=Zo(e);return l`
`}_buildSchedule(){let e=i=>{let n=parseInt(this._calOffset,10)||0;return n&&(i.offset=Math.max(-$t,Math.min(n,$t))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});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"||_i.includes(this._scheduleType)))return u;let i=el(e);return l`
<label class="field-label">${a("season_window_label",e)}</label>
<div class="field-help">${a("season_window_hint",e)}</div>
<div class="weekday-chips season-chips">
@@ -2276,7 +2276,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.value=${this._endsUntil}
@value-changed=${n=>this._endsUntil=n.detail.value}
></ms-date-field>`:u}
`}_renderCalendarFields(){let e=this._lang,t=Qo(e);if(this._scheduleType==="weekdays")return l`
`}_renderCalendarFields(){let e=this._lang,t=Xo(e);if(this._scheduleType==="weekdays")return l`
<label class="field-label">${a("recurrence_on_days",e)}</label>
<div class="weekday-chips">
${t.map((i,n)=>l`
@@ -2419,7 +2419,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
<ms-textfield
label="${a("target_changes",e)}"
type="number"
min=${sn[0]}
min=${nn[0]}
.value=${this._triggerTargetChanges}
@input=${t=>this._triggerTargetChanges=t.target.value}
></ms-textfield>
@@ -2428,7 +2428,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
<ms-textfield
label="${a("for_at_least_minutes",e)}"
type="number"
min=${rn[0]}
min=${sn[0]}
.value=${this._triggerForMinutes}
@input=${t=>this._triggerForMinutes=t.target.value}
></ms-textfield>
@@ -2491,7 +2491,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}
>
${Uo.map(i=>l`<option value=${i} ?selected=${i===this._type}>${a(i,e)}</option>`)}
${Vo.map(i=>l`<option value=${i} ?selected=${i===this._type}>${a(i,e)}</option>`)}
</select>
</div>
${this._type==="reading"?l`
@@ -2526,7 +2526,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}
>
${Bo.map(i=>l`<option value=${i} ?selected=${i===this._priority}>${a("priority_"+i,e)}</option>`)}
${Go.map(i=>l`<option value=${i} ?selected=${i===this._priority}>${a("priority_"+i,e)}</option>`)}
</select>
</div>
<div class="field">
@@ -2564,7 +2564,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}
>
${Wo.map(i=>l`<option value=${i} ?selected=${i===this._scheduleType}>${a(i,e)}</option>`)}
${Ko.map(i=>l`<option value=${i} ?selected=${i===this._scheduleType}>${a(i,e)}</option>`)}
</select>
</div>
${this._scheduleType==="time_based"?l`
@@ -2584,6 +2584,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
<option value="completion" ?selected=${this._intervalAnchor==="completion"}>${a("anchor_completion",e)}</option>
<option value="planned" ?selected=${this._intervalAnchor==="planned"}>${a("anchor_planned",e)}</option>
</select>
<div class="field-help anchor-help">${a("interval_anchor_hint",e)}</div>
</div>
`:u}
${this._renderCalendarFields()}
@@ -2597,7 +2598,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
@value-changed=${i=>this._dueDate=i.detail.value}
></ms-date-field>
`:u}
${this.scheduleTimeEnabled&&Sn.includes(this._scheduleType)?l`
${this.scheduleTimeEnabled&&Tn.includes(this._scheduleType)?l`
<label class="checkbox-row schedule-time-toggle">
<input type="checkbox" .checked=${this._scheduleTimeOn}
@change=${i=>this._scheduleTimeOn=i.target.checked} />
@@ -2619,8 +2620,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
<ms-textfield
label="${a("warning_days",e)}"
type="number"
min=${rr[0]}
max=${rr[1]}
min=${sr[0]}
max=${sr[1]}
.value=${this._warningDays}
@input=${i=>this._warningDays=i.target.value}
></ms-textfield>
@@ -2646,7 +2647,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
${this._renderPhasesEditor(e)}
<h3>${a("require_on_completion",e)}</h3>
<div class="required-completion">
${ar.map(i=>l`
${or.map(i=>l`
<label class="req-option">
<input
type="checkbox"
@@ -2715,7 +2716,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:bn,device_class:xn}}}]}
.schema=${[{name:"environmental_entity",selector:{entity:{domain:xn,device_class:wn}}}]}
.data=${{environmental_entity:this._environmentalEntity}}
.computeLabel=${()=>a("environmental_entity_optional",e)}
.computeHelper=${()=>a("environmental_entity_helper",e)}
@@ -2751,8 +2752,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()||lr(this._type)}></ha-icon>
${a("notify_icon_hint",e).replace("{default}",lr(this._type))}
<ha-icon icon=${this._notifyIcon.trim()||cr(this._type)}></ha-icon>
${a("notify_icon_hint",e).replace("{default}",cr(this._type))}
</div>
${this._availableTags.length>0?l`
<div class="select-row">
@@ -3230,8 +3231,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
font-size: 14px;
cursor: pointer;
}
`,c([v({attribute:!1})],g.prototype,"hass",2),c([v({type:Boolean,attribute:"checklists-enabled"})],g.prototype,"checklistsEnabled",2),c([v({type:Boolean,attribute:"schedule-time-enabled"})],g.prototype,"scheduleTimeEnabled",2),c([v({type:Boolean,attribute:"completion-actions-enabled"})],g.prototype,"completionActionsEnabled",2),c([v({type:Boolean,attribute:"adaptive-feature"})],g.prototype,"adaptiveFeature",2),c([v({type:Boolean,attribute:"seasonal-feature"})],g.prototype,"seasonalFeature",2),c([v({type:Boolean,attribute:"environmental-feature"})],g.prototype,"environmentalFeature",2),c([v({type:Number,attribute:"default-warning-days"})],g.prototype,"defaultWarningDays",2),c([h()],g.prototype,"parts",2),c([h()],g.prototype,"_foreignOwners",2),c([h()],g.prototype,"_open",2),c([h()],g.prototype,"_entityPickerFallback",2),c([h()],g.prototype,"_loading",2),c([h()],g.prototype,"_error",2),c([h()],g.prototype,"_warning",2),c([h()],g.prototype,"_entryId",2),c([h()],g.prototype,"_taskId",2),c([h()],g.prototype,"_isFleetTask",2),c([h()],g.prototype,"_objectChoices",2),c([h()],g.prototype,"_name",2),c([h()],g.prototype,"_type",2),c([h()],g.prototype,"_scheduleType",2),c([h()],g.prototype,"_intervalDays",2),c([h()],g.prototype,"_intervalUnit",2),c([h()],g.prototype,"_dueDate",2),c([h()],g.prototype,"_warningDays",2),c([h()],g.prototype,"_earliestCompletionDays",2),c([h()],g.prototype,"_intervalAnchor",2),c([h()],g.prototype,"_weekdays",2),c([h()],g.prototype,"_nth",2),c([h()],g.prototype,"_nthWeekday",2),c([h()],g.prototype,"_domDay",2),c([h()],g.prototype,"_domLastDay",2),c([h()],g.prototype,"_domBusiness",2),c([h()],g.prototype,"_calOffset",2),c([h()],g.prototype,"_calendarEntity",2),c([h()],g.prototype,"_seasonMonths",2),c([h()],g.prototype,"_endsMode",2),c([h()],g.prototype,"_endsCount",2),c([h()],g.prototype,"_endsUntil",2),c([h()],g.prototype,"_schedulePreview",2),c([h()],g.prototype,"_schedulePreviewEnded",2),c([h()],g.prototype,"_notes",2),c([h()],g.prototype,"_documentationUrl",2),c([h()],g.prototype,"_customIcon",2),c([h()],g.prototype,"_notifyIcon",2),c([h()],g.prototype,"_priority",2),c([h()],g.prototype,"_labels",2),c([h()],g.prototype,"_mirrorTodoEntities",2),c([h()],g.prototype,"_enabled",2),c([h()],g.prototype,"_triggerEntityId",2),c([h()],g.prototype,"_triggerEntityIds",2),c([h()],g.prototype,"_triggerEntityLogic",2),c([h()],g.prototype,"_triggerAttribute",2),c([h()],g.prototype,"_triggerType",2),c([h()],g.prototype,"_triggerAbove",2),c([h()],g.prototype,"_triggerBelow",2),c([h()],g.prototype,"_triggerEquals",2),c([h()],g.prototype,"_triggerNotEquals",2),c([h()],g.prototype,"_triggerForMinutes",2),c([h()],g.prototype,"_triggerCombinator",2),c([h()],g.prototype,"_triggerTargetValue",2),c([h()],g.prototype,"_triggerDeltaMode",2),c([h()],g.prototype,"_triggerBaselineValue",2),c([h()],g.prototype,"_liveBaselineValue",2),c([h()],g.prototype,"_autoCompleteOnRecovery",2),c([h()],g.prototype,"_triggerFromState",2),c([h()],g.prototype,"_triggerToState",2),c([h()],g.prototype,"_triggerTargetChanges",2),c([h()],g.prototype,"_triggerRuntimeHours",2),c([h()],g.prototype,"_triggerDaysBefore",2),c([h()],g.prototype,"_triggerRuntimeMaxSession",2),c([h()],g.prototype,"_triggerOnStates",2),c([h()],g.prototype,"_compoundLogic",2),c([h()],g.prototype,"_compoundConditions",2),c([h()],g.prototype,"_suggestedAttributes",2),c([h()],g.prototype,"_availableAttributes",2),c([h()],g.prototype,"_entityDomain",2),c([h()],g.prototype,"_lastPerformed",2),c([h()],g.prototype,"_nfcTagId",2),c([h()],g.prototype,"_requireTagScan",2),c([h()],g.prototype,"_allowSkip",2),c([h()],g.prototype,"_notifyEnabled",2),c([h()],g.prototype,"_readingUnit",2),c([h()],g.prototype,"_readings",2),c([h()],g.prototype,"_consumesParts",2),c([h()],g.prototype,"_consumesQtyText",2),c([h()],g.prototype,"_partsLoadFailed",2),c([h()],g.prototype,"_availableTags",2),c([h()],g.prototype,"_responsibleUserId",2),c([h()],g.prototype,"_assigneePool",2),c([h()],g.prototype,"_rotationStrategy",2),c([h()],g.prototype,"_availableUsers",2),c([h()],g.prototype,"_checklistText",2),c([h()],g.prototype,"_phaseDefs",2),c([h()],g.prototype,"_phaseSeq",2),c([h()],g.prototype,"_requiredCompletion",2),c([h()],g.prototype,"_scheduleTime",2),c([h()],g.prototype,"_scheduleTimeOn",2),c([h()],g.prototype,"_actionService",2),c([h()],g.prototype,"_actionTargetEntity",2),c([h()],g.prototype,"_actionSkipAuto",2),c([h()],g.prototype,"_actionPresent",2),c([h()],g.prototype,"_actionData",2),c([h()],g.prototype,"_actionDataJsonFallback",2),c([h()],g.prototype,"_actionTesting",2),c([h()],g.prototype,"_actionTestResult",2),c([h()],g.prototype,"_actionTestError",2),c([h()],g.prototype,"_qcNotes",2),c([h()],g.prototype,"_qcCost",2),c([h()],g.prototype,"_qcDuration",2),c([h()],g.prototype,"_qcFeedback",2),c([h()],g.prototype,"_environmentalEntity",2),c([h()],g.prototype,"_environmentalAttribute",2),c([h()],g.prototype,"_adaptiveEnabled",2),c([h()],g.prototype,"_adaptiveAlpha",2),c([h()],g.prototy 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,n=Math.min(1,il/Math.max(t,i)),o=document.createElement("canvas");o.width=Math.round(t*n),o.height=Math.round(i*n);let d=o.getContext("2d");if(!d)throw new Error("no_canvas");d.drawImage(e,0,0,o.width,o.height);let p=await new Promise(f=>o.toBlob(f,"image/jpeg",rl));if(!p)throw new Error("no_blob");let _=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),m=new File([p],`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 u;let e=this.lang,t=this._busy||this._switching;return l`
`,c([v({attribute:!1})],g.prototype,"hass",2),c([v({type:Boolean,attribute:"checklists-enabled"})],g.prototype,"checklistsEnabled",2),c([v({type:Boolean,attribute:"schedule-time-enabled"})],g.prototype,"scheduleTimeEnabled",2),c([v({type:Boolean,attribute:"completion-actions-enabled"})],g.prototype,"completionActionsEnabled",2),c([v({type:Boolean,attribute:"adaptive-feature"})],g.prototype,"adaptiveFeature",2),c([v({type:Boolean,attribute:"seasonal-feature"})],g.prototype,"seasonalFeature",2),c([v({type:Boolean,attribute:"environmental-feature"})],g.prototype,"environmentalFeature",2),c([v({type:Number,attribute:"default-warning-days"})],g.prototype,"defaultWarningDays",2),c([h()],g.prototype,"parts",2),c([h()],g.prototype,"_foreignOwners",2),c([h()],g.prototype,"_open",2),c([h()],g.prototype,"_entityPickerFallback",2),c([h()],g.prototype,"_loading",2),c([h()],g.prototype,"_error",2),c([h()],g.prototype,"_warning",2),c([h()],g.prototype,"_entryId",2),c([h()],g.prototype,"_taskId",2),c([h()],g.prototype,"_isFleetTask",2),c([h()],g.prototype,"_objectChoices",2),c([h()],g.prototype,"_name",2),c([h()],g.prototype,"_type",2),c([h()],g.prototype,"_scheduleType",2),c([h()],g.prototype,"_intervalDays",2),c([h()],g.prototype,"_intervalUnit",2),c([h()],g.prototype,"_dueDate",2),c([h()],g.prototype,"_warningDays",2),c([h()],g.prototype,"_earliestCompletionDays",2),c([h()],g.prototype,"_intervalAnchor",2),c([h()],g.prototype,"_weekdays",2),c([h()],g.prototype,"_nth",2),c([h()],g.prototype,"_nthWeekday",2),c([h()],g.prototype,"_domDay",2),c([h()],g.prototype,"_domLastDay",2),c([h()],g.prototype,"_domBusiness",2),c([h()],g.prototype,"_calOffset",2),c([h()],g.prototype,"_calendarEntity",2),c([h()],g.prototype,"_seasonMonths",2),c([h()],g.prototype,"_endsMode",2),c([h()],g.prototype,"_endsCount",2),c([h()],g.prototype,"_endsUntil",2),c([h()],g.prototype,"_schedulePreview",2),c([h()],g.prototype,"_schedulePreviewEnded",2),c([h()],g.prototype,"_notes",2),c([h()],g.prototype,"_documentationUrl",2),c([h()],g.prototype,"_customIcon",2),c([h()],g.prototype,"_notifyIcon",2),c([h()],g.prototype,"_priority",2),c([h()],g.prototype,"_labels",2),c([h()],g.prototype,"_mirrorTodoEntities",2),c([h()],g.prototype,"_enabled",2),c([h()],g.prototype,"_triggerEntityId",2),c([h()],g.prototype,"_triggerEntityIds",2),c([h()],g.prototype,"_triggerEntityLogic",2),c([h()],g.prototype,"_triggerAttribute",2),c([h()],g.prototype,"_triggerType",2),c([h()],g.prototype,"_triggerAbove",2),c([h()],g.prototype,"_triggerBelow",2),c([h()],g.prototype,"_triggerEquals",2),c([h()],g.prototype,"_triggerNotEquals",2),c([h()],g.prototype,"_triggerForMinutes",2),c([h()],g.prototype,"_triggerCombinator",2),c([h()],g.prototype,"_triggerTargetValue",2),c([h()],g.prototype,"_triggerDeltaMode",2),c([h()],g.prototype,"_triggerBaselineValue",2),c([h()],g.prototype,"_liveBaselineValue",2),c([h()],g.prototype,"_autoCompleteOnRecovery",2),c([h()],g.prototype,"_triggerFromState",2),c([h()],g.prototype,"_triggerToState",2),c([h()],g.prototype,"_triggerTargetChanges",2),c([h()],g.prototype,"_triggerRuntimeHours",2),c([h()],g.prototype,"_triggerDaysBefore",2),c([h()],g.prototype,"_triggerRuntimeMaxSession",2),c([h()],g.prototype,"_triggerOnStates",2),c([h()],g.prototype,"_compoundLogic",2),c([h()],g.prototype,"_compoundConditions",2),c([h()],g.prototype,"_suggestedAttributes",2),c([h()],g.prototype,"_availableAttributes",2),c([h()],g.prototype,"_entityDomain",2),c([h()],g.prototype,"_lastPerformed",2),c([h()],g.prototype,"_nfcTagId",2),c([h()],g.prototype,"_requireTagScan",2),c([h()],g.prototype,"_allowSkip",2),c([h()],g.prototype,"_notifyEnabled",2),c([h()],g.prototype,"_readingUnit",2),c([h()],g.prototype,"_readings",2),c([h()],g.prototype,"_consumesParts",2),c([h()],g.prototype,"_consumesQtyText",2),c([h()],g.prototype,"_partsLoadFailed",2),c([h()],g.prototype,"_availableTags",2),c([h()],g.prototype,"_responsibleUserId",2),c([h()],g.prototype,"_assigneePool",2),c([h()],g.prototype,"_rotationStrategy",2),c([h()],g.prototype,"_availableUsers",2),c([h()],g.prototype,"_checklistText",2),c([h()],g.prototype,"_phaseDefs",2),c([h()],g.prototype,"_phaseSeq",2),c([h()],g.prototype,"_requiredCompletion",2),c([h()],g.prototype,"_scheduleTime",2),c([h()],g.prototype,"_scheduleTimeOn",2),c([h()],g.prototype,"_actionService",2),c([h()],g.prototype,"_actionTargetEntity",2),c([h()],g.prototype,"_actionSkipAuto",2),c([h()],g.prototype,"_actionPresent",2),c([h()],g.prototype,"_actionData",2),c([h()],g.prototype,"_actionDataJsonFallback",2),c([h()],g.prototype,"_actionTesting",2),c([h()],g.prototype,"_actionTestResult",2),c([h()],g.prototype,"_actionTestError",2),c([h()],g.prototype,"_qcNotes",2),c([h()],g.prototype,"_qcCost",2),c([h()],g.prototype,"_qcDuration",2),c([h()],g.prototype,"_qcFeedback",2),c([h()],g.prototype,"_environmentalEntity",2),c([h()],g.prototype,"_environmentalAttribute",2),c([h()],g.prototype,"_adaptiveEnabled",2),c([h()],g.prototype,"_adaptiveAlpha",2),c([h()],g.prototy 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,n=Math.min(1,nl/Math.max(t,i)),o=document.createElement("canvas");o.width=Math.round(t*n),o.height=Math.round(i*n);let d=o.getContext("2d");if(!d)throw new Error("no_canvas");d.drawImage(e,0,0,o.width,o.height);let p=await new Promise(f=>o.toBlob(f,"image/jpeg",al));if(!p)throw new Error("no_blob");let _=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),m=new File([p],`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 u;let e=this.lang,t=this._busy||this._switching;return l`
<div class="overlay" role="dialog" aria-modal="true" aria-label=${a("doc_camera",e)}>
<video autoplay playsinline muted></video>
${this._switching?l`<div class="switching" role="status">${a("camera_switching",e)}</div>`:u}
@@ -3296,7 +3297,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([v({type:String})],X.prototype,"lang",2),c([h()],X.prototype,"_open",2),c([h()],X.prototype,"_busy",2),c([h()],X.prototype,"_switching",2),c([h()],X.prototype,"_devices",2),c([h()],X.prototype,"_deviceIndex",2),c([h()],X.prototype,"_switchFailed",2),c([h()],X.prototype,"_copied",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",X)});var gi,ee,Ct=y(()=>{"use strict";I();F();T();ur();_r();_r();gi=E`
`,c([v({type:String})],X.prototype,"lang",2),c([h()],X.prototype,"_open",2),c([h()],X.prototype,"_busy",2),c([h()],X.prototype,"_switching",2),c([h()],X.prototype,"_devices",2),c([h()],X.prototype,"_deviceIndex",2),c([h()],X.prototype,"_switchFailed",2),c([h()],X.prototype,"_copied",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",X)});var gi,ee,Ct=y(()=>{"use strict";I();F();T();hr();mr();mr();gi=E`
ms-photo-picker { display: contents; }
.photo-pickers {
display: flex;
@@ -3325,7 +3326,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
color: var(--secondary-text-color);
margin-top: 4px;
}
`,ee=class extends S{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=mi();this._inAppCamera=Bn()}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 u;let e=this.lang,t=this._locked?"disabled":"",i=this.busy?a("uploading",e):a("doc_camera",e),n=a(this._singlePick?"choose_photo":"choose_photos",e);return l`
`,ee=class extends S{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=mi();this._inAppCamera=Wn()}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 u;let e=this.lang,t=this._locked?"disabled":"",i=this.busy?a("uploading",e):a("doc_camera",e),n=a(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:u}
@@ -3348,7 +3349,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>`:u}
`}};c([v({type:String})],ee.prototype,"lang",2),c([v({type:Boolean})],ee.prototype,"disabled",2),c([v({type:Boolean})],ee.prototype,"busy",2),c([v({type:String})],ee.prototype,"accept",2),c([v({type:Boolean})],ee.prototype,"showCamera",2),c([v({type:Boolean})],ee.prototype,"showGallery",2),c([v({type:Boolean})],ee.prototype,"compact",2),c([v({type:Number})],ee.prototype,"remaining",2),c([h()],ee.prototype,"_inAppCamera",2);customElements.get("ms-photo-picker")||customElements.define("ms-photo-picker",ee)});var st,$,Vn=y(()=>{"use strict";I();F();je();T();ze();Z();St();di();Gt();or();pr();pi();tt();hi();Ct();Ct();st=ke,$=class extends S{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=>[ae(t),{...t}])),this._usedQtyText={})}_rangeError(e,t){let i=this.lang;return a("settings_value_out_of_range",i).replace("{min}",C(e,i,{maximumFractionDigits:2})).replace("{max}",C(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=it(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(Q(this._completedAt)>Date.now()){this._error=a("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 p of this.readings){let _=(this._readingValues[p.id]??"").trim();if(_==="")continue;let m=parseFloat(_.replace(",","."));isNaN(m)||(d[p.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<Xe[0]||d>Xe[1]){this._error=this._rangeError(...Xe);return}e.restock_quantity=d}if(this.parts.length>0){let d=[];for(let[p,_]of Object.entries(this._usedParts)){let m=this._usedQtyText[p],f=m===void 0?_.quantity:parseFloat(m.replace(",","."));if(!Number.isFinite(f)||f<st[0]||f>st[1]){this._error=this._rangeError(...st);return}d.push({..._,quantity:f})}e.used_parts=d.map(p=>p.entry_id?{part_id:p.part_id,quantity:p.quantity,entry_id:p.entry_id}:{part_id:p.part_id,quantity:p.quantity})}let n=await D(this,e,{busy:d=>{this._loading=d},lang:this.lang,fallbackKey:"save_error",onError:d=>{this._error=d}});if(n===void 0)return;this._photos.markAttached(),this._open=!1;let o={entryId:this.entryId,taskId:this.taskId,taskName:this.taskName,undo:n?.undo===!0};this.dispatchEvent(new CustomEvent("task-completed",{detail:o}))}_renderReadingField(e,t){let i=this._completedAt?Q(this._completedAt):NaN,n=Qs(this.readingHistory,e.id,isNaN(i)?void 0:i),o=e.unit||this.readingUnit,d=(this._readingValues[e.id]??"").trim(),p=d===""?NaN:parseFloat(d.replace(",",".")),_=n!==void 0&&!isNaN(p)&&p<n.value,m=n!==void 0?C(n.value,t,{maximumFractionDigits:3}):"";return l`
`}};c([v({type:String})],ee.prototype,"lang",2),c([v({type:Boolean})],ee.prototype,"disabled",2),c([v({type:Boolean})],ee.prototype,"busy",2),c([v({type:String})],ee.prototype,"accept",2),c([v({type:Boolean})],ee.prototype,"showCamera",2),c([v({type:Boolean})],ee.prototype,"showGallery",2),c([v({type:Boolean})],ee.prototype,"compact",2),c([v({type:Number})],ee.prototype,"remaining",2),c([h()],ee.prototype,"_inAppCamera",2);customElements.get("ms-photo-picker")||customElements.define("ms-photo-picker",ee)});var st,$,Gn=y(()=>{"use strict";I();F();je();T();ze();Z();St();di();Gt();lr();ur();pi();tt();hi();Ct();Ct();st=ke,$=class extends S{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=>[ae(t),{...t}])),this._usedQtyText={})}_rangeError(e,t){let i=this.lang;return a("settings_value_out_of_range",i).replace("{min}",C(e,i,{maximumFractionDigits:2})).replace("{max}",C(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=it(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(Q(this._completedAt)>Date.now()){this._error=a("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 p of this.readings){let _=(this._readingValues[p.id]??"").trim();if(_==="")continue;let m=parseFloat(_.replace(",","."));isNaN(m)||(d[p.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<Xe[0]||d>Xe[1]){this._error=this._rangeError(...Xe);return}e.restock_quantity=d}if(this.parts.length>0){let d=[];for(let[p,_]of Object.entries(this._usedParts)){let m=this._usedQtyText[p],f=m===void 0?_.quantity:parseFloat(m.replace(",","."));if(!Number.isFinite(f)||f<st[0]||f>st[1]){this._error=this._rangeError(...st);return}d.push({..._,quantity:f})}e.used_parts=d.map(p=>p.entry_id?{part_id:p.part_id,quantity:p.quantity,entry_id:p.entry_id}:{part_id:p.part_id,quantity:p.quantity})}let n=await D(this,e,{busy:d=>{this._loading=d},lang:this.lang,fallbackKey:"save_error",onError:d=>{this._error=d}});if(n===void 0)return;this._photos.markAttached(),this._open=!1;let o={entryId:this.entryId,taskId:this.taskId,taskName:this.taskName,undo:n?.undo===!0};this.dispatchEvent(new CustomEvent("task-completed",{detail:o}))}_renderReadingField(e,t){let i=this._completedAt?Q(this._completedAt):NaN,n=Zs(this.readingHistory,e.id,isNaN(i)?void 0:i),o=e.unit||this.readingUnit,d=(this._readingValues[e.id]??"").trim(),p=d===""?NaN:parseFloat(d.replace(",",".")),_=n!==void 0&&!isNaN(p)&&p<n.value,m=n!==void 0?C(n.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"
@@ -3356,11 +3357,11 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.value=${this._readingValues[e.id]??""}
@input=${f=>{this._readingValues={...this._readingValues,[e.id]:f.target.value}}} />
${_?l`<span class="reading-warn">${a("reading_below_last",t).replace("{value}",m)}</span>`:u}
</label>`}get _missingRequired(){let e={notes:this._notes.trim()!=="",cost:this._cost.trim()!=="",duration:this._duration.trim()!=="",photo:this._photos.photos.length>0,user:!!this.hass?.user};return this.requiredFields.filter(t=>!e[t])}_demands(e){return this.requiredFields.includes(e)}_req(e){return this._demands(e)?l`<span class="req-mark" aria-hidden="true">*</span>`:u}_purchaseSuggestion(){if(this.restockDefault===null)return null;let e=parseFloat(this._restockQty);return this.restockUnitCost==null||!Number.isFinite(e)||e<=0?null:Math.round(this.restockUnitCost*e*100)/100}_partsValue(){if(this.restockDefault!==null||!this.parts.length)return null;let e=0,t=!1;for(let i of Object.values(this._usedParts)){let n=this.parts.find(d=>ae({part_id:d.id,entry_id:d.entry_id})===ae(i)),o=ps(n);o!==null&&(e+=o*(i.quantity||1),t=!0)}return t?Math.round(e*100)/100:null}_renderCostSuggestion(e){let t=this._purchaseSuggestion();if(this.restockDefault!==null){let d=this.partsCostMode==="use"?l`<div class="cost-note">${a("cost_purchase_use_hint",e)}</div>`:u;if(this._cost.trim()!==""||t==null||t<=0)return d;let p=J(t,this.currencySymbol,e);return l`<button
</label>`}get _missingRequired(){let e={notes:this._notes.trim()!=="",cost:this._cost.trim()!=="",duration:this._duration.trim()!=="",photo:this._photos.photos.length>0,user:!!this.hass?.user};return this.requiredFields.filter(t=>!e[t])}_demands(e){return this.requiredFields.includes(e)}_req(e){return this._demands(e)?l`<span class="req-mark" aria-hidden="true">*</span>`:u}_purchaseSuggestion(){if(this.restockDefault===null)return null;let e=parseFloat(this._restockQty);return this.restockUnitCost==null||!Number.isFinite(e)||e<=0?null:Math.round(this.restockUnitCost*e*100)/100}_partsValue(){if(this.restockDefault!==null||!this.parts.length)return null;let e=0,t=!1;for(let i of Object.values(this._usedParts)){let n=this.parts.find(d=>ae({part_id:d.id,entry_id:d.entry_id})===ae(i)),o=us(n);o!==null&&(e+=o*(i.quantity||1),t=!0)}return t?Math.round(e*100)/100:null}_renderCostSuggestion(e){let t=this._purchaseSuggestion();if(this.restockDefault!==null){let d=this.partsCostMode==="use"?l`<div class="cost-note">${a("cost_purchase_use_hint",e)}</div>`:u;if(this._cost.trim()!==""||t==null||t<=0)return d;let p=J(t,this.currencySymbol,e);return l`<button
type="button"
class="cost-suggestion"
@click=${()=>this._cost=String(Math.round(t*100)/100)}
>${a("cost_from_parts",e).replace("{amount}",p)}</button>${d}`}let i=this._partsValue();if(i==null||i<=0)return u;let n=J(i,this.currencySymbol,e),o=this.partsCostMode==="use"?"cost_parts_booked":"cost_parts_info";return l`<div class="cost-note">${a(o,e).replace("{amount}",n)}</div>`}_close(){this._open=!1,this._photos.discardOrphans()}_pickCompletedAt(){this._completedAt=`${ys()}:00`}render(){if(!this._open)return l``;let e=this.lang||this.hass?.language||"en",t=this._error||this._photos.errorText(e);return l`
>${a("cost_from_parts",e).replace("{amount}",p)}</button>${d}`}let i=this._partsValue();if(i==null||i<=0)return u;let n=J(i,this.currencySymbol,e),o=this.partsCostMode==="use"?"cost_parts_booked":"cost_parts_info";return l`<div class="cost-note">${a(o,e).replace("{amount}",n)}</div>`}_close(){this._open=!1,this._photos.discardOrphans()}_pickCompletedAt(){this._completedAt=`${bs()}:00`}render(){if(!this._open)return l``;let e=this.lang||this.hass?.language||"en",t=this._error||this._photos.errorText(e);return l`
<ha-dialog open @closed=${this._close}>
<div class="dialog-title">${a("complete_title",e)}${this.taskName}</div>
${this.phaseLabel?l`<div class="phase-line">${a("phase_current",e)}: ${this.phaseLabel}</div>`:u}
@@ -3716,13 +3717,13 @@ 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([v({attribute:!1})],$.prototype,"hass",2),c([v()],$.prototype,"entryId",2),c([v()],$.prototype,"taskId",2),c([v()],$.prototype,"taskName",2),c([v()],$.prototype,"lang",2),c([v({type:Array})],$.prototype,"checklist",2),c([v({type:Boolean})],$.prototype,"adaptiveEnabled",2),c([v()],$.prototype,"taskType",2),c([v()],$.prototype,"readingUnit",2),c([v({attribute:!1})],$.prototype,"readings",2),c([v({attribute:!1})],$.prototype,"readingHistory",2),c([v({attribute:!1})],$.prototype,"restockDefault",2),c([v({attribute:!1})],$.prototype,"restockUnitCost",2),c([v({attribute:!1})],$.prototype,"restockPackage",2),c([v()],$.prototype,"currencySymbol",2),c([v({attribute:!1})],$.prototype,"partsCostMode",2),c([v({attribute:!1})],$.prototype,"parts",2),c([v({attribute:!1})],$.prototype,"consumesParts",2),c([v({type:Array})],$.prototype,"consumesInfo",2),c([v({type:Array})],$.prototype,"requiredFields",2),c([v()],$.prototype,"phaseLabel",2),c([v({type:Boolean})],$.prototype,"requireTagScan",2),c([v({type:Boolean})],$.prototype,"viaTagScan",2),c([h()],$.prototype,"_open",2),c([h()],$.prototype,"_notes",2),c([h()],$.prototype,"_cost",2),c([h()],$.prototype,"_duration",2),c([h()],$.prototype,"_loading",2),c([h()],$.prototype,"_error",2),c([h()],$.prototype,"_checklistState",2),c([h()],$.prototype,"_feedback",2),c([h()],$.prototype,"_readingValue",2),c([h()],$.prototype,"_readingValues",2),c([h()],$.prototype,"_restockQty",2),c([h()],$.prototype,"_completedAt",2),c([h()],$.prototype,"_usedParts",2),c([h()],$.prototype,"_usedQtyText",2),c([v({attribute:!1})],$.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",$)});function ol(s,r){s.key!=="Escape"||s.defaultPrevented||s.composedPath().some(e=>e instanceof Element&&e.localName==="ms-camera-capture")||(s.preventDefault(),s.stopPropagation(),r())}function at(s,r){return l`
`],c([v({attribute:!1})],$.prototype,"hass",2),c([v()],$.prototype,"entryId",2),c([v()],$.prototype,"taskId",2),c([v()],$.prototype,"taskName",2),c([v()],$.prototype,"lang",2),c([v({type:Array})],$.prototype,"checklist",2),c([v({type:Boolean})],$.prototype,"adaptiveEnabled",2),c([v()],$.prototype,"taskType",2),c([v()],$.prototype,"readingUnit",2),c([v({attribute:!1})],$.prototype,"readings",2),c([v({attribute:!1})],$.prototype,"readingHistory",2),c([v({attribute:!1})],$.prototype,"restockDefault",2),c([v({attribute:!1})],$.prototype,"restockUnitCost",2),c([v({attribute:!1})],$.prototype,"restockPackage",2),c([v()],$.prototype,"currencySymbol",2),c([v({attribute:!1})],$.prototype,"partsCostMode",2),c([v({attribute:!1})],$.prototype,"parts",2),c([v({attribute:!1})],$.prototype,"consumesParts",2),c([v({type:Array})],$.prototype,"consumesInfo",2),c([v({type:Array})],$.prototype,"requiredFields",2),c([v()],$.prototype,"phaseLabel",2),c([v({type:Boolean})],$.prototype,"requireTagScan",2),c([v({type:Boolean})],$.prototype,"viaTagScan",2),c([h()],$.prototype,"_open",2),c([h()],$.prototype,"_notes",2),c([h()],$.prototype,"_cost",2),c([h()],$.prototype,"_duration",2),c([h()],$.prototype,"_loading",2),c([h()],$.prototype,"_error",2),c([h()],$.prototype,"_checklistState",2),c([h()],$.prototype,"_feedback",2),c([h()],$.prototype,"_readingValue",2),c([h()],$.prototype,"_readingValues",2),c([h()],$.prototype,"_restockQty",2),c([h()],$.prototype,"_completedAt",2),c([h()],$.prototype,"_usedParts",2),c([h()],$.prototype,"_usedQtyText",2),c([v({attribute:!1})],$.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",$)});function dl(s,r){s.key!=="Escape"||s.defaultPrevented||s.composedPath().some(e=>e instanceof Element&&e.localName==="ms-camera-capture")||(s.preventDefault(),s.stopPropagation(),r())}function at(s,r){return l`
<div class="backdrop" @click=${s}></div>
<div class="dialog" role="dialog" aria-modal="true" tabindex="-1"
@keydown=${e=>ol(e,s)}>${r}</div>
@keydown=${e=>dl(e,s)}>${r}</div>
`}function ot(s){s?.querySelector(".dialog")?.focus({preventScroll:!0})}var nt,fi=y(()=>{"use strict";I();nt=E`
.backdrop {
position: fixed; inset: 0; z-index: 100;
position: fixed; inset: 0; z-index: var(--ms-modal-z, 100);
background: rgba(0,0,0,0.5);
}
.dialog {
@@ -3736,11 +3737,18 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
box-shadow: 0 10px 30px rgba(0,0,0,0.4);
padding: 20px;
display: flex; flex-direction: column; gap: var(--ms-modal-gap, 14px);
z-index: 101;
z-index: calc(var(--ms-modal-z, 100) + 1);
}
/* Focused programmatically on open (so Escape works at once) — no ring. */
.dialog:focus { outline: none; }
`});var V,Gn=y(()=>{"use strict";I();F();T();V=class extends S{constructor(){super(...arguments);this._open=!1;this._title="";this._message="";this._confirmText="";this._danger=!1;this._inputLabel="";this._inputType="";this._options=null;this._inputValue="";this._resolve=null;this._promptResolve=null}confirm(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel="",this._inputType="",this._options=null,this._inputValue="",this._open=!0,new Promise(t=>{this._resolve=t,this._promptResolve=null})}prompt(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel=e.inputLabel||"",this._inputType=e.inputType||"text",this._options=e.options&&e.options.length?e.options:null,this._inputValue=e.inputValue||"",this._open=!0,new Promise(t=>{this._promptResolve=t,this._resolve=null})}_cancel(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!1,value:""}),this._promptResolve=null),this._resolve?.(!1),this._resolve=null}_confirmAction(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!0,value:this._inputValue}),this._promptResolve=null),this._resolve?.(!0),this._resolve=null}render(){if(!this._open)return u;let e=N(this.hass);return l`
/* The one part that shrinks and scrolls (min-height: 0); the header and the
buttons around it keep their content's height. */
.dialog-scroll {
flex: 1 1 auto; min-height: 0;
overflow-y: auto; overscroll-behavior: contain;
display: flex; flex-direction: column; gap: var(--ms-modal-gap, 14px);
}
`});var V,Kn=y(()=>{"use strict";I();F();T();V=class extends S{constructor(){super(...arguments);this._open=!1;this._title="";this._message="";this._confirmText="";this._danger=!1;this._inputLabel="";this._inputType="";this._options=null;this._inputValue="";this._resolve=null;this._promptResolve=null}confirm(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel="",this._inputType="",this._options=null,this._inputValue="",this._open=!0,new Promise(t=>{this._resolve=t,this._promptResolve=null})}prompt(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel=e.inputLabel||"",this._inputType=e.inputType||"text",this._options=e.options&&e.options.length?e.options:null,this._inputValue=e.inputValue||"",this._open=!0,new Promise(t=>{this._promptResolve=t,this._resolve=null})}_cancel(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!1,value:""}),this._promptResolve=null),this._resolve?.(!1),this._resolve=null}_confirmAction(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!0,value:this._inputValue}),this._promptResolve=null),this._resolve?.(!0),this._resolve=null}render(){if(!this._open)return u;let e=N(this.hass);return l`
<ha-dialog open @closed=${this._cancel}>
<div class="dialog-title">${this._title}</div>
<div class="content">
@@ -3804,7 +3812,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([v({attribute:!1})],V.prototype,"hass",2),c([h()],V.prototype,"_open",2),c([h()],V.prototype,"_title",2),c([h()],V.prototype,"_message",2),c([h()],V.prototype,"_confirmText",2),c([h()],V.prototype,"_danger",2),c([h()],V.prototype,"_inputLabel",2),c([h()],V.prototype,"_inputType",2),c([h()],V.prototype,"_options",2),c([h()],V.prototype,"_inputValue",2);customElements.get("maintenance-confirm-dialog")||customElements.define("maintenance-confirm-dialog",V)});function ll(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function Ue(s,r){let e=ll(),t=e.querySelector(`${Kn}[${Yn}]`);return t||(t=document.createElement(Kn),t.setAttribute(Yn,""),e.appendChild(t)),t.hass=s,t.confirm(r)}var Kn,Yn,vi=y(()=>{"use strict";Gn();Kn="maintenance-confirm-dialog",Yn="data-ms-lovelace-confirm"});function Qn(s,r,e){let t=new Blob([s],{type:e}),i=URL.createObjectURL(t),n=document.createElement("a");n.href=i,n.download=r,n.target="_blank",n.rel="noopener",n.style.display="none",document.body.appendChild(n),n.dispatchEvent(new MouseEvent("click")),document.body.removeChild(n),setTimeout(()=>URL.revokeObjectURL(i),6e4)}var mr=y(()=>{"use strict"});async function cl(s,r,e=300){return(await s.connection.sendMessagePromise({type:"auth/sign_path",path:r,expires:e})).path}async function Zn(s,r,e=300){return cl(s,`/api/maintenance_supporter/document/${r}`,e)}var Jn=y(()=>{"use strict";mr()});var Ee,gr=y(()=>{"use strict";I();F();Jn();Ee=class extends S{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 Zn(this.hass,this.docId)}catch{this._failed=!0}}render(){return this._failed||!this.docId?u:this._url?l`
`],c([v({attribute:!1})],V.prototype,"hass",2),c([h()],V.prototype,"_open",2),c([h()],V.prototype,"_title",2),c([h()],V.prototype,"_message",2),c([h()],V.prototype,"_confirmText",2),c([h()],V.prototype,"_danger",2),c([h()],V.prototype,"_inputLabel",2),c([h()],V.prototype,"_inputType",2),c([h()],V.prototype,"_options",2),c([h()],V.prototype,"_inputValue",2);customElements.get("maintenance-confirm-dialog")||customElements.define("maintenance-confirm-dialog",V)});function pl(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function Ue(s,r){let e=pl(),t=e.querySelector(`${Yn}[${Qn}]`);return t||(t=document.createElement(Yn),t.setAttribute(Qn,""),e.appendChild(t)),t.hass=s,t.confirm(r)}var Yn,Qn,vi=y(()=>{"use strict";Kn();Yn="maintenance-confirm-dialog",Qn="data-ms-lovelace-confirm"});function Zn(s,r,e){let t=new Blob([s],{type:e}),i=URL.createObjectURL(t),n=document.createElement("a");n.href=i,n.download=r,n.target="_blank",n.rel="noopener",n.style.display="none",document.body.appendChild(n),n.dispatchEvent(new MouseEvent("click")),document.body.removeChild(n),setTimeout(()=>URL.revokeObjectURL(i),6e4)}var gr=y(()=>{"use strict"});async function ul(s,r,e=300){return(await s.connection.sendMessagePromise({type:"auth/sign_path",path:r,expires:e})).path}async function Jn(s,r,e=300){return ul(s,`/api/maintenance_supporter/document/${r}`,e)}var Xn=y(()=>{"use strict";gr()});var Ee,fr=y(()=>{"use strict";I();F();Xn();Ee=class extends S{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 Jn(this.hass,this.docId)}catch{this._failed=!0}}render(){return this._failed||!this.docId?u:this._url?l`
<a href=${this._url} target="_blank" rel="noopener" class="wrap">
<img src=${this._url} alt="" loading="lazy"
@error=${()=>this._failed=!0} />
@@ -3828,7 +3836,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([v({attribute:!1})],Ee.prototype,"hass",2),c([v()],Ee.prototype,"docId",2),c([h()],Ee.prototype,"_url",2),c([h()],Ee.prototype,"_failed",2);customElements.get("maintenance-history-photo")||customElements.define("maintenance-history-photo",Ee)});var K,Xn=y(()=>{"use strict";I();F();T();ze();Z();St();fi();pr();pi();vi();tt();hi();gr();Ct();Ct();K=class extends S{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 N(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 n={};for(let o of e.reading_values??[])n[o.id]=String(o.value);this._readingText=n,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 n=parseFloat(i.replace(",","."));isNaN(n)||(e[t.id]=n)}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 n=[];for(let d of i.parts||[]){let p=d.entry_id===e.entry_id,_=d.consumers.some(m=>m.entry_id===e.entry_id&&m.task_id===e.task_id);!p&&!_||n.push({part_id:d.part_id,name:d.name,entry_id:d.entry_id,foreign:!p,object_name:d.object_name})}for(let d of e.used_parts||[]){let p=d.entry_id||e.entry_id;n.some(_=>_.part_id===d.part_id&&_.entry_id===p)||n.push({part_id:d.part_id,name:d.name||d.part_id,entry_id:p,foreign:p!==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=n,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(p=>p.quantity>0).map(p=>`${C(p.quantity,e)}\xD7 ${p.name||p.part_id}`).join(", ");if(!await Ue(this.hass,{title:a("history_delete_entry",e),message:i?`${a("history_delete_confirm_entry",e)} ${a("history_delete_returns_parts",e).replace("{parts}",i)}`:a("history_delete_confirm_entry",e),confirmText:a("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 p of this._readingRows)d[p.id]=o[p.id]??null;i.reading_values=d}if(JSON.stringify( Line truncated
`,c([v({attribute:!1})],Ee.prototype,"hass",2),c([v()],Ee.prototype,"docId",2),c([h()],Ee.prototype,"_url",2),c([h()],Ee.prototype,"_failed",2);customElements.get("maintenance-history-photo")||customElements.define("maintenance-history-photo",Ee)});var K,ea=y(()=>{"use strict";I();F();T();ze();Z();St();fi();ur();pi();vi();tt();hi();fr();Ct();Ct();K=class extends S{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 N(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 n={};for(let o of e.reading_values??[])n[o.id]=String(o.value);this._readingText=n,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 n=parseFloat(i.replace(",","."));isNaN(n)||(e[t.id]=n)}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 n=[];for(let d of i.parts||[]){let p=d.entry_id===e.entry_id,_=d.consumers.some(m=>m.entry_id===e.entry_id&&m.task_id===e.task_id);!p&&!_||n.push({part_id:d.part_id,name:d.name,entry_id:d.entry_id,foreign:!p,object_name:d.object_name})}for(let d of e.used_parts||[]){let p=d.entry_id||e.entry_id;n.some(_=>_.part_id===d.part_id&&_.entry_id===p)||n.push({part_id:d.part_id,name:d.name||d.part_id,entry_id:p,foreign:p!==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=n,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(p=>p.quantity>0).map(p=>`${C(p.quantity,e)}\xD7 ${p.name||p.part_id}`).join(", ");if(!await Ue(this.hass,{title:a("history_delete_entry",e),message:i?`${a("history_delete_confirm_entry",e)} ${a("history_delete_returns_parts",e).replace("{parts}",i)}`:a("history_delete_confirm_entry",e),confirmText:a("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 p of this._readingRows)d[p.id]=o[p.id]??null;i.reading_values=d}if(JSON.stringify( Line truncated
<h2>${a("history_edit_title",e)}</h2>
<div class="entry-type">
<ha-icon icon="mdi:tag-outline"></ha-icon>
@@ -3841,7 +3849,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
.lang=${e}
.label=${a("history_edit_timestamp",e)}
.helper=${ri(e)}
.value=${xs(t.timestamp)}
.value=${ws(t.timestamp)}
@value-changed=${n=>{let o=n.detail.value;o&&this._set("timestamp",o)}}
></ms-date-field>
<label>
@@ -4018,7 +4026,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([v({attribute:!1})],K.prototype,"hass",2),c([h()],K.prototype,"_open",2),c([h()],K.prototype,"_saving",2),c([h()],K.prototype,"_error",2),c([h()],K.prototype,"_draft",2),c([h()],K.prototype,"_partOptions",2),c([h()],K.prototype,"_partQty",2),c([h()],K.prototype,"_readingRows",2),c([h()],K.prototype,"_readingText",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",K)});function Be(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function fr(s){return!s.startsWith("data:image/svg+xml,")&&!s.startsWith("data:image/png;base64,")?"":Be(s)}function dl(s){return s.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var Y,ea=y(()=>{"use strict";I();F();T();mr();Y=class extends S{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||N(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,n){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._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 n=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1]),n.length>2&&(this._quickResult=n[2])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,n=t?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?a("qr_error_no_url",this._dialogLang):a("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(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let o=this._dialogLang,d=Be(t),p=Be(i),_=!!this._completeResult,m=!!this._quickResult,f=Be(a("qr_action_view",o)),x=Be(a("qr_action_complete",o)),w=Be(a("qr_action_quick_complete",o));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
`],c([v({attribute:!1})],K.prototype,"hass",2),c([h()],K.prototype,"_open",2),c([h()],K.prototype,"_saving",2),c([h()],K.prototype,"_error",2),c([h()],K.prototype,"_draft",2),c([h()],K.prototype,"_partOptions",2),c([h()],K.prototype,"_partQty",2),c([h()],K.prototype,"_readingRows",2),c([h()],K.prototype,"_readingText",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",K)});function Be(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function vr(s){return!s.startsWith("data:image/svg+xml,")&&!s.startsWith("data:image/png;base64,")?"":Be(s)}function hl(s){return s.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var Y,ta=y(()=>{"use strict";I();F();T();gr();Y=class extends S{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||N(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,n){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._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 n=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1]),n.length>2&&(this._quickResult=n[2])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,n=t?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?a("qr_error_no_url",this._dialogLang):a("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(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let o=this._dialogLang,d=Be(t),p=Be(i),_=!!this._completeResult,m=!!this._quickResult,f=Be(a("qr_action_view",o)),x=Be(a("qr_action_complete",o)),w=Be(a("qr_action_quick_complete",o));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
<meta name="color-scheme" content="light">
<title>${d}</title>
<style>
@@ -4040,21 +4048,21 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
${p?`<div class="sub">${p}</div>`:""}
<div class="qr-row">
<div class="qr-col">
<img src="${fr(this._viewResult.svg_data_uri)}" alt="QR Info" />
<img src="${vr(this._viewResult.svg_data_uri)}" alt="QR Info" />
<div class="qr-label">${f}</div>
</div>
${_?`<div class="qr-col">
<img src="${fr(this._completeResult.svg_data_uri)}" alt="QR Complete" />
<img src="${vr(this._completeResult.svg_data_uri)}" alt="QR Complete" />
<div class="qr-label">${x}</div>
</div>`:""}
${m?`<div class="qr-col">
<img src="${fr(this._quickResult.svg_data_uri)}" alt="QR Quick-complete" />
<img src="${vr(this._quickResult.svg_data_uri)}" alt="QR Quick-complete" />
<div class="qr-label">${w}</div>
</div>`:""}
</div>
<div class="url">${Be(this._viewResult.url)}</div>
<script>setTimeout(()=>window.print(),300)<\/script>
</body></html>`),n.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;Qn(i,`qr-${dl(n)}-${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?`${a("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${a("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return l`
</body></html>`),n.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;Zn(i,`qr-${hl(n)}-${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?`${a("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${a("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">
@@ -4250,14 +4258,14 @@ ${p?`<div class="sub">${p}</div>`:""}
color: var(--text-primary-color, #fff);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
`,c([v({attribute:!1})],Y.prototype,"hass",2),c([v()],Y.prototype,"lang",2),c([h()],Y.prototype,"_open",2),c([h()],Y.prototype,"_loading",2),c([h()],Y.prototype,"_error",2),c([h()],Y.prototype,"_viewResult",2),c([h()],Y.prototype,"_completeResult",2),c([h()],Y.prototype,"_quickResult",2),c([h()],Y.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",Y)});function ta(s,r,e=new Date){let t=s?.hours,i=Q(s?.snoozed_until);if(typeof t!="number"||!Number.isFinite(i))return a("snoozed",r);let n=fe(),d=ve(i,n)===ve(e,n)?ti(new Date(i),r):ii(s.snoozed_until,r);return(t===1?a("snoozed_for_one",r):a("snoozed_for",r).replace("{hours}",C(t,r))).replace("{until}",d)}var ia=y(()=>{"use strict";T();Z()});function pl(s,r){if(r<=0)return 0;let e=typeof s=="number"&&Number.isFinite(s)?Math.trunc(s):0;return e<0?0:e%r}function ul(s){return!!(s?.phases&&s.phase_sequence&&s.phase_sequence.length>0)}function vr(s){if(!s||!ul(s))return null;let r=s.phase_sequence,e=pl(s.phase_cursor,r.length),t=r[e],i=s.phases?.[t];return i?{id:t,name:i.name,index:e,count:r.length,notes:i.notes,checklist:i.checklist!==void 0?i.checklist:s.checklist??[],consumesParts:i.consumes_parts!==void 0?i.consumes_parts:s.consumes_parts??[],requiredFields:i.required_completion_fields!==void 0?i.required_completion_fields:s.required_completion_fields??[]}:null}function It(s){let r=vr(s);return r?`${r.index+1}/${r.count} \xB7 ${r.name}`:""}var yr=y(()=>{"use strict"});function hl(s,r){return typeof s=="number"&&Number.isFinite(s)&&s>=.01?s:r}function ra(s){let r=s.task??null,e=r?vr(r):null,t=e?e.consumesParts:r?.consumes_parts||[],i=!!r?.part_ref,n=s.objects.find(m=>m.entry_id===s.entryId)?.parts||[],o=i?n.find(m=>m.id===r.part_ref.part_id):void 0,d=s.features?s.features.checklists:s.checklistsEnabled??!0,p=s.features?s.features.checklists?s.checklist??r?.checklist??[]:[]:s.checklist??[],_=s.features?s.features.adaptive&&(s.adaptiveEnabled??!!r?.adaptive_config?.enabled):!!s.adaptiveEnabled;return{entry_id:s.entryId,task_id:s.taskId,task_name:s.taskName,checklist:e?d?e.checklist:[]:p,adaptive_enabled:_,required_completion_fields:e?e.requiredFields:r?.required_completion_fields||[],task_type:r?.type||"",reading_unit:r?.reading_unit||"",readings:r?.readings||[],reading_history:Ys(r?.history),parts:i?[]:yn({consumes_parts:t},s.entryId,s.objects,s.lang),consumes_parts:i?[]:t,phase_label:e?It(r):"",require_tag_scan:!!r?.require_tag_scan,restock_default:i?hl(o?.restock_quantity,1):null,restock_unit_cost:i?o?.cost??null:null,restock_package:i&&o?.package_size?Ze(o.package_size,o.unit,s.lang):"",currency_symbol:De({currency_symbol:s.currencySymbol}),consumes_info:t.map(m=>vn(m,s.entryId,s.objects,s.lang)),checklist_prefill:r?.checklist_progress||{},via_tag_scan:!!s.viaTagScan,parts_cost_mode:s.partsCostMode??"purchase"}}function sa(s,r,e){s.entryId=r.entry_id,s.taskId=r.task_id,s.taskName=r.task_name,s.lang=e,s.checklist=r.checklist??[],s.adaptiveEnabled=!!r.adaptive_enabled,s.requiredFields=r.required_completion_fields??[],s.taskType=r.task_type??"",s.readingUnit=r.reading_unit??"",s.readings=r.readings??[],s.readingHistory=r.reading_history??[],s.parts=r.parts??[],s.consumesParts=r.consumes_parts??[],s.phaseLabel=r.phase_label??"",s.requireTagScan=!!r.require_tag_scan,s.restockDefault=r.restock_default??null,s.restockUnitCost=r.restock_unit_cost??null,s.restockPackage=r.restock_package??"",s.currencySymbol=De(r),s.consumesInfo=r.consumes_info??[],s.checklistPrefill=r.checklist_prefill??{},s.viaTagScan=!!r.via_tag_scan,s.partsCostMode=r.parts_cost_mode??"purchase",s.open({viaTagScan:!!r.via_tag_scan})}var br=y(()=>{"use strict";je();di();yr();T()});var kh,na,aa=y(()=>{Ge();({I:kh}=Jr),na=s=>s.strings===void 0});var oa,xr,yi,bi=y(()=>{oa={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},xr=s=>(...r)=>({_$litDirective$:s,values:r}),yi=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}}});function _l(s){this._$AN!==void 0?(xi(this),this._$AM=s,la(this)):this._$AM=s}function ml(s,r=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(r)if(Array.isArray(t))for(let n=e;n<t.length;n++)Rt(t[n],!1),xi(t[n]);else t!=null&&(Rt(t,!1),xi(t));else Rt(this,s)}var Rt,xi,la,gl,wi,ca=y(()=>{aa();bi();bi();Rt=(s,r)=>{let e=s._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(r,!1),Rt(t,r);return!0},xi=s=>{let r,e;do{if((r=s._$AM)===void 0)break;e=r._$AN,e.delete(s),s=r}while(e?.size===0)},la=s=>{for(let r;r=s._$AM;s=r){let e=r._$AN;if(e===void 0)r._$AN=e=new Set;else if(e.has(s))break;e.add(s),gl(r)}};gl=s=>{s.type==oa.CHILD&&(s._$AP??=ml,s._$AQ??=_l)},wi=class extends yi{constructor(){super(...arguments),this._$AN=void 0}_$AT(r,e,t){super._$AT(r,e,t),la(this),this.isConnected=r._$AU}_$AO(r,e=!0){r!==this.isConnected&&(this.isConnected=r,r?this.reconnected?.():this.di Line truncated
`,c([v({attribute:!1})],Y.prototype,"hass",2),c([v()],Y.prototype,"lang",2),c([h()],Y.prototype,"_open",2),c([h()],Y.prototype,"_loading",2),c([h()],Y.prototype,"_error",2),c([h()],Y.prototype,"_viewResult",2),c([h()],Y.prototype,"_completeResult",2),c([h()],Y.prototype,"_quickResult",2),c([h()],Y.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",Y)});function ia(s,r,e=new Date){let t=s?.hours,i=Q(s?.snoozed_until);if(typeof t!="number"||!Number.isFinite(i))return a("snoozed",r);let n=fe(),d=ve(i,n)===ve(e,n)?ti(new Date(i),r):ii(s.snoozed_until,r);return(t===1?a("snoozed_for_one",r):a("snoozed_for",r).replace("{hours}",C(t,r))).replace("{until}",d)}var ra=y(()=>{"use strict";T();Z()});function _l(s,r){if(r<=0)return 0;let e=typeof s=="number"&&Number.isFinite(s)?Math.trunc(s):0;return e<0?0:e%r}function ml(s){return!!(s?.phases&&s.phase_sequence&&s.phase_sequence.length>0)}function yr(s){if(!s||!ml(s))return null;let r=s.phase_sequence,e=_l(s.phase_cursor,r.length),t=r[e],i=s.phases?.[t];return i?{id:t,name:i.name,index:e,count:r.length,notes:i.notes,checklist:i.checklist!==void 0?i.checklist:s.checklist??[],consumesParts:i.consumes_parts!==void 0?i.consumes_parts:s.consumes_parts??[],requiredFields:i.required_completion_fields!==void 0?i.required_completion_fields:s.required_completion_fields??[]}:null}function It(s){let r=yr(s);return r?`${r.index+1}/${r.count} \xB7 ${r.name}`:""}var br=y(()=>{"use strict"});function gl(s,r){return typeof s=="number"&&Number.isFinite(s)&&s>=.01?s:r}function sa(s){let r=s.task??null,e=r?yr(r):null,t=e?e.consumesParts:r?.consumes_parts||[],i=!!r?.part_ref,n=s.objects.find(m=>m.entry_id===s.entryId)?.parts||[],o=i?n.find(m=>m.id===r.part_ref.part_id):void 0,d=s.features?s.features.checklists:s.checklistsEnabled??!0,p=s.features?s.features.checklists?s.checklist??r?.checklist??[]:[]:s.checklist??[],_=s.features?s.features.adaptive&&(s.adaptiveEnabled??!!r?.adaptive_config?.enabled):!!s.adaptiveEnabled;return{entry_id:s.entryId,task_id:s.taskId,task_name:s.taskName,checklist:e?d?e.checklist:[]:p,adaptive_enabled:_,required_completion_fields:e?e.requiredFields:r?.required_completion_fields||[],task_type:r?.type||"",reading_unit:r?.reading_unit||"",readings:r?.readings||[],reading_history:Qs(r?.history),parts:i?[]:bn({consumes_parts:t},s.entryId,s.objects,s.lang),consumes_parts:i?[]:t,phase_label:e?It(r):"",require_tag_scan:!!r?.require_tag_scan,restock_default:i?gl(o?.restock_quantity,1):null,restock_unit_cost:i?o?.cost??null:null,restock_package:i&&o?.package_size?Ze(o.package_size,o.unit,s.lang):"",currency_symbol:De({currency_symbol:s.currencySymbol}),consumes_info:t.map(m=>yn(m,s.entryId,s.objects,s.lang)),checklist_prefill:r?.checklist_progress||{},via_tag_scan:!!s.viaTagScan,parts_cost_mode:s.partsCostMode??"purchase"}}function na(s,r,e){s.entryId=r.entry_id,s.taskId=r.task_id,s.taskName=r.task_name,s.lang=e,s.checklist=r.checklist??[],s.adaptiveEnabled=!!r.adaptive_enabled,s.requiredFields=r.required_completion_fields??[],s.taskType=r.task_type??"",s.readingUnit=r.reading_unit??"",s.readings=r.readings??[],s.readingHistory=r.reading_history??[],s.parts=r.parts??[],s.consumesParts=r.consumes_parts??[],s.phaseLabel=r.phase_label??"",s.requireTagScan=!!r.require_tag_scan,s.restockDefault=r.restock_default??null,s.restockUnitCost=r.restock_unit_cost??null,s.restockPackage=r.restock_package??"",s.currencySymbol=De(r),s.consumesInfo=r.consumes_info??[],s.checklistPrefill=r.checklist_prefill??{},s.viaTagScan=!!r.via_tag_scan,s.partsCostMode=r.parts_cost_mode??"purchase",s.open({viaTagScan:!!r.via_tag_scan})}var xr=y(()=>{"use strict";je();di();br();T()});var Th,aa,oa=y(()=>{Ge();({I:Th}=Xr),aa=s=>s.strings===void 0});var la,wr,yi,bi=y(()=>{la={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},wr=s=>(...r)=>({_$litDirective$:s,values:r}),yi=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}}});function fl(s){this._$AN!==void 0?(xi(this),this._$AM=s,ca(this)):this._$AM=s}function vl(s,r=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(r)if(Array.isArray(t))for(let n=e;n<t.length;n++)Rt(t[n],!1),xi(t[n]);else t!=null&&(Rt(t,!1),xi(t));else Rt(this,s)}var Rt,xi,ca,yl,wi,da=y(()=>{oa();bi();bi();Rt=(s,r)=>{let e=s._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(r,!1),Rt(t,r);return!0},xi=s=>{let r,e;do{if((r=s._$AM)===void 0)break;e=r._$AN,e.delete(s),s=r}while(e?.size===0)},ca=s=>{for(let r;r=s._$AM;s=r){let e=r._$AN;if(e===void 0)r._$AN=e=new Set;else if(e.has(s))break;e.add(s),yl(r)}};yl=s=>{s.type==la.CHILD&&(s._$AP??=vl,s._$AQ??=fl)},wi=class extends yi{constructor(){super(...arguments),this._$AN=void 0}_$AT(r,e,t){super._$AT(r,e,t),ca(this),this.isConnected=r._$AU}_$AO(r,e=!0){r!==this.isConnected&&(this.isConnected=r,r?this.reconnected?.():this.di Line truncated
class="notes-md"
.content=${r}
breaks
${da(t=>xl(t,e))}
></ha-markdown>`}return l`${s}`}function bl(s){let r=[],e=n=>{let o=$r(n);return!o||vl.has(o)||!ki(n)?null:(r.push(kr(n)),`${Tr}${r.length-1}`)},t=n=>n.replace(new RegExp(`(!?)(\\[[^\\]\\n]*\\]\\(\\s*)<(${$i}[^>\\n]*)>`,"g"),(o,d,p,_)=>{let m=d?null:e(_);return m?`${p}${m}`:o}).replace(new RegExp(`(!?)(\\[[^\\]\\n]*\\]\\(\\s*)(${$i}[^\\s)]*)`,"g"),(o,d,p,_)=>{let m=d?null:e(_);return m?`${p}${m}`:o}).replace(new RegExp(`(^|[^(])<(${$i}[^\\s<>]*)>`,"gm"),(o,d,p)=>{let _=e(p);return _?`${d}[${p.replace(/([\\[\]])/g,"\\$1")}](${_})`:o}).replace(new RegExp(`^( {0,3}\\[[^\\]\\n]+\\]:[ \\t]*)<?(${$i}[^\\s>]*)>?`,"gm"),(o,d,p)=>{let _=e(p);return _?`${d}${_}`:o});return{content:s.split(yl).map((n,o)=>o%2?n:t(n)).join(""),links:r}}function Sr(s,r){for(let e of s.querySelectorAll(`a[href^="${Tr}"]`)){let t=r[Number(e.getAttribute("href").slice(Tr.length))];t&&e.setAttribute("href",t)}}function xl(s,r){if(!s)return;let e=_a.get(s);if(!e&&r.length===0)return;if(e){e.links=r,s.shadowRoot&&Sr(s.shadowRoot,r);return}let t={links:r};_a.set(s,t),(async()=>{await s.updateComplete;let i=s.shadowRoot;i&&(new MutationObserver(()=>Sr(i,t.links)).observe(i,{childList:!0,subtree:!0}),Sr(i,t.links))})()}var Tr,vl,yl,$i,_a,Ar=y(()=>{"use strict";I();ua();Er();Tr="https://app-link.invalid/",vl=new Set(["http","https","mailto","tel","ftp"]),yl=/(```[\s\S]*?```|~~~[\s\S]*?~~~|`[^`\n]*`)/,$i="[a-zA-Z][a-zA-Z0-9+.-]+:";_a=new WeakMap});function wl(s){return s&&ma(s.ref_no)?String(s.ref_no):null}function ga(s,r){let e=wl(s);return e&&r&&ma(r.ref_no)?`${e}.${r.ref_no}`:null}function fa(s,r){return s?l`<span class="ref-chip" title=${r??""}>#${s}</span>`:u}var ma,Cr=y(()=>{"use strict";I();ma=s=>typeof s=="number"&&Number.isInteger(s)&&s>0});var va=y(()=>{"use strict"});function ya(s,r){if(!s)return"";let e=kl[s.trim()];if(e)return a(e,r);for(let[t,i,n]of $l){let o=s.trim().match(t);if(o){let d=n(o,r);return a(i,r).replace(/\{(\w+)\}/g,(p,_)=>d[_]??p)}}return s}var kl,$l,ba=y(()=>{"use strict";T();kl={"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"},$l=[[/^Auto-completed: sensor recovered \((.+)\)$/,"hist_note_auto_recovered",s=>({value:s[1]})],[/^Reset to (\d{4}-\d{2}-\d{2})$/,"hist_note_reset",(s,r)=>({date:O(s[1],r)})],[/^Trigger entity replaced: (.+) → (.+)$/,"hist_note_trigger_replaced",s=>({old:s[1],new:s[2]})],[/^Sensor trigger removed \(entity was: (.+)\)\. Schedule converted to (\w+)\.$/,"hist_note_trigger_removed",(s,r)=>({entity:s[1],schedule:a(s[2],r)})],[/^Entity (.+) removed from compound trigger; (\d+) conditions remain\.$/,"hist_note_compound_removed",s=>({entity:s[1],count:s[2]})]]});function xa(s){let r=e=>{let t=Q(e.timestamp);return Number.isNaN(t)?-1/0:t};return(s??[]).map((e,t)=>({entry:e,index:t,at:r(e)})).sort((e,t)=>t.at-e.at||t.index-e.index).map(e=>e.entry)}function Sl(s,r){return s.taskRef&&r.ref_no?`${s.taskRef}-${r.ref_no}`:null}function Tl(s,r){let e=ai(r);return e.length>0?l`<div class="history-photos">
${pa(t=>$l(t,e))}
></ha-markdown>`}return l`${s}`}function kl(s){let r=[],e=n=>{let o=Er(n);return!o||xl.has(o)||!ki(n)?null:(r.push($r(n)),`${Ar}${r.length-1}`)},t=n=>n.replace(new RegExp(`(!?)(\\[[^\\]\\n]*\\]\\(\\s*)<(${$i}[^>\\n]*)>`,"g"),(o,d,p,_)=>{let m=d?null:e(_);return m?`${p}${m}`:o}).replace(new RegExp(`(!?)(\\[[^\\]\\n]*\\]\\(\\s*)(${$i}[^\\s)]*)`,"g"),(o,d,p,_)=>{let m=d?null:e(_);return m?`${p}${m}`:o}).replace(new RegExp(`(^|[^(])<(${$i}[^\\s<>]*)>`,"gm"),(o,d,p)=>{let _=e(p);return _?`${d}[${p.replace(/([\\[\]])/g,"\\$1")}](${_})`:o}).replace(new RegExp(`^( {0,3}\\[[^\\]\\n]+\\]:[ \\t]*)<?(${$i}[^\\s>]*)>?`,"gm"),(o,d,p)=>{let _=e(p);return _?`${d}${_}`:o});return{content:s.split(wl).map((n,o)=>o%2?n:t(n)).join(""),links:r}}function Tr(s,r){for(let e of s.querySelectorAll(`a[href^="${Ar}"]`)){let t=r[Number(e.getAttribute("href").slice(Ar.length))];t&&e.setAttribute("href",t)}}function $l(s,r){if(!s)return;let e=ma.get(s);if(!e&&r.length===0)return;if(e){e.links=r,s.shadowRoot&&Tr(s.shadowRoot,r);return}let t={links:r};ma.set(s,t),(async()=>{await s.updateComplete;let i=s.shadowRoot;i&&(new MutationObserver(()=>Tr(i,t.links)).observe(i,{childList:!0,subtree:!0}),Tr(i,t.links))})()}var Ar,xl,wl,$i,ma,Cr=y(()=>{"use strict";I();ha();Sr();Ar="https://app-link.invalid/",xl=new Set(["http","https","mailto","tel","ftp"]),wl=/(```[\s\S]*?```|~~~[\s\S]*?~~~|`[^`\n]*`)/,$i="[a-zA-Z][a-zA-Z0-9+.-]+:";ma=new WeakMap});function El(s){return s&&ga(s.ref_no)?String(s.ref_no):null}function fa(s,r){let e=El(s);return e&&r&&ga(r.ref_no)?`${e}.${r.ref_no}`:null}function va(s,r){return s?l`<span class="ref-chip" title=${r??""}>#${s}</span>`:u}var ga,Ir=y(()=>{"use strict";I();ga=s=>typeof s=="number"&&Number.isInteger(s)&&s>0});var ya=y(()=>{"use strict"});function ba(s,r){if(!s)return"";let e=Sl[s.trim()];if(e)return a(e,r);for(let[t,i,n]of Tl){let o=s.trim().match(t);if(o){let d=n(o,r);return a(i,r).replace(/\{(\w+)\}/g,(p,_)=>d[_]??p)}}return s}var Sl,Tl,xa=y(()=>{"use strict";T();Sl={"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"},Tl=[[/^Auto-completed: sensor recovered \((.+)\)$/,"hist_note_auto_recovered",s=>({value:s[1]})],[/^Reset to (\d{4}-\d{2}-\d{2})$/,"hist_note_reset",(s,r)=>({date:O(s[1],r)})],[/^Trigger entity replaced: (.+) → (.+)$/,"hist_note_trigger_replaced",s=>({old:s[1],new:s[2]})],[/^Sensor trigger removed \(entity was: (.+)\)\. Schedule converted to (\w+)\.$/,"hist_note_trigger_removed",(s,r)=>({entity:s[1],schedule:a(s[2],r)})],[/^Entity (.+) removed from compound trigger; (\d+) conditions remain\.$/,"hist_note_compound_removed",s=>({entity:s[1],count:s[2]})]]});function wa(s){let r=e=>{let t=Q(e.timestamp);return Number.isNaN(t)?-1/0:t};return(s??[]).map((e,t)=>({entry:e,index:t,at:r(e)})).sort((e,t)=>t.at-e.at||t.index-e.index).map(e=>e.entry)}function Cl(s,r){return s.taskRef&&r.ref_no?`${s.taskRef}-${r.ref_no}`:null}function Il(s,r){let e=ai(r);return e.length>0?l`<div class="history-photos">
${e.map(t=>l`<maintenance-history-photo .hass=${s} .docId=${t}></maintenance-history-photo>`)}
</div>`:u}function Al(s,r){let e=r.lang,t=o=>C(o,e,{maximumFractionDigits:3}),i=o=>o==null?"":` (${o>=0?"+":""}${t(o)})`,n=xe(s);return n.length>0?l`<div class="history-readings">
</div>`:u}function Rl(s,r){let e=r.lang,t=o=>C(o,e,{maximumFractionDigits:3}),i=o=>o==null?"":` (${o>=0?"+":""}${t(o)})`,n=xe(s);return n.length>0?l`<div class="history-readings">
${n.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(r.readingSlotDelta?.(s,o.id))}</span>
@@ -4265,7 +4273,7 @@ ${p?`<div class="sub">${p}</div>`:""}
</div>`:s.reading_value!=null?l`<div class="history-readings"><span class="history-reading">
<span class="history-reading-name">${a("reading_label",e)}</span>
<span class="history-reading-value">${t(s.reading_value)}${r.readingUnit?` ${r.readingUnit}`:""}${i(r.readingDelta?.(s))}</span>
</span></div>`:u}function wa(s,r,e={}){let t=r.lang,{compact:i=!1,showRef:n=!0,showBadges:o=!0,showEdit:d=!0}=e,p=r.openEdit,_=d&&!!p&&El.includes(s.type),m=typeof s.parts_cost=="number"?s.parts_cost:null,f=s.cost_basis==="use",x=f&&!!s.purchase;return l`
</span></div>`:u}function ka(s,r,e={}){let t=r.lang,{compact:i=!1,showRef:n=!0,showBadges:o=!0,showEdit:d=!0}=e,p=r.openEdit,_=d&&!!p&&Al.includes(s.type),m=typeof s.parts_cost=="number"?s.parts_cost:null,f=s.cost_basis==="use",x=f&&!!s.purchase;return l`
<div class="history-entry${i?" compact":""}">
${i?u:l`<div class="history-icon ${s.type}">
<ha-icon .icon=${yt[s.type]||"mdi:circle"}></ha-icon>
@@ -4273,7 +4281,7 @@ ${p?`<div class="sub">${p}</div>`:""}
<div class="history-content">
<div class="history-row">
<strong>${a(s.type,t)}</strong>
${n?fa(Sl(r,s),a("ref_number",t)):u}
${n?va(Cl(r,s),a("ref_number",t)):u}
${o&&s.phase_id?l`<span class="history-phase-badge">${r.phaseNames?.[s.phase_id]||s.phase_id}</span>`:u}
${o&&s.auto?l`<span class="history-auto-badge">${a("history_auto",t)}</span>`:u}
${_?l`<button class="history-edit-btn"
@@ -4283,9 +4291,9 @@ ${p?`<div class="sub">${p}</div>`:""}
</button>`:u}
</div>
<div class="history-date">${ii(s.timestamp,t)}</div>
${s.notes?l`<div class="history-notes">${ya(s.notes,t)}</div>`:u}
${Tl(r.hass,s)}
${Al(s,r)}
${s.notes?l`<div class="history-notes">${ba(s.notes,t)}</div>`:u}
${Il(r.hass,s)}
${Rl(s,r)}
${s.cost!=null||s.duration!=null||s.trigger_value!=null||m!=null?l`<div class="history-details">
${s.cost!=null?x?l`<span>${a("history_purchase_stock",t).replace("{amount}",J(s.cost,r.currencySymbol,t))}</span>`:s.cost<0?l`<span class="history-credit">${a("cost_kind_credit",t)}: ${J(-s.cost,r.currencySymbol,t)}</span>`:l`<span>${a("cost",t)}: ${J(s.cost,r.currencySymbol,t)}</span>`:u}
${m!=null?l`<span title=${a(f?"history_parts_counted_hint":"history_parts_info_hint",t)}>${a(f?"history_parts_counted":"history_parts_info",t).replace("{amount}",J(m,r.currencySymbol,t))}</span>`:u}
@@ -4294,23 +4302,23 @@ ${p?`<div class="sub">${p}</div>`:""}
</div>`:u}
</div>
</div>
`}var El,ka=y(()=>{"use strict";I();T();gr();oi();Cr();je();va();ba();Z();El=["completed","reset","skipped"]});function Pt(s){return s.archived?"archived":s.is_done?"done":s.status||"ok"}function Ir(s,r){return a(s==="done"?"completed":s,r)}function Si(s){let r=Pt(s);return r==="done"?Cl:Mi[r]||"var(--disabled-color, #9e9e9e)"}function Il(s){return yt[s==="done"?"completed":s]||"mdi:circle-medium"}function $a(s,r,e="pill"){let t=Pt(s),i=Ir(t,r);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="${Il(t)}"></ha-icon><span class="status-label">${i}</span></span>`}var Cl,Rr=y(()=>{"use strict";I();T();Kt();Cl="var(--maint-done-color, #78909c)"});var Ti,Ea=y(()=>{"use strict";Ti=class{constructor(){this._handle=null}schedule(r,e=4e3){this.clear(),this._handle=setTimeout(()=>{this._handle=null,r()},e)}clear(){this._handle!==null&&(clearTimeout(this._handle),this._handle=null)}get pending(){return this._handle!==null}}});function A(s){return s.toFixed(1)}var Pr=y(()=>{"use strict";T();Z()});function Sa(s,r){let e=s.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return u;let n=s.interval_days??0,o=s.suggested_interval??n;return l`
`}var Al,$a=y(()=>{"use strict";I();T();fr();oi();Ir();je();ya();xa();Z();Al=["completed","reset","skipped"]});function Pt(s){return s.archived?"archived":s.is_done?"done":s.status||"ok"}function Rr(s,r){return a(s==="done"?"completed":s,r)}function Si(s){let r=Pt(s);return r==="done"?Pl:Mi[r]||"var(--disabled-color, #9e9e9e)"}function Ll(s){return yt[s==="done"?"completed":s]||"mdi:circle-medium"}function Ea(s,r,e="pill"){let t=Pt(s),i=Rr(t,r);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="${Ll(t)}"></ha-icon><span class="status-label">${i}</span></span>`}var Pl,Pr=y(()=>{"use strict";I();T();Kt();Pl="var(--maint-done-color, #78909c)"});var Ti,Sa=y(()=>{"use strict";Ti=class{constructor(){this._handle=null}schedule(r,e=4e3){this.clear(),this._handle=setTimeout(()=>{this._handle=null,r()},e)}clear(){this._handle!==null&&(clearTimeout(this._handle),this._handle=null)}get pending(){return this._handle!==null}}});function A(s){return s.toFixed(1)}var Lr=y(()=>{"use strict";T();Z()});function Ta(s,r){let e=s.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return u;let n=s.interval_days??0,o=s.suggested_interval??n;return l`
<div class="weibull-section">
<div class="weibull-title">
<ha-svg-icon aria-hidden="true" path="M3,14L3.5,14.07L8.07,9.5C7.89,8.85 8.06,8.11 8.59,7.59C9.37,6.8 10.63,6.8 11.41,7.59C11.94,8.11 12.11,8.85 11.93,9.5L14.5,12.07L15,12C15.18,12 15.35,12 15.5,12.07L19.07,8.5C19,8.35 19,8.18 19,8A2,2 0 0,1 21,6A2,2 0 0,1 23,8A2,2 0 0,1 21,10C20.82,10 20.65,10 20.5,9.93L16.93,13.5C17,13.65 17,13.82 17,14A2,2 0 0,1 15,16A2,2 0 0,1 13,14L13.07,13.5L10.5,10.93C10.18,11 9.82,11 9.5,10.93L4.93,15.5L5,16A2,2 0 0,1 3,18A2,2 0 0,1 1,16A2,2 0 0,1 3,14Z"></ha-svg-icon>
${a("weibull_reliability_curve",r)}
${Rl(t,r)}
${Nl(t,r)}
</div>
${Pl(t,i,n,o,r)}
${Ll(e,r)}
${e?.confidence_interval_low!=null?Nl(e,s,r):u}
${Hl(t,i,n,o,r)}
${ql(e,r)}
${e?.confidence_interval_low!=null?Ol(e,s,r):u}
</div>
`}function Rl(s,r){let e,t,i;return s<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):s<=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"):s<=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 Nl(s,r){let e,t,i;return s<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):s<=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"):s<=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>
${a(i,r)} (\u03B2=${C(s,r,2)})
</span>
`}function Pl(s,r,e,t,i){let w=Math.max(e,t,r,1)*1.3,k=50,H=[];for(let q=0;q<=k;q++){let z=q/k*w,ct=1-Math.exp(-Math.pow(z/r,s)),dt=32+z/w*260,Ai=136-ct*128;H.push([dt,Ai])}let L=H.map(([q,z])=>`${A(q)},${A(z)}`).join(" "),M="M32,136 "+H.map(([q,z])=>`L${A(q)},${A(z)}`).join(" ")+` L${A(H[k][0])},136 Z`,B=32+e/w*260,W=1-Math.exp(-Math.pow(e/r,s)),b=136-W*128,le=C((1-W)*100,i,0),Se=32+t/w*260,me=[0,.25,.5,.75,1];return l`
`}function Hl(s,r,e,t,i){let w=Math.max(e,t,r,1)*1.3,k=50,H=[];for(let q=0;q<=k;q++){let z=q/k*w,ct=1-Math.exp(-Math.pow(z/r,s)),dt=32+z/w*260,Ai=136-ct*128;H.push([dt,Ai])}let L=H.map(([q,z])=>`${A(q)},${A(z)}`).join(" "),M="M32,136 "+H.map(([q,z])=>`L${A(q)},${A(z)}`).join(" ")+` L${A(H[k][0])},136 Z`,B=32+e/w*260,W=1-Math.exp(-Math.pow(e/r,s)),b=136-W*128,le=C((1-W)*100,i,0),Se=32+t/w*260,me=[0,.25,.5,.75,1];return l`
<div class="weibull-chart">
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${a("chart_weibull",i)}">
${me.map(q=>{let z=136-q*128;return Ve`
@@ -4353,7 +4361,7 @@ ${p?`<div class="sub">${p}</div>`:""}
${e>0?l`<span class="legend-item"><span class="legend-swatch" style="background:var(--primary-color, #03a9f4); opacity:0.5"></span> ${a("current_interval_marker",i)}</span>`:u}
${t>0&&t!==e?l`<span class="legend-item"><span class="legend-swatch" style="background:var(--success-color, #4caf50)"></span> ${a("recommended_marker",i)}</span>`:u}
</div>
`}function Ll(s,r){return l`
`}function ql(s,r){return l`
<div class="weibull-info-row">
<div class="weibull-info-item">
<span>${a("characteristic_life",r)}</span>
@@ -4366,7 +4374,7 @@ ${p?`<div class="sub">${p}</div>`:""}
</div>
`:u}
</div>
`}function Nl(s,r,e){let t=s.confidence_interval_low,i=s.confidence_interval_high,n=r.suggested_interval??r.interval_days??0,o=r.interval_days??0,d=Math.max(0,t-5),_=i+5-d,m=(t-d)/_*100,f=(i-t)/_*100,x=(n-d)/_*100,w=o>0?(o-d)/_*100:-1;return l`
`}function Ol(s,r,e){let t=s.confidence_interval_low,i=s.confidence_interval_high,n=r.suggested_interval??r.interval_days??0,o=r.interval_days??0,d=Math.max(0,t-5),_=i+5-d,m=(t-d)/_*100,f=(i-t)/_*100,x=(n-d)/_*100,w=o>0?(o-d)/_*100:-1;return l`
<div class="confidence-range">
<div class="confidence-range-title">
${a("confidence_interval",e)}: ${n} ${a("days",e)} (${t}\u2013${i})
@@ -4381,7 +4389,7 @@ ${p?`<div class="sub">${p}</div>`:""}
<span class="confidence-text high">${a("confidence_aggressive",e)} (${i}${a("days",e).charAt(0)})</span>
</div>
</div>
`}var Ta=y(()=>{"use strict";I();T();Pr()});function Aa(s,r,e){let t=s.degradation_trend!=null&&s.degradation_trend!=="insufficient_data",i=s.days_until_threshold!=null,n=s.environmental_factor!=null&&s.environmental_factor!==1;if(!t&&!i&&!n)return u;let o=s.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":s.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 Aa=y(()=>{"use strict";I();T();Lr()});function Ca(s,r,e){let t=s.degradation_trend!=null&&s.degradation_trend!=="insufficient_data",i=s.days_until_threshold!=null,n=s.environmental_factor!=null&&s.environmental_factor!==1;if(!t&&!i&&!n)return u;let o=s.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":s.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">
${s.sensor_prediction_urgency?l`
<div class="prediction-urgency-banner">
@@ -4417,12 +4425,12 @@ ${p?`<div class="sub">${p}</div>`:""}
<ha-svg-icon path="M15,13V5A3,3 0 0,0 12,2A3,3 0 0,0 9,5V13A5,5 0 0,0 7,17A5,5 0 0,0 12,22A5,5 0 0,0 17,17A5,5 0 0,0 15,13M12,4A1,1 0 0,1 13,5V8H11V5A1,1 0 0,1 12,4Z"></ha-svg-icon>
<span class="prediction-label">${a("environmental_adjustment",r)}</span>
<span class="prediction-value">${C(s.environmental_factor,r,2)}x</span>
${s.environmental_entity?l`<span class="prediction-entity entity-link" @click=${d=>Bs(d,s.environmental_entity)}>${s.environmental_entity}</span>`:u}
${s.environmental_entity?l`<span class="prediction-entity entity-link" @click=${d=>Ws(d,s.environmental_entity)}>${s.environmental_entity}</span>`:u}
</div>
`:u}
</div>
</div>
`}var Ca=y(()=>{"use strict";I();T()});function Ia(s,r,e,t){let i=Math.max(s||1,r);return l`
`}var Ia=y(()=>{"use strict";I();T()});function Ra(s,r,e,t){let i=Math.max(s||1,r);return l`
<div class="interval-comparison">
<div class="interval-bar">
<div class="interval-label">
@@ -4440,7 +4448,7 @@ ${p?`<div class="sub">${p}</div>`:""}
style="width: ${Math.min(r/i*100,100)}%"></div>
</div>
</div>
`}var Ra=y(()=>{"use strict";I();T()});function La(){return Number(ye().slice(5,7))-1}function Na(s,r,e){if(!e.seasonal||!s.seasonal_factor||s.seasonal_factor===1)return u;let t=Pa.map(d=>a(d,r)),i=La(),n=s.seasonal_factors||s.interval_analysis?.seasonal_factors||null,o=n&&n.length===12?n:t.map((d,p)=>{let _=s.seasonal_factor||1,m=Math.sin((p-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,_+m))});return l`
`}var Pa=y(()=>{"use strict";I();T()});function Na(){return Number(ye().slice(5,7))-1}function Ha(s,r,e){if(!e.seasonal||!s.seasonal_factor||s.seasonal_factor===1)return u;let t=La.map(d=>a(d,r)),i=Na(),n=s.seasonal_factors||s.interval_analysis?.seasonal_factors||null,o=n&&n.length===12?n:t.map((d,p)=>{let _=s.seasonal_factor||1,m=Math.sin((p-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,_+m))});return l`
<div class="seasonal-card-compact">
<h4>${a("seasonal_awareness",r)}</h4>
<div class="seasonal-mini-chart">
@@ -4457,7 +4465,7 @@ ${p?`<div class="sub">${p}</div>`:""}
<span class="legend-item"><span class="dot high"></span> ${a("longer",r)}</span>
</div>
</div>
`}function Ha(s,r){return Hl(s,r)}function Hl(s,r){let e=s.seasonal_factors??s.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return u;let t=s.interval_analysis?.seasonal_reason,i=La(),n=300,o=100,d=8,_=o-d-4,m=Math.max(...e,1.5),f=n/12,x=f*.65,w=d+_-1/m*_;return l`
`}function qa(s,r){return Dl(s,r)}function Dl(s,r){let e=s.seasonal_factors??s.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return u;let t=s.interval_analysis?.seasonal_reason,i=Na(),n=300,o=100,d=8,_=o-d-4,m=Math.max(...e,1.5),f=n/12,x=f*.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>
@@ -4474,13 +4482,13 @@ ${p?`<div class="sub">${p}</div>`:""}
`})}
</svg>
<div class="seasonal-labels">
${Pa.map((k,H)=>l`<span class="seasonal-label ${H===i?"active-month":""}">${a(k,r)}</span>`)}
${La.map((k,H)=>l`<span class="seasonal-label ${H===i?"active-month":""}">${a(k,r)}</span>`)}
</div>
</div>
`}var Pa,qa=y(()=>{"use strict";I();T();Pr();Z();Pa=["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 P,Oa=y(()=>{"use strict";I();F();T();ze();ia();fi();Z();br();yr();Ar();ir();je();Cr();ka();Rr();Tt();wt();vi();Ea();Ta();Ca();Ra();tt();qa();P=class extends S{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 Ti;this._access=Me;this._currencySymbol="";this._partsCostMode="purchase";this._loadSeq=0}get _lang(){return N(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=ye(),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){let e=await se(this.hass);this._features={...this._features,...e.features},this._access=e.access,this._currencySymbol=De(e.budget??void 0),ei(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,n="",o=await D(this,{type:"maintenance_supporter/object",entry_id:e},{onError:p=>{n=p}});if(i!==this._loadSeq)return;if(o===void 0){this._error=n;return}this._objectName=o?.object?.name||"";let d=(o?.tasks||[]).find(p=>p.id===t);this._task=d??null,this._taskRef=ga(o?.object,d),d||(this._error=a("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(()=>(oe(),ue)).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(ra({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:ta(e,this._lang)},bubbles:!0,composed:!0})),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(oe(),ue)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(oe(),ue)).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 Ue(this.hass,{title:a("delete",this._lang),message:a("delete_task_confirm",this._lang),confirmText:a("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 La,Oa=y(()=>{"use strict";I();T();Lr();Z();La=["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 P,Da=y(()=>{"use strict";I();F();T();ze();ra();fi();Z();xr();br();Cr();rr();je();Ir();$a();Pr();Tt();wt();vi();Sa();Aa();Ia();Pa();tt();Oa();P=class extends S{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 Ti;this._access=Me;this._currencySymbol="";this._partsCostMode="purchase";this._loadSeq=0}get _lang(){return N(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=ye(),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){let e=await se(this.hass);this._features={...this._features,...e.features},this._access=e.access,this._currencySymbol=De(e.budget??void 0),ei(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,n="",o=await D(this,{type:"maintenance_supporter/object",entry_id:e},{onError:p=>{n=p}});if(i!==this._loadSeq)return;if(o===void 0){this._error=n;return}this._objectName=o?.object?.name||"";let d=(o?.tasks||[]).find(p=>p.id===t);this._task=d??null,this._taskRef=fa(o?.object,d),d||(this._error=a("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(()=>(oe(),ue)).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(sa({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:ia(e,this._lang)},bubbles:!0,composed:!0})),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(oe(),ue)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(oe(),ue)).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 Ue(this.hass,{title:a("delete",this._lang),message:a("delete_task_confirm",this._lang),confirmText:a("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>${a("suggested_interval",t)}</h4>
${Ia(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
${Ra(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
<div class="recommendation-actions">
${we(this.hass?.user,this._access)?l`<button class="btn primary qa-apply-suggestion"
@click=${this._applySuggestion} ?disabled=${this._busy}>
@@ -4500,14 +4508,14 @@ ${p?`<div class="sub">${p}</div>`:""}
<div class="adaptive-stack">
${this._toast?l`<div class="toast">${this._toast}</div>`:u}
${i?this._renderRecommendation(e):u}
${n?Aa(e,t,this._features):u}
${o?Sa(e,t):u}
${n?Ca(e,t,this._features):u}
${o?Ta(e,t):u}
${d?l`
${Na(e,t,this._features)}
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?Ha(e,t):u}
${Ha(e,t,this._features)}
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?qa(e,t):u}
`:u}
</div>
`}_renderDetails(e){let t=this._lang,i=e.history||[],n=e.history_count??i.length,o=xa(i).slice(0,20);return l`
`}_renderDetails(e){let t=this._lang,i=e.history||[],n=e.history_count??i.length,o=wa(i).slice(0,20);return l`
<div class="details">
<div class="stats-grid">
<div class="stat">
@@ -4529,7 +4537,7 @@ ${p?`<div class="sub">${p}</div>`:""}
</div>
${i.length===0?l`<div class="history-empty">${a("history_empty",t)}</div>`:l`
<div class="history-list">
${o.map(d=>wa(d,{lang:t,hass:this.hass,currencySymbol:this._currencySymbol,openEdit:we(this.hass?.user,this._access)?p=>this._onEditHistoryEntry(p):void 0,readingUnit:e.reading_unit,readingSlotDelta:(p,_)=>Zs(i,p,_),taskRef:this._taskRef},{compact:!0}))}
${o.map(d=>ka(d,{lang:t,hass:this.hass,currencySymbol:this._currencySymbol,openEdit:we(this.hass?.user,this._access)?p=>this._onEditHistoryEntry(p):void 0,readingUnit:e.reading_unit,readingSlotDelta:(p,_)=>Js(i,p,_),taskRef:this._taskRef},{compact:!0}))}
${n>o.length?l`<div class="history-more">… +${n-o.length} ${a("older_entries",t)}</div>`:u}
</div>
`}
@@ -4540,7 +4548,7 @@ ${p?`<div class="sub">${p}</div>`:""}
<div class="title">
<span class="status-dot" style="background: ${Si(t)}"></span>
<span class="task-name">${t.name}</span>
${$a(t,e)}
${Ea(t,e)}
</div>
<div class="object">
<button class="link-inline" @click=${()=>{this._entryId&&Promise.resolve().then(()=>(oe(),ue)).then(({openObjectQuickActions:o})=>{o(this._entryId),this.close()})}}>${this._objectName}</button>
@@ -4548,7 +4556,7 @@ ${p?`<div class="sub">${p}</div>`:""}
<div class="quick-info">
${t.next_due?l`<span><strong>${a("next_due",e)}:</strong> ${O(t.next_due,e)}</span>`:u}
${t.last_performed?l`<span><strong>${a("last_performed",e)}:</strong> ${O(t.last_performed,e)}</span>`:u}
${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?l`<span><strong>${a("interval",e)}:</strong> ${Us(t,e)}</span>`:u}
${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?l`<span><strong>${a("interval",e)}:</strong> ${Bs(t,e)}</span>`:u}
${It(t)?l`<span><strong>${a("phase_current",e)}:</strong> ${It(t)}</span>`:u}
</div>
${t.notes?l`<div class="notes-body">${Ei(t.notes)}</div>`:u}
@@ -4836,7 +4844,7 @@ ${p?`<div class="sub">${p}</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([v({attribute:!1})],P.prototype,"hass",2),c([h()],P.prototype,"_open",2),c([h()],P.prototype,"_entryId",2),c([h()],P.prototype,"_taskId",2),c([h()],P.prototype,"_task",2),c([h()],P.prototype,"_objectName",2),c([h()],P.prototype,"_taskRef",2),c([h()],P.prototype,"_busy",2),c([h()],P.prototype,"_error",2),c([h()],P.prototype,"_showSkip",2),c([h()],P.prototype,"_showReset",2),c([h()],P.prototype,"_showPostpone",2),c([h()],P.prototype,"_showDetails",2),c([h()],P.prototype,"_showAdaptive",2),c([h()],P.prototype,"_skipReason",2),c([h()],P.prototype,"_resetDate",2),c([h()],P.prototype,"_postponeDate",2),c([h()],P.prototype,"_features",2),c([h()],P.prototype,"_toast",2),c([h()],P.prototype,"_access",2),c([h()],P.prototype,"_partsCostMode",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",P)});var ne,Da=y(()=>{"use strict";I();Er();Ar();F();T();ze();Rr();Tt();wt();vi();fi();ne=class extends S{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error="";this._access=Me}get _lang(){return N(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await Promise.all([this._load(),se(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(()=>(oe(),ue)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(oe(),ue)).then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data||!await Ue(this.hass,{title:a("delete",this._lang),message:a("delete_object_confirm",this._lang),confirmText:a("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 Ue(this.hass,{title:a("archive_object",this._lang),message:a("confirm_archive_object",this._lang),confirmText:a("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(()=>(oe(),ue)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return u;let e=this._lang,t=this._data,i=t?.object,n=t?.tasks||[],o=we(this.hass?.user,this._access);return at(()=>this.close(),l`
`],c([v({attribute:!1})],P.prototype,"hass",2),c([h()],P.prototype,"_open",2),c([h()],P.prototype,"_entryId",2),c([h()],P.prototype,"_taskId",2),c([h()],P.prototype,"_task",2),c([h()],P.prototype,"_objectName",2),c([h()],P.prototype,"_taskRef",2),c([h()],P.prototype,"_busy",2),c([h()],P.prototype,"_error",2),c([h()],P.prototype,"_showSkip",2),c([h()],P.prototype,"_showReset",2),c([h()],P.prototype,"_showPostpone",2),c([h()],P.prototype,"_showDetails",2),c([h()],P.prototype,"_showAdaptive",2),c([h()],P.prototype,"_skipReason",2),c([h()],P.prototype,"_resetDate",2),c([h()],P.prototype,"_postponeDate",2),c([h()],P.prototype,"_features",2),c([h()],P.prototype,"_toast",2),c([h()],P.prototype,"_access",2),c([h()],P.prototype,"_partsCostMode",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",P)});var ne,ja=y(()=>{"use strict";I();Sr();Cr();F();T();ze();Pr();Tt();wt();vi();fi();ne=class extends S{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error="";this._access=Me}get _lang(){return N(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await Promise.all([this._load(),se(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(()=>(oe(),ue)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(oe(),ue)).then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data||!await Ue(this.hass,{title:a("delete",this._lang),message:a("delete_object_confirm",this._lang),confirmText:a("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 Ue(this.hass,{title:a("archive_object",this._lang),message:a("confirm_archive_object",this._lang),confirmText:a("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(()=>(oe(),ue)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return u;let e=this._lang,t=this._data,i=t?.object,n=t?.tasks||[],o=we(this.hass?.user,this._access);return at(()=>this.close(),l`
${t&&i?l`
<div class="header">
<div class="title">${i.name}</div>
@@ -4856,7 +4864,7 @@ ${p?`<div class="sub">${p}</div>`:""}
<div class="task-row" @click=${()=>this._onTaskClick(d.id)}>
<span class="status-dot" style="background: ${Si(d)}"></span>
<span class="task-name">${d.name}</span>
<span class="task-status ${Pt(d)}">${Ir(Pt(d),e)}</span>
<span class="task-status ${Pt(d)}">${Rr(Pt(d),e)}</span>
</div>
`)}
</div>
@@ -4896,7 +4904,7 @@ ${p?`<div class="sub">${p}</div>`:""}
${i.map(([n,o,d])=>l`
<div class="meta-item">
<span class="meta-label">${n}</span>
<span class="meta-value">${d||ha(o)?l`<a href="${o}" target="_blank" rel="noopener noreferrer">${o}</a>`:o}</span>
<span class="meta-value">${d||_a(o)?l`<a href="${o}" target="_blank" rel="noopener noreferrer">${o}</a>`:o}</span>
</div>
`)}
</div>
@@ -4945,7 +4953,7 @@ ${p?`<div class="sub">${p}</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([v({attribute:!1})],ne.prototype,"hass",2),c([h()],ne.prototype,"_open",2),c([h()],ne.prototype,"_entryId",2),c([h()],ne.prototype,"_data",2),c([h()],ne.prototype,"_busy",2),c([h()],ne.prototype,"_error",2),c([h()],ne.prototype,"_access",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",ne)});var ue={};Wa(ue,{__resetSettingsCacheForTests:()=>Ul,getRowActionStyle:()=>Fl,openCompleteDialog:()=>Kl,openCreateObjectDialog:()=>Bl,openCreateTaskDialog:()=>Vl,openEditObjectDialog:()=>Wl,openEditTaskDialog:()=>Gl,openHistoryEditDialog:()=>Lr,openObjectQuickActions:()=>Ql,openQrDialog:()=>Yl,openTaskQuickActions:()=>Nr});function Lt(){return document.querySelector("home-assistant")?.hass}function zl(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function he(s){let r=zl(),e=r.querySelector(s)??document.body.querySelector(s);return e?e.parentNode!==r&&r.appendChild(e):(e=document.createElement(s),r.appendChild(e)),e}function _e(s){let r=Lt();if(!r)return!1;s.hass=r;let e=N(r);return He(e)||qe(e).then(()=>{s.requestUpdate?.()}),Ji(r.locale,r.config?.country,r.config?.time_zone),!0}function Fl(s){return se(s).then(r=>r.rowActionStyle)}function Ul(){an()}function Bl(){let s=he(ja);return _e(s)?(s.openCreate(),za(s),!0):!1}async function za(s){let r=Lt();r&&(s.placesEnabled=(await se(r)).features.places)}function Wl(s,r){let e=he(ja);return _e(e)?(e.openEdit(s,r),za(e),!0):!1}function Vl(s="",r){let e=he(Ma);if(!_e(e))return!1;let t=Lt();return t?((async()=>{let i=await se(t),n=e;Fa(n,i),n.openCreate(s,r)})(),!0):!1}function Fa(s,r){s.checklistsEnabled=r.features.checklists,s.scheduleTimeEnabled=r.features.schedule_time,s.completionActionsEnabled=r.features.completion_actions,s.adaptiveFeature=r.features.adaptive,s.seasonalFeature=r.features.seasonal,s.environmentalFeature=r.features.environmental,s.defaultWarningDays=r.defaultWarningDays}function Gl(s,r){let e=he(Ma);if(!_e(e))return!1;let t=Lt();return t?((async()=>{try{let[i,n]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:s}),se(t)]),o=(i.tasks||[]).find(p=>p.id===r);if(!o){console.warn(`openEditTaskDialog: task ${r} not found in entry ${s}`);return}let d=e;Fa(d,n),await d.openEdit(s,o)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function Lr(s){let r=he(ql);return _e(r)?(r.openEdit(s),!0):!1}function Kl(s){let r=he(Ol);return _e(r)?(sa(r,s,N(Lt())),!0):!1}function Yl(s){let r=he(Dl);return _e(r)?(r.openForTask(s.entry_id,s.task_id,s.object_name,s.task_name),!0):!1}function Nr(s,r){let e=he(jl);return _e(e)?(e.openFor(s,r),!0):!1}function Ql(s){let r=he(Ml);return _e(r)?(r.openFor(s),!0):!1}var ja,Ma,ql,Ol,Dl,jl,Ml,oe=y(()=>{"use strict";un();Pn();Vn();Xn();ea();Oa();Da();T();br();Tt();ja="maintenance-object-dialog",Ma="maintenance-task-dialog",ql="maintenance-history-edit-dialog",Ol="maintenance-complete-dialog",Dl="maintenance-qr-dialog",jl="maintenance-task-quick-actions-dialog",Ml="maintenance-object-quick-actions-dialog"});I();F();Gt();var no={days:1,weeks:7,months:30.4368,years:365.25};function us(s,r){return!s||s<=0?0:s*(no[r||"days"]??1)}Kt();function oo(s){return s.responsible_user_id?[s.responsible_user_id]:[...new Set((s.assignee_pool||[]).filter(r=>typeof r=="string"&&r))]}function Fi(s,r){return!!r&&oo(s).includes(r)}Z();var ws=5;function _o(s,r){let e=[];for(let t=0;t<r;t++)e.push(Le(s,t));return e}function mo(s){if(!s||s.length===0)return null;let r=s.map(e=>Vt(e)).filter(e=>e!==null&&e>=0);return r.length===0?null:r.reduce((e,t)=>e+t,0)/r.length}function go(s){let{windowStart:r,windowEnd:e,task:t,entryId:i,objectName:n}=s,o=[],d=(f,x)=>({date:f,entry_id:i,task_id:t.id,task_name:t.name,object_name:n,status:x&&(t.status==="overdue"||t.status==="triggered")?"ok":t.status,days_until_due:x?null:t.days_until_due??null,projected:x,schedule_type:t.schedule_type,interval_days:t.interval_days??null,interval_unit:t.interval_unit??null,responsible_user_id:t.responsible_user_id??null,avg_cost:mo(t.history),adaptive_enabled:!!t.adaptive_config?.enabled,prediction_confidence:t.threshold_prediction_confidence??null}),p=Math.max(1,Math.round(us(t.interval_days,t.interval_unit)));if(t.status==="overdue"||t.status==="triggered"){if(o.push(d(r,!1)),t.schedule_type==="time_based"&&t.interval_days&&t.interval_days>0){let f=Le(r,p),x=1;for(;f<=e&&x<ws;)o.push(d(f,!0)),x++,f=Le(f,p)}return o}let _=t.next_due;if(typeof _!="string"||!_)return o;let m=_.slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(m))return o;if(m>=r&&m<=e)o.push(d(m,!1));else if(m>e)return o;if(t.schedule_type==="time_based"&&t.interval_days&&t.interval_days>0){let f=Le(m,p),x=o.length;for(;f<=e&&x<ws;)f>=r&&(o.push(d(f,!0)),x++),f=Le(f,p)}return o}function ks(s,r,e,t=null){let i=_o(r,e),n=i[0],o=i[i.length-1],d=[];for(let _ of s){let m=_.object?.name||"",f=_.entry_id,x=_.tasks||[];for(let w of x){if(t&&!F Line truncated
`],c([v({attribute:!1})],ne.prototype,"hass",2),c([h()],ne.prototype,"_open",2),c([h()],ne.prototype,"_entryId",2),c([h()],ne.prototype,"_data",2),c([h()],ne.prototype,"_busy",2),c([h()],ne.prototype,"_error",2),c([h()],ne.prototype,"_access",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",ne)});var ue={};Va(ue,{__resetSettingsCacheForTests:()=>Vl,getRowActionStyle:()=>Wl,openCompleteDialog:()=>Zl,openCreateObjectDialog:()=>Gl,openCreateTaskDialog:()=>Yl,openEditObjectDialog:()=>Kl,openEditTaskDialog:()=>Ql,openHistoryEditDialog:()=>Nr,openObjectQuickActions:()=>Xl,openQrDialog:()=>Jl,openTaskQuickActions:()=>Hr});function Lt(){return document.querySelector("home-assistant")?.hass}function Bl(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function he(s){let r=Bl(),e=r.querySelector(s)??document.body.querySelector(s);return e?e.parentNode!==r&&r.appendChild(e):(e=document.createElement(s),r.appendChild(e)),e}function _e(s){let r=Lt();if(!r)return!1;s.hass=r;let e=N(r);return He(e)||qe(e).then(()=>{s.requestUpdate?.()}),Xi(r.locale,r.config?.country,r.config?.time_zone),!0}function Wl(s){return se(s).then(r=>r.rowActionStyle)}function Vl(){on()}function Gl(){let s=he(Ma);return _e(s)?(s.openCreate(),Fa(s),!0):!1}async function Fa(s){let r=Lt();r&&(s.placesEnabled=(await se(r)).features.places)}function Kl(s,r){let e=he(Ma);return _e(e)?(e.openEdit(s,r),Fa(e),!0):!1}function Yl(s="",r){let e=he(za);if(!_e(e))return!1;let t=Lt();return t?((async()=>{let i=await se(t),n=e;Ua(n,i),n.openCreate(s,r)})(),!0):!1}function Ua(s,r){s.checklistsEnabled=r.features.checklists,s.scheduleTimeEnabled=r.features.schedule_time,s.completionActionsEnabled=r.features.completion_actions,s.adaptiveFeature=r.features.adaptive,s.seasonalFeature=r.features.seasonal,s.environmentalFeature=r.features.environmental,s.defaultWarningDays=r.defaultWarningDays}function Ql(s,r){let e=he(za);if(!_e(e))return!1;let t=Lt();return t?((async()=>{try{let[i,n]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:s}),se(t)]),o=(i.tasks||[]).find(p=>p.id===r);if(!o){console.warn(`openEditTaskDialog: task ${r} not found in entry ${s}`);return}let d=e;Ua(d,n),await d.openEdit(s,o)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function Nr(s){let r=he(jl);return _e(r)?(r.openEdit(s),!0):!1}function Zl(s){let r=he(Ml);return _e(r)?(na(r,s,N(Lt())),!0):!1}function Jl(s){let r=he(zl);return _e(r)?(r.openForTask(s.entry_id,s.task_id,s.object_name,s.task_name),!0):!1}function Hr(s,r){let e=he(Fl);return _e(e)?(e.openFor(s,r),!0):!1}function Xl(s){let r=he(Ul);return _e(r)?(r.openFor(s),!0):!1}var Ma,za,jl,Ml,zl,Fl,Ul,oe=y(()=>{"use strict";hn();Ln();Gn();ea();ta();Da();ja();T();xr();Tt();Ma="maintenance-object-dialog",za="maintenance-task-dialog",jl="maintenance-history-edit-dialog",Ml="maintenance-complete-dialog",zl="maintenance-qr-dialog",Fl="maintenance-task-quick-actions-dialog",Ul="maintenance-object-quick-actions-dialog"});I();F();Gt();var ao={days:1,weeks:7,months:30.4368,years:365.25};function hs(s,r){return!s||s<=0?0:s*(ao[r||"days"]??1)}Kt();function lo(s){return s.responsible_user_id?[s.responsible_user_id]:[...new Set((s.assignee_pool||[]).filter(r=>typeof r=="string"&&r))]}function Fi(s,r){return!!r&&lo(s).includes(r)}Z();var ks=5;function mo(s,r){let e=[];for(let t=0;t<r;t++)e.push(Le(s,t));return e}function go(s){if(!s||s.length===0)return null;let r=s.map(e=>Vt(e)).filter(e=>e!==null&&e>=0);return r.length===0?null:r.reduce((e,t)=>e+t,0)/r.length}function fo(s){let{windowStart:r,windowEnd:e,task:t,entryId:i,objectName:n}=s,o=[],d=(f,x)=>({date:f,entry_id:i,task_id:t.id,task_name:t.name,object_name:n,status:x&&(t.status==="overdue"||t.status==="triggered")?"ok":t.status,days_until_due:x?null:t.days_until_due??null,projected:x,schedule_type:t.schedule_type,interval_days:t.interval_days??null,interval_unit:t.interval_unit??null,responsible_user_id:t.responsible_user_id??null,avg_cost:go(t.history),adaptive_enabled:!!t.adaptive_config?.enabled,prediction_confidence:t.threshold_prediction_confidence??null}),p=Math.max(1,Math.round(hs(t.interval_days,t.interval_unit)));if(t.status==="overdue"||t.status==="triggered"){if(o.push(d(r,!1)),t.schedule_type==="time_based"&&t.interval_days&&t.interval_days>0){let f=Le(r,p),x=1;for(;f<=e&&x<ks;)o.push(d(f,!0)),x++,f=Le(f,p)}return o}let _=t.next_due;if(typeof _!="string"||!_)return o;let m=_.slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(m))return o;if(m>=r&&m<=e)o.push(d(m,!1));else if(m>e)return o;if(t.schedule_type==="time_based"&&t.interval_days&&t.interval_days>0){let f=Le(m,p),x=o.length;for(;f<=e&&x<ks;)f>=r&&(o.push(d(f,!0)),x++),f=Le(f,p)}return o}function $s(s,r,e,t=null){let i=mo(r,e),n=i[0],o=i[i.length-1],d=[];for(let _ of s){let m=_.object?.name||"",f=_.entry_id,x=_.tasks||[];for(let w of x){if(t&&!F Line truncated
.cal-controls {
display: flex;
gap: 12px;
@@ -5142,16 +5150,16 @@ ${p?`<div class="sub">${p}</div>`:""}
.cal-pill-day { font-size: 17px; }
.cal-user-filter { margin-left: 0; width: 100%; }
}
`;T();function Ws(s){let r=window;r.customCards=r.customCards||[],r.customCards.some(e=>e.type===s.type)||r.customCards.push(s)}function Vs(s,r,e=t=>import(t)){let t=window,i;try{let m=new URL(r);i=m.origin+m.pathname}catch{return}let n=`__msCardHeal:${s[0]}:${i}`;if(t[n])return;t[n]=!0;let o=0,d=0,p=!1,_=()=>{if(o+=1,s.some(f=>!customElements.get(f))&&d<3&&!p){d+=1,p=!0;try{let f=new URL(r);f.searchParams.set("heal",`${Date.now()}`),e(f.href).catch(()=>{}).finally(()=>{p=!1})}catch{return}}o<20&&window.setTimeout(_,o<8?500:2e3)};window.setTimeout(_,250)}ir();wt();Tt();oe();var G=class extends S{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"};this._objects=[];this._stats=null;this._windowDays=30;this._pastDays=0;this._userFilter="";this._objectFilter="";this._configuredObjects=[];this._unsub=null;this._pastHistory={};this._pastHistorySig="";this._pastSeq=0;this._dataLoaded=!1;this._lastConnection=null;this._onHistorySaved=e=>{let t=e.detail;!t?.entry_id||!t.task_id||!(Jt(t.entry_id,t.task_id)in this._pastHistory)||(this._pastHistorySig="",this._loadPastHistories())}}static getConfigElement(){return document.createElement("maintenance-supporter-calendar-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-calendar-card",window_days:30,show_window_chips:!0,show_user_filter:!0}}setConfig(e){if(this._config={...e},this._windowDays=e.window_days&&[7,14,30,365].includes(e.window_days)?e.window_days:30,this._pastDays=e.past_days&&[30,90].includes(e.past_days)?e.past_days:0,this._userFilter=typeof e.user_filter=="string"?e.user_filter:"",typeof e.object_filter=="string")this._objectFilter=e.object_filter,this._configuredObjects=[];else if(Array.isArray(e.object_filter)){let t=e.object_filter.filter(i=>typeof i=="string"&&i!=="");this._objectFilter=t.length===1?t[0]:"",this._configuredObjects=t.length>1?t:[]}else this._objectFilter="",this._configuredObjects=[]}getCardSize(){return 6}get _lang(){return N(this.hass)}connectedCallback(){super.connectedCallback(),window.addEventListener("history-entry-saved",this._onHistorySaved)}disconnectedCallback(){if(super.disconnectedCallback(),window.removeEventListener("history-entry-saved",this._onHistorySaved),this._unsub){try{this._unsub()}catch{}this._unsub=null}this._dataLoaded=!1,this._lastConnection=null}updated(e){if(super.updated(e),Hs(this,e),this.hass&&this._pastDays>0&&(e.has("_objects")||e.has("_pastDays"))&&this._loadPastHistories(),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t,ei(this._stats.budget)}catch{}}async _loadPastHistories(){let e=$s(this._objects,ye(),this._pastDays||30),t=e.map(o=>o.sig).join("|");if(t===this._pastHistorySig)return;this._pastHistorySig=t;let i=++this._pastSeq,n=await Promise.all(e.map(async o=>{try{let d=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/history",entry_id:o.entryId,task_id:o.taskId});return[o.key,d.history??[]]}catch{return null}}));i===this._pastSeq&&(this._pastHistory=Object.fromEntries(n.filter(o=>o!==null)))}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}_onEventClick(e){if(e.history_timestamp){this._openHistoryEntry(e);return}this._openTask(e)}_openTask(e){Nr(e.entry_id,e.task_id)||this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:open-task",entry_id:e.entry_id,task_id:e.task_id},bubbles:!0,composed:!0}))}async _openHistoryEntry(e){try{let t=await se(this.hass);if(!we(this.hass?.user,t.access)){this._openTask(e);return}}catch{}try{let t=await en(this.hass,e.entry_id,e.task_id,e.history_timestamp);if(!t||Lr(t))return}catch{}this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:edit-history",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:e.history_timestamp},bubbles:!0,composed:!0}))}render(){if(!this.hass)return u;let e=this._lang,t=this._config.show_window_chips!==!1,i=this._config.show_user_filter!==!1,n=this._config.title,o=null;this._userFilter&&(o=this._userFilter==="current_user"?this.hass?.user?.id??null:this._userFilter);let d=b=>{let le=b.toLowerCase();return this._objects.find(me=>me.entry_id===b||me.object.name.toLowerCase()===le)?.entry_id??null},p=new Set(this._configuredObjects.map(d).filter(b=>b!==null)),_=p.size?this._objects.filter(b Line truncated
`;T();function Vs(s){let r=window;r.customCards=r.customCards||[],r.customCards.some(e=>e.type===s.type)||r.customCards.push(s)}function Gs(s,r,e=t=>import(t)){let t=window,i;try{let m=new URL(r);i=m.origin+m.pathname}catch{return}let n=`__msCardHeal:${s[0]}:${i}`;if(t[n])return;t[n]=!0;let o=0,d=0,p=!1,_=()=>{if(o+=1,s.some(f=>!customElements.get(f))&&d<3&&!p){d+=1,p=!0;try{let f=new URL(r);f.searchParams.set("heal",`${Date.now()}`),e(f.href).catch(()=>{}).finally(()=>{p=!1})}catch{return}}o<20&&window.setTimeout(_,o<8?500:2e3)};window.setTimeout(_,250)}rr();wt();Tt();oe();var G=class extends S{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"};this._objects=[];this._stats=null;this._windowDays=30;this._pastDays=0;this._userFilter="";this._objectFilter="";this._configuredObjects=[];this._unsub=null;this._pastHistory={};this._pastHistorySig="";this._pastSeq=0;this._dataLoaded=!1;this._lastConnection=null;this._onHistorySaved=e=>{let t=e.detail;!t?.entry_id||!t.task_id||!(Jt(t.entry_id,t.task_id)in this._pastHistory)||(this._pastHistorySig="",this._loadPastHistories())}}static getConfigElement(){return document.createElement("maintenance-supporter-calendar-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-calendar-card",window_days:30,show_window_chips:!0,show_user_filter:!0}}setConfig(e){if(this._config={...e},this._windowDays=e.window_days&&[7,14,30,365].includes(e.window_days)?e.window_days:30,this._pastDays=e.past_days&&[30,90].includes(e.past_days)?e.past_days:0,this._userFilter=typeof e.user_filter=="string"?e.user_filter:"",typeof e.object_filter=="string")this._objectFilter=e.object_filter,this._configuredObjects=[];else if(Array.isArray(e.object_filter)){let t=e.object_filter.filter(i=>typeof i=="string"&&i!=="");this._objectFilter=t.length===1?t[0]:"",this._configuredObjects=t.length>1?t:[]}else this._objectFilter="",this._configuredObjects=[]}getCardSize(){return 6}get _lang(){return N(this.hass)}connectedCallback(){super.connectedCallback(),window.addEventListener("history-entry-saved",this._onHistorySaved)}disconnectedCallback(){if(super.disconnectedCallback(),window.removeEventListener("history-entry-saved",this._onHistorySaved),this._unsub){try{this._unsub()}catch{}this._unsub=null}this._dataLoaded=!1,this._lastConnection=null}updated(e){if(super.updated(e),qs(this,e),this.hass&&this._pastDays>0&&(e.has("_objects")||e.has("_pastDays"))&&this._loadPastHistories(),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t,ei(this._stats.budget)}catch{}}async _loadPastHistories(){let e=Es(this._objects,ye(),this._pastDays||30),t=e.map(o=>o.sig).join("|");if(t===this._pastHistorySig)return;this._pastHistorySig=t;let i=++this._pastSeq,n=await Promise.all(e.map(async o=>{try{let d=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/history",entry_id:o.entryId,task_id:o.taskId});return[o.key,d.history??[]]}catch{return null}}));i===this._pastSeq&&(this._pastHistory=Object.fromEntries(n.filter(o=>o!==null)))}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}_onEventClick(e){if(e.history_timestamp){this._openHistoryEntry(e);return}this._openTask(e)}_openTask(e){Hr(e.entry_id,e.task_id)||this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:open-task",entry_id:e.entry_id,task_id:e.task_id},bubbles:!0,composed:!0}))}async _openHistoryEntry(e){try{let t=await se(this.hass);if(!we(this.hass?.user,t.access)){this._openTask(e);return}}catch{}try{let t=await tn(this.hass,e.entry_id,e.task_id,e.history_timestamp);if(!t||Nr(t))return}catch{}this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:edit-history",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:e.history_timestamp},bubbles:!0,composed:!0}))}render(){if(!this.hass)return u;let e=this._lang,t=this._config.show_window_chips!==!1,i=this._config.show_user_filter!==!1,n=this._config.title,o=null;this._userFilter&&(o=this._userFilter==="current_user"?this.hass?.user?.id??null:this._userFilter);let d=b=>{let le=b.toLowerCase();return this._objects.find(me=>me.entry_id===b||me.object.name.toLowerCase()===le)?.entry_id??null},p=new Set(this._configuredObjects.map(d).filter(b=>b!==null)),_=p.size?this._objects.filter(b Line truncated
title="${a("cal_source_sensor",e)}" icon="mdi:trending-up"></ha-icon>`:l`<ha-icon class="cal-event-icon cal-source-time"
title="${b.adaptive_enabled?a("cal_source_time_adaptive",e):a("cal_source_time",e)}"
icon="${b.adaptive_enabled?"mdi:clock-time-four-outline":"mdi:clock-outline"}"></ha-icon>`,dt=z&&b.prediction_confidence&&b.status!=="triggered"&&!b.projected?l`<span class="cal-event-prediction cal-conf-${b.prediction_confidence}">
${a("cal_predicted",e)} · ${a(`cal_confidence_${b.prediction_confidence}`,e)}
</span>`:u,Ai=De(this._stats?.budget),Ua=b.history_type?a(b.history_type,e):a(b.status,e);return l`
</span>`:u,Ai=De(this._stats?.budget),Ba=b.history_type?a(b.history_type,e):a(b.status,e);return l`
<div class="cal-event ${Se}"
@click=${()=>this._onEventClick(b)}>
${ct}
<span class="cal-status-pill ${le}">${Ua}</span>
<span class="cal-status-pill ${le}">${Ba}</span>
<div class="cal-event-body">
<div class="cal-event-title">${b.object_name} · ${b.task_name}${me}</div>
${dt}
@@ -5159,7 +5167,7 @@ ${p?`<div class="sub">${p}</div>`:""}
</div>
${b.avg_cost!=null&&b.avg_cost!==0?l`<span class="cal-event-cost">${J(b.avg_cost,Ai,e)}</span>`:u}
</div>
`},W=b=>{let[le,Se,me]=b.date.split("-").map(Number),q=new Date(le,Se-1,me),z=b.date===w,ct=zs(q,e,"short"),dt=Fs(q,e,"long");return l`
`},W=b=>{let[le,Se,me]=b.date.split("-").map(Number),q=new Date(le,Se-1,me),z=b.date===w,ct=Fs(q,e,"short"),dt=Us(q,e,"long");return l`
<div class="cal-day-row">
<div class="cal-day-pill ${z?"cal-today":""}">
<span class="cal-pill-weekday">${ct}</span>
@@ -5218,10 +5226,10 @@ ${p?`<div class="sub">${p}</div>`:""}
${M.length===0&&L?l`<div class="cal-empty">${a("cal_no_events",e)}</div>`:M.map(W)}
</div>
</ha-card>
`}};G.styles=[ni,Ts,E`
`}};G.styles=[ni,As,E`
:host { display: block; }
ha-card { padding: 0; overflow: hidden; }
`],c([v({attribute:!1})],G.prototype,"hass",2),c([h()],G.prototype,"_config",2),c([h()],G.prototype,"_objects",2),c([h()],G.prototype,"_stats",2),c([h()],G.prototype,"_windowDays",2),c([h()],G.prototype,"_pastDays",2),c([h()],G.prototype,"_userFilter",2),c([h()],G.prototype,"_objectFilter",2),c([h()],G.prototype,"_unsub",2),c([h()],G.prototype,"_pastHistory",2);var Zl=[{value:7,key:"cal_editor_window_week"},{value:14,key:"cal_editor_window_fortnight"},{value:30,key:"cal_editor_window_month"},{value:365,key:"cal_editor_window_year"}],Jl=[{value:30,key:"cal_editor_window_past_30"},{value:90,key:"cal_editor_window_past_90"}],lt=class extends S{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"}}get _lang(){return N(this.hass)}setConfig(e){this._config={...e}}updated(){let e=this._lang;e&&!He(e)&&qe(e).then(()=>this.requestUpdate())}_valueChanged(e,t){let i={...this._config,[e]:t};e==="show_window_chips"&&t===!0&&delete i.show_window_chips,e==="show_user_filter"&&t===!0&&delete i.show_user_filter,e==="show_object_filter"&&t===!0&&delete i.show_object_filter,e==="title"&&(!t||typeof t=="string"&&t.trim()==="")&&delete i.title,e==="user_filter"&&t===""&&delete i.user_filter,this._emit(i)}_windowChanged(e){let t={...this._config};e.startsWith("past-")?(t.past_days=Number(e.slice(5)),delete t.window_days):(t.window_days=Number(e),delete t.past_days),this._emit(t)}_emit(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}render(){let e=this._lang,t=this._config.past_days?`past-${this._config.past_days}`:`${this._config.window_days??30}`,i=this._config.show_window_chips!==!1,n=this._config.show_user_filter!==!1,o=this._config.user_filter??"",d=this._config.title??"";return l`
`],c([v({attribute:!1})],G.prototype,"hass",2),c([h()],G.prototype,"_config",2),c([h()],G.prototype,"_objects",2),c([h()],G.prototype,"_stats",2),c([h()],G.prototype,"_windowDays",2),c([h()],G.prototype,"_pastDays",2),c([h()],G.prototype,"_userFilter",2),c([h()],G.prototype,"_objectFilter",2),c([h()],G.prototype,"_unsub",2),c([h()],G.prototype,"_pastHistory",2);var ec=[{value:7,key:"cal_editor_window_week"},{value:14,key:"cal_editor_window_fortnight"},{value:30,key:"cal_editor_window_month"},{value:365,key:"cal_editor_window_year"}],tc=[{value:30,key:"cal_editor_window_past_30"},{value:90,key:"cal_editor_window_past_90"}],lt=class extends S{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"}}get _lang(){return N(this.hass)}setConfig(e){this._config={...e}}updated(){let e=this._lang;e&&!He(e)&&qe(e).then(()=>this.requestUpdate())}_valueChanged(e,t){let i={...this._config,[e]:t};e==="show_window_chips"&&t===!0&&delete i.show_window_chips,e==="show_user_filter"&&t===!0&&delete i.show_user_filter,e==="show_object_filter"&&t===!0&&delete i.show_object_filter,e==="title"&&(!t||typeof t=="string"&&t.trim()==="")&&delete i.title,e==="user_filter"&&t===""&&delete i.user_filter,this._emit(i)}_windowChanged(e){let t={...this._config};e.startsWith("past-")?(t.past_days=Number(e.slice(5)),delete t.window_days):(t.window_days=Number(e),delete t.past_days),this._emit(t)}_emit(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}render(){let e=this._lang,t=this._config.past_days?`past-${this._config.past_days}`:`${this._config.window_days??30}`,i=this._config.show_window_chips!==!1,n=this._config.show_user_filter!==!1,o=this._config.user_filter??"",d=this._config.title??"";return l`
<div class="editor">
<div class="row">
<label for="title">${a("card_title",e)}</label>
@@ -5238,8 +5246,8 @@ ${p?`<div class="sub">${p}</div>`:""}
id="window"
@change=${p=>this._windowChanged(p.target.value)}
>
${Zl.map(p=>l`<option value="${p.value}" ?selected=${`${p.value}`===t}>${a(p.key,e)}</option>`)}
${Jl.map(p=>l`<option value="past-${p.value}" ?selected=${`past-${p.value}`===t}>${a(p.key,e)}</option>`)}
${ec.map(p=>l`<option value="${p.value}" ?selected=${`${p.value}`===t}>${a(p.key,e)}</option>`)}
${tc.map(p=>l`<option value="past-${p.value}" ?selected=${`past-${p.value}`===t}>${a(p.key,e)}</option>`)}
</select>
</div>
<div class="row toggle">
@@ -5308,7 +5316,7 @@ ${p?`<div class="sub">${p}</div>`:""}
font-size: 12px;
color: var(--secondary-text-color, #666);
}
`,c([v({attribute:!1})],lt.prototype,"hass",2),c([h()],lt.prototype,"_config",2);customElements.get("maintenance-supporter-calendar-card")||customElements.define("maintenance-supporter-calendar-card",G);customElements.get("maintenance-supporter-calendar-card-editor")||customElements.define("maintenance-supporter-calendar-card-editor",lt);Vs(["maintenance-supporter-calendar-card"],import.meta.url);Ws({type:"maintenance-supporter-calendar-card",name:"Maintenance Supporter \u2014 Calendar",description:"Rolling calendar of maintenance tasks with 7/14/30/365 day windows, source icons, and prediction-confidence pills.",preview:!0});export{G as MaintenanceCalendarCard};
`,c([v({attribute:!1})],lt.prototype,"hass",2),c([h()],lt.prototype,"_config",2);customElements.get("maintenance-supporter-calendar-card")||customElements.define("maintenance-supporter-calendar-card",G);customElements.get("maintenance-supporter-calendar-card-editor")||customElements.define("maintenance-supporter-calendar-card-editor",lt);Gs(["maintenance-supporter-calendar-card"],import.meta.url);Vs({type:"maintenance-supporter-calendar-card",name:"Maintenance Supporter \u2014 Calendar",description:"Rolling calendar of maintenance tasks with 7/14/30/365 day windows, source icons, and prediction-confidence pills.",preview:!0});export{G as MaintenanceCalendarCard};
/*! Bundled license information:
@lit/reactive-element/css-tag.js: