182 files
This commit is contained in:
1 parent
7dddf6bb13
commit
ece15a1c1b
183 files changed
+11457
-3092
No files matched your search
@@ -1,9 +1,9 @@
|
||||
/*! maintenance_supporter frontend 2.57.0 */
|
||||
var ft=Object.defineProperty;var Hi=Object.getOwnPropertyDescriptor;var $=(a,s,e)=>()=>{if(e)throw e[0];try{return a&&(s=a(a=0)),s}catch(t){throw e=[t],t}};var Mi=(a,s)=>{for(var e in s)ft(a,e,{get:s[e],enumerable:!0})};var d=(a,s,e,t)=>{for(var i=t>1?void 0:t?Hi(s,e):s,n=a.length-1,l;n>=0;n--)(l=a[n])&&(i=(t?l(s,e,i):l(i))||i);return t&&i&&ft(s,e,i),i};var Se,Ae,Ue,vt,pe,bt,E,yt,Ve,Be=$(()=>{Se=globalThis,Ae=Se.ShadowRoot&&(Se.ShadyCSS===void 0||Se.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ue=Symbol(),vt=new WeakMap,pe=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==Ue)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=e}get styleSheet(){let s=this.o,e=this.t;if(Ae&&s===void 0){let t=e!==void 0&&e.length===1;t&&(s=vt.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&&vt.set(e,s))}return s}toString(){return this.cssText}},bt=a=>new pe(typeof a=="string"?a:a+"",void 0,Ue),E=(a,...s)=>{let e=a.length===1?a[0]:s.reduce((t,i,n)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+a[n+1],a[0]);return new pe(e,a,Ue)},yt=(a,s)=>{if(Ae)a.adoptedStyleSheets=s.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of s){let t=document.createElement("style"),i=Se.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,a.appendChild(t)}},Ve=Ae?a=>a:a=>a instanceof CSSStyleSheet?(s=>{let e="";for(let t of s.cssRules)e+=t.cssText;return bt(e)})(a):a});var Oi,qi,zi,Fi,Di,Ui,Te,xt,Vi,Bi,he,_e,Ie,$t,W,ue=$(()=>{Be();Be();({is:Oi,defineProperty:qi,getOwnPropertyDescriptor:zi,getOwnPropertyNames:Fi,getOwnPropertySymbols:Di,getPrototypeOf:Ui}=Object),Te=globalThis,xt=Te.trustedTypes,Vi=xt?xt.emptyScript:"",Bi=Te.reactiveElementPolyfillSupport,he=(a,s)=>a,_e={toAttribute(a,s){switch(s){case Boolean:a=a?Vi:null;break;case Object:case Array:a=a==null?a:JSON.stringify(a)}return a},fromAttribute(a,s){let e=a;switch(s){case Boolean:e=a!==null;break;case Number:e=a===null?null:Number(a);break;case Object:case Array:try{e=JSON.parse(a)}catch{e=null}}return e}},Ie=(a,s)=>!Oi(a,s),$t={attribute:!0,type:String,converter:_e,reflect:!1,useDefault:!1,hasChanged:Ie};Symbol.metadata??=Symbol("metadata"),Te.litPropertyMetadata??=new WeakMap;W=class extends HTMLElement{static addInitializer(s){this._$Ei(),(this.l??=[]).push(s)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(s,e=$t){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(s)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(s,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(s,t,e);i!==void 0&&qi(this.prototype,s,i)}}static getPropertyDescriptor(s,e,t){let{get:i,set:n}=zi(this.prototype,s)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let c=i?.call(this);n?.call(this,l),this.requestUpdate(s,c,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(s){return this.elementProperties.get(s)??$t}static _$Ei(){if(this.hasOwnProperty(he("elementProperties")))return;let s=Ui(this);s.finalize(),s.l!==void 0&&(this.l=[...s.l]),this.elementProperties=new Map(s.elementProperties)}static finalize(){if(this.hasOwnProperty(he("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(he("properties"))){let e=this.properties,t=[...Fi(e),...Di(e)];for(let i of t)this.createProperty(i,e[i])}let s=this[Symbol.metadata];if(s!==null){let e=litPropertyMetadata.get(s);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){let e=[];if(Array.isArray(s)){let t=new Set(s.flat(1/0).reverse());for(let i of t)e.unshift(Ve(i))}else s!==void 0&&e.push(Ve(s));return e}static _$Eu(s,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof s=="string"?s.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(s=>this.enableUpdating=s),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(s=>s(this))}addController(s){(this._$EO??=new Set).add(s),this.renderRoot!==void 0&&this.isConnected&&s.hostConnected?.()}removeController(s){this._$EO?.delete(s)}_$E_(){let s=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(s.set(t,this[t]),delete this[t]);s.size>0&&(this._$Ep=s)}createRenderRoot(){let s=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return yt(s,this.constructor.elementStyles),s}connectedCallback(){this.renderRoot??=thiLine truncated
|
||||
\f\r]`,ge=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Et=/-->/g,St=/>/g,Z=RegExp(`>|${We}(?:([^\\s"'>=/]+)(${We}*=${We}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),At=/'/g,Tt=/"/g,Pt=/^(?:script|style|textarea|title)$/i,et=a=>(s,...e)=>({_$litType$:a,strings:s,values:e}),o=et(1),oe=et(2),Gs=et(3),te=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),It=new WeakMap,X=ee.createTreeWalker(ee,129);Gi=(a,s)=>{let e=a.length-1,t=[],i,n=s===2?"<svg>":s===3?"<math>":"",l=ge;for(let c=0;c<e;c++){let p=a[c],u,v,f=-1,y=0;for(;y<p.length&&(l.lastIndex=y,v=l.exec(p),v!==null);)y=l.lastIndex,l===ge?v[1]==="!--"?l=Et:v[1]!==void 0?l=St:v[2]!==void 0?(Pt.test(v[2])&&(i=RegExp("</"+v[2],"g")),l=Z):v[3]!==void 0&&(l=Z):l===Z?v[0]===">"?(l=i??ge,f=-1):v[1]===void 0?f=-2:(f=l.lastIndex-v[2].length,u=v[1],l=v[3]===void 0?Z:v[3]==='"'?Tt:At):l===Tt||l===At?l=Z:l===Et||l===St?l=ge:(l=Z,i=void 0);let g=l===Z&&a[c+1].startsWith("/>")?" ":"";n+=l===ge?p+Wi:f>=0?(t.push(u),p.slice(0,f)+Ct+p.slice(f)+J+g):p+J+(f===-2?c:g)}return[Rt(a,n+(a[e]||"<?>")+(s===2?"</svg>":s===3?"</math>":"")),t]},ve=class a{constructor({strings:s,_$litType$:e},t){let i;this.parts=[];let n=0,l=0,c=s.length-1,p=this.parts,[u,v]=Gi(s,e);if(this.el=a.createElement(u,t),X.currentNode=this.el.content,e===2||e===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=X.nextNode())!==null&&p.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let f of i.getAttributeNames())if(f.endsWith(Ct)){let y=v[l++],g=i.getAttribute(f).split(J),x=/([.?@])?(.*)/.exec(y);p.push({type:1,index:n,name:x[2],strings:g,ctor:x[1]==="."?Ge:x[1]==="?"?Ye:x[1]==="@"?Qe:ne}),i.removeAttribute(f)}else f.startsWith(J)&&(p.push({type:6,index:n}),i.removeAttribute(f));if(Pt.test(i.tagName)){let f=i.textContent.split(J),y=f.length-1;if(y>0){i.textContent=Ce?Ce.emptyScript:"";for(let g=0;g<y;g++)i.append(f[g],me()),X.nextNode(),p.push({type:2,index:++n});i.append(f[y],me())}}}else if(i.nodeType===8)if(i.data===Lt)p.push({type:2,index:n});else{let f=-1;for(;(f=i.data.indexOf(J,f+1))!==-1;)p.push({type:7,index:n}),f+=J.length-1}n++}}static createElement(s,e){let t=ee.createElement("template");return t.innerHTML=s,t}};Ke=class{constructor(s,e){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){let{el:{content:e},parts:t}=this._$AD,i=(s?.creationScope??ee).importNode(e,!0);X.currentNode=i;let n=X.nextNode(),l=0,c=0,p=t[0];for(;p!==void 0;){if(l===p.index){let u;p.type===2?u=new be(n,n.nextSibling,this,s):p.type===1?u=new p.ctor(n,p.name,p.strings,this,s):p.type===6&&(u=new Je(n,this,s)),this._$AV.push(u),p=t[++c]}l!==p?.index&&(n=X.nextNode(),l++)}return X.currentNode=ee,i}p(s){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(s,t,e),e+=t.strings.length-2):t._$AI(s[e])),e++}},be=class a{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(s,e,t,i){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=s,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let s=this._$AA.parentNode,e=this._$AM;return e!==void 0&&s?.nodeType===11&&(s=e.parentNode),s}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(s,e=this){s=ae(this,s,e),fe(s)?s===_||s==null||s===""?(this._$AH!==_&&this._$AR(),this._$AH=_):s!==this._$AH&&s!==te&&this._(s):s._$litType$!==void 0?this.$(s):s.nodeType!==void 0?this.T(s):Ki(s)?this.k(s):this._(s)}O(s){return this._$AA.parentNode.insertBefore(s,this._$AB)}T(s){this._$AH!==s&&(this._$AR(),this._$AH=this.O(s))}_(s){this._$AH!==_&&fe(this._$AH)?this._$AA.nextSibling.data=s:this.T(ee.createTextNode(s)),this._$AH=s}$(s){let{values:e,_$litType$:t}=s,i=typeof t=="number"?this._$AC(s):(t.el===void 0&&(t.el=ve.createElement(Rt(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new Ke(i,this),l=n.u(this.options);n.p(e),this.T(l),this._$AH=n}}_$AC(s){let e=It.get(s.strings);return e===void 0&&It.set(s.strings,e=new ve(s)),e}k(s){Xe(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of s)i===e.length?e.push(t=new a(this.O(me()),this.O(me()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(s=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);s!==this._$AB;){let t=wt(s).nextSibling;wt(s).remove(),s=t}}setConnected(s){this._$AM===void 0&&(this._$Cv=s,this._$AP?.(s))}},ne=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(s,e,t,i,n){this.type=1,this._$AH=_,this._$AN=void 0,this.element=s,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=_}_$AI(s,e=this,t,i){let n=this.strings,l=!1;if(n===void 0)s=ae(this,s,e,0),l=!fe(s)||s!==this._$AH&&s!==te,l&&(this._$AH=s);else{let c=s,p,u;for(s=n[0],p=0;p<n.length-1;p++)u=ae(this,c[t+p],e,p),u===te&&(u=this._$AH[p]),l||=!fe(u)||u!==this._$AH[p],u===_?s=_:s!==_&&(s+=(u??"")+n[p+1]),this._$AH[p]=u}l&&!i&&this.j(s)}j(s){s===_?this.element.removeAttribute(this.name):this.element.setAtLine truncated
|
||||
/*! maintenance_supporter frontend 2.58.0 */
|
||||
var bt=Object.defineProperty;var zi=Object.getOwnPropertyDescriptor;var $=(a,s,e)=>()=>{if(e)throw e[0];try{return a&&(s=a(a=0)),s}catch(t){throw e=[t],t}};var Fi=(a,s)=>{for(var e in s)bt(a,e,{get:s[e],enumerable:!0})};var d=(a,s,e,t)=>{for(var i=t>1?void 0:t?zi(s,e):s,n=a.length-1,l;n>=0;n--)(l=a[n])&&(i=(t?l(s,e,i):l(i))||i);return t&&i&&bt(s,e,i),i};var Te,Ce,Be,yt,_e,xt,E,$t,We,Ke=$(()=>{Te=globalThis,Ce=Te.ShadowRoot&&(Te.ShadyCSS===void 0||Te.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Be=Symbol(),yt=new WeakMap,_e=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==Be)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=e}get styleSheet(){let s=this.o,e=this.t;if(Ce&&s===void 0){let t=e!==void 0&&e.length===1;t&&(s=yt.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&&yt.set(e,s))}return s}toString(){return this.cssText}},xt=a=>new _e(typeof a=="string"?a:a+"",void 0,Be),E=(a,...s)=>{let e=a.length===1?a[0]:s.reduce((t,i,n)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+a[n+1],a[0]);return new _e(e,a,Be)},$t=(a,s)=>{if(Ce)a.adoptedStyleSheets=s.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of s){let t=document.createElement("style"),i=Te.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,a.appendChild(t)}},We=Ce?a=>a:a=>a instanceof CSSStyleSheet?(s=>{let e="";for(let t of s.cssRules)e+=t.cssText;return xt(e)})(a):a});var Di,Ui,Vi,Bi,Wi,Ki,Ie,wt,Gi,Yi,ue,ge,Le,kt,K,me=$(()=>{Ke();Ke();({is:Di,defineProperty:Ui,getOwnPropertyDescriptor:Vi,getOwnPropertyNames:Bi,getOwnPropertySymbols:Wi,getPrototypeOf:Ki}=Object),Ie=globalThis,wt=Ie.trustedTypes,Gi=wt?wt.emptyScript:"",Yi=Ie.reactiveElementPolyfillSupport,ue=(a,s)=>a,ge={toAttribute(a,s){switch(s){case Boolean:a=a?Gi:null;break;case Object:case Array:a=a==null?a:JSON.stringify(a)}return a},fromAttribute(a,s){let e=a;switch(s){case Boolean:e=a!==null;break;case Number:e=a===null?null:Number(a);break;case Object:case Array:try{e=JSON.parse(a)}catch{e=null}}return e}},Le=(a,s)=>!Di(a,s),kt={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:Le};Symbol.metadata??=Symbol("metadata"),Ie.litPropertyMetadata??=new WeakMap;K=class extends HTMLElement{static addInitializer(s){this._$Ei(),(this.l??=[]).push(s)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(s,e=kt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(s)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(s,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(s,t,e);i!==void 0&&Ui(this.prototype,s,i)}}static getPropertyDescriptor(s,e,t){let{get:i,set:n}=Vi(this.prototype,s)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let c=i?.call(this);n?.call(this,l),this.requestUpdate(s,c,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(s){return this.elementProperties.get(s)??kt}static _$Ei(){if(this.hasOwnProperty(ue("elementProperties")))return;let s=Ki(this);s.finalize(),s.l!==void 0&&(this.l=[...s.l]),this.elementProperties=new Map(s.elementProperties)}static finalize(){if(this.hasOwnProperty(ue("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ue("properties"))){let e=this.properties,t=[...Bi(e),...Wi(e)];for(let i of t)this.createProperty(i,e[i])}let s=this[Symbol.metadata];if(s!==null){let e=litPropertyMetadata.get(s);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){let e=[];if(Array.isArray(s)){let t=new Set(s.flat(1/0).reverse());for(let i of t)e.unshift(We(i))}else s!==void 0&&e.push(We(s));return e}static _$Eu(s,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof s=="string"?s.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(s=>this.enableUpdating=s),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(s=>s(this))}addController(s){(this._$EO??=new Set).add(s),this.renderRoot!==void 0&&this.isConnected&&s.hostConnected?.()}removeController(s){this._$EO?.delete(s)}_$E_(){let s=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(s.set(t,this[t]),delete this[t]);s.size>0&&(this._$Ep=s)}createRenderRoot(){let s=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return $t(s,this.constructor.elementStyles),s}connectedCallback(){this.renderRoot??=thiLine truncated
|
||||
\f\r]`,fe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,At=/-->/g,Tt=/>/g,ee=RegExp(`>|${Ge}(?:([^\\s"'>=/]+)(${Ge}*=${Ge}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ct=/'/g,It=/"/g,jt=/^(?:script|style|textarea|title)$/i,it=a=>(s,...e)=>({_$litType$:a,strings:s,values:e}),o=it(1),de=it(2),er=it(3),se=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Lt=new WeakMap,te=ie.createTreeWalker(ie,129);Zi=(a,s)=>{let e=a.length-1,t=[],i,n=s===2?"<svg>":s===3?"<math>":"",l=fe;for(let c=0;c<e;c++){let p=a[c],u,v,f=-1,y=0;for(;y<p.length&&(l.lastIndex=y,v=l.exec(p),v!==null);)y=l.lastIndex,l===fe?v[1]==="!--"?l=At:v[1]!==void 0?l=Tt:v[2]!==void 0?(jt.test(v[2])&&(i=RegExp("</"+v[2],"g")),l=ee):v[3]!==void 0&&(l=ee):l===ee?v[0]===">"?(l=i??fe,f=-1):v[1]===void 0?f=-2:(f=l.lastIndex-v[2].length,u=v[1],l=v[3]===void 0?ee:v[3]==='"'?It:Ct):l===It||l===Ct?l=ee:l===At||l===Tt?l=fe:(l=ee,i=void 0);let g=l===ee&&a[c+1].startsWith("/>")?" ":"";n+=l===fe?p+Qi:f>=0?(t.push(u),p.slice(0,f)+Pt+p.slice(f)+X+g):p+X+(f===-2?c:g)}return[Nt(a,n+(a[e]||"<?>")+(s===2?"</svg>":s===3?"</math>":"")),t]},ye=class a{constructor({strings:s,_$litType$:e},t){let i;this.parts=[];let n=0,l=0,c=s.length-1,p=this.parts,[u,v]=Zi(s,e);if(this.el=a.createElement(u,t),te.currentNode=this.el.content,e===2||e===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=te.nextNode())!==null&&p.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let f of i.getAttributeNames())if(f.endsWith(Pt)){let y=v[l++],g=i.getAttribute(f).split(X),x=/([.?@])?(.*)/.exec(y);p.push({type:1,index:n,name:x[2],strings:g,ctor:x[1]==="."?Qe:x[1]==="?"?Je:x[1]==="@"?Ze:le}),i.removeAttribute(f)}else f.startsWith(X)&&(p.push({type:6,index:n}),i.removeAttribute(f));if(jt.test(i.tagName)){let f=i.textContent.split(X),y=f.length-1;if(y>0){i.textContent=Pe?Pe.emptyScript:"";for(let g=0;g<y;g++)i.append(f[g],ve()),te.nextNode(),p.push({type:2,index:++n});i.append(f[y],ve())}}}else if(i.nodeType===8)if(i.data===Rt)p.push({type:2,index:n});else{let f=-1;for(;(f=i.data.indexOf(X,f+1))!==-1;)p.push({type:7,index:n}),f+=X.length-1}n++}}static createElement(s,e){let t=ie.createElement("template");return t.innerHTML=s,t}};Ye=class{constructor(s,e){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){let{el:{content:e},parts:t}=this._$AD,i=(s?.creationScope??ie).importNode(e,!0);te.currentNode=i;let n=te.nextNode(),l=0,c=0,p=t[0];for(;p!==void 0;){if(l===p.index){let u;p.type===2?u=new xe(n,n.nextSibling,this,s):p.type===1?u=new p.ctor(n,p.name,p.strings,this,s):p.type===6&&(u=new Xe(n,this,s)),this._$AV.push(u),p=t[++c]}l!==p?.index&&(n=te.nextNode(),l++)}return te.currentNode=ie,i}p(s){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(s,t,e),e+=t.strings.length-2):t._$AI(s[e])),e++}},xe=class a{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(s,e,t,i){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=s,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let s=this._$AA.parentNode,e=this._$AM;return e!==void 0&&s?.nodeType===11&&(s=e.parentNode),s}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(s,e=this){s=oe(this,s,e),be(s)?s===_||s==null||s===""?(this._$AH!==_&&this._$AR(),this._$AH=_):s!==this._$AH&&s!==se&&this._(s):s._$litType$!==void 0?this.$(s):s.nodeType!==void 0?this.T(s):Ji(s)?this.k(s):this._(s)}O(s){return this._$AA.parentNode.insertBefore(s,this._$AB)}T(s){this._$AH!==s&&(this._$AR(),this._$AH=this.O(s))}_(s){this._$AH!==_&&be(this._$AH)?this._$AA.nextSibling.data=s:this.T(ie.createTextNode(s)),this._$AH=s}$(s){let{values:e,_$litType$:t}=s,i=typeof t=="number"?this._$AC(s):(t.el===void 0&&(t.el=ye.createElement(Nt(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new Ye(i,this),l=n.u(this.options);n.p(e),this.T(l),this._$AH=n}}_$AC(s){let e=Lt.get(s.strings);return e===void 0&&Lt.set(s.strings,e=new ye(s)),e}k(s){tt(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of s)i===e.length?e.push(t=new a(this.O(ve()),this.O(ve()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(s=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);s!==this._$AB;){let t=Et(s).nextSibling;Et(s).remove(),s=t}}setConnected(s){this._$AM===void 0&&(this._$Cv=s,this._$AP?.(s))}},le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(s,e,t,i,n){this.type=1,this._$AH=_,this._$AN=void 0,this.element=s,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=_}_$AI(s,e=this,t,i){let n=this.strings,l=!1;if(n===void 0)s=oe(this,s,e,0),l=!be(s)||s!==this._$AH&&s!==se,l&&(this._$AH=s);else{let c=s,p,u;for(s=n[0],p=0;p<n.length-1;p++)u=oe(this,c[t+p],e,p),u===se&&(u=this._$AH[p]),l||=!be(u)||u!==this._$AH[p],u===_?s=_:s!==_&&(s+=(u??"")+n[p+1]),this._$AH[p]=u}l&&!i&&this.j(s)}j(s){s===_?this.element.removeAttribute(this.name):thiLine truncated
|
||||
Replace seal
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",all_parts:"All parts",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",adaptive_prediction_enabled:"Enable sensor-driven predictions",adaptive_seasonal_enabled:"Enable seasonal awareness",adaptive_max_interval:"Maximum interval (days)",adaptive_min_interval:"Minimum interval (days)",adaptive_ewa_alpha:"Learning rate (alpha)",adaptive_enabled:"Enable adaptive scheduling",adaptive_section_title:"Adaptive Scheduling",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low
Line truncated
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",all_parts:"All parts",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",adaptive_prediction_enabled:"Enable sensor-driven predictions",adaptive_seasonal_enabled:"Enable seasonal awareness",adaptive_max_interval:"Maximum interval (days)",adaptive_min_interval:"Minimum interval (days)",adaptive_ewa_alpha:"Learning rate (alpha)",adaptive_enabled:"Enable adaptive scheduling",adaptive_section_title:"Adaptive Scheduling",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low
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); }
|
||||
`,Oe=E`
|
||||
`,ze=E`
|
||||
:host {
|
||||
--maint-ok-color: var(--success-color, #4caf50);
|
||||
--maint-due-soon-color: var(--warning-color, #ff9800);
|
||||
@@ -1157,7 +1157,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; }
|
||||
.stat-value { font-size: 20px; }
|
||||
}
|
||||
`});var de,nt=$(()=>{"use strict";de=class{constructor(s){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=s}updateHass(s){this.hass=s}async getUsers(s=!1){let e=Date.now();if(!s&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(s,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:s,task_id:e,user_id:t})}async getTasksByUser(s){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:s})).tasks}getUserName(s){return!s||!this.usersCache?null:this.usersCache.find(t=>t.id===s)?.name||null}getUser(s){return!s||!this.usersCache?null:this.usersCache.find(e=>e.id===s)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(s){return s?s===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function D(a){return`${a.entry_id??""}\0${a.part_id}`}function cs(a,s,e,t){let i=!!a.entry_id&&a.entry_id!==s,n=i?a.entry_id:s,l=e.find(v=>v.entry_id===n),c=(l?.parts||[]).find(v=>v.id===a.part_id)||null,p=i&&l?.object?.name||"",u=c?.name||r("shared_part_unknown",t);return{part:c,foreign:i,ownerName:p,label:p?`${u} (${p})`:u}}function ii(a,s,e,t){let n=(e.find(c=>c.entry_id===s)?.parts||[]).map(c=>({...c})),l=new Set(n.map(c=>D({part_id:c.id})));for(let c of a?.consumes_parts||[]){if(!c.entry_id||c.entry_id===s)continue;let p=D(c);if(l.has(p))continue;l.add(p);let{part:u,ownerName:v}=cs(c,s,e,t);n.push({id:c.part_id,name:u?.name||r("shared_part_unknown",t),unit:u?.unit,stock:u?.stock??null,storage_location:u?.storage_location,entry_id:c.entry_id,owner_name:v})}return n}var qe=$(()=>{"use strict";C()});function _s(a,s){let e=hs[a];if(!e)return a;let t=r(e,s);return t&&t!==e?t:a}function us(a){let e=a.match(/data\['([^']+)'\]/)?.[1],t;return(t=a.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=a.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=a.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=a.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(a)?{field:e,rule:"required"}:(t=a.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(a)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(a)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function P(a,s,e){if(e=e??r("action_error",s),typeof a=="string")return a;if(typeof a!="object"||a===null)return e;let t=a,i=t.message||t.error?.message||"";if(!i)return e;let n=us(i),l=n.field?_s(n.field,s):"",c=p=>r(p,s).replace("{field}",l).replace("{n}",n.param??"");switch(n.rule){case"too_long":return c("err_too_long");case"too_short":return c("err_too_short");case"value_too_high":return c("err_value_too_high");case"value_too_low":return c("err_value_too_low");case"required":return c("err_required");case"wrong_type":return c("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return c("err_invalid_choice");case"invalid_value":return c("err_invalid_value");default:return i||e}}var hs,re=$(()=>{"use strict";C();hs={name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_for_minutes:"trigger_for_minutes"}});var si,ze,ot=$(()=>{"use strict";si=["notes","cost","duration","photo","user"],ze={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"}});var w,lt=$(()=>{"use strict";L();q();C();re();qe();ot();w=class extends k{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.restockDef
Line truncated
|
||||
`});var pe,lt=$(()=>{"use strict";pe=class{constructor(s){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=s}updateHass(s){this.hass=s}async getUsers(s=!1){let e=Date.now();if(!s&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(s,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:s,task_id:e,user_id:t})}async getTasksByUser(s){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:s})).tasks}getUserName(s){return!s||!this.usersCache?null:this.usersCache.find(t=>t.id===s)?.name||null}getUser(s){return!s||!this.usersCache?null:this.usersCache.find(e=>e.id===s)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(s){return s?s===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function U(a){return`${a.entry_id??""}\0${a.part_id}`}function ms(a,s,e,t){let i=!!a.entry_id&&a.entry_id!==s,n=i?a.entry_id:s,l=e.find(v=>v.entry_id===n),c=(l?.parts||[]).find(v=>v.id===a.part_id)||null,p=i&&l?.object?.name||"",u=c?.name||r("shared_part_unknown",t);return{part:c,foreign:i,ownerName:p,label:p?`${u} (${p})`:u}}function ni(a,s,e,t){let n=(e.find(c=>c.entry_id===s)?.parts||[]).map(c=>({...c})),l=new Set(n.map(c=>U({part_id:c.id})));for(let c of a?.consumes_parts||[]){if(!c.entry_id||c.entry_id===s)continue;let p=U(c);if(l.has(p))continue;l.add(p);let{part:u,ownerName:v}=ms(c,s,e,t);n.push({id:c.part_id,name:u?.name||r("shared_part_unknown",t),unit:u?.unit,stock:u?.stock??null,storage_location:u?.storage_location,entry_id:c.entry_id,owner_name:v})}return n}var Fe=$(()=>{"use strict";I()});function bs(a,s){let e=vs[a];if(!e)return a;let t=r(e,s);return t&&t!==e?t:a}function ys(a){let e=a.match(/data\['([^']+)'\]/)?.[1],t;return(t=a.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=a.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=a.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=a.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(a)?{field:e,rule:"required"}:(t=a.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(a)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(a)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function P(a,s,e){if(e=e??r("action_error",s),typeof a=="string")return a;if(typeof a!="object"||a===null)return e;let t=a,i=t.message||t.error?.message||"";if(!i)return e;let n=ys(i),l=n.field?bs(n.field,s):"",c=p=>r(p,s).replace("{field}",l).replace("{n}",n.param??"");switch(n.rule){case"too_long":return c("err_too_long");case"too_short":return c("err_too_short");case"value_too_high":return c("err_value_too_high");case"value_too_low":return c("err_value_too_low");case"required":return c("err_required");case"wrong_type":return c("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return c("err_invalid_choice");case"invalid_value":return c("err_invalid_value");default:return i||e}}var vs,ne=$(()=>{"use strict";I();vs={name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_for_minutes:"trigger_for_minutes"}});var oi,De,dt=$(()=>{"use strict";oi=["notes","cost","duration","photo","user"],De={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"}});var w,ct=$(()=>{"use strict";L();z();I();ne();Fe();dt();w=class extends k{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.restockDef
Line truncated
|
||||
type="button"
|
||||
class="cost-suggestion"
|
||||
@click=${()=>this._cost=t.toFixed(2)}
|
||||
@@ -1186,7 +1186,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
</label>`:_}
|
||||
${this.parts.length?o`<div class="used-parts">
|
||||
<span class="field-label">${r("complete_parts_used",e)}</span>
|
||||
${this.parts.map(t=>{let i=D({part_id:t.id,entry_id:t.entry_id}),n=this._usedParts[i],l=n!==void 0,c=t.entry_id?{part_id:t.id,quantity:1,entry_id:t.entry_id}:{part_id:t.id,quantity:1};return o`<div class="used-part-row">
|
||||
${this.parts.map(t=>{let i=U({part_id:t.id,entry_id:t.entry_id}),n=this._usedParts[i],l=n!==void 0,c=t.entry_id?{part_id:t.id,quantity:1,entry_id:t.entry_id}:{part_id:t.id,quantity:1};return o`<div class="used-part-row">
|
||||
<label class="used-part-check">
|
||||
<input type="checkbox" .checked=${l}
|
||||
@change=${p=>{let u={...this._usedParts};p.target.checked?u[i]=u[i]||c:delete u[i],this._usedParts=u}} />
|
||||
@@ -1276,13 +1276,13 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
<ha-button
|
||||
@click=${this._complete}
|
||||
.disabled=${this._loading||this._missingRequired.length>0}
|
||||
title=${this._missingRequired.length?this._missingRequired.map(t=>r("err_required",e).replace("{field}",r(ze[t]??t,e))).join(" \xB7 "):""}
|
||||
title=${this._missingRequired.length?this._missingRequired.map(t=>r("err_required",e).replace("{field}",r(De[t]??t,e))).join(" \xB7 "):""}
|
||||
>
|
||||
${this._loading?r("completing",e):r("complete",e)}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};w.styles=[ti,E`
|
||||
`}};w.styles=[si,E`
|
||||
.req-mark {
|
||||
color: var(--error-color, #f44336);
|
||||
margin-left: 2px;
|
||||
@@ -1447,7 +1447,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
color: var(--text-primary-color, #fff);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
`],d([b({attribute:!1})],w.prototype,"hass",2),d([b()],w.prototype,"entryId",2),d([b()],w.prototype,"taskId",2),d([b()],w.prototype,"taskName",2),d([b()],w.prototype,"lang",2),d([b({type:Array})],w.prototype,"checklist",2),d([b({type:Boolean})],w.prototype,"adaptiveEnabled",2),d([b()],w.prototype,"taskType",2),d([b()],w.prototype,"readingUnit",2),d([b({attribute:!1})],w.prototype,"restockDefault",2),d([b({attribute:!1})],w.prototype,"restockUnitCost",2),d([b()],w.prototype,"currencySymbol",2),d([b({attribute:!1})],w.prototype,"parts",2),d([b({attribute:!1})],w.prototype,"consumesParts",2),d([b({type:Array})],w.prototype,"consumesInfo",2),d([b({type:Array})],w.prototype,"requiredFields",2),d([h()],w.prototype,"_open",2),d([h()],w.prototype,"_notes",2),d([h()],w.prototype,"_cost",2),d([h()],w.prototype,"_duration",2),d([h()],w.prototype,"_loading",2),d([h()],w.prototype,"_error",2),d([h()],w.prototype,"_checklistState",2),d([h()],w.prototype,"_feedback",2),d([h()],w.prototype,"_photoDocId",2),d([h()],w.prototype,"_photoPreview",2),d([h()],w.prototype,"_photoUploading",2),d([h()],w.prototype,"_readingValue",2),d([h()],w.prototype,"_restockQty",2),d([h()],w.prototype,"_usedParts",2),d([b({attribute:!1})],w.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",w)});var R,dt=$(()=>{"use strict";L();q();R=class extends k{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(e){let t=e.target.value;this.value=t,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){return o`
|
||||
`],d([b({attribute:!1})],w.prototype,"hass",2),d([b()],w.prototype,"entryId",2),d([b()],w.prototype,"taskId",2),d([b()],w.prototype,"taskName",2),d([b()],w.prototype,"lang",2),d([b({type:Array})],w.prototype,"checklist",2),d([b({type:Boolean})],w.prototype,"adaptiveEnabled",2),d([b()],w.prototype,"taskType",2),d([b()],w.prototype,"readingUnit",2),d([b({attribute:!1})],w.prototype,"restockDefault",2),d([b({attribute:!1})],w.prototype,"restockUnitCost",2),d([b()],w.prototype,"currencySymbol",2),d([b({attribute:!1})],w.prototype,"parts",2),d([b({attribute:!1})],w.prototype,"consumesParts",2),d([b({type:Array})],w.prototype,"consumesInfo",2),d([b({type:Array})],w.prototype,"requiredFields",2),d([h()],w.prototype,"_open",2),d([h()],w.prototype,"_notes",2),d([h()],w.prototype,"_cost",2),d([h()],w.prototype,"_duration",2),d([h()],w.prototype,"_loading",2),d([h()],w.prototype,"_error",2),d([h()],w.prototype,"_checklistState",2),d([h()],w.prototype,"_feedback",2),d([h()],w.prototype,"_photoDocId",2),d([h()],w.prototype,"_photoPreview",2),d([h()],w.prototype,"_photoUploading",2),d([h()],w.prototype,"_readingValue",2),d([h()],w.prototype,"_restockQty",2),d([h()],w.prototype,"_usedParts",2),d([b({attribute:!1})],w.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",w)});var R,pt=$(()=>{"use strict";L();z();R=class extends k{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(e){let t=e.target.value;this.value=t,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){return o`
|
||||
<label class="field">
|
||||
${this.label?o`<span class="label">${this.label}${this.required?o`<span class="req">*</span>`:_}</span>`:_}
|
||||
<input
|
||||
@@ -1499,7 +1499,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
color: var(--secondary-text-color);
|
||||
font-style: italic;
|
||||
}
|
||||
`,d([b()],R.prototype,"label",2),d([b()],R.prototype,"value",2),d([b()],R.prototype,"placeholder",2),d([b()],R.prototype,"type",2),d([b({type:Boolean})],R.prototype,"required",2),d([b({type:Boolean})],R.prototype,"disabled",2),d([b()],R.prototype,"step",2),d([b()],R.prototype,"min",2),d([b()],R.prototype,"max",2),d([b()],R.prototype,"pattern",2),d([b()],R.prototype,"helper",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",R)});var A,ri=$(()=>{"use strict";L();q();C();re();dt();A=class extends k{constructor(){super(...arguments);this.objects=[];this._open=!1;this._loading=!1;this._error="";this._name="";this._manufacturer="";this._model="";this._serialNumber="";this._areaId="";this._installationDate="";this._warrantyExpiry="";this._documentationUrl="";this._notes="";this._haDeviceId="";this._parentEntryId="";this._entryId=null}get _lang(){return this.hass?.language??navigator.language.split("-")[0]??"en"}openCreate(){this._entryId=null,this._name="",this._manufacturer="",this._model="",this._serialNumber="",this._areaId="",this._installationDate="",this._warrantyExpiry="",this._documentationUrl="",this._notes="",this._haDeviceId="",this._parentEntryId="",this._error="",this._open=!0}openEdit(e,t){this._entryId=e,this._name=t.name||"",this._manufacturer=t.manufacturer||"",this._model=t.model||"",this._serialNumber=t.serial_number||"",this._areaId=t.area_id||"",this._installationDate=t.installation_date||"",this._warrantyExpiry=t.warranty_expiry||"",this._documentationUrl=t.documentation_url||"",this._notes=t.notes||"",this._haDeviceId=t.ha_device_id||"",this._parentEntryId=t.parent_entry_id||"",this._error="",this._open=!0}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{this._entryId?await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/update",entry_id:this._entryId,name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}):await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/create",name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}),this._open=!1,this.dispatchEvent(new CustomEvent("object-saved"))}catch(e){this._error=P(e,this._lang,r("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(e=>e.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return o``;let e=this._lang,t=this._entryId?r("edit_object",e):r("new_object",e);return o`
|
||||
`,d([b()],R.prototype,"label",2),d([b()],R.prototype,"value",2),d([b()],R.prototype,"placeholder",2),d([b()],R.prototype,"type",2),d([b({type:Boolean})],R.prototype,"required",2),d([b({type:Boolean})],R.prototype,"disabled",2),d([b()],R.prototype,"step",2),d([b()],R.prototype,"min",2),d([b()],R.prototype,"max",2),d([b()],R.prototype,"pattern",2),d([b()],R.prototype,"helper",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",R)});var A,li=$(()=>{"use strict";L();z();I();ne();pt();A=class extends k{constructor(){super(...arguments);this.objects=[];this._open=!1;this._loading=!1;this._error="";this._name="";this._manufacturer="";this._model="";this._serialNumber="";this._areaId="";this._installationDate="";this._warrantyExpiry="";this._documentationUrl="";this._notes="";this._haDeviceId="";this._parentEntryId="";this._entryId=null}get _lang(){return 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._error="",this._open=!0}openEdit(e,t){this._entryId=e,this._name=t.name||"",this._manufacturer=t.manufacturer||"",this._model=t.model||"",this._serialNumber=t.serial_number||"",this._areaId=t.area_id||"",this._installationDate=t.installation_date||"",this._warrantyExpiry=t.warranty_expiry||"",this._documentationUrl=t.documentation_url||"",this._notes=t.notes||"",this._haDeviceId=t.ha_device_id||"",this._parentEntryId=t.parent_entry_id||"",this._error="",this._open=!0}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{this._entryId?await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/update",entry_id:this._entryId,name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}):await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/create",name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}),this._open=!1,this.dispatchEvent(new CustomEvent("object-saved"))}catch(e){this._error=P(e,this._lang,r("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(e=>e.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return o``;let e=this._lang,t=this._entryId?r("edit_object",e):r("new_object",e);return o`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${t}</div>
|
||||
<div class="content">
|
||||
@@ -1640,8 +1640,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
color: var(--error-color, #f44336);
|
||||
font-size: 13px;
|
||||
}
|
||||
`,d([b({attribute:!1})],A.prototype,"hass",2),d([b({attribute:!1})],A.prototype,"objects",2),d([h()],A.prototype,"_open",2),d([h()],A.prototype,"_loading",2),d([h()],A.prototype,"_error",2),d([h()],A.prototype,"_name",2),d([h()],A.prototype,"_manufacturer",2),d([h()],A.prototype,"_model",2),d([h()],A.prototype,"_serialNumber",2),d([h()],A.prototype,"_areaId",2),d([h()],A.prototype,"_installationDate",2),d([h()],A.prototype,"_warrantyExpiry",2),d([h()],A.prototype,"_documentationUrl",2),d([h()],A.prototype,"_notes",2),d([h()],A.prototype,"_haDeviceId",2),d([h()],A.prototype,"_parentEntryId",2),d([h()],A.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",A)});var ct,ai,ni,oi=$(()=>{"use strict";ct=["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"],ai=["sensor"],ni=["temperature","humidity","pressure"]});function bs(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}function xs(a){return{entityIds:(a.entity_ids||(a.entity_id?[a.entity_id]:[])).join(", "),type:a.type||"threshold",attribute:a.attribute||"",above:a.trigger_above?.toString()??"",below:a.trigger_below?.toString()??"",forMinutes:a.trigger_for_minutes?.toString()??"0",targetValue:a.trigger_target_value?.toString()??"",deltaMode:a.trigger_delta_mode||!1,fromState:a.trigger_from_state||"",toState:a.trigger_to_state||"",targetChanges:a.trigger_target_changes?.toString()??"",runtimeHours:a.trigger_runtime_hours?.toString()??"",onStates:(a.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(a).filter(([e])=>!ys.has(e)&&!e.startsWith("_")))}}function $s(a){let s=a.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(s.length===0)return null;let e={...a.carry||{},entity_id:s[0],entity_ids:s,type:a.type};if(a.attribute&&(e.attribute=a.attribute),a.type==="threshold"){let t=parseFloat(a.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(a.below);isNaN(i)||(e.trigger_below=i);let n=parseInt(a.forMinutes,10);isNaN(n)||(e.trigger_for_minutes=n)}else if(a.type==="counter"){let t=parseFloat(a.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=a.deltaMode}else if(a.type==="state_change"){a.fromState&&(e.trigger_from_state=a.fromState),a.toState&&(e.trigger_to_state=a.toState);let t=parseInt(a.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(a.type==="runtime"){let t=parseFloat(a.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t);let i=(a.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);i.length>0&&(e.trigger_on_states=i)}return e}function ws(a){return Array.from({length:7},(s,e)=>we(e,a,"short"))}function ks(a){let s=new Intl.DateTimeFormat(a||"en",{month:"short"});return Array.from({length:12},(e,t)=>s.format(new Date(2021,t,1)))}var gs,ms,fs,pt,li,vs,ys,m,ht,di=$(()=>{"use strict";L();q();C();nt();qe();oi();re();ot();dt();gs=["cleaning","inspection","replacement","calibration","service","reading","custom"],ms=["low","normal","high"],fs=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],pt=["weekdays","nth_weekday","day_of_month"],li=["threshold","counter","state_change","runtime"],vs=[...li,"compound"];ys=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states"]);m=class m extends k{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this.parts=[];this._foreignOwners=[];this._open=!1;this._entityPickerFallback=!1;this._pickerProbeStrikes=0;this._loading=!1;this._error="";this._entryId="";this._taskId=null;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._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._schedulePreview=[];this._schedulePreviewEnded=!1;this._previewSeq=0;this._notes="";this._documentationUrl="";this._customIcon="";this._priority="normal";this._labels="";this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerForMinutes="0";this._triggerTargetValue="";this._trigger
Line truncated
|
||||
`),this._requiredCompletion=[...t.required_completion_fields||[]],this._scheduleTime=t.schedule_time||"";let l=t.on_complete_action;if(l&&l.service){this._actionService=l.service;let u=l.target?.entity_id;this._actionTargetEntity=Array.isArray(u)?u[0]||"":u||"",this._actionData=l.data&&typeof l.data=="object"?{...l.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let c=t.quick_complete_defaults;this._qcNotes=c?.notes||"",this._qcCost=c?.cost!=null?String(c.cost):"",this._qcDuration=c?.duration!=null?String(c.duration):"",this._qcFeedback=c?.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??.3).toString(),this._adaptiveMin=(p.min_interval_days??7).toString(),this._adaptiveMax=(p.max_interval_days??365).toString(),this._adaptiveSeasonal=p.seasonal_enabled!==!1,this._adaptivePrediction=p.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),t.trigger_config){let u=t.trigger_config;this._triggerEntityId=u.entity_id||u.entity_ids&&u.entity_ids[0]||"",this._triggerEntityIds=u.entity_ids||(u.entity_id?[u.entity_id]:[]),this._triggerEntityLogic=u.entity_logic||"any",this._triggerAttribute=u.attribute||"",this._triggerType=u.type||"threshold",this._triggerAbove=u.trigger_above?.toString()||"",this._triggerBelow=u.trigger_below?.toString()||"",this._triggerForMinutes=u.trigger_for_minutes?.toString()||"0",this._triggerTargetValue=u.trigger_target_value?.toString()||"",this._triggerDeltaMode=u.trigger_delta_mode||!1,this._triggerBaselineValue=u.trigger_baseline_value?.toString()||"",this._liveBaselineValue=t.trigger_baseline_value??null,this._autoCompleteOnRecovery=u.auto_complete_on_recovery||!1,this._triggerFromState=u.trigger_from_state||"",this._triggerToState=u.trigger_to_state||"",this._triggerTargetChanges=u.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=u.trigger_runtime_hours?.toString()||"",this._triggerOnStates=(u.trigger_on_states||[]).join(", "),u.type==="compound"?(this._compoundLogic=u.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(u.conditions||[]).map(xs)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._requiredCompletion=[],this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha="0.3",this._adaptiveMin="7",this._adaptiveMax="365",this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this._triggerAbove="",this._triggerBelow="",this._triggerForMinutes="0",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._triggerBaselineValue="",this._liveBaselineValue=null,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._triggerOnStates="",this._compoundLogic="AND",this._compoundConditions=[]}async _loadUsers(){this._userService||(this._userService=new de(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(e){console.error("Failed to load users:",e),this._availableUsers=[]}}_toggleAssigne
Line truncated
|
||||
`,d([b({attribute:!1})],A.prototype,"hass",2),d([b({attribute:!1})],A.prototype,"objects",2),d([h()],A.prototype,"_open",2),d([h()],A.prototype,"_loading",2),d([h()],A.prototype,"_error",2),d([h()],A.prototype,"_name",2),d([h()],A.prototype,"_manufacturer",2),d([h()],A.prototype,"_model",2),d([h()],A.prototype,"_serialNumber",2),d([h()],A.prototype,"_areaId",2),d([h()],A.prototype,"_installationDate",2),d([h()],A.prototype,"_warrantyExpiry",2),d([h()],A.prototype,"_documentationUrl",2),d([h()],A.prototype,"_notes",2),d([h()],A.prototype,"_haDeviceId",2),d([h()],A.prototype,"_parentEntryId",2),d([h()],A.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",A)});var ht,di,ci,pi=$(()=>{"use strict";ht=["sensor","binary_sensor","number","input_number","input_boolean","switch","climate","vacuum","cover","fan","light","water_heater","humidifier","media_player","weather","air_quality","valve","lawn_mower","lock"],di=["sensor"],ci=["temperature","humidity","pressure"]});function Es(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}function As(a){return{entityIds:(a.entity_ids||(a.entity_id?[a.entity_id]:[])).join(", "),type:a.type||"threshold",attribute:a.attribute||"",above:a.trigger_above?.toString()??"",below:a.trigger_below?.toString()??"",forMinutes:a.trigger_for_minutes?.toString()??"0",targetValue:a.trigger_target_value?.toString()??"",deltaMode:a.trigger_delta_mode||!1,fromState:a.trigger_from_state||"",toState:a.trigger_to_state||"",targetChanges:a.trigger_target_changes?.toString()??"",runtimeHours:a.trigger_runtime_hours?.toString()??"",onStates:(a.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(a).filter(([e])=>!Ss.has(e)&&!e.startsWith("_")))}}function Ts(a){let s=a.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(s.length===0)return null;let e={...a.carry||{},entity_id:s[0],entity_ids:s,type:a.type};if(a.attribute&&(e.attribute=a.attribute),a.type==="threshold"){let t=parseFloat(a.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(a.below);isNaN(i)||(e.trigger_below=i);let n=parseInt(a.forMinutes,10);isNaN(n)||(e.trigger_for_minutes=n)}else if(a.type==="counter"){let t=parseFloat(a.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=a.deltaMode}else if(a.type==="state_change"){a.fromState&&(e.trigger_from_state=a.fromState),a.toState&&(e.trigger_to_state=a.toState);let t=parseInt(a.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(a.type==="runtime"){let t=parseFloat(a.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t);let i=(a.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);i.length>0&&(e.trigger_on_states=i)}return e}function Cs(a){return Array.from({length:7},(s,e)=>Ee(e,a,"short"))}function Is(a){let s=new Intl.DateTimeFormat(a||"en",{month:"short"});return Array.from({length:12},(e,t)=>s.format(new Date(2021,t,1)))}var xs,$s,ws,_t,hi,ks,Y,Ss,m,ut,_i=$(()=>{"use strict";L();z();I();lt();Fe();pi();ne();dt();pt();xs=["cleaning","inspection","replacement","calibration","service","reading","custom"],$s=["low","normal","high"],ws=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],_t=["weekdays","nth_weekday","day_of_month"],hi=["threshold","counter","state_change","runtime"],ks=[...hi,"compound"],Y={alpha:"0.3",min:"7",max:"365"};Ss=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states"]);m=class m extends k{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this.parts=[];this._foreignOwners=[];this._open=!1;this._entityPickerFallback=!1;this._pickerProbeStrikes=0;this._loading=!1;this._error="";this._entryId="";this._taskId=null;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._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._schedulePreview=[];this._schedulePreviewEnded=!1;this._previewSeq=0;this._notes="";this._documentationUrl="";this._customIcon="";this._priority="normal";this._labels="";this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerForMinutes="0";this.
Line truncated
|
||||
`),this._requiredCompletion=[...t.required_completion_fields||[]],this._scheduleTime=t.schedule_time||"";let l=t.on_complete_action;if(l&&l.service){this._actionService=l.service;let u=l.target?.entity_id;this._actionTargetEntity=Array.isArray(u)?u[0]||"":u||"",this._actionData=l.data&&typeof l.data=="object"?{...l.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let c=t.quick_complete_defaults;this._qcNotes=c?.notes||"",this._qcCost=c?.cost!=null?String(c.cost):"",this._qcDuration=c?.duration!=null?String(c.duration):"",this._qcFeedback=c?.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()??Y.alpha,this._adaptiveMin=p.min_interval_days?.toString()??Y.min,this._adaptiveMax=p.max_interval_days?.toString()??Y.max,this._adaptiveSeasonal=p.seasonal_enabled!==!1,this._adaptivePrediction=p.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),t.trigger_config){let u=t.trigger_config;this._triggerEntityId=u.entity_id||u.entity_ids&&u.entity_ids[0]||"",this._triggerEntityIds=u.entity_ids||(u.entity_id?[u.entity_id]:[]),this._triggerEntityLogic=u.entity_logic||"any",this._triggerAttribute=u.attribute||"",this._triggerType=u.type||"threshold",this._triggerAbove=u.trigger_above?.toString()||"",this._triggerBelow=u.trigger_below?.toString()||"",this._triggerForMinutes=u.trigger_for_minutes?.toString()||"0",this._triggerTargetValue=u.trigger_target_value?.toString()||"",this._triggerDeltaMode=u.trigger_delta_mode||!1,this._triggerBaselineValue=u.trigger_baseline_value?.toString()||"",this._liveBaselineValue=t.trigger_baseline_value??null,this._autoCompleteOnRecovery=u.auto_complete_on_recovery||!1,this._triggerFromState=u.trigger_from_state||"",this._triggerToState=u.trigger_to_state||"",this._triggerTargetChanges=u.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=u.trigger_runtime_hours?.toString()||"",this._triggerOnStates=(u.trigger_on_states||[]).join(", "),u.type==="compound"?(this._compoundLogic=u.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(u.conditions||[]).map(As)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._requiredCompletion=[],this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=Y.alpha,this._adaptiveMin=Y.min,this._adaptiveMax=Y.max,this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this._triggerAbove="",this._triggerBelow="",this._triggerForMinutes="0",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._triggerBaselineValue="",this._liveBaselineValue=null,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._triggerOnStates="",this._compoundLogic="AND",this._compoundConditions=[]}async _loadUsers(){this._userService||(this._userService=new pe(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(e){console.error("Failed to load users:",e),this._availableUsers=[]}}_t
Line truncated
|
||||
<details class="ca-section">
|
||||
<summary>${r("on_complete_action_title",e)}</summary>
|
||||
<p class="field-help">${r("on_complete_action_desc",e)}</p>
|
||||
@@ -1717,7 +1717,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
<option value="not_needed">${r("quick_complete_defaults_feedback_not_needed",e)}</option>
|
||||
</select>
|
||||
</details>
|
||||
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=e.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadForeignPools(){if(this._foreignOwners=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"});this._foreignOwners=(e.objects||[]).filter(t=>t.entry_id!==this._entryId&&(t.parts||[]).length>0).map(t=>({entry_id:t.entry_id,name:t.object?.name||t.entry_id,parts:t.parts||[]})).sort((t,i)=>t.name.localeCompare(i.name))}catch{this._foreignOwners=[]}}async _loadTags(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=e.tags||[]}catch{this._availableTags=[]}}_fetchConditionAttributes(e){!e||!this.hass||this._conditionAttrOptions[e]||this._conditionAttrPending.has(e)||(this._conditionAttrPending.add(e),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e}).then(t=>{let i=t;this._conditionAttrOptions={...this._conditionAttrOptions,[e]:{suggested:i.suggested_attributes||[],available:i.available_attributes||[]}}}).catch(()=>{this._conditionAttrOptions={...this._conditionAttrOptions,[e]:{suggested:[],available:[]}}}))}async _fetchEntityAttributes(e){if(!e||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e});this._entityDomain=t.domain||"",this._suggestedAttributes=t.suggested_attributes||[],this._availableAttributes=t.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}get _hasForeignPick(){return Object.values(this._consumesParts).some(e=>!!e.entry_id)}_renderConsumesRow(e,t){let i=D({part_id:e.id,entry_id:t}),n=this._consumesParts[i],l=t?{part_id:e.id,quantity:1,entry_id:t}:{part_id:e.id,quantity:1};return o`
|
||||
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=e.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadForeignPools(){if(this._foreignOwners=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"});this._foreignOwners=(e.objects||[]).filter(t=>t.entry_id!==this._entryId&&(t.parts||[]).length>0).map(t=>({entry_id:t.entry_id,name:t.object?.name||t.entry_id,parts:t.parts||[]})).sort((t,i)=>t.name.localeCompare(i.name))}catch{this._foreignOwners=[]}}async _loadTags(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=e.tags||[]}catch{this._availableTags=[]}}_fetchConditionAttributes(e){!e||!this.hass||this._conditionAttrOptions[e]||this._conditionAttrPending.has(e)||(this._conditionAttrPending.add(e),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e}).then(t=>{let i=t;this._conditionAttrOptions={...this._conditionAttrOptions,[e]:{suggested:i.suggested_attributes||[],available:i.available_attributes||[]}}}).catch(()=>{this._conditionAttrOptions={...this._conditionAttrOptions,[e]:{suggested:[],available:[]}}}))}async _fetchEntityAttributes(e){if(!e||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e});this._entityDomain=t.domain||"",this._suggestedAttributes=t.suggested_attributes||[],this._availableAttributes=t.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}get _hasForeignPick(){return Object.values(this._consumesParts).some(e=>!!e.entry_id)}_renderConsumesRow(e,t){let i=U({part_id:e.id,entry_id:t}),n=this._consumesParts[i],l=t?{part_id:e.id,quantity:1,entry_id:t}:{part_id:e.id,quantity:1};return o`
|
||||
<div class="consumes-row">
|
||||
<label class="consumes-check">
|
||||
<input
|
||||
@@ -1737,7 +1737,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
@input=${c=>{let p=parseFloat(c.target.value);this._consumesParts={...this._consumesParts,[i]:{...l,quantity:Number.isFinite(p)&&p>=.01?p:1}}}}
|
||||
/>`:_}
|
||||
</div>
|
||||
`}_toggleRequired(e,t){let i=new Set(this._requiredCompletion);t?i.add(e):i.delete(e),this._requiredCompletion=[...i]}async _save(){if(!this._loading&&this._name.trim()){if(this._adaptiveSnapshot()!==this._adaptiveInitial){let e=parseInt(this._adaptiveMin,10),t=parseInt(this._adaptiveMax,10);if(!isNaN(e)&&!isNaN(t)&&e>t){this._error=`${r("adaptive_min_interval",this._lang)} > ${r("adaptive_max_interval",this._lang)}`;return}}this._loading=!0,this._error="";try{let e={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:Number.isNaN(parseInt(this._warningDays,10))?this.defaultWarningDays:Math.max(0,parseInt(this._warningDays,10))},t=this._earliestCompletionDays.trim();if(e.earliest_completion_days=t===""?null:Math.max(0,parseInt(t,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):pt.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.priority=this._priority,e.labels=this._labels.split(",").map(c=>c.trim()).filter(Boolean),e.enabled=this._enabled,e.last_performed=this._lastPerformed||null,e.nfc_tag_id=this._nfcTagId||null,e.reading_unit=this._readingUnit.trim()||null,(this.parts.length||this._foreignOwners.length)&&(e.consumes_parts=Object.values(this._consumesParts).map(c=>c.entry_id?{part_id:c.part_id,quantity:c.quantity,entry_id:c.entry_id}:{part_id:c.part_id,quantity:c.quantity})),e.responsible_user_id=this._responsibleUserId,e.assignee_pool=this._assigneePool,e.required_completion_fields=this._requiredCompletion,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let c=this._compoundConditions.map($s).filter(p=>p!==null);if(c.length>0){let p={type:"compound",compound_logic:this._compoundLogic,conditions:c};this._autoCompleteOnRecovery&&(p.auto_complete_on_recovery=!0),e.trigger_config=p}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let c=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],p={entity_id:c[0],entity_ids:c,type:this._triggerType};if(this._triggerAttribute&&(p.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(p.auto_complete_on_recovery=!0),c.length>1&&(p.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let u=parseFloat(this._triggerAbove);isNaN(u)||(p.trigger_above=u)}if(this._triggerBelow){let u=parseFloat(this._triggerBelow);isNaN(u)||(p.trigger_below=u)}if(this._triggerForMinutes){let u=parseInt(this._triggerForMinutes,10);isNaN(u)||(p.trigger_for_minutes=u)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let u=parseFloat(this._triggerTargetValue);isNaN(u)||(p.trigger_target_value=u)}if(p.trigger_delta_mode=this._triggerDeltaMode,this._triggerDeltaMode&&this._triggerBaselineValue){let u=parseFloat(this._triggerBaselineValue);!isNaN(u)&&u>=0&&(p.trigger_baseline_value=u)}}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(p.trigger_from_state=this._triggerFromState),this._triggerToState&&(p.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let u=parseInt(this._triggerTargetChanges,10);isNaN(u)||(p.trigger_target_changes=u)}}else if(this._triggerType==="runtime"){if(this._triggerRuntimeHours){let v=parseFloat(this._triggerRuntimeHours);isNaN(v)||(p.trigger_runtime_hours=v)}let u=this._triggerOnStates.split(",").map(v=>v.trim()).filter(Boolean);u.length>0&&(p.trigger_on_states=u)}e.trigger_config=p}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let c=this._scheduleTime.trim();e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(c)?c:null}if(this.checklistsEnabled){let c=this._checklistText.split(`
|
||||
`}_toggleRequired(e,t){let i=new Set(this._requiredCompletion);t?i.add(e):i.delete(e),this._requiredCompletion=[...i]}async _save(){if(!this._loading&&this._name.trim()){if(this._adaptiveSnapshot()!==this._adaptiveInitial){let e=parseInt(this._adaptiveMin,10),t=parseInt(this._adaptiveMax,10);if(!isNaN(e)&&!isNaN(t)&&e>t){this._error=`${r("adaptive_min_interval",this._lang)} > ${r("adaptive_max_interval",this._lang)}`;return}}this._loading=!0,this._error="";try{let e={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:Number.isNaN(parseInt(this._warningDays,10))?this.defaultWarningDays:Math.max(0,parseInt(this._warningDays,10))},t=this._earliestCompletionDays.trim();if(e.earliest_completion_days=t===""?null:Math.max(0,parseInt(t,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):_t.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.priority=this._priority,e.labels=this._labels.split(",").map(c=>c.trim()).filter(Boolean),e.enabled=this._enabled,e.last_performed=this._lastPerformed||null,e.nfc_tag_id=this._nfcTagId||null,e.reading_unit=this._readingUnit.trim()||null,(this.parts.length||this._foreignOwners.length)&&(e.consumes_parts=Object.values(this._consumesParts).map(c=>c.entry_id?{part_id:c.part_id,quantity:c.quantity,entry_id:c.entry_id}:{part_id:c.part_id,quantity:c.quantity})),e.responsible_user_id=this._responsibleUserId,e.assignee_pool=this._assigneePool,e.required_completion_fields=this._requiredCompletion,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let c=this._compoundConditions.map(Ts).filter(p=>p!==null);if(c.length>0){let p={type:"compound",compound_logic:this._compoundLogic,conditions:c};this._autoCompleteOnRecovery&&(p.auto_complete_on_recovery=!0),e.trigger_config=p}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let c=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],p={entity_id:c[0],entity_ids:c,type:this._triggerType};if(this._triggerAttribute&&(p.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(p.auto_complete_on_recovery=!0),c.length>1&&(p.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let u=parseFloat(this._triggerAbove);isNaN(u)||(p.trigger_above=u)}if(this._triggerBelow){let u=parseFloat(this._triggerBelow);isNaN(u)||(p.trigger_below=u)}if(this._triggerForMinutes){let u=parseInt(this._triggerForMinutes,10);isNaN(u)||(p.trigger_for_minutes=u)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let u=parseFloat(this._triggerTargetValue);isNaN(u)||(p.trigger_target_value=u)}if(p.trigger_delta_mode=this._triggerDeltaMode,this._triggerDeltaMode&&this._triggerBaselineValue){let u=parseFloat(this._triggerBaselineValue);!isNaN(u)&&u>=0&&(p.trigger_baseline_value=u)}}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(p.trigger_from_state=this._triggerFromState),this._triggerToState&&(p.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let u=parseInt(this._triggerTargetChanges,10);isNaN(u)||(p.trigger_target_changes=u)}}else if(this._triggerType==="runtime"){if(this._triggerRuntimeHours){let v=parseFloat(this._triggerRuntimeHours);isNaN(v)||(p.trigger_runtime_hours=v)}let u=this._triggerOnStates.split(",").map(v=>v.trim()).filter(Boolean);u.length>0&&(p.trigger_on_states=u)}e.trigger_config=p}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let c=this._scheduleTime.trim();e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(c)?c:null}if(this.checklistsEnabled){let c=this._checklistText.split(`
|
||||
`).map(p=>p.trim()).filter(Boolean).slice(0,100);e.checklist=c.length?c:null}if(this.completionActionsEnabled){let c=this._actionService.trim();if(c&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(c)){let f={service:c},y=this._actionTargetEntity.trim();y&&(f.target={entity_id:y});let g=this._buildActionData();Object.keys(g).length>0&&(f.data=g),e.on_complete_action=f}else e.on_complete_action=null;let p={};this._qcNotes.trim()&&(p.notes=this._qcNotes.trim());let u=parseFloat(this._qcCost);!isNaN(u)&&u>=0&&(p.cost=u);let v=parseInt(this._qcDuration,10);!isNaN(v)&&v>=0&&(p.duration=v),this._qcFeedback&&(p.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(p).length?p:null}let i=await this.hass.connection.sendMessagePromise(e),n=this._taskId||i?.task_id,l=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(n&&this._scheduleType==="sensor_based"&&l)try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:n,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null}),this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute}catch{}if(n&&this._adaptiveSnapshot()!==this._adaptiveInitial){let c=parseFloat(this._adaptiveAlpha),p=parseInt(this._adaptiveMin,10),u=parseInt(this._adaptiveMax,10);try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_adaptive",entry_id:this._entryId,task_id:n,enabled:this._adaptiveEnabled,...c>=.1&&c<=.9?{ewa_alpha:c}:{},...!isNaN(p)&&p>=1?{min_interval_days:p}:{},...!isNaN(u)&&u>=1?{max_interval_days:u}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction}),this._adaptiveInitial=this._adaptiveSnapshot()}catch{}}this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}catch(e){this._error=P(e,this._lang,r("save_error",this._lang))}finally{this._loading=!1}}}_close(){this._open=!1,this._pickerProbeTimer!==void 0&&(clearTimeout(this._pickerProbeTimer),this._pickerProbeTimer=void 0),this._pickerProbeStrikes=0}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return _;let e=this._lang,t=this._triggerType==="compound";return o`
|
||||
<h3>${r("trigger_configuration",e)}</h3>
|
||||
<div class="select-row">
|
||||
@@ -1746,7 +1746,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}
|
||||
>
|
||||
${vs.map(i=>o`<option value=${i} ?selected=${i===this._triggerType}>${r(i,e)}</option>`)}
|
||||
${ks.map(i=>o`<option value=${i} ?selected=${i===this._triggerType}>${r(i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${t?this._renderCompoundEditor():o`
|
||||
@@ -1760,7 +1760,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:ct}}}]}
|
||||
.schema=${[{name:"trigger_entities",selector:{entity:{multiple:!0,domain:ht}}}]}
|
||||
.data=${{trigger_entities:this._triggerEntityIds.length>0?this._triggerEntityIds:this._triggerEntityId?[this._triggerEntityId]:[]}}
|
||||
.computeLabel=${()=>r("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("")}}
|
||||
@@ -1777,25 +1777,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
</select>
|
||||
</div>
|
||||
`:_}
|
||||
${this._availableAttributes.length>0?o`
|
||||
<div class="select-row">
|
||||
<label>${r("attribute_optional",e)}</label>
|
||||
<select
|
||||
.value=${this._triggerAttribute}
|
||||
@change=${i=>this._triggerAttribute=i.target.value}
|
||||
>
|
||||
<option value="" ?selected=${!this._triggerAttribute}>${r("use_entity_state",e)}</option>
|
||||
${this._suggestedAttributes.map(i=>o`<option value=${i} ?selected=${i===this._triggerAttribute}>${i} ★</option>`)}
|
||||
${this._availableAttributes.filter(i=>!this._suggestedAttributes.includes(i.name)).map(i=>o`<option value=${i.name} ?selected=${i.name===this._triggerAttribute}>${i.name}${i.numeric?"":" (non-numeric)"}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
`:o`
|
||||
<ms-textfield
|
||||
label="${r("attribute_optional",e)}"
|
||||
.value=${this._triggerAttribute}
|
||||
@input=${i=>this._triggerAttribute=i.target.value}
|
||||
></ms-textfield>
|
||||
`}
|
||||
${this._renderAttributeSelect({label:r("attribute_optional",e),value:this._triggerAttribute,suggested:this._suggestedAttributes,available:this._availableAttributes,onSelect:i=>this._triggerAttribute=i})}
|
||||
${this._renderTriggerTypeFields()}
|
||||
${this._renderTriggerLiveHint()}
|
||||
`}
|
||||
@@ -1815,7 +1797,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
@input=${i=>this._intervalDays=i.target.value}
|
||||
></ms-textfield>
|
||||
${this._intervalDays?this._renderUnitSelect():_}
|
||||
`}_patchCondition(e,t){this._compoundConditions=this._compoundConditions.map((i,n)=>n===e?{...i,...t}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,bs()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((t,i)=>i!==e)}_renderCompoundEditor(){let e=this._lang;return o`
|
||||
`}_patchCondition(e,t){this._compoundConditions=this._compoundConditions.map((i,n)=>n===e?{...i,...t}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Es()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((t,i)=>i!==e)}_renderCompoundEditor(){let e=this._lang;return o`
|
||||
<div class="select-row">
|
||||
<label>${r("compound_logic",e)}</label>
|
||||
<select
|
||||
@@ -1852,7 +1834,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:ct}}}]}
|
||||
.schema=${[{name:"condition_entities",selector:{entity:{multiple:!0,domain:ht}}}]}
|
||||
.data=${{condition_entities:e.entityIds.split(",").map(l=>l.trim()).filter(Boolean)}}
|
||||
.computeLabel=${()=>r("entity_id",i)}
|
||||
@value-changed=${l=>{let c=(l.detail.value.condition_entities||[]).filter(Boolean);this._patchCondition(t,{entityIds:c.join(", ")})}}
|
||||
@@ -1864,7 +1846,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.value=${e.type}
|
||||
@change=${l=>this._patchCondition(t,{type:l.target.value})}
|
||||
>
|
||||
${li.map(l=>o`<option value=${l} ?selected=${l===e.type}>${r(l,i)}</option>`)}
|
||||
${hi.map(l=>o`<option value=${l} ?selected=${l===e.type}>${r(l,i)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._renderConditionTypeFields(e,t)}
|
||||
@@ -1953,43 +1935,25 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
</label>
|
||||
`:_}
|
||||
</details>
|
||||
`}_renderEnvironmentalAttribute(e){this._fetchConditionAttributes(this._environmentalEntity);let t=this._conditionAttrOptions[this._environmentalEntity];return t&&t.available.length>0?o`
|
||||
`}_renderAttributeSelect(e){let t=this._lang;return e.available.length>0?o`
|
||||
<div class="select-row">
|
||||
<label>${r("environmental_attribute_optional",e)}</label>
|
||||
<label>${e.label}</label>
|
||||
<select
|
||||
.value=${this._environmentalAttribute}
|
||||
@change=${i=>this._environmentalAttribute=i.target.value}
|
||||
.value=${e.value}
|
||||
@change=${i=>e.onSelect(i.target.value)}
|
||||
>
|
||||
<option value="" ?selected=${!this._environmentalAttribute}>${r("use_entity_state",e)}</option>
|
||||
${t.suggested.map(i=>o`<option value=${i} ?selected=${i===this._environmentalAttribute}>${i} ★</option>`)}
|
||||
${t.available.filter(i=>!t.suggested.includes(i.name)).map(i=>o`<option value=${i.name} ?selected=${i.name===this._environmentalAttribute}>${i.name}${i.numeric?"":" (non-numeric)"}</option>`)}
|
||||
<option value="" ?selected=${!e.value}>${r("use_entity_state",t)}</option>
|
||||
${e.suggested.map(i=>o`<option value=${i} ?selected=${i===e.value}>${i} ★</option>`)}
|
||||
${e.available.filter(i=>!e.suggested.includes(i.name)).map(i=>o`<option value=${i.name} ?selected=${i.name===e.value}>${i.name}${i.numeric?"":" (non-numeric)"}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
`:o`
|
||||
<ms-textfield
|
||||
label="${r("environmental_attribute_optional",e)}"
|
||||
.value=${this._environmentalAttribute}
|
||||
@input=${i=>this._environmentalAttribute=i.target.value.trim()}
|
||||
label="${e.label}"
|
||||
.value=${e.value}
|
||||
@input=${i=>e.onSelect(i.target.value.trim())}
|
||||
></ms-textfield>
|
||||
`}_renderConditionAttribute(e,t){let i=this._lang,n=e.entityIds.split(",")[0]?.trim()||"";n&&this._fetchConditionAttributes(n);let l=n?this._conditionAttrOptions[n]:void 0;return l&&l.available.length>0?o`
|
||||
<div class="select-row">
|
||||
<label>${r("attribute_optional",i)}</label>
|
||||
<select
|
||||
.value=${e.attribute}
|
||||
@change=${c=>this._patchCondition(t,{attribute:c.target.value})}
|
||||
>
|
||||
<option value="" ?selected=${!e.attribute}>${r("use_entity_state",i)}</option>
|
||||
${l.suggested.map(c=>o`<option value=${c} ?selected=${c===e.attribute}>${c} ★</option>`)}
|
||||
${l.available.filter(c=>!l.suggested.includes(c.name)).map(c=>o`<option value=${c.name} ?selected=${c.name===e.attribute}>${c.name}${c.numeric?"":" (non-numeric)"}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
`:o`
|
||||
<ms-textfield
|
||||
label="${r("attribute_optional",i)}"
|
||||
.value=${e.attribute}
|
||||
@input=${c=>this._patchCondition(t,{attribute:c.target.value.trim()})}
|
||||
></ms-textfield>
|
||||
`}_renderConditionTypeFields(e,t){let i=this._lang;if(e.type==="threshold")return o`
|
||||
`}_renderEnvironmentalAttribute(e){this._fetchConditionAttributes(this._environmentalEntity);let t=this._conditionAttrOptions[this._environmentalEntity];return this._renderAttributeSelect({label:r("environmental_attribute_optional",e),value:this._environmentalAttribute,suggested:t?.suggested??[],available:t?.available??[],onSelect:i=>this._environmentalAttribute=i})}_renderConditionAttribute(e,t){let i=e.entityIds.split(",")[0]?.trim()||"";i&&this._fetchConditionAttributes(i);let n=i?this._conditionAttrOptions[i]:void 0;return this._renderAttributeSelect({label:r("attribute_optional",this._lang),value:e.attribute,suggested:n?.suggested??[],available:n?.available??[],onSelect:l=>this._patchCondition(t,{attribute:l})})}_renderConditionTypeFields(e,t){let i=this._lang;if(e.type==="threshold")return o`
|
||||
<ms-textfield label="${r("trigger_above",i)}" type="number" .value=${e.above}
|
||||
@input=${n=>this._patchCondition(t,{above:n.target.value})}></ms-textfield>
|
||||
<ms-textfield label="${r("trigger_below",i)}" type="number" .value=${e.below}
|
||||
@@ -2022,12 +1986,12 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
>
|
||||
${["days","weeks","months","years"].map(t=>o`<option value=${t} ?selected=${t===this._intervalUnit}>${r("unit_"+t,e)}</option>`)}
|
||||
</select>
|
||||
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(pt.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e),this._scheduleEntityPickerProbe();for(let t of e.keys())if(m._PREVIEW_RELEVANT.has(String(t))){this._schedulePreviewRefresh();return}}_scheduleEntityPickerProbe(){this._entityPickerFallback||this._pickerProbeTimer!==void 0||!this._open||this._scheduleType!=="sensor_based"||(this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),1500))}_probeEntityPickers(){if(this._pickerProbeTimer=void 0,this._entityPickerFallback||!this._open)return;let e=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),t=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!e||!t){this._pickerProbeStrikes=0;return}let i=(p,u,v=0)=>{if(!(!p||v>10)){(p.tagName?.toLowerCase()??"")==="ha-entity-picker"&&u.push(p);for(let f of[p.shadowRoot,p])if(f)for(let y of Array.from(f.children??[]))i(y,u,v+1)}},n=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],l=[];for(let p of n)i(p,l);let c=l.length===0||l.some(p=>p.offsetHeight===0);if(e.offsetHeight===0||c){if(this._pickerProbeStrikes+=1,this._pickerProbeStrikes>=2){this._entityPickerFallback=!0;return}this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),700)}else this._pickerProbeStrikes=0}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let t=++this._previewSeq;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(t!==this._previewSeq)return;this._schedulePreview=i.occurrences||[],this._schedulePreviewEnded=!!i.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return _;let e=this._lang,t=this.scheduleTimeEnabled&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((l,c)=>{let p=new Date(`${l}T12:00:00`).getDay();return`${we(p===0?6:p-1,e,"short")} ${K(l,e)}${c===0?t:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?o`<div class="field-help">${r("schedule_preview_ontime",e)}</div>`:_;return o`
|
||||
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(_t.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e),this._scheduleEntityPickerProbe();for(let t of e.keys())if(m._PREVIEW_RELEVANT.has(String(t))){this._schedulePreviewRefresh();return}}_scheduleEntityPickerProbe(){this._entityPickerFallback||this._pickerProbeTimer!==void 0||!this._open||this._scheduleType!=="sensor_based"||(this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),1500))}_probeEntityPickers(){if(this._pickerProbeTimer=void 0,this._entityPickerFallback||!this._open)return;let e=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),t=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!e||!t){this._pickerProbeStrikes=0;return}let i=(p,u,v=0)=>{if(!(!p||v>10)){(p.tagName?.toLowerCase()??"")==="ha-entity-picker"&&u.push(p);for(let f of[p.shadowRoot,p])if(f)for(let y of Array.from(f.children??[]))i(y,u,v+1)}},n=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],l=[];for(let p of n)i(p,l);let c=l.length===0||l.some(p=>p.offsetHeight===0);if(e.offsetHeight===0||c){if(this._pickerProbeStrikes+=1,this._pickerProbeStrikes>=2){this._entityPickerFallback=!0;return}this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),700)}else this._pickerProbeStrikes=0}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let t=++this._previewSeq;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(t!==this._previewSeq)return;this._schedulePreview=i.occurrences||[],this._schedulePreviewEnded=!!i.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return _;let e=this._lang,t=this.scheduleTimeEnabled&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((l,c)=>{let p=new Date(`${l}T12:00:00`).getDay();return`${Ee(p===0?6:p-1,e,"short")} ${G(l,e)}${c===0?t:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?o`<div class="field-help">${r("schedule_preview_ontime",e)}</div>`:_;return o`
|
||||
<div class="trigger-live-hint schedule-preview">
|
||||
${r("schedule_preview_title",e)}: ${i}${this._schedulePreviewEnded?o` <span class="field-help">${r("schedule_preview_ends",e)}</span>`:_}
|
||||
${n}
|
||||
</div>
|
||||
`}_buildSchedule(){let e=i=>{let n=parseInt(this._calOffset,10)||0;return n&&(i.offset=Math.max(-15,Math.min(n,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||pt.includes(this._scheduleType)))return _;let i=ks(e);return o`
|
||||
`}_buildSchedule(){let e=i=>{let n=parseInt(this._calOffset,10)||0;return n&&(i.offset=Math.max(-15,Math.min(n,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||_t.includes(this._scheduleType)))return _;let i=Is(e);return o`
|
||||
<label class="field-label">${r("season_window_label",e)}</label>
|
||||
<div class="field-help">${r("season_window_hint",e)}</div>
|
||||
<div class="weekday-chips season-chips">
|
||||
@@ -2062,7 +2026,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.value=${this._endsUntil}
|
||||
@input=${n=>this._endsUntil=n.target.value}
|
||||
></ms-textfield>`:_}
|
||||
`}_renderCalendarFields(){let e=this._lang,t=ws(e);if(this._scheduleType==="weekdays")return o`
|
||||
`}_renderCalendarFields(){let e=this._lang,t=Cs(e);if(this._scheduleType==="weekdays")return o`
|
||||
<label class="field-label">${r("recurrence_on_days",e)}</label>
|
||||
<div class="weekday-chips">
|
||||
${t.map((i,n)=>o`
|
||||
@@ -2216,7 +2180,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}
|
||||
>
|
||||
${gs.map(i=>o`<option value=${i} ?selected=${i===this._type}>${r(i,e)}</option>`)}
|
||||
${xs.map(i=>o`<option value=${i} ?selected=${i===this._type}>${r(i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._type==="reading"?o`
|
||||
@@ -2250,7 +2214,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}
|
||||
>
|
||||
${ms.map(i=>o`<option value=${i} ?selected=${i===this._priority}>${r("priority_"+i,e)}</option>`)}
|
||||
${$s.map(i=>o`<option value=${i} ?selected=${i===this._priority}>${r("priority_"+i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
@@ -2269,7 +2233,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}
|
||||
>
|
||||
${fs.map(i=>o`<option value=${i} ?selected=${i===this._scheduleType}>${r(i,e)}</option>`)}
|
||||
${ws.map(i=>o`<option value=${i} ?selected=${i===this._scheduleType}>${r(i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._scheduleType==="time_based"?o`
|
||||
@@ -2340,14 +2304,14 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
`:_}
|
||||
<h3>${r("require_on_completion",e)}</h3>
|
||||
<div class="required-completion">
|
||||
${si.map(i=>o`
|
||||
${oi.map(i=>o`
|
||||
<label class="req-option">
|
||||
<input
|
||||
type="checkbox"
|
||||
.checked=${this._requiredCompletion.includes(i)}
|
||||
@change=${n=>this._toggleRequired(i,n.target.checked)}
|
||||
/>
|
||||
<span>${r(ze[i],e)}</span>
|
||||
<span>${r(De[i],e)}</span>
|
||||
</label>
|
||||
`)}
|
||||
</div>
|
||||
@@ -2406,7 +2370,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:ai,device_class:ni}}}]}
|
||||
.schema=${[{name:"environmental_entity",selector:{entity:{domain:di,device_class:ci}}}]}
|
||||
.data=${{environmental_entity:this._environmentalEntity}}
|
||||
.computeLabel=${()=>r("environmental_entity_optional",e)}
|
||||
.computeHelper=${()=>r("environmental_entity_helper",e)}
|
||||
@@ -2770,7 +2734,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
`,d([b({attribute:!1})],m.prototype,"hass",2),d([b({type:Boolean,attribute:"checklists-enabled"})],m.prototype,"checklistsEnabled",2),d([b({type:Boolean,attribute:"schedule-time-enabled"})],m.prototype,"scheduleTimeEnabled",2),d([b({type:Boolean,attribute:"completion-actions-enabled"})],m.prototype,"completionActionsEnabled",2),d([b({type:Number,attribute:"default-warning-days"})],m.prototype,"defaultWarningDays",2),d([h()],m.prototype,"parts",2),d([h()],m.prototype,"_foreignOwners",2),d([h()],m.prototype,"_open",2),d([h()],m.prototype,"_entityPickerFallback",2),d([h()],m.prototype,"_loading",2),d([h()],m.prototype,"_error",2),d([h()],m.prototype,"_entryId",2),d([h()],m.prototype,"_taskId",2),d([h()],m.prototype,"_objectChoices",2),d([h()],m.prototype,"_name",2),d([h()],m.prototype,"_type",2),d([h()],m.prototype,"_scheduleType",2),d([h()],m.prototype,"_intervalDays",2),d([h()],m.prototype,"_intervalUnit",2),d([h()],m.prototype,"_dueDate",2),d([h()],m.prototype,"_warningDays",2),d([h()],m.prototype,"_earliestCompletionDays",2),d([h()],m.prototype,"_intervalAnchor",2),d([h()],m.prototype,"_weekdays",2),d([h()],m.prototype,"_nth",2),d([h()],m.prototype,"_nthWeekday",2),d([h()],m.prototype,"_domDay",2),d([h()],m.prototype,"_domLastDay",2),d([h()],m.prototype,"_domBusiness",2),d([h()],m.prototype,"_calOffset",2),d([h()],m.prototype,"_seasonMonths",2),d([h()],m.prototype,"_endsMode",2),d([h()],m.prototype,"_endsCount",2),d([h()],m.prototype,"_endsUntil",2),d([h()],m.prototype,"_schedulePreview",2),d([h()],m.prototype,"_schedulePreviewEnded",2),d([h()],m.prototype,"_notes",2),d([h()],m.prototype,"_documentationUrl",2),d([h()],m.prototype,"_customIcon",2),d([h()],m.prototype,"_priority",2),d([h()],m.prototype,"_labels",2),d([h()],m.prototype,"_enabled",2),d([h()],m.prototype,"_triggerEntityId",2),d([h()],m.prototype,"_triggerEntityIds",2),d([h()],m.prototype,"_triggerEntityLogic",2),d([h()],m.prototype,"_triggerAttribute",2),d([h()],m.prototype,"_triggerType",2),d([h()],m.prototype,"_triggerAbove",2),d([h()],m.prototype,"_triggerBelow",2),d([h()],m.prototype,"_triggerForMinutes",2),d([h()],m.prototype,"_triggerTargetValue",2),d([h()],m.prototype,"_triggerDeltaMode",2),d([h()],m.prototype,"_triggerBaselineValue",2),d([h()],m.prototype,"_liveBaselineValue",2),d([h()],m.prototype,"_autoCompleteOnRecovery",2),d([h()],m.prototype,"_triggerFromState",2),d([h()],m.prototype,"_triggerToState",2),d([h()],m.prototype,"_triggerTargetChanges",2),d([h()],m.prototype,"_triggerRuntimeHours",2),d([h()],m.prototype,"_triggerOnStates",2),d([h()],m.prototype,"_compoundLogic",2),d([h()],m.prototype,"_compoundConditions",2),d([h()],m.prototype,"_suggestedAttributes",2),d([h()],m.prototype,"_availableAttributes",2),d([h()],m.prototype,"_entityDomain",2),d([h()],m.prototype,"_lastPerformed",2),d([h()],m.prototype,"_nfcTagId",2),d([h()],m.prototype,"_readingUnit",2),d([h()],m.prototype,"_consumesParts",2),d([h()],m.prototype,"_partsLoadFailed",2),d([h()],m.prototype,"_availableTags",2),d([h()],m.prototype,"_responsibleUserId",2),d([h()],m.prototype,"_assigneePool",2),d([h()],m.prototype,"_rotationStrategy",2),d([h()],m.prototype,"_availableUsers",2),d([h()],m.prototype,"_checklistText",2),d([h()],m.prototype,"_requiredCompletion",2),d([h()],m.prototype,"_scheduleTime",2),d([h()],m.prototype,"_actionService",2),d([h()],m.prototype,"_actionTargetEntity",2),d([h()],m.prototype,"_actionData",2),d([h()],m.prototype,"_actionDataJsonFallback",2),d([h()],m.prototype,"_actionTesting",2),d([h()],m.prototype,"_actionTestResult",2),d([h()],m.prototype,"_actionTestError",2),d([h()],m.prototype,"_qcNotes",2),d([h()],m.prototype,"_qcCost",2),d([h()],m.prototype,"_qcDuration",2),d([h()],m.prototype,"_qcFeedback",2),d([h()],m.prototype,"_environmentalEntity",2),d([h()],m.prototype,"_environmentalAttribute",2),d([h()],m.prototype,"_adaptiveEnabled",2),d([h()],m.prototype,"_adaptiveAlpha",2),d([h()],m.prototype,"_adaptiveMin",2),d([h()],m.prototype,"_adaptiveMax",2),d([h()],m.prototype,"_adaptiveSeasonal",2),d([h()],m.prototype,"_adaptivePrediction",2),d([h()],m.prototype,"_conditionAttrOptions",2);ht=m;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",ht)});var z,ci=$(()=>{"use strict";L();q();C();re();z=class extends k{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null;this._partOptions=null;this._partQty={};this._partQtyOriginal=""}get _lang(){return this.hass?.language||"en"}openEdit(e){this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._loadPartOptions()}async _loadPartOptions(){let e=this._draft;if(e)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"}),i=[];for(let l of t.parts||[]){let c=l.entry_id===e.entry_id,p=l.consumers.some(u=>u.entry_id===e.entry_id&&u.task_id===e.task_id);!c&&!p|
Line truncated
|
||||
`,d([b({attribute:!1})],m.prototype,"hass",2),d([b({type:Boolean,attribute:"checklists-enabled"})],m.prototype,"checklistsEnabled",2),d([b({type:Boolean,attribute:"schedule-time-enabled"})],m.prototype,"scheduleTimeEnabled",2),d([b({type:Boolean,attribute:"completion-actions-enabled"})],m.prototype,"completionActionsEnabled",2),d([b({type:Number,attribute:"default-warning-days"})],m.prototype,"defaultWarningDays",2),d([h()],m.prototype,"parts",2),d([h()],m.prototype,"_foreignOwners",2),d([h()],m.prototype,"_open",2),d([h()],m.prototype,"_entityPickerFallback",2),d([h()],m.prototype,"_loading",2),d([h()],m.prototype,"_error",2),d([h()],m.prototype,"_entryId",2),d([h()],m.prototype,"_taskId",2),d([h()],m.prototype,"_objectChoices",2),d([h()],m.prototype,"_name",2),d([h()],m.prototype,"_type",2),d([h()],m.prototype,"_scheduleType",2),d([h()],m.prototype,"_intervalDays",2),d([h()],m.prototype,"_intervalUnit",2),d([h()],m.prototype,"_dueDate",2),d([h()],m.prototype,"_warningDays",2),d([h()],m.prototype,"_earliestCompletionDays",2),d([h()],m.prototype,"_intervalAnchor",2),d([h()],m.prototype,"_weekdays",2),d([h()],m.prototype,"_nth",2),d([h()],m.prototype,"_nthWeekday",2),d([h()],m.prototype,"_domDay",2),d([h()],m.prototype,"_domLastDay",2),d([h()],m.prototype,"_domBusiness",2),d([h()],m.prototype,"_calOffset",2),d([h()],m.prototype,"_seasonMonths",2),d([h()],m.prototype,"_endsMode",2),d([h()],m.prototype,"_endsCount",2),d([h()],m.prototype,"_endsUntil",2),d([h()],m.prototype,"_schedulePreview",2),d([h()],m.prototype,"_schedulePreviewEnded",2),d([h()],m.prototype,"_notes",2),d([h()],m.prototype,"_documentationUrl",2),d([h()],m.prototype,"_customIcon",2),d([h()],m.prototype,"_priority",2),d([h()],m.prototype,"_labels",2),d([h()],m.prototype,"_enabled",2),d([h()],m.prototype,"_triggerEntityId",2),d([h()],m.prototype,"_triggerEntityIds",2),d([h()],m.prototype,"_triggerEntityLogic",2),d([h()],m.prototype,"_triggerAttribute",2),d([h()],m.prototype,"_triggerType",2),d([h()],m.prototype,"_triggerAbove",2),d([h()],m.prototype,"_triggerBelow",2),d([h()],m.prototype,"_triggerForMinutes",2),d([h()],m.prototype,"_triggerTargetValue",2),d([h()],m.prototype,"_triggerDeltaMode",2),d([h()],m.prototype,"_triggerBaselineValue",2),d([h()],m.prototype,"_liveBaselineValue",2),d([h()],m.prototype,"_autoCompleteOnRecovery",2),d([h()],m.prototype,"_triggerFromState",2),d([h()],m.prototype,"_triggerToState",2),d([h()],m.prototype,"_triggerTargetChanges",2),d([h()],m.prototype,"_triggerRuntimeHours",2),d([h()],m.prototype,"_triggerOnStates",2),d([h()],m.prototype,"_compoundLogic",2),d([h()],m.prototype,"_compoundConditions",2),d([h()],m.prototype,"_suggestedAttributes",2),d([h()],m.prototype,"_availableAttributes",2),d([h()],m.prototype,"_entityDomain",2),d([h()],m.prototype,"_lastPerformed",2),d([h()],m.prototype,"_nfcTagId",2),d([h()],m.prototype,"_readingUnit",2),d([h()],m.prototype,"_consumesParts",2),d([h()],m.prototype,"_partsLoadFailed",2),d([h()],m.prototype,"_availableTags",2),d([h()],m.prototype,"_responsibleUserId",2),d([h()],m.prototype,"_assigneePool",2),d([h()],m.prototype,"_rotationStrategy",2),d([h()],m.prototype,"_availableUsers",2),d([h()],m.prototype,"_checklistText",2),d([h()],m.prototype,"_requiredCompletion",2),d([h()],m.prototype,"_scheduleTime",2),d([h()],m.prototype,"_actionService",2),d([h()],m.prototype,"_actionTargetEntity",2),d([h()],m.prototype,"_actionData",2),d([h()],m.prototype,"_actionDataJsonFallback",2),d([h()],m.prototype,"_actionTesting",2),d([h()],m.prototype,"_actionTestResult",2),d([h()],m.prototype,"_actionTestError",2),d([h()],m.prototype,"_qcNotes",2),d([h()],m.prototype,"_qcCost",2),d([h()],m.prototype,"_qcDuration",2),d([h()],m.prototype,"_qcFeedback",2),d([h()],m.prototype,"_environmentalEntity",2),d([h()],m.prototype,"_environmentalAttribute",2),d([h()],m.prototype,"_adaptiveEnabled",2),d([h()],m.prototype,"_adaptiveAlpha",2),d([h()],m.prototype,"_adaptiveMin",2),d([h()],m.prototype,"_adaptiveMax",2),d([h()],m.prototype,"_adaptiveSeasonal",2),d([h()],m.prototype,"_adaptivePrediction",2),d([h()],m.prototype,"_conditionAttrOptions",2);ut=m;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",ut)});var F,ui=$(()=>{"use strict";L();z();I();ne();F=class extends k{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null;this._partOptions=null;this._partQty={};this._partQtyOriginal=""}get _lang(){return N(this.hass)}openEdit(e){this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._loadPartOptions()}async _loadPartOptions(){let e=this._draft;if(e)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"}),i=[];for(let l of t.parts||[]){let c=l.entry_id===e.entry_id,p=l.consumers.some(u=>u.entry_id===e.entry_id&&u.task_id===e.task_id);!c&&!p||i.push({part
Line truncated
|
||||
<div class="backdrop" @click=${this.close}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true">
|
||||
<h2>${r("history_edit_title",e)||"Edit history entry"}</h2>
|
||||
@@ -2832,7 +2796,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`}};z.styles=E`
|
||||
`}};F.styles=E`
|
||||
:host { display: contents; }
|
||||
.backdrop {
|
||||
position: fixed; inset: 0;
|
||||
@@ -2908,7 +2872,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.part-row-edit input[type="checkbox"] { width: auto; }
|
||||
.part-label { flex: 1; color: var(--primary-text-color); }
|
||||
.part-qty { width: 76px; }
|
||||
`,d([b({attribute:!1})],z.prototype,"hass",2),d([h()],z.prototype,"_open",2),d([h()],z.prototype,"_saving",2),d([h()],z.prototype,"_error",2),d([h()],z.prototype,"_draft",2),d([h()],z.prototype,"_partOptions",2),d([h()],z.prototype,"_partQty",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",z)});function ce(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function pi(a){return!a.startsWith("data:image/svg+xml,")&&!a.startsWith("data:image/png;base64,")?"":ce(a)}function Es(a){return a.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var H,hi=$(()=>{"use strict";L();q();C();H=class extends k{constructor(){super(...arguments);this.lang="en";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}openForObject(e,t){this._entryId=e,this._taskId=null,this._objectName=t,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(e,t,i,n){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let t={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(t.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...t,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...t,action:"complete"}));let n=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,n=t?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?r("qr_error_no_url",this.lang):r("qr_error",this.lang)}finally{e===this._generateSeq&&(this._loading=!1)}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,t=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,i=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let l=this.lang||"en",c=ce(t),p=ce(i),u=!!this._completeResult,v=ce(r("qr_action_view",l)),f=ce(r("qr_action_complete",l));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
`,d([b({attribute:!1})],F.prototype,"hass",2),d([h()],F.prototype,"_open",2),d([h()],F.prototype,"_saving",2),d([h()],F.prototype,"_error",2),d([h()],F.prototype,"_draft",2),d([h()],F.prototype,"_partOptions",2),d([h()],F.prototype,"_partQty",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",F)});function he(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function gi(a){return!a.startsWith("data:image/svg+xml,")&&!a.startsWith("data:image/png;base64,")?"":he(a)}function Ls(a){return a.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var O,mi=$(()=>{"use strict";L();z();I();O=class extends k{constructor(){super(...arguments);this.lang="en";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}openForObject(e,t){this._entryId=e,this._taskId=null,this._objectName=t,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(e,t,i,n){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let t={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(t.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...t,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...t,action:"complete"}));let n=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,n=t?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?r("qr_error_no_url",this.lang):r("qr_error",this.lang)}finally{e===this._generateSeq&&(this._loading=!1)}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,t=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,i=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let l=this.lang||"en",c=he(t),p=he(i),u=!!this._completeResult,v=he(r("qr_action_view",l)),f=he(r("qr_action_complete",l));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
<meta name="color-scheme" content="light">
|
||||
<title>${c}</title>
|
||||
<style>
|
||||
@@ -2930,17 +2894,17 @@ 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="${pi(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<img src="${gi(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<div class="qr-label">${v}</div>
|
||||
</div>
|
||||
${u?`<div class="qr-col">
|
||||
<img src="${pi(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<img src="${gi(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<div class="qr-label">${f}</div>
|
||||
</div>`:""}
|
||||
</div>
|
||||
<div class="url">${ce(this._viewResult.url)}</div>
|
||||
<div class="url">${he(this._viewResult.url)}</div>
|
||||
<script>setTimeout(()=>window.print(),300)<\/script>
|
||||
</body></html>`),n.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=new Blob([i],{type:"image/svg+xml"}),l=URL.createObjectURL(n),c=document.createElement("a");c.href=l;let p=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;c.download=`qr-${Es(p)}-${t}.svg`,c.click(),URL.revokeObjectURL(l)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return o``;let e=this.lang||this.hass?.language||"en",t=this._taskName?`${r("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${r("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return o`
|
||||
</body></html>`),n.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=new Blob([i],{type:"image/svg+xml"}),l=URL.createObjectURL(n),c=document.createElement("a");c.href=l;let p=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;c.download=`qr-${Ls(p)}-${t}.svg`,c.click(),URL.revokeObjectURL(l)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return o``;let e=this.lang||this.hass?.language||"en",t=this._taskName?`${r("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${r("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return o`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${t}</div>
|
||||
<div class="content">
|
||||
@@ -3001,7 +2965,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};H.styles=E`
|
||||
`}};O.styles=E`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -3119,30 +3083,30 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
color: var(--text-primary-color, #fff);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
`,d([b({attribute:!1})],H.prototype,"hass",2),d([b()],H.prototype,"lang",2),d([h()],H.prototype,"_open",2),d([h()],H.prototype,"_loading",2),d([h()],H.prototype,"_error",2),d([h()],H.prototype,"_viewResult",2),d([h()],H.prototype,"_completeResult",2),d([h()],H.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",H)});function _i(a,s){let e=a.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return _;let n=a.interval_days??0,l=a.suggested_interval??n;return o`
|
||||
`,d([b({attribute:!1})],O.prototype,"hass",2),d([b()],O.prototype,"lang",2),d([h()],O.prototype,"_open",2),d([h()],O.prototype,"_loading",2),d([h()],O.prototype,"_error",2),d([h()],O.prototype,"_viewResult",2),d([h()],O.prototype,"_completeResult",2),d([h()],O.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",O)});function fi(a,s){let e=a.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return _;let n=a.interval_days??0,l=a.suggested_interval??n;return o`
|
||||
<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>
|
||||
${r("weibull_reliability_curve",s)}
|
||||
${Ss(t,s)}
|
||||
${Ps(t,s)}
|
||||
</div>
|
||||
${As(t,i,n,l,s)}
|
||||
${Ts(e,s)}
|
||||
${e?.confidence_interval_low!=null?Is(e,a,s):_}
|
||||
${Rs(t,i,n,l,s)}
|
||||
${js(e,s)}
|
||||
${e?.confidence_interval_low!=null?Ns(e,a,s):_}
|
||||
</div>
|
||||
`}function Ss(a,s){let e,t,i;return a<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):a<=1.2?(e="random_failures",t="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,17H11V15H13V17M13,13H11V7H13V13Z",i="beta_random_failures"):a<=3.5?(e="wear_out",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4M12,6A6,6 0 0,1 18,12H12V6Z",i="beta_wear_out"):(e="highly_predictable",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M11,16.5L18,9.5L16.59,8.09L11,13.67L7.91,10.59L6.5,12L11,16.5Z",i="beta_highly_predictable"),o`
|
||||
`}function Ps(a,s){let e,t,i;return a<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):a<=1.2?(e="random_failures",t="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,17H11V15H13V17M13,13H11V7H13V13Z",i="beta_random_failures"):a<=3.5?(e="wear_out",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4M12,6A6,6 0 0,1 18,12H12V6Z",i="beta_wear_out"):(e="highly_predictable",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M11,16.5L18,9.5L16.59,8.09L11,13.67L7.91,10.59L6.5,12L11,16.5Z",i="beta_highly_predictable"),o`
|
||||
<span class="beta-badge ${e}">
|
||||
<ha-svg-icon path="${t}"></ha-svg-icon>
|
||||
${r(i,s)} (\u03B2=${a.toFixed(2)})
|
||||
</span>
|
||||
`}function As(a,s,e,t,i){let g=Math.max(e,t,s,1)*1.3,x=50,N=[];for(let O=0;O<=x;O++){let F=O/x*g,Ri=1-Math.exp(-Math.pow(F/s,a)),ji=32+F/g*260,Ni=136-Ri*128;N.push([ji,Ni])}let j=N.map(([O,F])=>`${O.toFixed(1)},${F.toFixed(1)}`).join(" "),S="M32,136 "+N.map(([O,F])=>`L${O.toFixed(1)},${F.toFixed(1)}`).join(" ")+` L${N[x][0].toFixed(1)},136 Z`,I=32+e/g*260,ke=1-Math.exp(-Math.pow(e/s,a)),Ee=136-ke*128,Li=((1-ke)*100).toFixed(0),mt=32+t/g*260,Pi=[0,.25,.5,.75,1];return o`
|
||||
`}function Rs(a,s,e,t,i){let g=Math.max(e,t,s,1)*1.3,x=50,H=[];for(let q=0;q<=x;q++){let D=q/x*g,Oi=1-Math.exp(-Math.pow(D/s,a)),Mi=32+D/g*260,qi=136-Oi*128;H.push([Mi,qi])}let j=H.map(([q,D])=>`${q.toFixed(1)},${D.toFixed(1)}`).join(" "),S="M32,136 "+H.map(([q,D])=>`L${q.toFixed(1)},${D.toFixed(1)}`).join(" ")+` L${H[x][0].toFixed(1)},136 Z`,C=32+e/g*260,Se=1-Math.exp(-Math.pow(e/s,a)),Ae=136-Se*128,Ni=((1-Se)*100).toFixed(0),vt=32+t/g*260,Hi=[0,.25,.5,.75,1];return o`
|
||||
<div class="weibull-chart">
|
||||
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${r("chart_weibull",i)}">
|
||||
${Pi.map(O=>{let F=136-O*128;return oe`
|
||||
<line x1="${32}" y1="${F.toFixed(1)}" x2="${292}" y2="${F.toFixed(1)}"
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${O===.5?"4,3":_}" />
|
||||
<text x="${28}" y="${(F+3).toFixed(1)}" fill="var(--secondary-text-color)"
|
||||
font-size="8" text-anchor="end">${(O*100).toFixed(0)}%</text>
|
||||
${Hi.map(q=>{let D=136-q*128;return de`
|
||||
<line x1="${32}" y1="${D.toFixed(1)}" x2="${292}" y2="${D.toFixed(1)}"
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${q===.5?"4,3":_}" />
|
||||
<text x="${28}" y="${(D+3).toFixed(1)}" fill="var(--secondary-text-color)"
|
||||
font-size="8" text-anchor="end">${(q*100).toFixed(0)}%</text>
|
||||
`})}
|
||||
|
||||
<text x="${32}" y="${156}" fill="var(--secondary-text-color)" font-size="8" text-anchor="middle">0</text>
|
||||
@@ -3153,17 +3117,17 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
<polyline points="${j}" fill="none"
|
||||
stroke="var(--primary-color, #03a9f4)" stroke-width="2" />
|
||||
|
||||
${e>0?oe`
|
||||
<line x1="${I.toFixed(1)}" y1="${8}" x2="${I.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
${e>0?de`
|
||||
<line x1="${C.toFixed(1)}" y1="${8}" x2="${C.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
stroke="var(--primary-color, #03a9f4)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||
<circle cx="${I.toFixed(1)}" cy="${Ee.toFixed(1)}" r="3"
|
||||
<circle cx="${C.toFixed(1)}" cy="${Ae.toFixed(1)}" r="3"
|
||||
fill="var(--primary-color, #03a9f4)" />
|
||||
<text x="${(I+4).toFixed(1)}" y="${(Ee-6).toFixed(1)}" fill="var(--primary-color, #03a9f4)"
|
||||
font-size="9" font-weight="600">R=${Li}%</text>
|
||||
<text x="${(C+4).toFixed(1)}" y="${(Ae-6).toFixed(1)}" fill="var(--primary-color, #03a9f4)"
|
||||
font-size="9" font-weight="600">R=${Ni}%</text>
|
||||
`:_}
|
||||
|
||||
${t>0&&t!==e?oe`
|
||||
<line x1="${mt.toFixed(1)}" y1="${8}" x2="${mt.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
${t>0&&t!==e?de`
|
||||
<line x1="${vt.toFixed(1)}" y1="${8}" x2="${vt.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
stroke="var(--success-color, #4caf50)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||
`:_}
|
||||
|
||||
@@ -3178,7 +3142,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
${e>0?o`<span class="legend-item"><span class="legend-swatch" style="background:var(--primary-color, #03a9f4); opacity:0.5"></span> ${r("current_interval_marker",i)}</span>`:_}
|
||||
${t>0&&t!==e?o`<span class="legend-item"><span class="legend-swatch" style="background:var(--success-color, #4caf50)"></span> ${r("recommended_marker",i)}</span>`:_}
|
||||
</div>
|
||||
`}function Ts(a,s){return o`
|
||||
`}function js(a,s){return o`
|
||||
<div class="weibull-info-row">
|
||||
<div class="weibull-info-item">
|
||||
<span>${r("characteristic_life",s)}</span>
|
||||
@@ -3191,7 +3155,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
</div>
|
||||
`:_}
|
||||
</div>
|
||||
`}function Is(a,s,e){let t=a.confidence_interval_low,i=a.confidence_interval_high,n=s.suggested_interval??s.interval_days??0,l=s.interval_days??0,c=Math.max(0,t-5),u=i+5-c,v=(t-c)/u*100,f=(i-t)/u*100,y=(n-c)/u*100,g=l>0?(l-c)/u*100:-1;return o`
|
||||
`}function Ns(a,s,e){let t=a.confidence_interval_low,i=a.confidence_interval_high,n=s.suggested_interval??s.interval_days??0,l=s.interval_days??0,c=Math.max(0,t-5),u=i+5-c,v=(t-c)/u*100,f=(i-t)/u*100,y=(n-c)/u*100,g=l>0?(l-c)/u*100:-1;return o`
|
||||
<div class="confidence-range">
|
||||
<div class="confidence-range-title">
|
||||
${r("confidence_interval",e)}: ${n} ${r("days",e)} (${t}\u2013${i})
|
||||
@@ -3206,7 +3170,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
<span class="confidence-text high">${r("confidence_aggressive",e)} (${i}${r("days",e).charAt(0)})</span>
|
||||
</div>
|
||||
</div>
|
||||
`}var ui=$(()=>{"use strict";L();C()});function gi(a,s,e){let t=a.degradation_trend!=null&&a.degradation_trend!=="insufficient_data",i=a.days_until_threshold!=null,n=a.environmental_factor!=null&&a.environmental_factor!==1;if(!t&&!i&&!n)return _;let l=a.degradation_trend==="rising"?"M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z":a.degradation_trend==="falling"?"M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z":"M22,12L18,8V11H3V13H18V16L22,12Z";return o`
|
||||
`}var vi=$(()=>{"use strict";L();I()});function bi(a,s,e){let t=a.degradation_trend!=null&&a.degradation_trend!=="insufficient_data",i=a.days_until_threshold!=null,n=a.environmental_factor!=null&&a.environmental_factor!==1;if(!t&&!i&&!n)return _;let l=a.degradation_trend==="rising"?"M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z":a.degradation_trend==="falling"?"M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z":"M22,12L18,8V11H3V13H18V16L22,12Z";return o`
|
||||
<div class="prediction-section">
|
||||
${a.sensor_prediction_urgency?o`
|
||||
<div class="prediction-urgency-banner">
|
||||
@@ -3232,7 +3196,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
<ha-svg-icon path="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z"></ha-svg-icon>
|
||||
<span class="prediction-label">${r("days_until_threshold",s)}</span>
|
||||
<span class="prediction-value prediction-days${a.days_until_threshold===0?" exceeded":a.sensor_prediction_urgency?" urgent":""}">${a.days_until_threshold===0?r("threshold_exceeded",s):"~"+Math.round(a.days_until_threshold)+" "+r("days",s)}</span>
|
||||
${a.threshold_prediction_date?o`<span class="prediction-date">${K(a.threshold_prediction_date,s)}</span>`:_}
|
||||
${a.threshold_prediction_date?o`<span class="prediction-date">${G(a.threshold_prediction_date,s)}</span>`:_}
|
||||
${a.threshold_prediction_confidence?o`<span class="confidence-dot ${a.threshold_prediction_confidence}"></span>`:_}
|
||||
</div>
|
||||
`:_}
|
||||
@@ -3241,12 +3205,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">${r("environmental_adjustment",s)}</span>
|
||||
<span class="prediction-value">${a.environmental_factor.toFixed(2)}x</span>
|
||||
${a.environmental_entity?o`<span class="prediction-entity entity-link" @click=${c=>ei(c,a.environmental_entity)}>${a.environmental_entity}</span>`:_}
|
||||
${a.environmental_entity?o`<span class="prediction-entity entity-link" @click=${c=>ii(c,a.environmental_entity)}>${a.environmental_entity}</span>`:_}
|
||||
</div>
|
||||
`:_}
|
||||
</div>
|
||||
</div>
|
||||
`}var mi=$(()=>{"use strict";L();C()});function fi(a,s,e,t){let i=Math.max(a||1,s);return o`
|
||||
`}var yi=$(()=>{"use strict";L();I()});function xi(a,s,e,t){let i=Math.max(a||1,s);return o`
|
||||
<div class="interval-comparison">
|
||||
<div class="interval-bar">
|
||||
<div class="interval-label">
|
||||
@@ -3264,7 +3228,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
style="width: ${Math.min(s/i*100,100)}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
`}var vi=$(()=>{"use strict";L();C()});function yi(a,s,e){if(!e.seasonal||!a.seasonal_factor||a.seasonal_factor===1)return _;let t=bi.map(c=>r(c,s)),i=new Date().getMonth(),n=a.seasonal_factors||a.interval_analysis?.seasonal_factors||null,l=n&&n.length===12?n:t.map((c,p)=>{let u=a.seasonal_factor||1,v=Math.sin((p-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,u+v))});return o`
|
||||
`}var $i=$(()=>{"use strict";L();I()});function ki(a,s,e){if(!e.seasonal||!a.seasonal_factor||a.seasonal_factor===1)return _;let t=wi.map(c=>r(c,s)),i=new Date().getMonth(),n=a.seasonal_factors||a.interval_analysis?.seasonal_factors||null,l=n&&n.length===12?n:t.map((c,p)=>{let u=a.seasonal_factor||1,v=Math.sin((p-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,u+v))});return o`
|
||||
<div class="seasonal-card-compact">
|
||||
<h4>${r("seasonal_awareness",s)}</h4>
|
||||
<div class="seasonal-mini-chart">
|
||||
@@ -3281,7 +3245,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
<span class="legend-item"><span class="dot high"></span> ${r("longer",s)||"L\xE4nger"}</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function xi(a,s){return Cs(a,s)}function Cs(a,s){let e=a.seasonal_factors??a.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return _;let t=a.interval_analysis?.seasonal_reason,i=new Date().getMonth(),n=300,l=100,c=8,u=l-c-4,v=Math.max(...e,1.5),f=n/12,y=f*.65,g=c+u-1/v*u;return o`
|
||||
`}function Ei(a,s){return Hs(a,s)}function Hs(a,s){let e=a.seasonal_factors??a.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return _;let t=a.interval_analysis?.seasonal_reason,i=new Date().getMonth(),n=300,l=100,c=8,u=l-c-4,v=Math.max(...e,1.5),f=n/12,y=f*.65,g=c+u-1/v*u;return o`
|
||||
<div class="seasonal-chart">
|
||||
<div class="seasonal-chart-title">
|
||||
<ha-svg-icon aria-hidden="true" path="M17.75 4.09L15.22 6.03L16.13 9.09L13.5 7.28L10.87 9.09L11.78 6.03L9.25 4.09L12.44 4L13.5 1L14.56 4L17.75 4.09M21.25 11L19.61 12.25L20.2 14.23L18.5 13.06L16.8 14.23L17.39 12.25L15.75 11L17.81 10.95L18.5 9L19.19 10.95L21.25 11M18.97 15.95C19.8 15.87 20.69 17.05 20.16 17.8C19.84 18.25 19.5 18.67 19.08 19.07C15.17 23 8.84 23 4.94 19.07C1.03 15.17 1.03 8.83 4.94 4.93C5.34 4.53 5.76 4.17 6.21 3.85C6.96 3.32 8.14 4.21 8.06 5.04C7.79 7.9 8.75 10.87 10.95 13.06C13.14 15.26 16.1 16.22 18.97 15.95Z"></ha-svg-icon>
|
||||
@@ -3291,20 +3255,20 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
<svg viewBox="0 0 ${n} ${l}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${r("chart_seasonal",s)}">
|
||||
<line x1="0" y1="${g.toFixed(1)}" x2="${n}" y2="${g.toFixed(1)}"
|
||||
stroke="var(--divider-color)" stroke-width="1" stroke-dasharray="4,3" />
|
||||
${e.map((x,N)=>{let j=x/v*u,S=N*f+(f-y)/2,I=c+u-j,ke=N===i,Ee=x<1?"var(--success-color, #4caf50)":x>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return oe`
|
||||
<rect x="${S.toFixed(1)}" y="${I.toFixed(1)}"
|
||||
${e.map((x,H)=>{let j=x/v*u,S=H*f+(f-y)/2,C=c+u-j,Se=H===i,Ae=x<1?"var(--success-color, #4caf50)":x>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return de`
|
||||
<rect x="${S.toFixed(1)}" y="${C.toFixed(1)}"
|
||||
width="${y.toFixed(1)}" height="${j.toFixed(1)}"
|
||||
fill="${Ee}" opacity="${ke?1:.5}" rx="2" />
|
||||
fill="${Ae}" opacity="${Se?1:.5}" rx="2" />
|
||||
`})}
|
||||
</svg>
|
||||
<div class="seasonal-labels">
|
||||
${bi.map((x,N)=>o`<span class="seasonal-label ${N===i?"active-month":""}">${r(x,s)}</span>`)}
|
||||
${wi.map((x,H)=>o`<span class="seasonal-label ${H===i?"active-month":""}">${r(x,s)}</span>`)}
|
||||
</div>
|
||||
</div>
|
||||
`}var bi,$i=$(()=>{"use strict";L();C();bi=["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 T,wi=$(()=>{"use strict";L();q();C();re();ui();mi();vi();$i();T=class extends k{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1}get _lang(){return this.hass?.language||"en"}async openFor(e,t){this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=new Date().toISOString().slice(0,10),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});e?.features&&(this._features={...this._features,...e.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=e.object?.name||"";let t=(e.tasks||[]).find(i=>i.id===this._taskId);this._task=t??null}catch(e){this._error=P(e,this._lang)}}async _runWs(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e),this._busy=!1,!0}catch(t){return this._error=P(t,this._lang),this._busy=!1,!1}}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(V(),G)).then(({openCompleteDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,checklist:this._task.checklist||[],adaptive_enabled:!!this._task.adaptive_config?.enabled})&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(V(),G)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(V(),G)).then(({openQrDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let e=r("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(e))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=r("suggestion_applied",this._lang)||"Applied",this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=e.recommended_interval?`${r("reanalyze_result",this._lang)||"Recomputed"}: ${je(e.rLine truncated
|
||||
`}var wi,Si=$(()=>{"use strict";L();I();wi=["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 T,Ai=$(()=>{"use strict";L();z();I();ne();vi();yi();$i();Si();T=class extends k{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1}get _lang(){return N(this.hass)}async openFor(e,t){this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=new Date().toISOString().slice(0,10),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});e?.features&&(this._features={...this._features,...e.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=e.object?.name||"";let t=(e.tasks||[]).find(i=>i.id===this._taskId);this._task=t??null}catch(e){this._error=P(e,this._lang)}}async _runWs(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e),this._busy=!1,!0}catch(t){return this._error=P(t,this._lang),this._busy=!1,!1}}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(B(),Q)).then(({openCompleteDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,checklist:this._task.checklist||[],adaptive_enabled:!!this._task.adaptive_config?.enabled})&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(B(),Q)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(B(),Q)).then(({openQrDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let e=r("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(e))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=r("suggestion_applied",this._lang)||"Applied",this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=e.recommended_interval?`${r("reanalyze_result",this._lang)||"Recomputed"}: ${He(e.recommended_inLine truncated
|
||||
<div class="recommendation-card">
|
||||
<h4>${r("suggested_interval",t)}</h4>
|
||||
${fi(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
|
||||
${xi(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
|
||||
<div class="recommendation-actions">
|
||||
<button class="btn primary"
|
||||
@click=${this._applySuggestion} ?disabled=${this._busy}>
|
||||
@@ -3324,11 +3288,11 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
<div class="adaptive-stack">
|
||||
${this._toast?o`<div class="toast">${this._toast}</div>`:_}
|
||||
${i?this._renderRecommendation(e):_}
|
||||
${n?gi(e,t,this._features):_}
|
||||
${l?_i(e,t):_}
|
||||
${n?bi(e,t,this._features):_}
|
||||
${l?fi(e,t):_}
|
||||
${c?o`
|
||||
${yi(e,t,this._features)}
|
||||
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?xi(e,t):_}
|
||||
${ki(e,t,this._features)}
|
||||
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?Ei(e,t):_}
|
||||
`:_}
|
||||
</div>
|
||||
`}_renderDetails(e){let t=this._lang,i=e.history||[],n=i.filter(p=>p.type==="completed"),l=n.reduce((p,u)=>p+(typeof u.cost=="number"?u.cost:0),0),c=(()=>{let p=n.map(u=>typeof u.duration=="number"?u.duration:null).filter(u=>u!=null);return p.length?Math.round(p.reduce((u,v)=>u+v,0)/p.length):null})();return o`
|
||||
@@ -3357,7 +3321,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
<div class="history-entry">
|
||||
<div class="history-line">
|
||||
<span class="history-type type-${p.type}">${r(p.type,t)}</span>
|
||||
<span class="history-date">${Zt(p.timestamp,t)}</span>
|
||||
<span class="history-date">${ei(p.timestamp,t)}</span>
|
||||
${u?o`<button class="history-edit"
|
||||
title="${r("history_edit_button",t)||"Edit"}"
|
||||
@click=${()=>this._onEditHistoryEntry(p)}>
|
||||
@@ -3381,16 +3345,16 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
${t?o`
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="status-dot" style="background: ${ie[t.status]||"#ccc"}"></span>
|
||||
<span class="status-dot" style="background: ${re[t.status]||"#ccc"}"></span>
|
||||
<span class="task-name">${t.name}</span>
|
||||
</div>
|
||||
<div class="object">
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&Promise.resolve().then(()=>(V(),G)).then(({openObjectQuickActions:n})=>{n(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&Promise.resolve().then(()=>(B(),Q)).then(({openObjectQuickActions:n})=>{n(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
</div>
|
||||
<div class="quick-info">
|
||||
${t.next_due?o`<span><strong>${r("next_due",e)||"Next due"}:</strong> ${K(t.next_due,e)}</span>`:_}
|
||||
${t.last_performed?o`<span><strong>${r("last_performed",e)||"Last"}:</strong> ${K(t.last_performed,e)}</span>`:_}
|
||||
${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?o`<span><strong>${r("interval",e)||"Interval"}:</strong> ${Xt(t,e)}</span>`:_}
|
||||
${t.next_due?o`<span><strong>${r("next_due",e)||"Next due"}:</strong> ${G(t.next_due,e)}</span>`:_}
|
||||
${t.last_performed?o`<span><strong>${r("last_performed",e)||"Last"}:</strong> ${G(t.last_performed,e)}</span>`:_}
|
||||
${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?o`<span><strong>${r("interval",e)||"Interval"}:</strong> ${ti(t,e)}</span>`:_}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3482,7 +3446,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
`}
|
||||
`:o`<div class="loading">${r("loading",e)||"Loading\u2026"}</div>`}
|
||||
</div>
|
||||
`}};T.styles=[Oe,E`
|
||||
`}};T.styles=[ze,E`
|
||||
:host { display: contents; }
|
||||
.backdrop {
|
||||
position: fixed; inset: 0; z-index: 100;
|
||||
@@ -3662,7 +3626,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; }
|
||||
`],d([b({attribute:!1})],T.prototype,"hass",2),d([h()],T.prototype,"_open",2),d([h()],T.prototype,"_entryId",2),d([h()],T.prototype,"_taskId",2),d([h()],T.prototype,"_task",2),d([h()],T.prototype,"_objectName",2),d([h()],T.prototype,"_busy",2),d([h()],T.prototype,"_error",2),d([h()],T.prototype,"_showSkip",2),d([h()],T.prototype,"_showReset",2),d([h()],T.prototype,"_showDetails",2),d([h()],T.prototype,"_showAdaptive",2),d([h()],T.prototype,"_skipReason",2),d([h()],T.prototype,"_resetDate",2),d([h()],T.prototype,"_features",2),d([h()],T.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",T)});function ki(a){return!!a&&/^https?:\/\//i.test(a)}var Ei=$(()=>{"use strict"});var B,Si=$(()=>{"use strict";L();Ei();q();C();re();B=class extends k{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return this.hass?.language||"en"}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=P(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(V(),G)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(V(),G)).then(({openCreateTaskDialog:e})=>{e(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=r("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=P(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=r("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=P(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(V(),G)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return _;let e=this._lang,t=this._data,i=t?.object,n=t?.tasks||[],l=this.hass?.user?.is_admin??!0;return o`
|
||||
`],d([b({attribute:!1})],T.prototype,"hass",2),d([h()],T.prototype,"_open",2),d([h()],T.prototype,"_entryId",2),d([h()],T.prototype,"_taskId",2),d([h()],T.prototype,"_task",2),d([h()],T.prototype,"_objectName",2),d([h()],T.prototype,"_busy",2),d([h()],T.prototype,"_error",2),d([h()],T.prototype,"_showSkip",2),d([h()],T.prototype,"_showReset",2),d([h()],T.prototype,"_showDetails",2),d([h()],T.prototype,"_showAdaptive",2),d([h()],T.prototype,"_skipReason",2),d([h()],T.prototype,"_resetDate",2),d([h()],T.prototype,"_features",2),d([h()],T.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",T)});function Ti(a){return!!a&&/^https?:\/\//i.test(a)}var Ci=$(()=>{"use strict"});var W,Ii=$(()=>{"use strict";L();Ci();z();I();ne();W=class extends k{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return N(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=P(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(B(),Q)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(B(),Q)).then(({openCreateTaskDialog:e})=>{e(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=r("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=P(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=r("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=P(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(B(),Q)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return _;let e=this._lang,t=this._data,i=t?.object,n=t?.tasks||[],l=this.hass?.user?.is_admin??!0;return o`
|
||||
<div class="backdrop" @click=${this.close}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true">
|
||||
${t&&i?o`
|
||||
@@ -3682,7 +3646,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
<div class="task-list">
|
||||
${n.map(c=>o`
|
||||
<div class="task-row" @click=${()=>this._onTaskClick(c.id)}>
|
||||
<span class="status-dot" style="background: ${ie[c.status]||"#ccc"}"></span>
|
||||
<span class="status-dot" style="background: ${re[c.status]||"#ccc"}"></span>
|
||||
<span class="task-name">${c.name}</span>
|
||||
<span class="task-status">${r(c.status||"ok",e)}</span>
|
||||
</div>
|
||||
@@ -3725,11 +3689,11 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
${i.map(([n,l])=>o`
|
||||
<div class="meta-item">
|
||||
<span class="meta-label">${n}</span>
|
||||
<span class="meta-value">${ki(l)?o`<a href="${l}" target="_blank" rel="noopener noreferrer">${l}</a>`:l}</span>
|
||||
<span class="meta-value">${Ti(l)?o`<a href="${l}" target="_blank" rel="noopener noreferrer">${l}</a>`:l}</span>
|
||||
</div>
|
||||
`)}
|
||||
</div>
|
||||
`}};B.styles=E`
|
||||
`}};W.styles=E`
|
||||
:host { display: contents; }
|
||||
.backdrop {
|
||||
position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.5);
|
||||
@@ -3788,7 +3752,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; }
|
||||
`,d([b({attribute:!1})],B.prototype,"hass",2),d([h()],B.prototype,"_open",2),d([h()],B.prototype,"_entryId",2),d([h()],B.prototype,"_data",2),d([h()],B.prototype,"_busy",2),d([h()],B.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",B)});var G={};Mi(G,{openCompleteDialog:()=>zs,openCreateObjectDialog:()=>_t,openCreateTaskDialog:()=>ut,openEditObjectDialog:()=>Ms,openEditTaskDialog:()=>Os,openHistoryEditDialog:()=>qs,openObjectQuickActions:()=>Ds,openQrDialog:()=>Fs,openTaskQuickActions:()=>gt});function De(){return document.querySelector("home-assistant")?.hass}function Hs(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function Y(a){let s=Hs(),e=s.querySelector(a)??document.body.querySelector(a);return e?e.parentNode!==s&&s.appendChild(e):(e=document.createElement(a),s.appendChild(e)),e}function Q(a){let s=De();if(!s)return!1;a.hass=s;let e=s.language||"en";return He(e)||Me(e).then(()=>{a.requestUpdate?.()}),!0}function Ci(a){return Fe||(Fe=a.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(s=>({features:s.features??Ai.features,defaultWarningDays:s.general?.default_warning_days??7})).catch(()=>Ai),Fe)}function _t(){let a=Y(Ti);return Q(a)?(a.openCreate(),!0):!1}function Ms(a,s){let e=Y(Ti);return Q(e)?(e.openEdit(a,s),!0):!1}function ut(){let a=Y(Ii);if(!Q(a))return!1;let s=De();return s?((async()=>{let e=await Ci(s),t=a;t.checklistsEnabled=e.features.checklists,t.scheduleTimeEnabled=e.features.schedule_time,t.completionActionsEnabled=e.features.completion_actions,t.defaultWarningDays=e.defaultWarningDays,t.openCreate()})(),!0):!1}function Os(a,s){let e=Y(Ii);if(!Q(e))return!1;let t=De();return t?((async()=>{try{let[i,n]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:a}),Ci(t)]),l=(i.tasks||[]).find(p=>p.id===s);if(!l){console.warn(`openEditTaskDialog: task ${s} not found in entry ${a}`);return}let c=e;c.checklistsEnabled=n.features.checklists,c.scheduleTimeEnabled=n.features.schedule_time,c.completionActionsEnabled=n.features.completion_actions,c.defaultWarningDays=n.defaultWarningDays,await c.openEdit(a,l)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function qs(a){let s=Y(Ls);return Q(s)?(s.openEdit(a),!0):!1}function zs(a){let s=Y(Ps);return Q(s)?(s.entryId=a.entry_id,s.taskId=a.task_id,s.taskName=a.task_name,s.checklist=a.checklist??[],s.adaptiveEnabled=!!a.adaptive_enabled,s.requiredFields=a.required_completion_fields??[],s.lang=De()?.language||"en",s.open(),!0):!1}function Fs(a){let s=Y(Rs);return Q(s)?(s.openForTask(a.entry_id,a.task_id,a.object_name,a.task_name),!0):!1}function gt(a,s){let e=Y(js);return Q(e)?(e.openFor(a,s),!0):!1}function Ds(a){let s=Y(Ns);return Q(s)?(s.openFor(a),!0):!1}var Ti,Ii,Ls,Ps,Rs,js,Ns,Ai,Fe,V=$(()=>{"use strict";ri();di();lt();ci();hi();wi();Si();C();Ti="maintenance-object-dialog",Ii="maintenance-task-dialog",Ls="maintenance-history-edit-dialog",Ps="maintenance-complete-dialog",Rs="maintenance-qr-dialog",js="maintenance-task-quick-actions-dialog",Ns="maintenance-object-quick-actions-dialog";Ai={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7},Fe=null});L();var Ji=["assignee_pool","required_completion_fields","checklist","labels","history"],Zi=["checklist_progress"],Xi=["tasks","parts"],es=["manual_docs","battery_fleet_excluded"];function it(a,s,e=[]){for(let t of s)a[t]===void 0&&(a[t]=[]);for(let t of e)a[t]===void 0&&(a[t]={})}function ts(a){let s=a;it(s,Xi),s.object&&typeof s.object=="object"&&it(s.object,es);for(let e of s.tasks)it(e,Ji,Zi);return a}function ye(a){for(let s of a)ts(s);return a}function is(a,s){if(s.objects)return s.objects;let e=s.delta||[],t=s.removed||[];if(!e.length&&!t.length)return null;let i=new Map(a.map(n=>[n.entry_id,n]));for(let n of e)i.set(n.entry_id,n);for(let n of t)i.delete(n);return[...i.values()]}function Mt(a,s){return s.objects&&ye(s.objects),s.delta&&ye(s.delta),is(a,s)}q();C();nt();qe();L();q();C();var ps=["overdue","triggered","due_soon","ok"],U=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._loadingObjects=!0;this._loadError=!1;this._views=[];this._objectsLoaded=!1;this._onEntitiesChanged=e=>{this._valueChanged("entity_ids",e.detail.value||[])}}get _lang(){return this.hass?.language||"en"}setConfig(e){this._config={...e}}updated(e){super.updated(e),e.has("hass")&&this.hass&&!this._objectsLoaded&&(this._objectsLoaded=!0,this._loadObjects())}async _loadObjects(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"});this._objects=e.objects||[],this._loadError=!1}catch{this._objects=[],this._loadError=!0}this._loadingObjects=!1;try{let e=await this.h
Line truncated
|
||||
`,d([b({attribute:!1})],W.prototype,"hass",2),d([h()],W.prototype,"_open",2),d([h()],W.prototype,"_entryId",2),d([h()],W.prototype,"_data",2),d([h()],W.prototype,"_busy",2),d([h()],W.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",W)});var Q={};Fi(Q,{openCompleteDialog:()=>Ws,openCreateObjectDialog:()=>gt,openCreateTaskDialog:()=>mt,openEditObjectDialog:()=>Us,openEditTaskDialog:()=>Vs,openHistoryEditDialog:()=>Bs,openObjectQuickActions:()=>Gs,openQrDialog:()=>Ks,openTaskQuickActions:()=>ft});function Ve(){return document.querySelector("home-assistant")?.hass}function Ds(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function J(a){let s=Ds(),e=s.querySelector(a)??document.body.querySelector(a);return e?e.parentNode!==s&&s.appendChild(e):(e=document.createElement(a),s.appendChild(e)),e}function Z(a){let s=Ve();if(!s)return!1;a.hass=s;let e=s.language||"en";return Me(e)||qe(e).then(()=>{a.requestUpdate?.()}),!0}function ji(a){return Ue||(Ue=a.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(s=>({features:s.features??Li.features,defaultWarningDays:s.general?.default_warning_days??7})).catch(()=>Li),Ue)}function gt(){let a=J(Pi);return Z(a)?(a.openCreate(),!0):!1}function Us(a,s){let e=J(Pi);return Z(e)?(e.openEdit(a,s),!0):!1}function mt(){let a=J(Ri);if(!Z(a))return!1;let s=Ve();return s?((async()=>{let e=await ji(s),t=a;t.checklistsEnabled=e.features.checklists,t.scheduleTimeEnabled=e.features.schedule_time,t.completionActionsEnabled=e.features.completion_actions,t.defaultWarningDays=e.defaultWarningDays,t.openCreate()})(),!0):!1}function Vs(a,s){let e=J(Ri);if(!Z(e))return!1;let t=Ve();return t?((async()=>{try{let[i,n]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:a}),ji(t)]),l=(i.tasks||[]).find(p=>p.id===s);if(!l){console.warn(`openEditTaskDialog: task ${s} not found in entry ${a}`);return}let c=e;c.checklistsEnabled=n.features.checklists,c.scheduleTimeEnabled=n.features.schedule_time,c.completionActionsEnabled=n.features.completion_actions,c.defaultWarningDays=n.defaultWarningDays,await c.openEdit(a,l)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function Bs(a){let s=J(Os);return Z(s)?(s.openEdit(a),!0):!1}function Ws(a){let s=J(Ms);return Z(s)?(s.entryId=a.entry_id,s.taskId=a.task_id,s.taskName=a.task_name,s.checklist=a.checklist??[],s.adaptiveEnabled=!!a.adaptive_enabled,s.requiredFields=a.required_completion_fields??[],s.lang=Ve()?.language||"en",s.open(),!0):!1}function Ks(a){let s=J(qs);return Z(s)?(s.openForTask(a.entry_id,a.task_id,a.object_name,a.task_name),!0):!1}function ft(a,s){let e=J(zs);return Z(e)?(e.openFor(a,s),!0):!1}function Gs(a){let s=J(Fs);return Z(s)?(s.openFor(a),!0):!1}var Pi,Ri,Os,Ms,qs,zs,Fs,Li,Ue,B=$(()=>{"use strict";li();_i();ct();ui();mi();Ai();Ii();I();Pi="maintenance-object-dialog",Ri="maintenance-task-dialog",Os="maintenance-history-edit-dialog",Ms="maintenance-complete-dialog",qs="maintenance-qr-dialog",zs="maintenance-task-quick-actions-dialog",Fs="maintenance-object-quick-actions-dialog";Li={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7},Ue=null});L();var ts=["assignee_pool","required_completion_fields","checklist","labels","history"],is=["checklist_progress"],ss=["tasks","parts"],rs=["manual_docs","battery_fleet_excluded"];function rt(a,s,e=[]){for(let t of s)a[t]===void 0&&(a[t]=[]);for(let t of e)a[t]===void 0&&(a[t]={})}function as(a){let s=a;rt(s,ss),s.object&&typeof s.object=="object"&&rt(s.object,rs);for(let e of s.tasks)rt(e,ts,is);return a}function $e(a){for(let s of a)as(s);return a}function ns(a,s){if(s.objects)return s.objects;let e=s.delta||[],t=s.removed||[];if(!e.length&&!t.length)return null;let i=new Map(a.map(n=>[n.entry_id,n]));for(let n of e)i.set(n.entry_id,n);for(let n of t)i.delete(n);return[...i.values()]}function qt(a,s){return s.objects&&$e(s.objects),s.delta&&$e(s.delta),ns(a,s)}z();I();async function us(a,s,e=300){return(await a.connection.sendMessagePromise({type:"auth/sign_path",path:s,expires:e})).path}async function gs(a,s,e=300){return us(a,`/api/maintenance_supporter/document/${s}`,e)}async function ri(a,s,e=""){let t=window.open("about:blank","_blank");try{let i=await gs(a,s);t&&(t.location.href=new URL(i+e,window.location.origin).href)}catch(i){throw t&&t.close(),i}}function ai(a){let s=window;s.customCards=s.customCards||[],s.customCards.some(e=>e.type===a.type)||s.customCards.push(a)}lt();Fe();L();z();I();var fs=["overdue","triggered","due_soon","ok"],V=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._loadingObjects=!0;this._loadError=!1;this._views=[];this._objectsLoaded=!1;this._onEntiti
Line truncated
|
||||
<div class="editor">
|
||||
<ha-textfield
|
||||
label="${r("card_title",e)}"
|
||||
@@ -3800,7 +3764,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
<div class="field">
|
||||
<div class="field-label">${r("card_filter_status",e)}</div>
|
||||
<div class="chip-row">
|
||||
${ps.map(g=>o`
|
||||
${fs.map(g=>o`
|
||||
<label class="chip ${t.has(g)?"active":""}">
|
||||
<input type="checkbox"
|
||||
.checked=${t.has(g)}
|
||||
@@ -3942,7 +3906,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
></ha-textfield>
|
||||
${_}
|
||||
</div>
|
||||
`}};U.styles=E`
|
||||
`}};V.styles=E`
|
||||
.editor {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -4021,7 +3985,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
font-size: 14px;
|
||||
max-width: 320px;
|
||||
}
|
||||
`,d([b({attribute:!1})],U.prototype,"hass",2),d([h()],U.prototype,"_config",2),d([h()],U.prototype,"_objects",2),d([h()],U.prototype,"_loadingObjects",2),d([h()],U.prototype,"_loadError",2),d([h()],U.prototype,"_views",2);customElements.get("maintenance-supporter-card-editor")||customElements.define("maintenance-supporter-card-editor",U);lt();V();var M=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._stats=null;this._unsub=null;this._viewFilters=null;this._userNames={};this._userService=null;this._userNamesLoaded=!1;this._taskDocs={};this._docsLoadedFor=new Set;this._dataLoaded=!1;this._lastConnection=null;this._onCompleted=async()=>{await this._loadData()}}get _lang(){return this.hass?.language||"en"}static getConfigElement(){return document.createElement("maintenance-supporter-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-card",show_header:!0,show_actions:!0,filter_status:["overdue","triggered","due_soon"],max_items:10}}setConfig(e){let t=e.view_id!==this._config.view_id;this._config=e,t&&this._dataLoaded&&this.hass&&this._loadViewFilters()}getCardSize(){return 3}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub(),this._unsub=null),this._dataLoaded=!1,this._lastConnection=null}updated(e){super.updated(e),e.has("hass")&&Qt(this.hass?.locale);let t=this.hass?.language;if(t&&!He(t)&&Me(t).then(()=>this.requestUpdate()),this.hass&&!this._userNamesLoaded&&this._config.show_assignee!==!1&&this._objects.some(i=>i.tasks.some(n=>n.responsible_user_id))&&this._loadUserNames(),this.hass&&this._config.show_documents!==!1)for(let i of this._objects)this._docsLoadedFor.has(i.entry_id)||i.tasks.some(n=>(n.document_count??0)>0)&&this._loadDocuments(i.entry_id);if(e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=ye(e.objects),this._stats=t}catch{}await this._loadViewFilters()}_assigneeName(e){if(this._config.show_assignee===!1)return"";let t=e.responsible_user_id;return t&&this._userNames[t]||""}async _loadUserNames(){this._userNamesLoaded=!0,this._userService?this._userService.updateHass(this.hass):this._userService=new de(this.hass);try{let e=await this._userService.getUsers();this._userNames=Object.fromEntries(e.map(t=>[t.id,t.name]))}catch{}}async _loadDocuments(e){this._docsLoadedFor.add(e);try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/list",entry_id:e}),i={};for(let n of t.documents||[])for(let l of n.task_ids||[])(i[l]||=[]).push({id:n.id,title:n.title,kind:n.kind,url:n.url});this._taskDocs={...this._taskDocs,[e]:i}}catch{}}_docsFor(e,t){if(this._config.show_documents===!1)return[];let n=[...this._taskDocs[e]?.[t.id]||[]];return t.documentation_url&&n.push({id:`url:${t.id}`,title:r("documentation_label",this._lang),kind:"weblink",url:t.documentation_url}),n}async _openDoc(e){if(e.kind==="weblink"&&e.url){window.open(e.url,"_blank","noopener");return}let t=window.open("about:blank","_blank");try{let i=await this.hass.connection.sendMessagePromise({type:"auth/sign_path",path:`/api/maintenance_supporter/document/${e.id}`,expires:300});t&&(t.location.href=new URL(i.path,window.location.origin).href)}catch{t&&t.close()}}async _loadViewFilters(){if(!this._config.view_id){this._viewFilters=null;return}try{let t=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"})).views||[]).find(i=>i.id===this._config.view_id);this._viewFilters=t?t.filters:null}catch{this._viewFilters=null}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=Mt(this._objects,t);i!==null&&(this._objects=i)},{type:"maintenance_supporter/subscribe",deltas:!0,compact:!0});if(!this.isConnected){e();return}this._unsub=e}catch{}}get _flatTasks(){let e=[],{filter_status:t,filter_objects:i,entity_ids:n,filter_due_min_days:l,filter_due_max_days:c,filter_labels:p,filter_areas:u,max_items:v}=this._config,f=n?.length?new Set(n):null,y=l!==void 0||c!==void 0,g=this._viewFilters,x=g?.user_id==="current_user"?this.hass.user?.id??null:g?.user_id??null;for(let j of this._objects)if(!(i?.length&&!i.includes(j.object.name))){if(u?.length){let S=j.object.area_id;if(!S||!u.includes(S))continue}for(let S of j.tasks)if(!S.is_done&&!(S.archived||j.object.archived)&&!(t?.length&&!t.includes(S.status))&&!(p?.length&&!(S.labels||[]).some(I=>p.includes(I)))&&!(f&&!(
Line truncated
|
||||
`,d([b({attribute:!1})],V.prototype,"hass",2),d([h()],V.prototype,"_config",2),d([h()],V.prototype,"_objects",2),d([h()],V.prototype,"_loadingObjects",2),d([h()],V.prototype,"_loadError",2),d([h()],V.prototype,"_views",2);customElements.get("maintenance-supporter-card-editor")||customElements.define("maintenance-supporter-card-editor",V);ct();B();var M=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._stats=null;this._unsub=null;this._viewFilters=null;this._userNames={};this._userService=null;this._userNamesLoaded=!1;this._taskDocs={};this._docsLoadedFor=new Set;this._dataLoaded=!1;this._lastConnection=null;this._onCompleted=async()=>{await this._loadData()}}get _lang(){return N(this.hass)}static getConfigElement(){return document.createElement("maintenance-supporter-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-card",show_header:!0,show_actions:!0,filter_status:["overdue","triggered","due_soon"],max_items:10}}setConfig(e){let t=e.view_id!==this._config.view_id;this._config=e,t&&this._dataLoaded&&this.hass&&this._loadViewFilters()}getCardSize(){return 3}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub(),this._unsub=null),this._dataLoaded=!1,this._lastConnection=null}updated(e){super.updated(e),e.has("hass")&&Zt(this.hass?.locale);let t=this.hass?.language;if(t&&!Me(t)&&qe(t).then(()=>this.requestUpdate()),this.hass&&!this._userNamesLoaded&&this._config.show_assignee!==!1&&this._objects.some(i=>i.tasks.some(n=>n.responsible_user_id))&&this._loadUserNames(),this.hass&&this._config.show_documents!==!1)for(let i of this._objects)this._docsLoadedFor.has(i.entry_id)||i.tasks.some(n=>(n.document_count??0)>0)&&this._loadDocuments(i.entry_id);if(e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=$e(e.objects),this._stats=t}catch{}await this._loadViewFilters()}_assigneeName(e){if(this._config.show_assignee===!1)return"";let t=e.responsible_user_id;return t&&this._userNames[t]||""}async _loadUserNames(){this._userNamesLoaded=!0,this._userService?this._userService.updateHass(this.hass):this._userService=new pe(this.hass);try{let e=await this._userService.getUsers();this._userNames=Object.fromEntries(e.map(t=>[t.id,t.name]))}catch{}}async _loadDocuments(e){this._docsLoadedFor.add(e);try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/list",entry_id:e}),i={};for(let n of t.documents||[])for(let l of n.task_ids||[])(i[l]||=[]).push({id:n.id,title:n.title,kind:n.kind,url:n.url});this._taskDocs={...this._taskDocs,[e]:i}}catch{}}_docsFor(e,t){if(this._config.show_documents===!1)return[];let n=[...this._taskDocs[e]?.[t.id]||[]];return t.documentation_url&&n.push({id:`url:${t.id}`,title:r("documentation_label",this._lang),kind:"weblink",url:t.documentation_url}),n}async _openDoc(e){if(e.kind==="weblink"&&e.url){window.open(e.url,"_blank","noopener");return}try{await ri(this.hass,e.id)}catch{}}async _loadViewFilters(){if(!this._config.view_id){this._viewFilters=null;return}try{let t=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"})).views||[]).find(i=>i.id===this._config.view_id);this._viewFilters=t?t.filters:null}catch{this._viewFilters=null}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=qt(this._objects,t);i!==null&&(this._objects=i)},{type:"maintenance_supporter/subscribe",deltas:!0,compact:!0});if(!this.isConnected){e();return}this._unsub=e}catch{}}get _flatTasks(){let e=[],{filter_status:t,filter_objects:i,entity_ids:n,filter_due_min_days:l,filter_due_max_days:c,filter_labels:p,filter_areas:u,max_items:v}=this._config,f=n?.length?new Set(n):null,y=l!==void 0||c!==void 0,g=this._viewFilters,x=g?.user_id==="current_user"?this.hass.user?.id??null:g?.user_id??null;for(let j of this._objects)if(!(i?.length&&!i.includes(j.object.name))){if(u?.length){let S=j.object.area_id;if(!S||!u.includes(S))continue}for(let S of j.tasks)if(!S.is_done&&!(S.archived||j.object.archived)&&!(t?.length&&!t.includes(S.status))&&!(p?.length&&!(S.labels||[]).some(C=>p.includes(C)))&&!(f&&!(S.sensor_entity_id&&f.has(S.sensor_entity_id)||S.binary_sensor_entity_id&&f.has(S.binary_sensor_entity_id)))){if(y){let C=S.days_until_due;if(C==null||l!==void 0&&C<l||c!==void 0&&C>c)continue}g&&(g.status&&S.status!==g.status||g.label&&!(S.labels
Line truncated
|
||||
<ha-card>
|
||||
<div class="card-header">
|
||||
<h1>${t}</h1>
|
||||
@@ -4037,14 +4001,14 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
<mwc-icon-button
|
||||
class="hdr-add"
|
||||
title="${r("new_object",e)}"
|
||||
@click=${()=>_t()}
|
||||
@click=${()=>gt()}
|
||||
>
|
||||
<ha-icon icon="mdi:plus-box"></ha-icon>
|
||||
</mwc-icon-button>
|
||||
<mwc-icon-button
|
||||
class="hdr-add"
|
||||
title="${r("add_task",e)}"
|
||||
@click=${()=>ut()}
|
||||
@click=${()=>mt()}
|
||||
>
|
||||
<ha-icon icon="mdi:playlist-plus"></ha-icon>
|
||||
</mwc-icon-button>
|
||||
@@ -4064,7 +4028,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
<div class="task-item clickable"
|
||||
@click=${()=>this._openTaskDetail(u,f.id)}
|
||||
title="${r("open_task",e)||"Open task"}">
|
||||
<div class="status-dot" style="background: ${ie[f.status]||"#ccc"}"></div>
|
||||
<div class="status-dot" style="background: ${re[f.status]||"#ccc"}"></div>
|
||||
<div class="task-info">
|
||||
<div class="task-name">
|
||||
${f.name}
|
||||
@@ -4096,13 +4060,13 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
`)}
|
||||
</div>`:_}
|
||||
<div class="task-due">
|
||||
${f.days_until_due!==null&&f.days_until_due!==void 0?f.days_until_due<0?o`<span class="overdue-text">${at(f.days_until_due,e)}</span>`:at(f.days_until_due,e):f.trigger_active?"\u26A1":"\u2014"}
|
||||
${f.days_until_due!==null&&f.days_until_due!==void 0?f.days_until_due<0?o`<span class="overdue-text">${ot(f.days_until_due,e)}</span>`:ot(f.days_until_due,e):f.trigger_active?"\u26A1":"\u2014"}
|
||||
</div>
|
||||
${n?o`
|
||||
<mwc-icon-button
|
||||
class="complete-btn"
|
||||
title="${r("complete",e)}"
|
||||
@click=${y=>{y.stopPropagation();let g=this.shadowRoot.querySelector("maintenance-complete-dialog");g.entryId=u,g.taskId=f.id,g.taskName=f.name,g.checklist=f.checklist||[],g.adaptiveEnabled=!!f.adaptive_config?.enabled,g.taskType=f.type||"",g.readingUnit=f.reading_unit||"",g.requiredFields=f.required_completion_fields||[],g.lang=e;let x=!!f.part_ref;g.parts=x?[]:ii(f,u,this._objects,e),g.consumesParts=x?[]:f.consumes_parts||[],g.open()}}
|
||||
@click=${y=>{y.stopPropagation();let g=this.shadowRoot.querySelector("maintenance-complete-dialog");g.entryId=u,g.taskId=f.id,g.taskName=f.name,g.checklist=f.checklist||[],g.adaptiveEnabled=!!f.adaptive_config?.enabled,g.taskType=f.type||"",g.readingUnit=f.reading_unit||"",g.requiredFields=f.required_completion_fields||[],g.lang=e;let x=!!f.part_ref;g.parts=x?[]:ni(f,u,this._objects,e),g.consumesParts=x?[]:f.consumes_parts||[],g.open()}}
|
||||
>
|
||||
<ha-icon icon="mdi:check"></ha-icon>
|
||||
</mwc-icon-button>
|
||||
@@ -4116,7 +4080,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
.hass=${this.hass}
|
||||
@task-completed=${this._onCompleted}
|
||||
></maintenance-complete-dialog>
|
||||
`}};M.styles=[Oe,E`
|
||||
`}};M.styles=[ze,E`
|
||||
ha-card { overflow: hidden; }
|
||||
|
||||
.card-header {
|
||||
@@ -4248,7 +4212,7 @@ ${p?`<div class="sub">${p}</div>`:""}
|
||||
--mdc-icon-size: 18px;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
`],d([b({attribute:!1})],M.prototype,"hass",2),d([h()],M.prototype,"_config",2),d([h()],M.prototype,"_objects",2),d([h()],M.prototype,"_stats",2),d([h()],M.prototype,"_unsub",2),d([h()],M.prototype,"_viewFilters",2),d([h()],M.prototype,"_userNames",2),d([h()],M.prototype,"_taskDocs",2);customElements.get("maintenance-supporter-card")||customElements.define("maintenance-supporter-card",M);window.customCards=window.customCards||[];window.customCards.push({type:"maintenance-supporter-card",name:"Maintenance Supporter",description:"Overview of your maintenance tasks with quick actions.",preview:!0});export{M as MaintenanceSupporterCard};
|
||||
`],d([b({attribute:!1})],M.prototype,"hass",2),d([h()],M.prototype,"_config",2),d([h()],M.prototype,"_objects",2),d([h()],M.prototype,"_stats",2),d([h()],M.prototype,"_unsub",2),d([h()],M.prototype,"_viewFilters",2),d([h()],M.prototype,"_userNames",2),d([h()],M.prototype,"_taskDocs",2);customElements.get("maintenance-supporter-card")||customElements.define("maintenance-supporter-card",M);ai({type:"maintenance-supporter-card",name:"Maintenance Supporter",description:"Overview of your maintenance tasks with quick actions.",preview:!0});export{M as MaintenanceSupporterCard};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
Reference in new issue
Block a user