feat: add branch overviews scoped outdoor plans and complete room moves

This commit is contained in:
jhartworks committed 2026-11-19 15:12:11 +01:00
1 parent 382d6e04f2
commit 16eddacebf
35 files changed
+2593 -2111

No files matched your search

+2
View File
@@ -14,6 +14,8 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad
### Added
- **Branch overviews, scoped outdoors and room moves (Symcon 0.4.2):** Select entire locations or branches above the editor, with read-only plan overviews and scoped 3D scenes. Create independent outdoor plans at location, branch and building level; preserve legacy location references, unique navigation keys, owner paths, thumbnails, isolated live values, stack ranks and roof exclusions through saves and backups. Add an explicit room-move dialog with destination building/storey and adjustable position, retaining room IDs, native links, openings, contained furniture/devices/notes and related geometry. Reject stale selections and duplicate destination devices before changing the plan. Migrate existing room/device grants only for unique stable identities when their floor changes, preserving permission levels and undo without granting access to additional users.
- **Five-level site topology (Symcon 0.4.0):** Add optional location → branch → building → floor → room groups with editor creation, naming, reassignment and protected removal. Preserve existing floor/room IDs and native grants when enabling the hierarchy. Each location owns an independent outdoor plan. Designer and tile navigation drill into the selected branch, keep the upper room menu hidden until a floor is selected, frame previews from the node's own geometry and clip room previews. Scope live values and utility overviews to the selected group, keep floor explosion/automatic roofs within each building, and limit whole-building transforms to its floors. Native permission choices expose complete paths. Persist topology and outdoor membership through schema validation and backups.
- **Hydronic status bindings (Symcon 0.3.1):** Add native object-tree status selection for individual heating/cooling circuits, every fresh-water cascade unit and the common plant. Floating cards and detail dialogs preserve formatted Integer aliases, including zero, live updates, unavailable values, archive access and scoped user permissions. Status readings remain read-only, hide unlinked rows and truncate long labels without widening cards; existing single stations retain their links when promoted to cascades.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+138 -138
View File
@@ -1,13 +1,13 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var k={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=n=>n===void 0?n:JSON.parse(JSON.stringify(n)));var Jn=globalThis,Qn=Jn.ShadowRoot&&(Jn.ShadyCSS===void 0||Jn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Si=Symbol(),xs=new WeakMap,un=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Si)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Qn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=xs.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&xs.set(t,e))}return e}toString(){return this.cssText}},ks=n=>new un(typeof n=="string"?n:n+"",void 0,Si),J=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new un(t,n,Si)},Ss=(n,e)=>{if(Qn)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=Jn.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},$i=Qn?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return ks(t)})(n):n;var{is:Ed,defineProperty:zd,getOwnPropertyDescriptor:Td,getOwnPropertyNames:Fd,getOwnPropertySymbols:Dd,getPrototypeOf:Hd}=Object,Xn=globalThis,$s=Xn.trustedTypes,Pd=$s?$s.emptyScript:"",Id=Xn.reactiveElementPolyfillSupport,cn=(n,e)=>n,Mi={toAttribute(n,e){switch(e){case Boolean:n=n?Pd:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},As=(n,e)=>!Ed(n,e),Ms={attribute:!0,type:String,converter:Mi,reflect:!1,useDefault:!1,hasChanged:As};Symbol.metadata??=Symbol("metadata"),Xn.litPropertyMetadata??=new WeakMap;var Ve=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ms){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&zd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=Td(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ms}static _$Ei(){if(this.hasOwnProperty(cn("elementProperties")))return;let e=Hd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(cn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(cn("properties"))){let t=this.properties,r=[...Fd(t),...Dd(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift($i(i))}else e!==void 0&&t.push($i(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
\f\r]`,dn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zs=/-->/g,Ts=/>/g,mt=RegExp(`>|${Ai}(?:([^\\s"'>=/]+)(${Ai}*=${Ai}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Fs=/'/g,Ds=/"/g,Cs=/^(?:script|style|textarea|title)$/i,Pi=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),m=Pi(1),ne=Pi(2),Eg=Pi(3),_t=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Hs=new WeakMap,ft=gt.createTreeWalker(gt,129);function Ns(n,e){if(!Hi(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Es!==void 0?Es.createHTML(e):e}var Ld=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=dn;for(let a=0;a<t;a++){let l=n[a],u,c,d=-1,p=0;for(;p<l.length&&(s.lastIndex=p,c=s.exec(l),c!==null);)p=s.lastIndex,s===dn?c[1]==="!--"?s=zs:c[1]!==void 0?s=Ts:c[2]!==void 0?(Cs.test(c[2])&&(i=RegExp("</"+c[2],"g")),s=mt):c[3]!==void 0&&(s=mt):s===mt?c[0]===">"?(s=i??dn,d=-1):c[1]===void 0?d=-2:(d=s.lastIndex-c[2].length,u=c[1],s=c[3]===void 0?mt:c[3]==='"'?Ds:Fs):s===Ds||s===Fs?s=mt:s===zs||s===Ts?s=dn:(s=mt,i=void 0);let h=s===mt&&n[a+1].startsWith("/>")?" ":"";o+=s===dn?l+Cd:d>=0?(r.push(u),l.slice(0,d)+Ps+l.slice(d)+ot+h):l+ot+(d===-2?a:h)}return[Ns(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},mn=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[u,c]=Ld(e,t);if(this.el=n.createElement(u,r),ft.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=ft.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(Ps)){let p=c[s++],h=i.getAttribute(d).split(ot),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?Ei:g[1]==="?"?zi:g[1]==="@"?Ti:Ft}),i.removeAttribute(d)}else d.startsWith(ot)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(Cs.test(i.tagName)){let d=i.textContent.split(ot),p=d.length-1;if(p>0){i.textContent=er?er.emptyScript:"";for(let h=0;h<p;h++)i.append(d[h],hn()),ft.nextNode(),l.push({type:2,index:++o});i.append(d[p],hn())}}}else if(i.nodeType===8)if(i.data===Is)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(ot,d+1))!==-1;)l.push({type:7,index:o}),d+=ot.length-1}o++}}static createElement(e,t){let r=gt.createElement("template");return r.innerHTML=e,r}};function Tt(n,e,t=n,r){if(e===_t)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=pn(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Tt(n,i._$AS(n,e.values),i,r)),e}var Ri=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??gt).importNode(t,!0);ft.currentNode=i;let o=ft.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new fn(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new Fi(o,this,e)),this._$AV.push(u),l=r[++a]}s!==l?.index&&(o=ft.nextNode(),s++)}return ft.currentNode=gt,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},fn=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Tt(this,e,t),pn(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==_t&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Nd(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&pn(this._$AH)?this._$AA.nextSibling.data=e:this.T(gt.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=mn.createElement(Ns(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Ri(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Hs.get(e.strings);return t===void 0&&Hs.set(e.strings,t=new mn(e)),t}k(e){Hi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(hn()),this.O(hn()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=Rs(e).nextSibling;Rs(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Ft=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this.Line truncated
var k={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=n=>n===void 0?n:JSON.parse(JSON.stringify(n)));var nr=globalThis,rr=nr.ShadowRoot&&(nr.ShadyCSS===void 0||nr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ei=Symbol(),Ms=new WeakMap,dn=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ei)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(rr&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Ms.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Ms.set(t,e))}return e}toString(){return this.cssText}},As=n=>new dn(typeof n=="string"?n:n+"",void 0,Ei),J=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new dn(t,n,Ei)},Rs=(n,e)=>{if(rr)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=nr.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},zi=rr?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return As(t)})(n):n;var{is:Dd,defineProperty:Hd,getOwnPropertyDescriptor:Pd,getOwnPropertyNames:Id,getOwnPropertySymbols:Cd,getPrototypeOf:Nd}=Object,ir=globalThis,Es=ir.trustedTypes,Od=Es?Es.emptyScript:"",Ld=ir.reactiveElementPolyfillSupport,hn=(n,e)=>n,Ti={toAttribute(n,e){switch(e){case Boolean:n=n?Od:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Ts=(n,e)=>!Dd(n,e),zs={attribute:!0,type:String,converter:Ti,reflect:!1,useDefault:!1,hasChanged:Ts};Symbol.metadata??=Symbol("metadata"),ir.litPropertyMetadata??=new WeakMap;var Ve=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=zs){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Hd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=Pd(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??zs}static _$Ei(){if(this.hasOwnProperty(hn("elementProperties")))return;let e=Nd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(hn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(hn("properties"))){let t=this.properties,r=[...Id(t),...Cd(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(zi(i))}else e!==void 0&&t.push(zi(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
\f\r]`,pn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hs=/-->/g,Ps=/>/g,mt=RegExp(`>|${Fi}(?:([^\\s"'>=/]+)(${Fi}*=${Fi}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Is=/'/g,Cs=/"/g,Ws=/^(?:script|style|textarea|title)$/i,Li=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),m=Li(1),ne=Li(2),Dg=Li(3),_t=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Ns=new WeakMap,ft=gt.createTreeWalker(gt,129);function Bs(n,e){if(!Oi(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ds!==void 0?Ds.createHTML(e):e}var Vd=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=pn;for(let a=0;a<t;a++){let l=n[a],u,c,d=-1,p=0;for(;p<l.length&&(s.lastIndex=p,c=s.exec(l),c!==null);)p=s.lastIndex,s===pn?c[1]==="!--"?s=Hs:c[1]!==void 0?s=Ps:c[2]!==void 0?(Ws.test(c[2])&&(i=RegExp("</"+c[2],"g")),s=mt):c[3]!==void 0&&(s=mt):s===mt?c[0]===">"?(s=i??pn,d=-1):c[1]===void 0?d=-2:(d=s.lastIndex-c[2].length,u=c[1],s=c[3]===void 0?mt:c[3]==='"'?Cs:Is):s===Cs||s===Is?s=mt:s===Hs||s===Ps?s=pn:(s=mt,i=void 0);let h=s===mt&&n[a+1].startsWith("/>")?" ":"";o+=s===pn?l+Wd:d>=0?(r.push(u),l.slice(0,d)+Os+l.slice(d)+ot+h):l+ot+(d===-2?a:h)}return[Bs(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},gn=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[u,c]=Vd(e,t);if(this.el=n.createElement(u,r),ft.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=ft.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(Os)){let p=c[s++],h=i.getAttribute(d).split(ot),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?Hi:g[1]==="?"?Pi:g[1]==="@"?Ii:Ft}),i.removeAttribute(d)}else d.startsWith(ot)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(Ws.test(i.tagName)){let d=i.textContent.split(ot),p=d.length-1;if(p>0){i.textContent=or?or.emptyScript:"";for(let h=0;h<p;h++)i.append(d[h],mn()),ft.nextNode(),l.push({type:2,index:++o});i.append(d[p],mn())}}}else if(i.nodeType===8)if(i.data===Ls)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(ot,d+1))!==-1;)l.push({type:7,index:o}),d+=ot.length-1}o++}}static createElement(e,t){let r=gt.createElement("template");return r.innerHTML=e,r}};function Tt(n,e,t=n,r){if(e===_t)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=fn(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Tt(n,i._$AS(n,e.values),i,r)),e}var Di=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??gt).importNode(t,!0);ft.currentNode=i;let o=ft.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new _n(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new Ci(o,this,e)),this._$AV.push(u),l=r[++a]}s!==l?.index&&(o=ft.nextNode(),s++)}return ft.currentNode=gt,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},_n=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Tt(this,e,t),fn(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==_t&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Bd(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&fn(this._$AH)?this._$AA.nextSibling.data=e:this.T(gt.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=gn.createElement(Bs(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Di(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Ns.get(e.strings);return t===void 0&&Ns.set(e.strings,t=new gn(e)),t}k(e){Oi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(mn()),this.O(mn()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=Fs(e).nextSibling;Fs(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Ft=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this.Line truncated
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated
:host {
--nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b);
@@ -35,7 +35,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
font-family: var(--nf-font);
color: var(--nf-text);
}
`,Lr=J`
`,Kr=J`
:host([readable]) {
--secondary-text-color: var(--primary-text-color, #e1e1e1);
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
@@ -209,9 +209,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
min-height: 40px;
}
}
`;function Or(n){return n?.themes?.darkMode===!1?"light":"dark"}function Sn(n,e){let t=new Set;return e.flatMap(r=>{let i=String(n?.states[r]?.attributes.symcon_source_entity||r),o=n?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var Sl,go=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(Sl??=import(t).catch(i=>{throw Sl=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!Sn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return m`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
`;function Gr(n){return n?.themes?.darkMode===!1?"light":"dark"}function En(n,e){let t=new Set;return e.flatMap(r=>{let i=String(n?.states[r]?.attributes.symcon_source_entity||r),o=n?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var Rl,vo=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(Rl??=import(t).catch(i=>{throw Rl=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!En(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return m`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
</button>${this.error?m`<span role="alert">${this.error}</span>`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",go);function G(n,e,t=""){let r=Sn(n,e);return r.length?m`<nf-trend-button .hass=${n} .ids=${r} .label=${t}></nf-trend-button>`:f}var _o=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,r,i){if(W(this.hass,e)){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,r,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}}value(e,t,r){let i=this.hass.states[t],o=ye(i),s=i?.attributes,a=r&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return m`<div class="value"><span>${e}</span><b>${Ie(i)}${G(this.hass,[t],e)}</b>
</button>${this.error?m`<span role="alert">${this.error}</span>`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",vo);function G(n,e,t=""){let r=En(n,e);return r.length?m`<nf-trend-button .hass=${n} .ids=${r} .label=${t}></nf-trend-button>`:f}var wo=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,r,i){if(W(this.hass,e)){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,r,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}}value(e,t,r){let i=this.hass.states[t],o=ye(i),s=i?.attributes,a=r&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return m`<div class="value"><span>${e}</span><b>${Ie(i)}${G(this.hass,[t],e)}</b>
${r&&s?.symcon_has_action&&s.symcon_variable_type===0?m`<button class="nf-chip" aria-pressed=${le(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!le(i)})}}>${le(i)?"Ein":"Aus"}</button>`:r&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?m`<input type="number" aria-label=${e} .value=${String(ve(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
@change=${l=>{let u=l.target;u.value.trim()&&u.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(u.value)})}} />`:f}
</div>`}schedule(e){let t=this.hass.states[e];if(!t?.attributes.symcon_schedule)return m`<p class="missing">Schaltuhr nicht verfügbar</p>`;let r=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=r.find(u=>u.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=u=>`${String(u.hour).padStart(2,"0")}:${String(u.minute).padStart(2,"0")}${u.second?`:${String(u.second).padStart(2,"0")}`:""}`;return m`<details class="schedule"><summary>${String(t.attributes.friendly_name??"Schaltuhr")}</summary>
@@ -220,7 +220,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${i.length?i.map(u=>m`<div class="schedule-group"><b>${a.filter((c,d)=>u.days&1<<d).join(" \xB7 ")}</b><div class="points">
${[...u.points].sort((c,d)=>c.hour*3600+c.minute*60+c.second-(d.hour*3600+d.minute*60+d.second)).map(c=>{let d=r.find(p=>p.id===c.action);return m`<span class="point"><time>${l(c)}</time><span class="dot" style=${`background:#${Number(d?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${d?.name||"Aktion"}</span>`})}
</div></div>`):m`<p class="missing">Keine Schaltpunkte vorhanden.</p>`}
</details>`}render(){if(!this.hass||!this.room)return f;let e=kl.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],r=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return m`${r||e.length?m`<section><h3>Raumklima</h3>${r?this.value("Fu\xDFbodenheizung",r,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
</details>`}render(){if(!this.hass||!this.room)return f;let e=Al.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],r=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return m`${r||e.length?m`<section><h3>Raumklima</h3>${r?this.value("Fu\xDFbodenheizung",r,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
${t.length?m`<section><h3>Schaltuhren</h3>${t.map(i=>this.schedule(i))}</section>`:f}
${this._error?m`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[ke,Ne,J`
:host { display:block; }
@@ -240,12 +240,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.point time { font-variant-numeric:tabular-nums; }
.dot { width:8px; height:8px; border-radius:50%; }
.error { color:var(--nf-danger,#ff6b7a); font-size:12px; }
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",_o);var wp=new Set(["on","home","open","true","active","playing","heat","heating"]);function Ye(n,e){let t=e.show_when;if(!t?.entity||!n)return!0;let r=n.states[t.entity];if(!r||I(r))return!0;let i=String(r.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):wp.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function $l(n,e){let t=[];for(let r of e.floors)for(let i of r.furniture)Ye(n,i)||t.push(i.id);return t.sort()}function Ml(n,e){if(!e.length)return n;let t=new Set(e);return{...n,floors:n.floors.map(r=>r.furniture.some(i=>t.has(i.id))?{...r,furniture:r.furniture.filter(i=>!t.has(i.id))}:r)}}function ae(n,e){if(!Ki(e))return M(n,`furn_${e}`);let t=X(e);return t?xp(t,e,n?.language??navigator.language):M(n,"pack_missing_item")}function xp(n,e,t){return n.name[t.split("-")[0]]??al(t,e)??ca(n,t)}var ee=(n,e)=>[n[0]-e[0],n[1]-e[1]],Le=(n,e)=>[n[0]+e[0],n[1]+e[1]],Re=(n,e)=>[n[0]*e,n[1]*e],de=(n,e)=>n[0]*e[0]+n[1]*e[1],Je=(n,e)=>n[0]*e[1]-n[1]*e[0],Qe=n=>Math.hypot(n[0],n[1]),Ee=n=>{let e=Qe(n)||1;return[n[0]/e,n[1]/e]},bo=n=>[-n[1],n[0]],yo=n=>[n[1],-n[0]];function Al(n){let e=n.heightEnd!==void 0;return{...n,a:n.b,b:n.a,left:n.right,right:n.left,roomLeft:n.roomRight,roomRight:n.roomLeft,height:e?n.heightEnd:n.height,heightEnd:e?n.height:void 0}}function kp(n,e){let t=n.map(r=>({...r}));for(let r of e){let i=t.find(o=>o.room_id===r.room_id&&o.edge===r.edge&&(Math.abs(o.t1-r.t0)<1e-6||Math.abs(r.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,r.t0),i.t1=Math.max(i.t1,r.t1)):t.push({...r})}return t}function Sp(n,e,t){if(n.a===e.b)return!1;let r=Ee(ee(t[n.b],t[n.a])),i=Ee(ee(t[e.b],t[e.a]));return Math.abs(Je(r,i))>1e-6||de(r,i)<=0||n.free||e.free||n.heightEnd!==void 0||e.heightEnd!==void 0?!1:n.height===e.height&&n.exterior===e.exterior&&n.roomLeft===e.roomLeft&&n.roomRight===e.roomRight&&Math.abs(n.left-e.left)<=1e-9&&Math.abs(n.right-e.right)<=1e-9}function Rl(n,e,t=new Set){let r=n.slice();for(;;){let i=new Map;r.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=r[a[0]].b===s?r[a[0]]:Al(r[a[0]]),u=r[a[1]].a===s?r[a[1]]:Al(r[a[1]]);if(!Sp(l,u,e))continue;let c={...l,b:u.b,sources:kp(l.sources,u.sources)};o=[...r.filter((d,p)=>p!==a[0]&&p!==a[1]),c];break}if(!o)return r;r=o}}function El(n,e){let t=new Map;n.forEach((i,o)=>{let s=Ee(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:Re(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,u]of a)t.set(l,[...t.get(l)??[],u])});let r=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,u)=>l.angle-u.angle);for(let l of o)r.set(l.key,{left:Le(s,Re(bo(l.d),l.left)),right:Le(s,Re(yo(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=Le(s,Re(bo(l.d),l.left)),p=Le(s,Re(yo(c.d),c.right)),h=Je(l.d,c.d);if(Math.abs(h)<1e-4)return;let g=Le(d,Re(l.d,Je(ee(p,d),c.d)/h));Qe(ee(g,s))>a||(r.get(l.key).left=g,r.get(c.key).right=g)})}return r}function zl(n,e){let t=n.filter((r,i)=>Qe(ee(r,n[(i+1)%n.length]))>e);for(;;){if(t.length<=3)return t;let r=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,u]=[ee(i,s),ee(a,i)];return Math.abs(Je(Ee(l),Ee(u)))<1e-7&&de(l,u)>0});if(r===-1)return t;t=t.filter((i,o)=>o!==r)}}function $p(n){let e=[];return{points:e,idOf(t){let r=e.findIndex(i=>Math.abs(i[0]-t[0])<=n&&Math.abs(i[1]-t[1])<=n);return r>=0?r:(e.push([t[0],t[1]]),e.length-1)}}}function Mp(n,e){let t=[];for(let r of n){let i=r.points;if(i.length<3||Math.abs(wt(i))<1e-6)continue;let o=wt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let u=s[(l+1)%s.length];a!==u&&t.push(o?{u:a,v:u,room:r.id,edge:l,forward:!0}:{u,v:a,room:r.id,edge:l,forward:!1})})}return t}function Ap(n,e,t){let r=[];for(let i of n){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=Qe(a),u=Re(a,1/l),c=e.map((p,h)=>({id:h,rel:ee(p,o)})).filter(({id:p,rel:h})=>p!==i.u&&p!==i.v&&de(h,u)>t&&de(h,u)<l-t&&Math.abs(Je(u,h))<=t).map(({id:p,rel:h})=>({t:de(h,u),id:p})).sort((p,h)=>p.t-h.t),d=[{t:0,id:i.u},...c,{t:l,id:i.v}];for(let p=0;p+1<d.length;p++){let[h,g]=[d[p],d[p+1]];r.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return r}var Tl=n=>({room_id:n.room,edge:n.edge,t0:n.t0,t1:n.t1});function Rp(n,e){let t=new Map(n.map(a=>[a.id,a])),r=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;r.set(l,[...r.get(l)??[],a.t0].sort((u,c)=>u-c))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(r.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[u,c]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof u!="number"||typeof c!="number"||u<=0||c<=0)return null;le Line truncated
<h4>${Tn[e]} ${Oe[e]}</h4>
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",wo);var $p=new Set(["on","home","open","true","active","playing","heat","heating"]);function Ye(n,e){let t=e.show_when;if(!t?.entity||!n)return!0;let r=n.states[t.entity];if(!r||I(r))return!0;let i=String(r.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):$p.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function El(n,e){let t=[];for(let r of e.floors)for(let i of r.furniture)Ye(n,i)||t.push(i.id);return t.sort()}function zl(n,e){if(!e.length)return n;let t=new Set(e);return{...n,floors:n.floors.map(r=>r.furniture.some(i=>t.has(i.id))?{...r,furniture:r.furniture.filter(i=>!t.has(i.id))}:r)}}function ae(n,e){if(!Zi(e))return M(n,`furn_${e}`);let t=X(e);return t?Mp(t,e,n?.language??navigator.language):M(n,"pack_missing_item")}function Mp(n,e,t){return n.name[t.split("-")[0]]??dl(t,e)??ma(n,t)}var ee=(n,e)=>[n[0]-e[0],n[1]-e[1]],Oe=(n,e)=>[n[0]+e[0],n[1]+e[1]],Re=(n,e)=>[n[0]*e,n[1]*e],de=(n,e)=>n[0]*e[0]+n[1]*e[1],Je=(n,e)=>n[0]*e[1]-n[1]*e[0],Qe=n=>Math.hypot(n[0],n[1]),Ee=n=>{let e=Qe(n)||1;return[n[0]/e,n[1]/e]},xo=n=>[-n[1],n[0]],ko=n=>[n[1],-n[0]];function Tl(n){let e=n.heightEnd!==void 0;return{...n,a:n.b,b:n.a,left:n.right,right:n.left,roomLeft:n.roomRight,roomRight:n.roomLeft,height:e?n.heightEnd:n.height,heightEnd:e?n.height:void 0}}function Ap(n,e){let t=n.map(r=>({...r}));for(let r of e){let i=t.find(o=>o.room_id===r.room_id&&o.edge===r.edge&&(Math.abs(o.t1-r.t0)<1e-6||Math.abs(r.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,r.t0),i.t1=Math.max(i.t1,r.t1)):t.push({...r})}return t}function Rp(n,e,t){if(n.a===e.b)return!1;let r=Ee(ee(t[n.b],t[n.a])),i=Ee(ee(t[e.b],t[e.a]));return Math.abs(Je(r,i))>1e-6||de(r,i)<=0||n.free||e.free||n.heightEnd!==void 0||e.heightEnd!==void 0?!1:n.height===e.height&&n.exterior===e.exterior&&n.roomLeft===e.roomLeft&&n.roomRight===e.roomRight&&Math.abs(n.left-e.left)<=1e-9&&Math.abs(n.right-e.right)<=1e-9}function Fl(n,e,t=new Set){let r=n.slice();for(;;){let i=new Map;r.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=r[a[0]].b===s?r[a[0]]:Tl(r[a[0]]),u=r[a[1]].a===s?r[a[1]]:Tl(r[a[1]]);if(!Rp(l,u,e))continue;let c={...l,b:u.b,sources:Ap(l.sources,u.sources)};o=[...r.filter((d,p)=>p!==a[0]&&p!==a[1]),c];break}if(!o)return r;r=o}}function Dl(n,e){let t=new Map;n.forEach((i,o)=>{let s=Ee(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:Re(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,u]of a)t.set(l,[...t.get(l)??[],u])});let r=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,u)=>l.angle-u.angle);for(let l of o)r.set(l.key,{left:Oe(s,Re(xo(l.d),l.left)),right:Oe(s,Re(ko(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=Oe(s,Re(xo(l.d),l.left)),p=Oe(s,Re(ko(c.d),c.right)),h=Je(l.d,c.d);if(Math.abs(h)<1e-4)return;let g=Oe(d,Re(l.d,Je(ee(p,d),c.d)/h));Qe(ee(g,s))>a||(r.get(l.key).left=g,r.get(c.key).right=g)})}return r}function Hl(n,e){let t=n.filter((r,i)=>Qe(ee(r,n[(i+1)%n.length]))>e);for(;;){if(t.length<=3)return t;let r=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,u]=[ee(i,s),ee(a,i)];return Math.abs(Je(Ee(l),Ee(u)))<1e-7&&de(l,u)>0});if(r===-1)return t;t=t.filter((i,o)=>o!==r)}}function Ep(n){let e=[];return{points:e,idOf(t){let r=e.findIndex(i=>Math.abs(i[0]-t[0])<=n&&Math.abs(i[1]-t[1])<=n);return r>=0?r:(e.push([t[0],t[1]]),e.length-1)}}}function zp(n,e){let t=[];for(let r of n){let i=r.points;if(i.length<3||Math.abs(wt(i))<1e-6)continue;let o=wt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let u=s[(l+1)%s.length];a!==u&&t.push(o?{u:a,v:u,room:r.id,edge:l,forward:!0}:{u,v:a,room:r.id,edge:l,forward:!1})})}return t}function Tp(n,e,t){let r=[];for(let i of n){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=Qe(a),u=Re(a,1/l),c=e.map((p,h)=>({id:h,rel:ee(p,o)})).filter(({id:p,rel:h})=>p!==i.u&&p!==i.v&&de(h,u)>t&&de(h,u)<l-t&&Math.abs(Je(u,h))<=t).map(({id:p,rel:h})=>({t:de(h,u),id:p})).sort((p,h)=>p.t-h.t),d=[{t:0,id:i.u},...c,{t:l,id:i.v}];for(let p=0;p+1<d.length;p++){let[h,g]=[d[p],d[p+1]];r.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return r}var Pl=n=>({room_id:n.room,edge:n.edge,t0:n.t0,t1:n.t1});function Fp(n,e){let t=new Map(n.map(a=>[a.id,a])),r=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;r.set(l,[...r.get(l)??[],a.t0].sort((u,c)=>u-c))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(r.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[u,c]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof u!="number"||typeof c!="number"||u<=0||c<=0)return null;le Line truncated
<h4>${In[e]} ${Le[e]}</h4>
${this.readings.filter(t=>t.kind===e).map(t=>m`<div class="reading" title=${`${t.manual?"Eigener Z\xE4hler":"Bereichsz\xE4hler"}${t.incomplete?" \xB7 Err: Mindestens ein Wert fehlt; angezeigt wird die Summe der verf\xFCgbaren Werte.":""}
${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states[r]?.attributes.friendly_name||r).join(`
`)}`}>
<span>${Yt(t)}${t.manual?m` <small>· Zähler</small>`:""}</span><b>${Be(this.hass,t)}${G(this.hass,t.sources,`${Oe[t.kind]} \xB7 ${Yt(t)}`)}</b>
<span>${Qt(t)}${t.manual?m` <small>· Zähler</small>`:""}</span><b>${Be(this.hass,t)}${G(this.hass,t.sources,`${Le[t.kind]} \xB7 ${Qt(t)}`)}</b>
</div>`)}
</section>`)}`}static styles=J`
:host { display:block; color:var(--nf-text); font:inherit; }
@@ -256,12 +256,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.reading span { color:var(--nf-muted,#aaa); }
b { white-space:nowrap; font-variant-numeric:tabular-nums; }
small { font-size:.85em; }
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",Mo);var Ro=Math.PI/180,Ql=3,Xl=.1,Ao=1/6,eu=(n,e)=>[Math.sin((e+n)*Ro),-Math.cos((e+n)*Ro)],Up=["N","NE","E","SE","S","SW","W","NW"];function jp(n,e,t){return tu(n,e,t).map(r=>r.normal)}function tu(n,e,t){let r=[];for(let i of n.openings){if(i.room_id!==e.id||i.type==="garage")continue;let o=Hl(i,n.rooms,n.walls??[]),s=o?Il(t,i,o):null;if(!s||!s.wall.exterior)continue;let{wall:a}=s,l=Math.hypot(a.b[0]-a.a[0],a.b[1]-a.a[1]);if(l<1e-6)continue;let u=[-(a.b[1]-a.a[1])/l,(a.b[0]-a.a[0])/l],c=a.roomLeft===e.id?u:[-u[0],-u[1]];r.push({opening:i,normal:[-c[0],-c[1]]})}return r}function qp(n,e){let t=((Math.atan2(n[0],-n[1])/Ro-e)%360+360)%360;return Up[Math.round(t/45)%8]}var Yl=new WeakMap;function nu(n,e){let t=Yl.get(e);return t||(t=Ut(e.rooms,{exterior:n.settings.wall_exterior,interior:n.settings.wall_interior},e.walls??[]).walls,Yl.set(e,t)),t}var Jl=new WeakMap;function Jt(n,e,t,r,i=new Date){let o=`${t.id}|${i.toISOString().slice(0,10)}|${n.settings.north??0}|${r.latitude},${r.longitude},${r.zone??""}`,s=Jl.get(e);s||Jl.set(e,s=new Map);let a=s.get(o);if(a)return a;let l=Zp(n,e,t,r,i);return s.set(o,l),l}function Zp(n,e,t,r,i){let o=n.settings.north??0,s=jp(e,t,nu(n,e)),a=[...new Set(s.map(u=>qp(u,o)))];if(!s.length)return{hours:0,facing:a};let l=0;for(let u=Ao/2;u<24;u+=Ao){let c=yt(Dt(u,r.zone,i),r.latitude,r.longitude);if(c.elevation<Ql)continue;let d=eu(c.azimuth,o);s.some(p=>p[0]*d[0]+p[1]*d[1]>Xl)&&l++}return{hours:Math.round(l*Ao*10)/10,facing:a}}function ru(n,e,t,r,i=new Date().getFullYear()){return Array.from({length:12},(o,s)=>Jt(n,e,t,r,new Date(Date.UTC(i,s,15,12))).hours)}function iu(n,e,t,r,i=new Date){let o=yt(i,r.latitude,r.longitude);if(o.elevation<Ql)return[];let s=eu(o.azimuth,n.settings.north??0);return tu(e,t,nu(n,e)).filter(a=>a.normal[0]*s[0]+a.normal[1]*s[1]>Xl).map(a=>a.opening)}var ou=n=>6.112*Math.exp(17.62*n/(243.12+n));function Qt(n,e,t=4){if(n===null||e===null)return null;let r=Math.min(100,e*ou(n)/ou(n-t));return Math.round(Math.min(100,Math.max(0,(r-65)/20*100)))}function Yr(n,e,t){return t!==null&&t>=70?"mould":n!==null&&n>=1e3?"co2":e!==null&&e>=65?"humidity":null}function $t(n=new Date,e=50){let t=n.getMonth(),r=t>=4&&t<=8;return e<0?!r:r}function Jr(n,e,t,r=!1){let i=[];if(n!==null){let[s,a]=r?[22,26]:[20,23],l=n<s?s-n:n>a?n-a:0;i.push(Math.max(0,100-l*15))}if(e!==null){let s=e<40?40-e:e>60?e-60:0;i.push(Math.max(0,100-s*4))}if(t!==null&&i.push(Math.max(0,Math.min(100,100-(t-800)/600*100))),!i.length)return null;let o=i.reduce((s,a)=>s+a,0)/i.length;return Math.round(Math.min(o,Math.min(...i)+30))}var Yp={temperature:{deviceClass:"temperature",unit:"\xB0C",stops:[[16,[.2,.45,1]],[20,[.15,.85,.75]],[22.5,[.95,.8,.3]],[26,[1,.28,.18]]]},humidity:{deviceClass:"humidity",unit:"%",stops:[[30,[.95,.6,.2]],[45,[.3,.88,.5]],[60,[.2,.78,1]],[75,[.32,.4,.98]]]},co2:{deviceClass:"carbon_dioxide",unit:"ppm",stops:[[450,[.3,.88,.5]],[800,[.98,.84,.3]],[1200,[1,.5,.2]],[1600,[.98,.25,.25]]]},mould:{deviceClass:"",unit:"%",stops:[[0,[.3,.88,.5]],[40,[.98,.84,.3]],[70,[1,.5,.2]],[100,[.75,.2,.55]]]},comfort:{deviceClass:"",unit:"",stops:[[0,[.98,.25,.25]],[40,[1,.5,.2]],[65,[.98,.84,.3]],[85,[.3,.88,.5]],[100,[.2,.8,.7]]]},power:{deviceClass:"power",unit:"W",stops:[[0,[.25,.4,.6]],[100,[.3,.88,.5]],[500,[.98,.84,.3]],[1500,[1,.5,.2]],[3e3,[.98,.25,.25]]]},sun:{deviceClass:"",unit:"h",stops:[[0,[.22,.3,.55]],[2,[.35,.6,.85]],[4,[.98,.84,.3]],[7,[1,.62,.2]],[10,[1,.42,.25]]]}},Jp={deviceClass:"temperature",unit:"\xB0C",stops:[[19,[.2,.45,1]],[22.5,[.15,.85,.75]],[25.5,[.95,.8,.3]],[29,[1,.28,.18]]]};function Qr(n,e=!1){return n==="temperature"&&e?Jp:Yp[n]}var Qp=(n,e,t)=>[n[0]+(e[0]-n[0])*t,n[1]+(e[1]-n[1])*t,n[2]+(e[2]-n[2])*t];function su(n,e,t=!1){let{stops:r}=Qr(n,t),i=r.findIndex(([u])=>e<=u);if(i===-1)return r[r.length-1][1];if(i===0)return r[0][1];let[o,s]=r[i-1],[a,l]=r[i];return Qp(s,l,(e-o)/(a-o))}function Eo(n,e,t,r){let i=qt(n,r,e.floors?.flatMap(s=>s.rooms)??t.rooms).filter(s=>s.kind==="electricity"&&s.metric==="power");if(i.length)return i.find(s=>s.unit==="W")?.value??null;let o=null;for(let s of zo(n,e,t,r)){let a=Z(n.states[s]);a!==null&&(o=(o??0)+Math.max(0,a))}return o}function zo(n,e,t,r){let i=qt(n,r,e.floors?.flatMap(d=>d.rooms)??t.rooms).filter(d=>d.kind==="electricity"&&d.metric==="power");if(i.length)return i.filter(d=>d.unit==="W").flatMap(d=>d.sources);let{grid:o,solar:s,battery:a}=e.energy,l=new Set([o,s,a].filter(Boolean)),u=new Set,c=(d,p)=>r.points.length>=3&&H([d,p],r.points);for(let d of t.placements){let p=c(d.x,d.z)?Se(n,d.entity_id):null;p&&u.add(p)}for(let d of t.furniture){if(!c(d.x,d.z))continue;let p=d.power&&d.power!=="none"?d.power:d.entity&&d.entity!=="none"?Se(n,d.entity):null;p&&u.add(p);for(let h of d.gang_entities??[]){let g=h&&h!=="none"?Se(n,h):null;g&&u.add(g)}}return[...u].filter(d=>!l.has(d))}function au(n,e,t){let r=new Map;for(let i of e.floors)for( Line truncated
<path d=${Pr(n)} />
</svg>`,ni={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Do=n=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${n} /></svg>`,Mm=24,Am=10,Ho=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of ei(e))this.call("light",t.service,t.data)}renderMoods(e,t){let r=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!r.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>j(this.hass,l).filter(u=>u.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...r,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(Xr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",zo);var Fo=Math.PI/180,nu=3,ru=.1,To=1/6,iu=(n,e)=>[Math.sin((e+n)*Fo),-Math.cos((e+n)*Fo)],Yp=["N","NE","E","SE","S","SW","W","NW"];function Jp(n,e,t){return ou(n,e,t).map(r=>r.normal)}function ou(n,e,t){let r=[];for(let i of n.openings){if(i.room_id!==e.id||i.type==="garage")continue;let o=Nl(i,n.rooms,n.walls??[]),s=o?Ll(t,i,o):null;if(!s||!s.wall.exterior)continue;let{wall:a}=s,l=Math.hypot(a.b[0]-a.a[0],a.b[1]-a.a[1]);if(l<1e-6)continue;let u=[-(a.b[1]-a.a[1])/l,(a.b[0]-a.a[0])/l],c=a.roomLeft===e.id?u:[-u[0],-u[1]];r.push({opening:i,normal:[-c[0],-c[1]]})}return r}function Qp(n,e){let t=((Math.atan2(n[0],-n[1])/Fo-e)%360+360)%360;return Yp[Math.round(t/45)%8]}var eu=new WeakMap;function su(n,e){let t=eu.get(e);return t||(t=qt(e.rooms,{exterior:n.settings.wall_exterior,interior:n.settings.wall_interior},e.walls??[]).walls,eu.set(e,t)),t}var tu=new WeakMap;function Xt(n,e,t,r,i=new Date){let o=`${t.id}|${i.toISOString().slice(0,10)}|${n.settings.north??0}|${r.latitude},${r.longitude},${r.zone??""}`,s=tu.get(e);s||tu.set(e,s=new Map);let a=s.get(o);if(a)return a;let l=Xp(n,e,t,r,i);return s.set(o,l),l}function Xp(n,e,t,r,i){let o=n.settings.north??0,s=Jp(e,t,su(n,e)),a=[...new Set(s.map(u=>Qp(u,o)))];if(!s.length)return{hours:0,facing:a};let l=0;for(let u=To/2;u<24;u+=To){let c=yt(Dt(u,r.zone,i),r.latitude,r.longitude);if(c.elevation<nu)continue;let d=iu(c.azimuth,o);s.some(p=>p[0]*d[0]+p[1]*d[1]>ru)&&l++}return{hours:Math.round(l*To*10)/10,facing:a}}function au(n,e,t,r,i=new Date().getFullYear()){return Array.from({length:12},(o,s)=>Xt(n,e,t,r,new Date(Date.UTC(i,s,15,12))).hours)}function lu(n,e,t,r,i=new Date){let o=yt(i,r.latitude,r.longitude);if(o.elevation<nu)return[];let s=iu(o.azimuth,n.settings.north??0);return ou(e,t,su(n,e)).filter(a=>a.normal[0]*s[0]+a.normal[1]*s[1]>ru).map(a=>a.opening)}var uu=n=>6.112*Math.exp(17.62*n/(243.12+n));function en(n,e,t=4){if(n===null||e===null)return null;let r=Math.min(100,e*uu(n)/uu(n-t));return Math.round(Math.min(100,Math.max(0,(r-65)/20*100)))}function ti(n,e,t){return t!==null&&t>=70?"mould":n!==null&&n>=1e3?"co2":e!==null&&e>=65?"humidity":null}function $t(n=new Date,e=50){let t=n.getMonth(),r=t>=4&&t<=8;return e<0?!r:r}function ni(n,e,t,r=!1){let i=[];if(n!==null){let[s,a]=r?[22,26]:[20,23],l=n<s?s-n:n>a?n-a:0;i.push(Math.max(0,100-l*15))}if(e!==null){let s=e<40?40-e:e>60?e-60:0;i.push(Math.max(0,100-s*4))}if(t!==null&&i.push(Math.max(0,Math.min(100,100-(t-800)/600*100))),!i.length)return null;let o=i.reduce((s,a)=>s+a,0)/i.length;return Math.round(Math.min(o,Math.min(...i)+30))}var em={temperature:{deviceClass:"temperature",unit:"\xB0C",stops:[[16,[.2,.45,1]],[20,[.15,.85,.75]],[22.5,[.95,.8,.3]],[26,[1,.28,.18]]]},humidity:{deviceClass:"humidity",unit:"%",stops:[[30,[.95,.6,.2]],[45,[.3,.88,.5]],[60,[.2,.78,1]],[75,[.32,.4,.98]]]},co2:{deviceClass:"carbon_dioxide",unit:"ppm",stops:[[450,[.3,.88,.5]],[800,[.98,.84,.3]],[1200,[1,.5,.2]],[1600,[.98,.25,.25]]]},mould:{deviceClass:"",unit:"%",stops:[[0,[.3,.88,.5]],[40,[.98,.84,.3]],[70,[1,.5,.2]],[100,[.75,.2,.55]]]},comfort:{deviceClass:"",unit:"",stops:[[0,[.98,.25,.25]],[40,[1,.5,.2]],[65,[.98,.84,.3]],[85,[.3,.88,.5]],[100,[.2,.8,.7]]]},power:{deviceClass:"power",unit:"W",stops:[[0,[.25,.4,.6]],[100,[.3,.88,.5]],[500,[.98,.84,.3]],[1500,[1,.5,.2]],[3e3,[.98,.25,.25]]]},sun:{deviceClass:"",unit:"h",stops:[[0,[.22,.3,.55]],[2,[.35,.6,.85]],[4,[.98,.84,.3]],[7,[1,.62,.2]],[10,[1,.42,.25]]]}},tm={deviceClass:"temperature",unit:"\xB0C",stops:[[19,[.2,.45,1]],[22.5,[.15,.85,.75]],[25.5,[.95,.8,.3]],[29,[1,.28,.18]]]};function ri(n,e=!1){return n==="temperature"&&e?tm:em[n]}var nm=(n,e,t)=>[n[0]+(e[0]-n[0])*t,n[1]+(e[1]-n[1])*t,n[2]+(e[2]-n[2])*t];function cu(n,e,t=!1){let{stops:r}=ri(n,t),i=r.findIndex(([u])=>e<=u);if(i===-1)return r[r.length-1][1];if(i===0)return r[0][1];let[o,s]=r[i-1],[a,l]=r[i];return nm(s,l,(e-o)/(a-o))}function Do(n,e,t,r){let i=Yt(n,r,e.floors?.flatMap(s=>s.rooms)??t.rooms).filter(s=>s.kind==="electricity"&&s.metric==="power");if(i.length)return i.find(s=>s.unit==="W")?.value??null;let o=null;for(let s of Ho(n,e,t,r)){let a=Z(n.states[s]);a!==null&&(o=(o??0)+Math.max(0,a))}return o}function Ho(n,e,t,r){let i=Yt(n,r,e.floors?.flatMap(d=>d.rooms)??t.rooms).filter(d=>d.kind==="electricity"&&d.metric==="power");if(i.length)return i.filter(d=>d.unit==="W").flatMap(d=>d.sources);let{grid:o,solar:s,battery:a}=e.energy,l=new Set([o,s,a].filter(Boolean)),u=new Set,c=(d,p)=>r.points.length>=3&&H([d,p],r.points);for(let d of t.placements){let p=c(d.x,d.z)?Se(n,d.entity_id):null;p&&u.add(p)}for(let d of t.furniture){if(!c(d.x,d.z))continue;let p=d.power&&d.power!=="none"?d.power:d.entity&&d.entity!=="none"?Se(n,d.entity):null;p&&u.add(p);for(let h of d.gang_entities??[]){let g=h&&h!=="none"?Se(n,h):null;g&&u.add(g)}}return[...u].filter(d=>!l.has(d))}function du(n,e,t){let r=new Map;for(let i of e.floors)for( Line truncated
<path d=${Lr(n)} />
</svg>`,ai={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Co=n=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${n} /></svg>`,zm=24,Tm=10,No=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of oi(e))this.call("light",t.service,t.data)}renderMoods(e,t){let r=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!r.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>j(this.hass,l).filter(u=>u.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...r,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(ii)}]),this._moodName=null};return m`<div class="nf-rp-moods">
${r.map(l=>m`<span class="nf-rp-mood">
<button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button>
${o.length?m`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${u=>{let c=u.target,d=o.find(p=>p.id===c.value);c.value="",d&&this.runMood(vu(l,s(d)))}}>
${o.length?m`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${u=>{let c=u.target,d=o.find(p=>p.id===c.value);c.value="",d&&this.runMood(Su(l,s(d)))}}>
<option value="">→</option>
${o.map(u=>m`<option value=${u.id}>${u.name}</option>`)}
</select>`:f}
@@ -271,33 +271,33 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
><input type="text" maxlength="40" placeholder=${this.t("mood_new")} .value=${this._moodName} @input=${l=>this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} />
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
>`:f}
</div>`}async loadCurve(e){let t=xe(this.hass,this.floor,e,"temperature"),r=t.length?t:j(this.hass,e).filter(s=>s.startsWith("climate."));if(!r.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await Hn(this.hass,r,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let u=Xt(this.hass,s,o+(i-o)*l/96),c=r.map(d=>d.startsWith("climate.")?Number(u.states[d]?.attributes.current_temperature):Number(u.states[d]?.state)).filter(Number.isFinite);a.push(c.length?c.reduce((d,p)=>d+p,0)/c.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(V(this.hass)){this._energy=null;return}let t=zo(this.hass,this.building,this.floor,e);try{let r=await du(this.hass,t);this.room?.id===e.id&&(this._energy=r)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let r=j(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!r.length||r.some(s=>s.state!=="off"))return f;let i=Math.max(...r.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<Am?f:m`<div class="nf-rp-shade">
</div>`}async loadCurve(e){let t=xe(this.hass,this.floor,e,"temperature"),r=t.length?t:j(this.hass,e).filter(s=>s.startsWith("climate."));if(!r.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await On(this.hass,r,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let u=tn(this.hass,s,o+(i-o)*l/96),c=r.map(d=>d.startsWith("climate.")?Number(u.states[d]?.attributes.current_temperature):Number(u.states[d]?.state)).filter(Number.isFinite);a.push(c.length?c.reduce((d,p)=>d+p,0)/c.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(V(this.hass)){this._energy=null;return}let t=Ho(this.hass,this.building,this.floor,e);try{let r=await fu(this.hass,t);this.room?.id===e.id&&(this._energy=r)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let r=j(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!r.length||r.some(s=>s.state!=="off"))return f;let i=Math.max(...r.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<Tm?f:m`<div class="nf-rp-shade">
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span>
<button class="nf-btn nf-rp-small" ?disabled=${!t.some(s=>W(this.hass,s.entity_id))} @click=${()=>this.call("light","turn_off",{entity_id:t.filter(s=>W(this.hass,s.entity_id)).map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let r=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!r.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of r){if(!W(this.hass,a.entity_id))continue;(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})}};return m`<div class="nf-rp-shade nf-rp-open-heat">
<span>🪟 ${this.t("open_heating_hint",{n:o.length})}</span>
<button class="nf-btn nf-rp-small" ?disabled=${!r.some(a=>W(this.hass,a.entity_id))} @click=${s}>${this.t("open_heating_off")}</button>
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i=Y(this.hass,this.floor,e,"temperature");if(i===null||i<Mm)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||I(l))return!1;let u=l.attributes.current_position;return typeof u=="number"?u>30:l.state==="open"},s=[...new Set(iu(this.building,this.floor,e,{latitude:t,longitude:r}).flatMap(a=>[a.cover,a.cover2].filter(o)))].filter(a=>W(this.hass,a));return s.length?m`<div class="nf-rp-shade">
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i=Y(this.hass,this.floor,e,"temperature");if(i===null||i<zm)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||I(l))return!1;let u=l.attributes.current_position;return typeof u=="number"?u>30:l.state==="open"},s=[...new Set(lu(this.building,this.floor,e,{latitude:t,longitude:r}).flatMap(a=>[a.cover,a.cover2].filter(o)))].filter(a=>W(this.hass,a));return s.length?m`<div class="nf-rp-shade">
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${N(this.hass,ce(this.hass,i),1)} ${re(this.hass)}`})}</span>
<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button>
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i={latitude:t,longitude:r};if(!Jt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=m`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i={latitude:t,longitude:r};if(!Xt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=m`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
☀ ${this.t("room_sun_year")}
</button>`;if(!this._sunYear)return s;let a=ru(this.building,this.floor,e,i),l=Math.max(1,...a),u=Array.from({length:12},(c,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return m`${s}
</button>`;if(!this._sunYear)return s;let a=au(this.building,this.floor,e,i),l=Math.max(1,...a),u=Array.from({length:12},(c,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return m`${s}
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((c,d)=>`${u[d]} ${N(this.hass,c,1)} h`).join(", ")}>
${a.map((c,d)=>m`<span title=${`${N(this.hass,c,1)} h`}><i style=${`height:${Math.round(c/l*100)}%`}></i><b>${u[d]}</b></span>`)}
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,r=t?this.hass.states[t]:void 0,i=r?{value:Number(r.state),unit:String(r.attributes.unit_of_measurement??"")}:null,o=hu(e.month,i),s=a=>`${N(this.hass,a,a<10?2:1)} kWh`;return m`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,r=t?this.hass.states[t]:void 0,i=r?{value:Number(r.state),unit:String(r.attributes.unit_of_measurement??"")}:null,o=gu(e.month,i),s=a=>`${N(this.hass,a,a<10?2:1)} kWh`;return m`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${N(this.hass,o.value,2)} ${o.currency}`:""}
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(u=>u!==null),r=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-r),s=e.map(u=>u===null?null:u-r+o*.1),a=Pn(s,220,36,o*1.2),l=u=>`${N(this.hass,ce(this.hass,u),1)}\xB0`;return m`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(u=>u!==null),r=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-r),s=e.map(u=>u===null?null:u-r+o*.1),a=Ln(s,220,36,o*1.2),l=u=>`${N(this.hass,ce(this.hass,u),1)}\xB0`;return m`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${ne`<path d=${a}></path>`}</svg>
<span>24 h · ${l(r)} – ${l(i)}</span>
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return M(this.hass,e,t)}call(e,t,r){(Array.isArray(r.entity_id)?r.entity_id:[r.entity_id]).some(o=>typeof o!="string"||!W(this.hass,o))||this.hass.callService(e,t,r)}renderClean(e){let t=e.clean_entity,r=t?this.hass.states[t]:void 0;if(!t||!r||!W(this.hass,t))return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(r)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=Dn(e.filter(r=>W(this.hass,r.entity_id)));for(let r of t.off)this.call(r.domain,r.service,r.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return m`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=Dn(e.filter(r=>W(this.hass,r.entity_id)));return t<2?f:m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let r of t.placements)if(r.entity_id===e)return r}name(e){return this.placedAs(e)?.name?.trim()||O(this.hass,e,this.areaName)}nameButton(e){return m`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>Ae(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,r){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||r()};return m`<button
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return M(this.hass,e,t)}call(e,t,r){(Array.isArray(r.entity_id)?r.entity_id:[r.entity_id]).some(o=>typeof o!="string"||!W(this.hass,o))||this.hass.callService(e,t,r)}renderClean(e){let t=e.clean_entity,r=t?this.hass.states[t]:void 0;if(!t||!r||!W(this.hass,t))return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(r)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=Nn(e.filter(r=>W(this.hass,r.entity_id)));for(let r of t.off)this.call(r.domain,r.service,r.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return m`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=Nn(e.filter(r=>W(this.hass,r.entity_id)));return t<2?f:m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let r of t.placements)if(r.entity_id===e)return r}name(e){return this.placedAs(e)?.name?.trim()||L(this.hass,e,this.areaName)}nameButton(e){return m`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>Ae(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,r){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||r()};return m`<button
class="nf-switch"
role="switch"
aria-checked=${t?"true":"false"}
aria-label=${this.name(e.entity_id)}
?disabled=${I(e)||!W(this.hass,e.entity_id)}
@click=${i}
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let r=e??j(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?ja(this.hass,this.floor,t):{shown:r,more:[]}},a=to(this.hass,s).map(x=>x.primary),l=a.length,u=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(x=>!!x&&x!=="none"),c=new Set(u.map(x=>this.hass.states[x]?.attributes.symcon_id).filter(Boolean)),d=(this._showAll?[...o,...a]:o).filter(x=>!V(this.hass)||!c.has(this.hass.states[x]?.attributes.symcon_id)),p=x=>d.filter(F=>x.includes(P(F))).map(F=>this.hass.states[F]),h=p(["light"]),g=p(["cover"]),_=p(["climate"]),b=p(["media"]),y=p(["switch","fan","lock"]),S=p(["sensor","binary"]),$=p(["scene","script"]),A=t.symcon_read_room===!1?[]:this.facts(_),z=h.filter(x=>x.state==="on");return m`<section class="nf-rp" aria-label=${t.name}>
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let r=e??j(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Ja(this.hass,this.floor,t):{shown:r,more:[]}},a=oo(this.hass,s).map(x=>x.primary),l=a.length,u=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(x=>!!x&&x!=="none"),c=new Set(u.map(x=>this.hass.states[x]?.attributes.symcon_id).filter(Boolean)),d=(this._showAll?[...o,...a]:o).filter(x=>!V(this.hass)||!c.has(this.hass.states[x]?.attributes.symcon_id)),p=x=>d.filter(F=>x.includes(P(F))).map(F=>this.hass.states[F]),h=p(["light"]),g=p(["cover"]),_=p(["climate"]),b=p(["media"]),y=p(["switch","fan","lock"]),S=p(["sensor","binary"]),$=p(["scene","script"]),A=t.symcon_read_room===!1?[]:this.facts(_),z=h.filter(x=>x.state==="on");return m`<section class="nf-rp" aria-label=${t.name}>
<header class="nf-rp-head">
<div>
<h2>${t.name}</h2>
@@ -313,7 +313,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</button>
</header>
<div class="nf-rp-body" ?hidden=${this._folded}>
<nf-utility-report .hass=${this.hass} .readings=${qt(this.hass,t,this.building?.floors.flatMap(x=>x.rooms))}></nf-utility-report>
<nf-utility-report .hass=${this.hass} .readings=${Yt(this.hass,t,this.building?.floors.flatMap(x=>x.rooms))}></nf-utility-report>
${this.renderAllOff([...h,...b,...y])}
${this.renderClean(t)}
${t.symcon_read_room===!1?m`<p class="nf-rp-note">${this.t(d.length?"access_room_devices":"access_room_geometry")}</p>`:!t.area_id&&!e&&!(V(this.hass)&&u.length)?m`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!d.length&&!(V(this.hass)&&u.length)?m`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
@@ -331,9 +331,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</button>`:f}${z.some(x=>W(this.hass,x.entity_id))?m`<button class="nf-btn nf-rp-small" ?disabled=${!z.some(x=>W(this.hass,x.entity_id))} @click=${()=>this.call("light","turn_off",{entity_id:z.filter(x=>W(this.hass,x.entity_id)).map(x=>x.entity_id)})}>
${this.t("panel_all_off")}
</button>`:f}`):f}
${g.length?this.section("panel_covers",g.map(x=>W(this.hass,x.entity_id)?this.coverRow(x):this.sensorRow(x)),g.length>1&&wr(g.filter(x=>W(this.hass,x.entity_id)),this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:wr(g.filter(x=>W(this.hass,x.entity_id)),this.confirmEntities)})}>
${g.length?this.section("panel_covers",g.map(x=>W(this.hass,x.entity_id)?this.coverRow(x):this.sensorRow(x)),g.length>1&&Mr(g.filter(x=>W(this.hass,x.entity_id)),this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Mr(g.filter(x=>W(this.hass,x.entity_id)),this.confirmEntities)})}>
${this.t("panel_all_open")}</button
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:wr(g.filter(x=>W(this.hass,x.entity_id)),this.confirmEntities)})}>
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Mr(g.filter(x=>W(this.hass,x.entity_id)),this.confirmEntities)})}>
${this.t("panel_all_close")}
</button>`:f):f}
${V(this.hass)?m`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f}
@@ -342,25 +342,25 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${y.length?this.section("panel_switches",y.map(x=>W(this.hass,x.entity_id)?this.switchRow(x):this.sensorRow(x))):f}
${S.length?this.section("panel_sensors",S.map(x=>this.sensorRow(x))):f}
${this.extraValues(t)}
${!V(this.hass)&&xl(this.hass)&&wl(this.hass,this.floor,t)?this.announceSection(t):f}
${!V(this.hass)&&Ml(this.hass)&&$l(this.hass,this.floor,t)?this.announceSection(t):f}
${this.pluginSections(t,d)}
${l?m`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}>
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
</button>`:f}
</div>
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(r=>!r.outside&&H([r.x,r.z],e.points)).map(r=>({name:r.name||O(this.hass,r.entity_id),rows:Ir(this.hass,r.values)})),...this.floor.furniture.filter(r=>H([r.x,r.z],e.points)).map(r=>({name:r.name||(r.entity&&r.entity!=="none"?O(this.hass,r.entity):ae(this.hass,r.type)),rows:[...ti(this.hass,r),...Ir(this.hass,r.values)]}))].filter(r=>r.rows.length);return t.length?this.section("device_values",t.map(r=>m`<div class="nf-extra-values"><b>${r.name}</b>${r.rows.map(i=>m`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${G(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],r=this.room;if(!r)return t;let i=(T,E)=>{let R=Y(this.hass,this.floor,r,T);if(R===null)return null;if(T==="temperature")return`${N(this.hass,ce(this.hass,R),1)} ${re(this.hass)}`;let C=xe(this.hass,this.floor,r,T)[0],L=this.hass.states[C]?.attributes.unit_of_measurement??E;return`${N(this.hass,R,1)} ${L}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(m`${s}${G(this.hass,xe(this.hass,this.floor,r,"temperature"),"Temperatur")}`):o&&r.climate?.temperature!=="none"&&t.push(m`${N(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(m`${a}${G(this.hass,xe(this.hass,this.floor,r,"humidity"),"Luftfeuchte")}`);let l=Y(this.hass,this.floor??null,r,"illuminance");l!==null&&t.push(m`☀ ${N(this.hass,l,0)} lx${G(this.hass,xe(this.hass,this.floor,r,"illuminance"),"Helligkeit")}`);let u=qt(this.hass,r,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),c=!u&&this.floor&&this.building?Eo(this.hass,this.building,this.floor,r):null;u?t.push(m`⚡ ${Be(this.hass,u)}${G(this.hass,u.sources,"Leistung")}`):c!==null&&t.push(`\u26A1 ${Mt(this.hass,c)}`);let d=this.floor?this.floor.openings.filter(T=>T.room_id===r.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];d.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:To(Date.now()-Math.min(...d))})}`);let p=j(this.hass,r).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(p.length)if(p.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...p.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:To(Date.now()-T)})}`)}let h=this.building?fu(this.hass,this.building).filter(T=>T.roomId===r.id&&T.level<mu):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(r.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:y,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&y!==void 0&&this.building&&!_.includes("sun")){let T=Jt(this.building,this.floor,r,{latitude:b,longitude:y,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:N(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let $=Y(this.hass,this.floor,r,"temperature"),A=Y(this.hass,this.floor,r,"humidity"),z=Yr(Y(this.hass,this.floor,r,"co2"),A,Qt($,A));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let x=Jr($,A,Y(this.hass,this.floor,r,"co2"),$t(new Date,this.hass.config?.latitude)),F=r.hvac?.status;return F&&F!=="none"?t.push(m`${Ie(this.hass.states[F])}${G(this.hass,[F],"Raumstatus")}`):x!==null&&($!==null||A!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:x})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),r=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");r(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(o=>m`<button class="nf-btn" @click=${()=>r(o)}>${o}</button>`)}</div>
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(r=>!r.outside&&H([r.x,r.z],e.points)).map(r=>({name:r.name||L(this.hass,r.entity_id),rows:Wr(this.hass,r.values)})),...this.floor.furniture.filter(r=>H([r.x,r.z],e.points)).map(r=>({name:r.name||(r.entity&&r.entity!=="none"?L(this.hass,r.entity):ae(this.hass,r.type)),rows:[...si(this.hass,r),...Wr(this.hass,r.values)]}))].filter(r=>r.rows.length);return t.length?this.section("device_values",t.map(r=>m`<div class="nf-extra-values"><b>${r.name}</b>${r.rows.map(i=>m`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${G(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],r=this.room;if(!r)return t;let i=(T,E)=>{let R=Y(this.hass,this.floor,r,T);if(R===null)return null;if(T==="temperature")return`${N(this.hass,ce(this.hass,R),1)} ${re(this.hass)}`;let C=xe(this.hass,this.floor,r,T)[0],O=this.hass.states[C]?.attributes.unit_of_measurement??E;return`${N(this.hass,R,1)} ${O}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(m`${s}${G(this.hass,xe(this.hass,this.floor,r,"temperature"),"Temperatur")}`):o&&r.climate?.temperature!=="none"&&t.push(m`${N(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(m`${a}${G(this.hass,xe(this.hass,this.floor,r,"humidity"),"Luftfeuchte")}`);let l=Y(this.hass,this.floor??null,r,"illuminance");l!==null&&t.push(m`☀ ${N(this.hass,l,0)} lx${G(this.hass,xe(this.hass,this.floor,r,"illuminance"),"Helligkeit")}`);let u=Yt(this.hass,r,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),c=!u&&this.floor&&this.building?Do(this.hass,this.building,this.floor,r):null;u?t.push(m`⚡ ${Be(this.hass,u)}${G(this.hass,u.sources,"Leistung")}`):c!==null&&t.push(`\u26A1 ${Mt(this.hass,c)}`);let d=this.floor?this.floor.openings.filter(T=>T.room_id===r.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];d.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Po(Date.now()-Math.min(...d))})}`);let p=j(this.hass,r).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(p.length)if(p.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...p.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Po(Date.now()-T)})}`)}let h=this.building?yu(this.hass,this.building).filter(T=>T.roomId===r.id&&T.level<bu):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(r.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:y,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&y!==void 0&&this.building&&!_.includes("sun")){let T=Xt(this.building,this.floor,r,{latitude:b,longitude:y,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:N(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let $=Y(this.hass,this.floor,r,"temperature"),A=Y(this.hass,this.floor,r,"humidity"),z=ti(Y(this.hass,this.floor,r,"co2"),A,en($,A));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let x=ni($,A,Y(this.hass,this.floor,r,"co2"),$t(new Date,this.hass.config?.latitude)),F=r.hvac?.status;return F&&F!=="none"?t.push(m`${Ie(this.hass.states[F])}${G(this.hass,[F],"Raumstatus")}`):x!==null&&($!==null||A!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:x})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),r=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");r(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(o=>m`<button class="nf-btn" @click=${()=>r(o)}>${o}</button>`)}</div>
<form class="nf-rp-say" @submit=${i}>
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
</form>
${this._said?m`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return na({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
${this._said?m`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return sa({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
<div class="nf-rp-sec-head"><h3>${i.title}</h3></div>
${typeof i.content=="string"?m`<p class="nf-rp-note">${i.content}</p>`:i.content}
</div>`)}section(e,t,r=f){return m`<div class="nf-rp-sec">
<div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${r}</div>
${t}
</div>`}lightRow(e){let t=e.attributes,r=e.state==="on",i=t.supported_color_modes??[],o=i.some(h=>h!=="onoff"),s=i.includes("color_temp"),a=i.some(h=>["hs","rgb","rgbw","rgbww","xy"].includes(h)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,u=t.min_color_temp_kelvin??2200,c=t.max_color_temp_kelvin??6500,d=e.entity_id,p=!!this.placedAs(d)?.simple;return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${r?"nf-rp-on":""}">${tn("light")}</span>
<span class="nf-rp-icon ${r?"nf-rp-on":""}">${rn("light")}</span>
${this.nameButton(d)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
${this.toggle(e,r,()=>this.call("light","toggle",{entity_id:d}))}
@@ -384,23 +384,23 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@change=${h=>this.call("light","turn_on",{entity_id:d,color_temp_kelvin:Number(h.target.value)})}
/></label>`:f}
${r&&a&&!p?m`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
${$m.map(h=>m`<button
${Em.map(h=>m`<button
class="nf-rp-swatch"
style="--c: rgb(${h.join(",")})"
aria-label="rgb(${h.join(", ")})"
@click=${()=>this.call("light","turn_on",{entity_id:d,rgb_color:h})}
></button>`)}
</div>`:f}
</div>`}coverRow(e){let t=Tr(this.hass,this.building?.floors??[],e.entity_id);e=Fr(this.hass,e,t);let r=e.attributes,i=r.supported_features??0,o=e.entity_id,s=I(e)&&!yn(e);return m`<div class="nf-rp-row">
<span class="nf-rp-icon">${tn("cover")}</span>
</div>`}coverRow(e){let t=Ir(this.hass,this.building?.floors??[],e.entity_id);e=Cr(this.hass,e,t);let r=e.attributes,i=r.supported_features??0,o=e.entity_id,s=I(e)&&!Sn(e);return m`<div class="nf-rp-row">
<span class="nf-rp-icon">${rn("cover")}</span>
${this.nameButton(o)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
<div class="nf-rp-buttons">
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","open_cover",{entity_id:o})}>${this.t("cover_open")}</button>
${i&Sm?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
${i&Rm?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","close_cover",{entity_id:o})}>${this.t("cover_close")}</button>
</div>
${i&km&&typeof r.current_position=="number"?m`<label class="nf-rp-slider"
${i&Am&&typeof r.current_position=="number"?m`<label class="nf-rp-slider"
><span>${this.t("position")}</span>
<input
type="range"
@@ -424,7 +424,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${i&32?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:o})}>${this.t("cover_tilt_close")}</button>`:f}
</div>`:f}
</div>`}climateRow(e){let t=e.attributes,r=e.entity_id,i=typeof t.temperature=="number"?t.temperature:null,o=t.target_temp_step??.5,s=t.min_temp??5,a=t.max_temp??30,l=t.hvac_modes??[],u=c=>this.call("climate","set_temperature",{entity_id:r,temperature:Math.min(a,Math.max(s,Math.round(c/o)*o))});return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${tn("climate")}</span>
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${rn("climate")}</span>
${this.nameButton(r)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
${i!==null?m`<div class="nf-rp-stepper nf-rp-wide">
@@ -442,19 +442,19 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</button>`)}
</div>`:f}
</div>`}stateOf(e,t=se(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let r=P(e.entity_id);return e.state==="unknown"&&r!=="sensor"&&r!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,r=this.t(t);return r===t?e:r}mediaRow(e){let t=e.attributes,r=e.entity_id,i=I(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${tn("media")}</span>
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${rn("media")}</span>
${this.nameButton(r)}
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}${G(this.hass,[e.entity_id])}</span>
${o?m`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f}
<div class="nf-rp-buttons nf-rp-wide">
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:r})}>
${Do(ni.previous)}
${Co(ai.previous)}
</button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${I(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:r})}>
${Do(e.state==="playing"?ni.pause:ni.play)}
${Co(e.state==="playing"?ai.pause:ai.play)}
</button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:r})}>
${Do(ni.next)}
${Co(ai.next)}
</button>
</div>
${typeof t.volume_level=="number"?m`<label class="nf-rp-slider"
@@ -467,12 +467,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@change=${s=>this.call("media_player","volume_set",{entity_id:r,volume_level:Number(s.target.value)/100})}
/></label>`:f}
</div>`}switchRow(e){let t=e.entity_id,r=P(t),i=t.slice(0,t.indexOf(".")),o=r==="lock"?e.state==="unlocked"||e.state==="open":te(e),s=()=>r==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${tn(r)}</span>
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${rn(r)}</span>
${this.nameButton(t)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
${this.toggle(e,o,s)}
</div>`}sensorRow(e){let t=P(e.entity_id),r=t==="binary"&&e.state==="on";return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${r?"nf-rp-on":""}">${tn(t)}</span>
<span class="nf-rp-icon ${r?"nf-rp-on":""}">${rn(t)}</span>
${this.nameButton(e.entity_id)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[ke,Ne,J`
@@ -856,41 +856,41 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
outline: 2px solid var(--nf-accent);
outline-offset: 2px;
}
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Ho);function zu(n,e,t,r,i,o,s,a){let l=st(n,e),u=fr(n,e),c={all:"\u2302",location:"\u2316",branch:"\u25C7",building:"\u25A5",floor:"\u25A4",room:"\u25A1",outside:"\u{1F333}"};return m`<nav class="nf-thumbs nf-topology-navigation ${s?"nf-thumbs-small":""} ${a?"nf-thumbs-short":""} ${i?"nf-thumbs-compact":""}" aria-label="Topologie">
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",No);function Hu(n,e,t,r,i,o,s,a){let l=st(n,e),u=vr(n,e),c={all:"\u2302",location:"\u2316",branch:"\u25C7",building:"\u25A5",floor:"\u25A4",room:"\u25A1",outside:"\u{1F333}"};return m`<nav class="nf-thumbs nf-topology-navigation ${s?"nf-thumbs-small":""} ${a?"nf-thumbs-short":""} ${i?"nf-thumbs-compact":""}" aria-label="Topologie">
<style>.nf-topology-crumbs{display:grid;gap:3px}.nf-topology-crumbs button{min-width:0;text-align:left;padding:5px 7px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px}.nf-topology-navigation .nf-thumb>span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nf-topology-placeholder{height:74px;display:grid;place-items:center;font-size:25px;opacity:.45}.nf-topology-navigation{overflow:auto;overscroll-behavior:contain;max-height:calc(100% - 130px)}.nf-topology-navigation .nf-thumbs-fold{position:static;align-self:flex-start;flex-shrink:0}.nf-topology-navigation .nf-thumb-house{flex-shrink:0}.nf-topology-navigation .nf-thumb{flex-shrink:0}</style>
<button class="nf-thumbs-fold" aria-label=${i?"Topologie aufklappen":"Topologie einklappen"} @click=${o}>${i?"\u25B8":"\u25C2"}</button>
<button class="nf-thumb nf-thumb-house" aria-pressed=${e.kind==="all"} @click=${()=>r(_e)}>⌂ <span>Alle Orte</span></button>
${l.length>1?m`<div class="nf-topology-crumbs">${l.slice(1).map(d=>m`<button class="nf-chip" data-topology-key=${d.key} title=${l.slice(1,l.indexOf(d)+1).map(p=>p.name).join(" / ")} aria-current=${d===l.at(-1)?"location":f} @click=${()=>r(d.selection)}>${c[d.selection.kind]} ${d.name}</button>`)}</div>`:f}
${u.map(d=>m`<button class="nf-thumb" data-topology-key=${d.key} data-topology-kind=${d.selection.kind} aria-pressed=${pr(e)===d.key} title=${d.name} @click=${()=>r(d.selection)}>
${u.map(d=>m`<button class="nf-thumb" data-topology-key=${d.key} data-topology-kind=${d.selection.kind} aria-pressed=${yn(e)===d.key} title=${d.name} @click=${()=>r(d.selection)}>
${i?f:t.get(d.key)?m`<img src=${t.get(d.key)} alt=""/>`:m`<div class="nf-topology-placeholder" aria-hidden="true">${c[d.selection.kind]}</div>`}
<span>${d.name}</span>
</button>`)}
</nav>`}function Tu(n){if(!n)return"";let e=Math.min(.8,Math.max(0,n.dim??.35)),t=n.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(n.image)?n.image:null,r=n.color&&/^#[0-9a-f]{6}$/i.test(n.color)?n.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${r?` ${r}`:""}`:r?`;background:${r}`:""}var Rm=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],Fu=[34,211,238];function Po(n){return n?Rm.find(([e])=>e.test(n))?.[1]??Fu:Fu}function Io(n){if(n.state==="playing"||n.state==="paused")return!0;let e=t=>typeof n.attributes[t]=="string"&&n.attributes[t]!=="";return n.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Co=n=>n.state==="playing"||n.state==="on"&&Io(n);function Du(n,e){let t=[],r=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||r.has(i.entity))continue;r.add(i.entity);let o=n.states[i.entity];if(!o)continue;let s=o.attributes,a=c=>typeof s[c]=="string"?s[c]:"",l=a("app_name")||a("source")||a("app_id")||null,u=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:Co(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:u,color:Po(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(c=>typeof c=="string"&&c!==i.entity):[],rings:i.rings??1})}return t}function Hu(n){let e=new Map(n.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],r=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!r.has(a)&&(r.add(a),t.push([i,s]))}return t}var Em=3;function Pu(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(n.states[s])||r.push({id:o.id,at:{floorId:i.id,x:o.x,y:oe(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Em))})}return r}var ri=n=>n&&n!=="none"?n:null,Iu=n=>Math.min(1,Math.max(0,n));function Cu(n,e){let t=new Map;for(let r of e.settings.roof?.windows??[]){let i=je(n,{cover:ri(r.cover),contact:ri(r.contact),tilt:ri(r.tilt)},"window"),o=ri(r.window),s=o?n.states[o]:void 0,a=i.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?Iu(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(r.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function zm(n,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return n.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var dt=(n,e)=>typeof n[e]=="string"?n[e]:"";function Nu(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!Rr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:zm(i,o),l=a?n.states[a]:void 0;if(!l||!Io(l))continue;let u=l.attributes,c=dt(u,"app_name")||dt(u,"source")||null;r.push({id:o.id,furnitureId:o.id,floorId:i.id,color:Po(c),title:dt(u,"media_title")||dt(u,"media_channel")||c||"",subtitle:dt(u,"media_artist")||dt(u,"media_series_title")||dt(u,"media_album_name"),app:c,picture:dt(u,"entity_picture")||null,playing:Co(l),ambilight:o.ambilight??1})}return r}function Lu(n){let e=n.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function Ou(n,e){return(n===null?0:Iu((n+4)/16))*(1-.45*e)}function ht(n,e){return n.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&n.states[e]?e:Object.keys(n.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var ii=new Set(["contact_lost","unlocked_night","own"]);function Tm(n,e){let t=n.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let r=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(r);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return r.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Fm=600*1e3,Dm=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Hm=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),Wu=(n,e)=>{if(e.startsWith("binary_sensor."))return Hm.get(String(n.states[e]?.attributes.device_class))};function Pm(n,e){let t=new Set,r=[];for(let i of n.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),r.push({floorId:i.id,roomId:o.room_id,entity:a}))}return r}function Bu(n,e,t,r){let i=[];for(let a of e.floors)for(let l of a.rooms){let u=j(n,l).filter(c=>Wu(n,c));u.length>0&&Line truncated
</nav>`}function Pu(n){if(!n)return"";let e=Math.min(.8,Math.max(0,n.dim??.35)),t=n.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(n.image)?n.image:null,r=n.color&&/^#[0-9a-f]{6}$/i.test(n.color)?n.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${r?` ${r}`:""}`:r?`;background:${r}`:""}var Fm=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],Iu=[34,211,238];function Oo(n){return n?Fm.find(([e])=>e.test(n))?.[1]??Iu:Iu}function Lo(n){if(n.state==="playing"||n.state==="paused")return!0;let e=t=>typeof n.attributes[t]=="string"&&n.attributes[t]!=="";return n.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Wo=n=>n.state==="playing"||n.state==="on"&&Lo(n);function Cu(n,e){let t=[],r=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||r.has(i.entity))continue;r.add(i.entity);let o=n.states[i.entity];if(!o)continue;let s=o.attributes,a=c=>typeof s[c]=="string"?s[c]:"",l=a("app_name")||a("source")||a("app_id")||null,u=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:Wo(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:u,color:Oo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(c=>typeof c=="string"&&c!==i.entity):[],rings:i.rings??1})}return t}function Nu(n){let e=new Map(n.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],r=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!r.has(a)&&(r.add(a),t.push([i,s]))}return t}var Dm=3;function Ou(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(n.states[s])||r.push({id:o.id,at:{floorId:i.id,x:o.x,y:oe(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Dm))})}return r}var li=n=>n&&n!=="none"?n:null,Lu=n=>Math.min(1,Math.max(0,n));function Wu(n,e){let t=new Map;for(let r of e.settings.roof?.windows??[]){let i=je(n,{cover:li(r.cover),contact:li(r.contact),tilt:li(r.tilt)},"window"),o=li(r.window),s=o?n.states[o]:void 0,a=i.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?Lu(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(r.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function Hm(n,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return n.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var dt=(n,e)=>typeof n[e]=="string"?n[e]:"";function Bu(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!Dr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Hm(i,o),l=a?n.states[a]:void 0;if(!l||!Lo(l))continue;let u=l.attributes,c=dt(u,"app_name")||dt(u,"source")||null;r.push({id:o.id,furnitureId:o.id,floorId:i.id,color:Oo(c),title:dt(u,"media_title")||dt(u,"media_channel")||c||"",subtitle:dt(u,"media_artist")||dt(u,"media_series_title")||dt(u,"media_album_name"),app:c,picture:dt(u,"entity_picture")||null,playing:Wo(l),ambilight:o.ambilight??1})}return r}function Vu(n){let e=n.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function Ku(n,e){return(n===null?0:Lu((n+4)/16))*(1-.45*e)}function ht(n,e){return n.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&n.states[e]?e:Object.keys(n.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var ui=new Set(["contact_lost","unlocked_night","own"]);function Pm(n,e){let t=n.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let r=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(r);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return r.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Im=600*1e3,Cm=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Nm=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),Gu=(n,e)=>{if(e.startsWith("binary_sensor."))return Nm.get(String(n.states[e]?.attributes.device_class))};function Om(n,e){let t=new Set,r=[];for(let i of n.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),r.push({floorId:i.id,roomId:o.room_id,entity:a}))}return r}function Uu(n,e,t,r){let i=[];for(let a of e.floors)for(let l of a.rooms){let u=j(n,l).filter(c=>Gu(n,c));u.length>0&&Line truncated
${ne`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(r*Math.max(0,Math.min(1,n))).toFixed(1)} ${r.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
</svg>`}function Gf(n,e,t,r){let i=e.summary,o=u=>M(n,u),s=e.autarky,a=r?m`<button class="live-fold" title=${o(r.folded?"live_unfold":"live_fold")} aria-label=${o(r.folded?"live_unfold":"live_fold")} aria-expanded=${!r.folded} @click=${r.toggle}>${r.folded?"+":"\u2212"}</button>`:f;if(r?.folded){let u=i.solar!==null?`\u2600 ${He(n,i.solar)}`:i.consumption!==null?`\u2302 ${He(n,i.consumption)}`:null;return m`<div class="live-card live-card-house live-folded" data-i=${t}>
${s!==null?m`<div class="live-own">${Gn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
</svg>`}function Zf(n,e,t,r){let i=e.summary,o=u=>M(n,u),s=e.autarky,a=r?m`<button class="live-fold" title=${o(r.folded?"live_unfold":"live_fold")} aria-label=${o(r.folded?"live_unfold":"live_fold")} aria-expanded=${!r.folded} @click=${r.toggle}>${r.folded?"+":"\u2212"}</button>`:f;if(r?.folded){let u=i.solar!==null?`\u2600 ${He(n,i.solar)}`:i.consumption!==null?`\u2302 ${He(n,i.consumption)}`:null;return m`<div class="live-card live-card-house live-folded" data-i=${t}>
${s!==null?m`<div class="live-own">${Yn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
${u?m`<b>${u}</b>`:s===null?m`<b>⌂</b>`:f}
${a}
</div>`}let l=[];if(i.solar!==null&&l.push(m`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${He(n,i.solar)}</b></div>`),i.consumption!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${He(n,i.consumption)}</b></div>`),i.rest!==void 0&&i.rest!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${o("energy_rest")}</span><b>${He(n,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let u=i.battery===null||Math.abs(i.battery)<15?"":i.battery>0?" \u2193":" \u2191";l.push(m`<div class="live-row live-battery"><span>▮ ${o("energy_battery")}${u}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${He(n,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let u=i.grid<-15;l.push(m`<div class="live-row ${u?"live-export":"live-import"}"><span>⇄ ${o(u?"energy_grid_export":"energy_grid_import")}</span><b>${He(n,i.grid)}</b></div>`)}for(let u of e.meters??[])l.push(m`<div class="live-row live-meter"><span>${u.icon} ${u.label}</span><b>${u.value}</b></div>`);return m`<div class="live-card live-card-house" data-i=${t}>
${a}
${s!==null?m`<div class="live-own">${Gn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
${s!==null?m`<div class="live-own">${Yn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
<div class="live-rows">${l}</div>
${jf(n,e.curves)} ${Uf(n,e.week)}
</div>`}function Uf(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(u=>u!==null&&u>0);if(!t.length)return f;let r=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(u,c,d)=>u===null||u<=0?f:ne`<rect x=${c.toFixed(1)} y=${(o-u/r*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(u/r*o).toFixed(1)} class=${d}></rect>`,l=u=>u.reduce((c,d)=>c+(d??0),0);return m`<div class="live-day live-week" title=${M(n,"live_week_hint",{solar:N(n,l(e.solar),0),use:N(n,l(e.use),0)})}>
${Jf(n,e.curves)} ${Yf(n,e.week)}
</div>`}function Yf(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(u=>u!==null&&u>0);if(!t.length)return f;let r=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(u,c,d)=>u===null||u<=0?f:ne`<rect x=${c.toFixed(1)} y=${(o-u/r*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(u/r*o).toFixed(1)} class=${d}></rect>`,l=u=>u.reduce((c,d)=>c+(d??0),0);return m`<div class="live-day live-week" title=${M(n,"live_week_hint",{solar:N(n,l(e.solar),0),use:N(n,l(e.use),0)})}>
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
${e.days.map((u,c)=>ne`${a(e.solar[c],c*s+s*.1,"live-week-solar")}${a(e.use[c],c*s+s*.5,"live-week-use")}`)}
</svg>
<span>7 ${M(n,"live_days")}</span>
</div>`}function jf(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let r=Math.max(...t)*1.08||1,[i,o]=[150,34],s=Pn(e.solar,i,o,r),a=Pn(e.use,i,o,r);return m`<div class="live-day" title=${M(n,"live_day_hint")}>
</div>`}function Jf(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let r=Math.max(...t)*1.08||1,[i,o]=[150,34],s=Ln(e.solar,i,o,r),a=Ln(e.use,i,o,r);return m`<div class="live-day" title=${M(n,"live_day_hint")}>
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
${s?ne`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f}
${a?ne`<path d=${a} class="live-day-use"></path>`:f}
</svg>
<span>24 h</span>
</div>`}function qf(n,e,t,r){let i=e.car,o=(c,d)=>M(n,c,d),s=Ic(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${He(n,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${N(n,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,u=(c,d,p,h)=>m`<button class="live-btn ${c?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${c??!1} @click=${g=>(g.stopPropagation(),h())}>${p}</button>`;return m`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
</div>`}function Qf(n,e,t,r){let i=e.car,o=(c,d)=>M(n,c,d),s=Lc(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${He(n,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${N(n,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,u=(c,d,p,h)=>m`<button class="live-btn ${c?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${c??!1} @click=${g=>(g.stopPropagation(),h())}>${p}</button>`;return m`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
<div class="live-own">
${Gn((i.soc??0)/100,s)}
${Yn((i.soc??0)/100,s)}
<div class="live-own-text"><b>${i.soc!==null?`${Math.round(i.soc)} %`:"\u2013"}</b><span>${i.range!==null?`${Math.round(i.range)} ${i.rangeUnit}`:""}</span></div>
</div>
<div class="live-rows">
@@ -905,7 +905,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${l.charge&&i.home?u(i.charging,o("live_car_charge"),"\u26A1",()=>r(l.charge.split(".")[0],"toggle",l.charge)):f}
</div>
</div>
</div>`}function Zf(n,e,t,r){let i=e.media,o=l=>M(n,l),s=`rgb(${i.color.join(",")})`,a=(l,u,c)=>m`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),r("media_player",c,i.entity))}>${u}</button>`;return m`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
</div>`}function Xf(n,e,t,r){let i=e.media,o=l=>M(n,l),s=`rgb(${i.color.join(",")})`,a=(l,u,c)=>m`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),r("media_player",c,i.entity))}>${u}</button>`;return m`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
${i.picture?m`<img class="live-cover" src=${i.picture} alt="" loading="lazy" />`:m`<div class="live-cover live-cover-none">♪</div>`}
<div class="live-rows">
<div class="live-title" title=${i.title}>${i.title||i.name}</div>
@@ -924,9 +924,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
/>`:f}
</div>
</div>
</div>`}function Cc(n){let e=[...n.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"&&s.offsetWidth>0),t=[],r=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],u=r?r>l+16?Math.min(Math.max(a,l/2+8),r-l/2-8):r/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-u)}px`),{el:s,x:u,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>Number(a.el.dataset.priority||0)-Number(s.el.dataset.priority||0)||a.y-s.y);for(let s of o){let a=s.y;if((s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging"))&&r>s.w+16&&i>s.h+16){let d=[s.x,s.w/2+8,r-s.w/2-8,...t.flatMap(g=>[g.x0-s.w/2-8,g.x1+s.w/2+8])].filter(g=>g>=s.w/2+8&&g<=r-s.w/2-8).sort((g,_)=>Math.abs(g-s.x)-Math.abs(_-s.x)),p=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(g=>[g.y0-8,g.y1+s.h+8])].filter(g=>g>=s.h+8&&g<=i-8),h;for(let g of p){for(let _ of d)if(!t.some(b=>_-s.w/2<b.x1+6&&_+s.w/2>b.x0-6&&g-s.h<b.y1+6&&g>b.y0-6)){h={x:_,y:g};break}if(h)break}h&&(s.x=h.x,a=h.y)}for(let d=0;d<12;d++){let p={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},h=t.find(g=>p.x0<g.x1+6&&p.x1>g.x0-6&&p.y0<g.y1+6&&p.y1>g.y0-6);if(!h)break;a=h.y0-8}let l=s.y-a,u=!s.el.classList.contains("live-card-house")&&!s.el.classList.contains("live-card-roomclimate")&&s.el.dataset.focused!=="1",c=s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging");if(u&&i>0&&(a-s.h<8||a>i-8||!c&&Math.abs(l)>Math.max(100,Math.min(180,i*.25)))){s.el.style.visibility="hidden";continue}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a}),s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function Yf(n,e,t){let r=e.printer,i=(u,c)=>M(n,u,c),o=r.progress??0,s=u=>new Intl.DateTimeFormat(n?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(u)),a=r.remaining!==null?r.remaining>=60?`${Math.floor(r.remaining/60)} h ${Math.round(r.remaining%60)} min`:`${Math.round(r.remaining)} min`:null,l=[r.nozzle!==null?`${i("printer_nozzle")} ${Math.round(r.nozzle)}\xB0`:null,r.bed!==null?`${i("printer_bed")} ${Math.round(r.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return m`<div class="live-card live-card-printer ${r.printing?"live-charging":""}" data-i=${t}>
</div>`}function Wc(n){let e=[...n.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"&&s.offsetWidth>0),t=[],r=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],u=r?r>l+16?Math.min(Math.max(a,l/2+8),r-l/2-8):r/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-u)}px`),{el:s,x:u,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>Number(a.el.dataset.priority||0)-Number(s.el.dataset.priority||0)||a.y-s.y);for(let s of o){let a=s.y;if((s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging"))&&r>s.w+16&&i>s.h+16){let d=[s.x,s.w/2+8,r-s.w/2-8,...t.flatMap(g=>[g.x0-s.w/2-8,g.x1+s.w/2+8])].filter(g=>g>=s.w/2+8&&g<=r-s.w/2-8).sort((g,_)=>Math.abs(g-s.x)-Math.abs(_-s.x)),p=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(g=>[g.y0-8,g.y1+s.h+8])].filter(g=>g>=s.h+8&&g<=i-8),h;for(let g of p){for(let _ of d)if(!t.some(b=>_-s.w/2<b.x1+6&&_+s.w/2>b.x0-6&&g-s.h<b.y1+6&&g>b.y0-6)){h={x:_,y:g};break}if(h)break}h&&(s.x=h.x,a=h.y)}for(let d=0;d<12;d++){let p={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},h=t.find(g=>p.x0<g.x1+6&&p.x1>g.x0-6&&p.y0<g.y1+6&&p.y1>g.y0-6);if(!h)break;a=h.y0-8}let l=s.y-a,u=!s.el.classList.contains("live-card-house")&&!s.el.classList.contains("live-card-roomclimate")&&s.el.dataset.focused!=="1",c=s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging");if(u&&i>0&&(a-s.h<8||a>i-8||!c&&Math.abs(l)>Math.max(100,Math.min(180,i*.25)))){s.el.style.visibility="hidden";continue}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a}),s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function eg(n,e,t){let r=e.printer,i=(u,c)=>M(n,u,c),o=r.progress??0,s=u=>new Intl.DateTimeFormat(n?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(u)),a=r.remaining!==null?r.remaining>=60?`${Math.floor(r.remaining/60)} h ${Math.round(r.remaining%60)} min`:`${Math.round(r.remaining)} min`:null,l=[r.nozzle!==null?`${i("printer_nozzle")} ${Math.round(r.nozzle)}\xB0`:null,r.bed!==null?`${i("printer_bed")} ${Math.round(r.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return m`<div class="live-card live-card-printer ${r.printing?"live-charging":""}" data-i=${t}>
<div class="live-own">
${r.picture?m`<img class="live-print-pic" src=${r.picture} alt="" />`:Gn(o/100,r.printing?"#38bdf8":"#8aa0c8")}
${r.picture?m`<img class="live-print-pic" src=${r.picture} alt="" />`:Yn(o/100,r.printing?"#38bdf8":"#8aa0c8")}
<div class="live-own-text"><b>${r.progress!==null?`${Math.round(o)} %`:"\u2013"}</b><span>${i(`printer_${r.printing?"printing":/finish|complete|fertig/.test(r.status)?"done":/pause/.test(r.status)?"paused":/error|fail/.test(r.status)?"error":"idle"}`)}</span></div>
</div>
<div class="live-rows">
@@ -937,9 +937,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${l?m`<div class="live-status">🌡 ${l}</div>`:f}
${r.filaments.length?m`<div class="live-filaments">${r.filaments.map(u=>m`<i style=${`background:${u}`}></i>`)}</div>`:f}
</div>
</div>`}function Jf(n,e,t){let r=e.pump,i=a=>M(n,a),o=a=>a===null?"\u2013":`${N(n,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[r.mode];return m`<div class="live-card live-card-heatpump ${r.mode==="idle"?"":"live-charging"}" data-i=${t}>
</div>`}function tg(n,e,t){let r=e.pump,i=a=>M(n,a),o=a=>a===null?"\u2013":`${N(n,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[r.mode];return m`<div class="live-card live-card-heatpump ${r.mode==="idle"?"":"live-charging"}" data-i=${t}>
<div class="live-own">
${Gn(Math.min(1,(r.cop??0)/6),(r.cop??0)>=3.5?"#4ade80":(r.cop??0)>=2.5?"#facc15":"#fb923c")}
${Yn(Math.min(1,(r.cop??0)/6),(r.cop??0)>=3.5?"#4ade80":(r.cop??0)>=2.5?"#facc15":"#fb923c")}
<div class="live-own-text"><b>${r.cop!==null?N(n,r.cop,1):s}</b><span>${r.cop!==null?"COP":""}</span></div>
</div>
<div class="live-rows">
@@ -950,17 +950,17 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${r.power!==null?m`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${He(n,r.power)}</b></div>`:f}
${r.outside!==null?m`<div class="live-status">🌡 ${i("heatpump_outside")} ${o(r.outside)}</div>`:f}
</div>
</div>`}function Qf(n,e,t){let r=(o,s,a)=>o===null?"\u2013":`${N(n,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>Sn(n,o).length>0);return m`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||M(n,"room")} \xB7 ${M(n,"climate")}`}>
</div>`}function ng(n,e,t){let r=(o,s,a)=>o===null?"\u2013":`${N(n,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>En(n,o).length>0);return m`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||M(n,"room")} \xB7 ${M(n,"climate")}`}>
${e.showTemperature?m`<div class="live-row live-climate-temperature"><span title=${M(n,"climate_temperature")} aria-label=${M(n,"climate_temperature")}>🌡</span><b>${r(e.temperature===null?null:n?ce(n,e.temperature):e.temperature,1,n?re(n):"\xB0C")}</b>${G(n,e.sources?.temperature??[],M(n,"climate_temperature"))}</div>`:f}
${e.showHumidity?m`<div class="live-row live-climate-humidity"><span title=${M(n,"climate_humidity")} aria-label=${M(n,"climate_humidity")}>💧</span><b>${r(e.humidity,0,"%")}</b>${G(n,e.sources?.humidity??[],M(n,"climate_humidity"))}</div>`:f}
${e.showCo2?m`<div class="live-row live-climate-co2"><span title=${M(n,"climate_co2")} aria-label=${M(n,"climate_co2")}>☁</span><b>${r(e.co2,0,"ppm")}</b>${G(n,e.sources?.co2??[],M(n,"climate_co2"))}</div>`:f}
${e.showIlluminance?m`<div class="live-row live-climate-illuminance"><span title=${M(n,"climate_illuminance")} aria-label=${M(n,"climate_illuminance")}>☀</span><b>${r(e.illuminance,0,"lx")}</b>${G(n,e.sources?.illuminance??[],M(n,"climate_illuminance"))}</div>`:f}
</div>`}function Xf(n,e,t){let r=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${He(n,e.power)}`;return m`<div class="live-card live-card-power ${(e.readings??[]).length?"live-card-charging":""}" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}>
</div>`}function rg(n,e,t){let r=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${He(n,e.power)}`;return m`<div class="live-card live-card-power ${(e.readings??[]).length?"live-card-charging":""}" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}>
<div class="live-power-name">${e.name}</div>${e.powerEntity?m`<div class="live-row"><span aria-hidden="true">⚡</span><b>${r}</b>${G(n,[e.powerEntity],e.name)}</div>`:f}
${(e.readings??[]).map(i=>m`<div class="live-row live-charging-row" data-reading=${i.id}><span class="live-charging-label" title=${i.label}><span aria-hidden="true">${i.icon}</span> ${i.label}</span><b title=${i.text}>${i.text}</b>${G(n,[i.entity],i.label)}</div>`)}
</div>`}function Nc(n,e,t,r,i=!1){return e.length?m`<div class="live-cards">
${e.map((o,s)=>o.kind==="roomclimate"?Qf(n,o,s):o.kind==="power"?Xf(n,o,s):o.kind==="hydronic"?m`<div class="live-card live-card-hydronic" data-i=${s} data-furniture=${o.item.id}><nf-hydronic-card .hass=${n} .item=${o.item} .readOnly=${o.readOnly}></nf-hydronic-card></div>`:i?f:o.kind==="house"?Gf(n,o,s,r):o.kind==="car"?qf(n,o,s,t):o.kind==="printer"?Yf(n,o,s):o.kind==="heatpump"?Jf(n,o,s):Zf(n,o,s,t))}
</div>`:f}var Lc=J`
</div>`}function Bc(n,e,t,r,i=!1){return e.length?m`<div class="live-cards">
${e.map((o,s)=>o.kind==="roomclimate"?ng(n,o,s):o.kind==="power"?rg(n,o,s):o.kind==="hydronic"?m`<div class="live-card live-card-hydronic" data-i=${s} data-furniture=${o.item.id}><nf-hydronic-card .hass=${n} .item=${o.item} .readOnly=${o.readOnly}></nf-hydronic-card></div>`:i?f:o.kind==="house"?Zf(n,o,s,r):o.kind==="car"?Qf(n,o,s,t):o.kind==="printer"?eg(n,o,s):o.kind==="heatpump"?tg(n,o,s):Xf(n,o,s,t))}
</div>`:f}var Vc=J`
.live-card.live-card-power { display:grid; gap:4px; min-width:90px; max-width:220px; box-sizing:border-box; }
.live-power-name { font-size:11px; color:var(--nf-muted); overflow:hidden; text-overflow:ellipsis; }
.live-card-power .live-row { align-items:center; gap:6px; }
@@ -1307,7 +1307,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
text-transform: uppercase;
letter-spacing: 0.04em;
}
`;function is(n){switch(n.kind){case"house":return{density:0,priority:100};case"roomclimate":return{density:24,priority:80};case"hydronic":return{density:42,priority:45};case"power":return n.power!==null&&Math.abs(n.power)>1?{density:48,priority:60}:n.readings?.length?{density:56,priority:30}:{density:n.power===null?64:72,priority:20};case"car":return{density:n.car.charging?36:60,priority:n.car.charging?60:20};case"printer":return{density:n.printer.printing?36:60,priority:n.printer.printing?60:20};case"heatpump":return{density:n.pump.mode!=="idle"?36:60,priority:n.pump.mode!=="idle"?60:20};case"media":return{density:48,priority:40}}}function Oc(n,e,t){let r=is(n).density;return r?Number.isFinite(e)&&e>=r*(t?.88:1.12):!0}function _i(n){return n.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var os=n=>n.points.length>=3;function Wc(n,e,t){return n.rooms.filter(os).find(r=>H([e,t],r.points))}function eg(n,e,t,r){let i=[];for(let a of e.rooms.filter(os)){let[l,u]=Pe(a.points);i.push({kind:"room",name:a.name,where:r?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:u,y:0})}let o=new Set,s=(a,l,u,c)=>{if(o.has(a)||!(a in n.states))return;o.add(a);let d=Wc(e,l,u),p=[d?.name,r?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:O(n,a),where:p,floorId:e.id,roomId:d?.id??null,entity:a,icon:P(a),x:l,z:u,y:c})};for(let a of e.placements){let l=a.y??Ot(P(a.entity_id)??"sensor",Me(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),u=l?.entity??l?.power;if(!u)continue;let c=Me(e,a.x,a.z)-.3;s(u,a.x,a.z,Math.min(c,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Wc(e,a.x,a.z),u=[l?.name,r?e.name:void 0].filter(c=>!!c).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:u,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Bc(n,e){let t=qe(n,e.floors),r=e.floors.length>1,i=e.floors.flatMap(o=>eg(n,o,t,r));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(p=>o.rooms.includes(p.id)&&os(p)).map(p=>({f:d,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[u,c]=Pe(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:u,z:c,y:0})}return i}function tg(n,e){return(_i(n.name).startsWith(e)?0:2)+(n.kind==="room"?0:1)}function Vc(n,e,t=8){let r=_i(e).split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=_i(e.trim());return n.filter(o=>{let s=_i([o.name,o.where,o.entity].filter(Boolean).join(" "));return r.every(a=>s.includes(a))}).map(o=>({item:o,cost:tg(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var ng=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],rg=[2200,2700,3200,4e3,5e3,6500],ig=["hs","rgb","rgbw","rgbww","xy"],og=4,Kc=16,Gc=32,sg=128;function as(n){let e=n.attributes.supported_color_modes??[],t=e.some(r=>ig.includes(r));return{dim:e.some(r=>r!=="onoff"),color:t,temp:e.includes("color_temp")}}function ls(n){return((n.attributes.supported_features??0)&og)!==0&&typeof n.attributes.current_position=="number"}var ss=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return M(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,r={}){W(this.hass,this.entity)&&this.hass.callService(e,t,{entity_id:this.entity,...r})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){Ae(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((r,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${r}</div>`})}renderLight(e){let t=as(e),r=e.state==="on",i=r&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):r?100:0,o=t.color?ng.map(s=>m`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?rg.map(s=>m`<button class="qm-swatch" style="background:${ag(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
`;function ls(n){switch(n.kind){case"house":return{density:0,priority:100};case"roomclimate":return{density:24,priority:80};case"hydronic":return{density:42,priority:45};case"power":return n.power!==null&&Math.abs(n.power)>1?{density:48,priority:60}:n.readings?.length?{density:56,priority:30}:{density:n.power===null?64:72,priority:20};case"car":return{density:n.car.charging?36:60,priority:n.car.charging?60:20};case"printer":return{density:n.printer.printing?36:60,priority:n.printer.printing?60:20};case"heatpump":return{density:n.pump.mode!=="idle"?36:60,priority:n.pump.mode!=="idle"?60:20};case"media":return{density:48,priority:40}}}function Kc(n,e,t){let r=ls(n).density;return r?Number.isFinite(e)&&e>=r*(t?.88:1.12):!0}function xi(n){return n.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var us=n=>n.points.length>=3;function Gc(n,e,t){return n.rooms.filter(us).find(r=>H([e,t],r.points))}function ig(n,e,t,r){let i=[];for(let a of e.rooms.filter(us)){let[l,u]=Pe(a.points);i.push({kind:"room",name:a.name,where:r?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:u,y:0})}let o=new Set,s=(a,l,u,c)=>{if(o.has(a)||!(a in n.states))return;o.add(a);let d=Gc(e,l,u),p=[d?.name,r?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:L(n,a),where:p,floorId:e.id,roomId:d?.id??null,entity:a,icon:P(a),x:l,z:u,y:c})};for(let a of e.placements){let l=a.y??Bt(P(a.entity_id)??"sensor",Me(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),u=l?.entity??l?.power;if(!u)continue;let c=Me(e,a.x,a.z)-.3;s(u,a.x,a.z,Math.min(c,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Gc(e,a.x,a.z),u=[l?.name,r?e.name:void 0].filter(c=>!!c).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:u,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Uc(n,e){let t=qe(n,e.floors),r=e.floors.length>1,i=e.floors.flatMap(o=>ig(n,o,t,r));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(p=>o.rooms.includes(p.id)&&us(p)).map(p=>({f:d,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[u,c]=Pe(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:u,z:c,y:0})}return i}function og(n,e){return(xi(n.name).startsWith(e)?0:2)+(n.kind==="room"?0:1)}function jc(n,e,t=8){let r=xi(e).split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=xi(e.trim());return n.filter(o=>{let s=xi([o.name,o.where,o.entity].filter(Boolean).join(" "));return r.every(a=>s.includes(a))}).map(o=>({item:o,cost:og(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var sg=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],ag=[2200,2700,3200,4e3,5e3,6500],lg=["hs","rgb","rgbw","rgbww","xy"],ug=4,qc=16,Zc=32,cg=128;function ds(n){let e=n.attributes.supported_color_modes??[],t=e.some(r=>lg.includes(r));return{dim:e.some(r=>r!=="onoff"),color:t,temp:e.includes("color_temp")}}function hs(n){return((n.attributes.supported_features??0)&ug)!==0&&typeof n.attributes.current_position=="number"}var cs=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return M(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,r={}){W(this.hass,this.entity)&&this.hass.callService(e,t,{entity_id:this.entity,...r})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){Ae(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((r,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${r}</div>`})}renderLight(e){let t=ds(e),r=e.state==="on",i=r&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):r?100:0,o=t.color?sg.map(s=>m`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?ag.map(s=>m`<button class="qm-swatch" style="background:${dg(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
${this.ring(o)}
<button class="qm-power ${r?"qm-on":""}" aria-pressed=${r} @click=${()=>this.ask()&&this.call("light","toggle")}>
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
@@ -1322,7 +1322,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.value=${String(Math.max(1,i))}
aria-label=${this.t("brightness")}
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
/>`:f}`}renderCover(e){e=Fr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,r=e.state==="opening"||e.state==="closing",i=ls(e),o=(c,d,p,h=!1)=>m`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${d} @click=${p}>${c}</button>`,s=c=>t!==null&&Math.abs(t-c)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),r)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,u=t!==null||r||e.state==="open"||e.state==="closed";return m`<div class="qm-ring">
/>`:f}`}renderCover(e){e=Cr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,r=e.state==="opening"||e.state==="closing",i=hs(e),o=(c,d,p,h=!1)=>m`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${d} @click=${p}>${c}</button>`,s=c=>t!==null&&Math.abs(t-c)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),r)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,u=t!==null||r||e.state==="open"||e.state==="closed";return m`<div class="qm-ring">
${this.ring(a)}
<button
class="qm-power qm-blind ${u&&l<100?"qm-on":""}"
@@ -1344,7 +1344,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
aria-label=${this.t("position")}
@change=${c=>this.call("cover","set_cover_position",{position:Number(c.target.value)})}
/>`:f}
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,r=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&sg&&r!==null?m`<label class="qm-tilt"
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,r=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&cg&&r!==null?m`<label class="qm-tilt"
><span>${this.t("cover_tilt")} · ${Math.round(r)} %</span>
<input
class="qm-slider"
@@ -1354,9 +1354,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.value=${String(r)}
aria-label=${this.t("cover_tilt")}
@change=${i=>this.call("cover","set_cover_tilt_position",{entity_id:e.attributes.nf_cover_control?this.entity:this.tiltEntity||this.entity,tilt_position:Number(i.target.value)})}
/></label>`:t&(Kc|Gc)?m`<div class="qm-tilt-buttons">
${t&Kc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&Gc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
/></label>`:t&(qc|Zc)?m`<div class="qm-tilt-buttons">
${t&qc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&Zc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
</div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",r=e.entity_id.split(".")[0];return m`<div class="qm-ring qm-ring-small">
<button
class="qm-power ${t?"qm-on":""}"
@@ -1378,8 +1378,8 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${s.length?m`<div class="qm-play-head">${this.t("media_sources")}</div>
<div class="qm-play">${s.map(d=>m`<button class="qm-chip ${i.source===d?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:d})}>${d}</button>`)}</div>`:f}
${this.presets?.length?m`<div class="qm-play-head">${this.t("presets")}</div>
<div class="qm-play">${this.presets.map(d=>m`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:d.type,media_content_id:d.content})}>${d.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=P(this.entity),r=!W(this.hass,this.entity)||I(e)&&!yn(e)?m`<p class="qm-note">${se(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return m`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}>
<div class="qm-title">${O(this.hass,this.entity)}</div>
<div class="qm-play">${this.presets.map(d=>m`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:d.type,media_content_id:d.content})}>${d.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=P(this.entity),r=!W(this.hass,this.entity)||I(e)&&!Sn(e)?m`<p class="qm-note">${se(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return m`<div class="qm" role="dialog" aria-label=${L(this.hass,this.entity)}>
<div class="qm-title">${L(this.hass,this.entity)}</div>
${r}
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
</div>`}static styles=[ke,J`
@@ -1625,7 +1625,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.qm-note {
color: var(--nf-muted);
}
`]};function ag(n){let e=Math.min(1,Math.max(0,(n-2200)/4300)),t=(r,i)=>Math.round(r+(i-r)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",ss);var lg=new URL(import.meta.url),ug=new URL("./nextfloor-3d.js?v=2aa97dea1ed8",lg).href,Uc;function jc(){return Uc??=import(ug),Uc}function qc(n){if(!n||n.state!=="on")return 0;let e=typeof n.attributes.percentage=="number"?n.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var Zc="weather.nextfloor_symcon",Jc={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},Yc=new WeakMap;function cg(n){let e=n.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function bi(n,e){if(!V(n))return n;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return n;let r=Yc.get(n)??new WeakMap;Yc.set(n,r);let i=r.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?n.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=ve(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=ve(g);_!==null&&(o[h]=ui(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=ye(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=cg(Ie(s("condition"))),u=e.rain_sensor?n.states[e.rain_sensor]:void 0,c=le(u);c!==null&&e.rain_sensor_inverted&&(c=!c),c===null&&typeof o.precipitation=="number"&&(c=o.precipitation>0),le(s("lightning"))?l=c?"lightning-rainy":"lightning":le(s("snow"))?l=c?"snowy-rainy":"snowy":le(s("fog"))?l="fog":c===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":c===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&c===!1&&(l="sunny");let d={entity_id:Zc,state:l??"unknown",attributes:o},p={...n,states:{...n.states,[Zc]:d}};return r.set(e,p),p}var us=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?m`<span class="value" title=${`${Yt(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Be(this.hass,e)}</b>${e.period!=="total"?m`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${G(this.hass,e.sources,`${Oe[e.kind]} \xB7 ${Yt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return Ke.map(t=>{let r=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(r.length,i.length)},(o,s)=>m`<div class="row"><span class="kind" title=${Oe[t]}>${s?"":`${Tn[t]} ${Oe[t]}`}</span>${r[s]?this.value(r[s]):m`<span></span>`}${i[s]?this.value(i[s]):m`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?We(this.hass,t,e):ql(this.hass,this.floors);return m`${Ke.map(a=>{let l=s.filter(u=>u.kind===a);return l.length?m`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Oe[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${Tn[a]} ${Oe[a]}</span><div class="values">${l.map(u=>this.value(u))}</div></div>`:f})}`}let i=(t?Zt(this.hass,t,e,!0).map(s=>({...s,hasDetails:s.rooms.length>0})):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:We(this.hass,s,e),rooms:[],hasDetails:Zt(this.hass,s,e,!0).length>0}))).filter(s=>s.readings.length||s.hasDetails);if(!i.lLine truncated
`]};function dg(n){let e=Math.min(1,Math.max(0,(n-2200)/4300)),t=(r,i)=>Math.round(r+(i-r)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",cs);var hg=new URL(import.meta.url),pg=new URL("./nextfloor-3d.js?v=dbb5f8d395a4",hg).href,Yc;function Jc(){return Yc??=import(pg),Yc}function Qc(n){if(!n||n.state!=="on")return 0;let e=typeof n.attributes.percentage=="number"?n.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var Xc="weather.nextfloor_symcon",td={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},ed=new WeakMap;function mg(n){let e=n.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function ki(n,e){if(!V(n))return n;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return n;let r=ed.get(n)??new WeakMap;ed.set(n,r);let i=r.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?n.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=ve(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=ve(g);_!==null&&(o[h]=mi(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=ye(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=mg(Ie(s("condition"))),u=e.rain_sensor?n.states[e.rain_sensor]:void 0,c=le(u);c!==null&&e.rain_sensor_inverted&&(c=!c),c===null&&typeof o.precipitation=="number"&&(c=o.precipitation>0),le(s("lightning"))?l=c?"lightning-rainy":"lightning":le(s("snow"))?l=c?"snowy-rainy":"snowy":le(s("fog"))?l="fog":c===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":c===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&c===!1&&(l="sunny");let d={entity_id:Xc,state:l??"unknown",attributes:o},p={...n,states:{...n.states,[Xc]:d}};return r.set(e,p),p}var ps=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?m`<span class="value" title=${`${Qt(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Be(this.hass,e)}</b>${e.period!=="total"?m`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${G(this.hass,e.sources,`${Le[e.kind]} \xB7 ${Qt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return Ke.map(t=>{let r=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(r.length,i.length)},(o,s)=>m`<div class="row"><span class="kind" title=${Le[t]}>${s?"":`${In[t]} ${Le[t]}`}</span>${r[s]?this.value(r[s]):m`<span></span>`}${i[s]?this.value(i[s]):m`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?We(this.hass,t,e):Ql(this.hass,this.floors);return m`${Ke.map(a=>{let l=s.filter(u=>u.kind===a);return l.length?m`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Le[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${In[a]} ${Le[a]}</span><div class="values">${l.map(u=>this.value(u))}</div></div>`:f})}`}let i=(t?Jt(this.hass,t,e,!0).map(s=>({...s,hasDetails:s.rooms.length>0})):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:We(this.hass,s,e),rooms:[],hasDetails:Jt(this.hass,s,e,!0).length>0}))).filter(s=>s.readings.length||s.hasDetails);if(!i.lLine truncated
<button class="heading" aria-expanded=${!o} @click=${()=>{this.folded=!o}}><span>${t?"Bereiche":"Stockwerke"}<small>${t?.name||"Gesamtgeb\xE4ude"}</small></span><span aria-hidden="true">${o?"+":"\u2212"}</span></button>
${o?f:m`<div class="entries"><div class="columns"><span></span><span title="Leistung bzw. Durchfluss">Leistung</span><span>Energie / Verbrauch</span></div>
${i.map(s=>m`<section class="entry" data-area=${t?s.id:f}>
@@ -1669,9 +1669,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.kind { color:var(--nf-muted); font-size:10px; white-space:nowrap; }
.row .value b { font-size:11px; font-weight:normal; }
@media(max-width:600px) { .entries { max-height:32vh; } }
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",us);var Qc="image:";function cs(n,e,t){let r=(e??"").trim();if(!r)return null;if(r.startsWith(Qc))return t(r.slice(Qc.length));if(/^(https?:\/\/|\/)/.test(r))return r;if(/^[a-z_]+\.[a-z0-9_]+$/.test(r)){let i=n?.states[r]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Un=n=>Number(n);function qn(n){if(Array.isArray(n)){let[o,s]=[Un(n[0]),Un(n[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!n||typeof n!="object")return null;let{x:e,y:t}=n,[r,i]=[Un(e),Un(t)];return Number.isFinite(r)&&Number.isFinite(i)?[r,i]:null}function Xc(n){return n?qn(n.charger)??qn(n.charger_position):null}function ed(n){for(let[e,t]of Object.entries(n.states))if(e.startsWith("camera.")&&(qn(t.attributes?.vacuum_position)??Xc(t.attributes)))return e;return null}var dg=n=>Array.isArray(n)?typeof n[0]=="number":!!n&&typeof n=="object",jn=(n,e)=>e?[n[0],-n[1]]:n;function hg(n){if(!n)return null;let e=n.mirror===!0,[t,r]=jn(n.ga,e),[i,o]=jn(n.gb,e),[s,a]=n.a,[l,u]=n.b,[c,d]=[i-t,o-r],[p,h]=[l-s,u-a],g=Math.hypot(c,d),_=Math.hypot(p,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,y=Math.atan2(h,p)-Math.atan2(d,c),[S,$]=[Math.cos(y),Math.sin(y)];return A=>{let z=jn(A,e),[x,F]=[z[0]-t,z[1]-r];return[s+b*(x*S-F*$),a+b*(x*$+F*S)]}}function pg(n){if(!n)return null;let e=n.mirror===!0,[t,r]=jn(n.ga,e),[i,o]=jn(n.gb,e),s=Math.atan2(n.b[1]-n.a[1],n.b[0]-n.a[0])-Math.atan2(o-r,i-t);return Number.isFinite(s)?s:null}function td(n,e,t){if(!e)return null;let r=n.states[e]?.attributes;if(!r)return null;let i=hg(t)??(g=>g),o=pg(t)??0,s=t?.mirror===!0?-1:1,a=r.vacuum_position,l=qn(a),u=l?(()=>{let[g,_]=i(l),b=Un(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let y=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(y),Math.sin(y))}})():null,c=Xc(r),d=Array.isArray(r.path)?r.path:[],p=d.length>0&&dg(d[0])?[d]:d,h=[];for(let g of p){let _=[];for(let b of Array.isArray(g)?g:[]){let y=qn(b);y&&_.push(i(y))}_.length>1&&h.push(_)}return!u&&!c&&!h.length?null:{pose:u,charger:c?i(c):null,path:h}}var nd="nextfloor.lock3d",rd=520,hs=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},topologySelection:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;topologyImages=new Map;scopedFor=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig Line truncated
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",ps);var nd="image:";function ms(n,e,t){let r=(e??"").trim();if(!r)return null;if(r.startsWith(nd))return t(r.slice(nd.length));if(/^(https?:\/\/|\/)/.test(r))return r;if(/^[a-z_]+\.[a-z0-9_]+$/.test(r)){let i=n?.states[r]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Jn=n=>Number(n);function Xn(n){if(Array.isArray(n)){let[o,s]=[Jn(n[0]),Jn(n[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!n||typeof n!="object")return null;let{x:e,y:t}=n,[r,i]=[Jn(e),Jn(t)];return Number.isFinite(r)&&Number.isFinite(i)?[r,i]:null}function rd(n){return n?Xn(n.charger)??Xn(n.charger_position):null}function id(n){for(let[e,t]of Object.entries(n.states))if(e.startsWith("camera.")&&(Xn(t.attributes?.vacuum_position)??rd(t.attributes)))return e;return null}var fg=n=>Array.isArray(n)?typeof n[0]=="number":!!n&&typeof n=="object",Qn=(n,e)=>e?[n[0],-n[1]]:n;function gg(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Qn(n.ga,e),[i,o]=Qn(n.gb,e),[s,a]=n.a,[l,u]=n.b,[c,d]=[i-t,o-r],[p,h]=[l-s,u-a],g=Math.hypot(c,d),_=Math.hypot(p,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,y=Math.atan2(h,p)-Math.atan2(d,c),[S,$]=[Math.cos(y),Math.sin(y)];return A=>{let z=Qn(A,e),[x,F]=[z[0]-t,z[1]-r];return[s+b*(x*S-F*$),a+b*(x*$+F*S)]}}function _g(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Qn(n.ga,e),[i,o]=Qn(n.gb,e),s=Math.atan2(n.b[1]-n.a[1],n.b[0]-n.a[0])-Math.atan2(o-r,i-t);return Number.isFinite(s)?s:null}function od(n,e,t){if(!e)return null;let r=n.states[e]?.attributes;if(!r)return null;let i=gg(t)??(g=>g),o=_g(t)??0,s=t?.mirror===!0?-1:1,a=r.vacuum_position,l=Xn(a),u=l?(()=>{let[g,_]=i(l),b=Jn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let y=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(y),Math.sin(y))}})():null,c=rd(r),d=Array.isArray(r.path)?r.path:[],p=d.length>0&&fg(d[0])?[d]:d,h=[];for(let g of p){let _=[];for(let b of Array.isArray(g)?g:[]){let y=Xn(b);y&&_.push(i(y))}_.length>1&&h.push(_)}return!u&&!c&&!h.length?null:{pose:u,charger:c?i(c):null,path:h}}var sd="nextfloor.lock3d",ad=520,gs=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},topologySelection:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;topologyImages=new Map;scopedFor=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig Line truncated
${e.map(t=>m`<button class="nf-chip" aria-pressed=${!this.hiddenLayers.has(t.id)} @click=${()=>this.toggleLayer(t.id)}>${this.hiddenLayers.has(t.id)?"\u25CC":"\u{1F441}"} ${t.name}</button>`)}
</div>`}syncDevices(e){let t=this.viewer,r=this.building?this.scopeBuilding():null;if(!t||!r||!this.hass)return;let i=this._travel,o=i&&!i.loading?Xt(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Ue(o,r.floors),this.furnitureLinks=qe(o,r.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Bu(o,r,this.weatherEntityId,this.openingLinks):null,this.watched=Zu({hass:o,building:r,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(v=>this.shownStates.get(v)!==o.states[v])))return;let a=this.shownFor?.shown,l=this.shownBuilding(o);l!==a&&t.setBuilding(l),this.shownStates=new Map(this.watched.map(v=>[v,o.states[v]])),this.syncHydronics(t,r,o),this.refreshToday(r),this.refreshForecast(r);let u=Rn(o,r),c=dl(o,r.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(o):r);this.placementInfo=new Map(c.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let d=this.furnitureMarkers(o,r,new Set(c.map(v=>v.id)),new Set(u.map(v=>v.powerEntity)));u.push(...d.consumers);let p=En(o,r,u,Xe(r,v=>this.furnitureLinks?.get(v.id)?.power??null)),h=new Map(u.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=kt(o,r.floors);let g=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of r.floors)for(let w of v.outdoor??[]){if(!w.area_id&&!w.temp_entity&&!w.pump_entity)continue;let K=w.temp_entity?o.states[w.temp_entity]:void 0,we=w.pump_entity?o.states[w.pump_entity]:void 0,[ue,ge]=Pe(w.points),Ad=K&&Number.isFinite(Number(K.state))?`${N(o,ce(o,kr(Number(K.state),K.attributes.unit_of_measurement)),1)} ${re(o)}`:"",ws=!!we&&te(we);c.push({id:w.area_id?`outdoor:${w.id}`:w.pump_entity??w.temp_entity,floorId:v.id,roomId:null,x:ue,z:ge,y:_r(v,w,ue,ge)+.7,icon:Ce(w.type==="pool"?"pool":w.type==="terrace"?"table-chair":"tree-outline"),name:w.area_id&&o.areas?.[w.area_id]?.name||M(o,`out_${w.type}`),text:[Ad,ws?M(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:ws,unavailable:!1,glow:null,show:"always"})}let _=new Map;for(let v of r.floors){for(let w of v.placements)w.pin_offset&&_.set(`${v.id}:${w.entity_id}`,w.pin_offset);for(let w of v.furniture)w.pin_offset&&_.set(`f:${w.id}`,w.pin_offset)}let b=v=>{let w=v.lamp?void 0:(v.furnitureId?_.get(`f:${v.furnitureId}`):void 0)??_.get(`${v.floorId}:${v.id}`);return w?{...v,x:v.x+(w.x??0),z:v.z+(w.z??0),y:v.y+(w.y??0)}:v};t.setDevices([...[...c,...d.markers].map(b).map(v=>{let w=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:h.get(v.id)??null,K={...v,power:w,powerText:w===null?void 0:pe(o,w),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(o,r,p,v.furnitureId)??v.text},we=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",ue=g.has(v.id)||!!v.furnitureId&&g.has(v.furnitureId);return{...K,pin:this.showPin(K)&&!ue,full:v.show==="always",caption:we}})]),t.setPickTargets(d.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(d.screens),t.setFridgeDoors(Ua(o,r.floors)),t.setCovers(rl(o,r)),t.setRobots(this.robotInfos(o,r));let y=new Map;for(let v of r.floors)for(let w of v.furniture)!X(w.type)?.pet||!w.room_sensor||w.room_sensor==="none"||y.set(w.id,io(o,v.rooms.filter(K=>K.points.length>=3),null,w.room_sensor)?.id??null);y.size&&t.setPetRooms(y),t.setRoofWindows(Cu(o,r)),t.setParked(Wo(o,r)),t.setGateStates(tc(o,r));let S=new Map(r.floors.flatMap(v=>v.openings.map(w=>[w.id,w.type]))),$=new Map([...this.openingLinks].map(([v,w])=>[v,je(o,w,S.get(v))]));t.setOpeningStates($),this.setAlerts(this.alertSrc?No(o,r,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let A=[...c,...d.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(w=>w.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...$].map(([v,w])=>`${v}:${w.open}:${w.cover===null?"-":w.cover.toFixed(1)}`).join(";");if(A!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=A,v||this.scheduleThumbs(1500)}let z=fc(o,r,u,r.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),x=this.liveCars(o,r);for(let v of x){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let w=r.floors.flatMap(ue=>ue.furniture.filter(ge=>ge.type==="wallbox").map(ge=>({floorId:ue.id,x:ge.x,z:ge.z,y:1}))).sort((ue,ge)=>Math.hypot(ue.x-v.at.x,ue.z-v.at.z)-Math.hypot(ge.x-v.at.x,ge.z-v.at.z))[0],K=w&&w.floorId===v.at.floorId&&Math.hypot(w.x-v.at.x,w.z-v.at.z)<9,we=w??Bn(r);!we||!v.car.charging&&!K||z.arcs.push({key:`car:${v.spot}`,from:we,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...K?{via:[{...we,y:.35},{floorId:v.at.floorId,x:(we.x+v.at.x)/2,z:(we.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let F=Bn(r);for(let v ofLine truncated
</div>`}syncDevices(e){let t=this.viewer,r=this.building?this.scopeBuilding():null;if(!t||!r||!this.hass)return;let i=this._travel,o=i&&!i.loading?tn(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Ue(o,r.floors),this.furnitureLinks=qe(o,r.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Uu(o,r,this.weatherEntityId,this.openingLinks):null,this.watched=Xu({hass:o,building:r,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(v=>this.shownStates.get(v)!==o.states[v])))return;let a=this.shownFor?.shown,l=this.shownBuilding(o);l!==a&&t.setBuilding(l),this.shownStates=new Map(this.watched.map(v=>[v,o.states[v]])),this.syncHydronics(t,r,o),this.refreshToday(r),this.refreshForecast(r);let u=Dn(o,r),c=fl(o,r.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(o):r);this.placementInfo=new Map(c.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let d=this.furnitureMarkers(o,r,new Set(c.map(v=>v.id)),new Set(u.map(v=>v.powerEntity)));u.push(...d.consumers);let p=Hn(o,r,u,Xe(r,v=>this.furnitureLinks?.get(v.id)?.power??null)),h=new Map(u.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=kt(o,r.floors);let g=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of r.floors)for(let w of v.outdoor??[]){if(!w.area_id&&!w.temp_entity&&!w.pump_entity)continue;let K=w.temp_entity?o.states[w.temp_entity]:void 0,we=w.pump_entity?o.states[w.pump_entity]:void 0,[ue,ge]=Pe(w.points),Td=K&&Number.isFinite(Number(K.state))?`${N(o,ce(o,Rr(Number(K.state),K.attributes.unit_of_measurement)),1)} ${re(o)}`:"",$s=!!we&&te(we);c.push({id:w.area_id?`outdoor:${w.id}`:w.pump_entity??w.temp_entity,floorId:v.id,roomId:null,x:ue,z:ge,y:xr(v,w,ue,ge)+.7,icon:Ce(w.type==="pool"?"pool":w.type==="terrace"?"table-chair":"tree-outline"),name:w.area_id&&o.areas?.[w.area_id]?.name||M(o,`out_${w.type}`),text:[Td,$s?M(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:$s,unavailable:!1,glow:null,show:"always"})}let _=new Map;for(let v of r.floors){for(let w of v.placements)w.pin_offset&&_.set(`${v.id}:${w.entity_id}`,w.pin_offset);for(let w of v.furniture)w.pin_offset&&_.set(`f:${w.id}`,w.pin_offset)}let b=v=>{let w=v.lamp?void 0:(v.furnitureId?_.get(`f:${v.furnitureId}`):void 0)??_.get(`${v.floorId}:${v.id}`);return w?{...v,x:v.x+(w.x??0),z:v.z+(w.z??0),y:v.y+(w.y??0)}:v};t.setDevices([...[...c,...d.markers].map(b).map(v=>{let w=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:h.get(v.id)??null,K={...v,power:w,powerText:w===null?void 0:pe(o,w),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(o,r,p,v.furnitureId)??v.text},we=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",ue=g.has(v.id)||!!v.furnitureId&&g.has(v.furnitureId);return{...K,pin:this.showPin(K)&&!ue,full:v.show==="always",caption:we}})]),t.setPickTargets(d.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(d.screens),t.setFridgeDoors(Ya(o,r.floors)),t.setCovers(al(o,r)),t.setRobots(this.robotInfos(o,r));let y=new Map;for(let v of r.floors)for(let w of v.furniture)!X(w.type)?.pet||!w.room_sensor||w.room_sensor==="none"||y.set(w.id,lo(o,v.rooms.filter(K=>K.points.length>=3),null,w.room_sensor)?.id??null);y.size&&t.setPetRooms(y),t.setRoofWindows(Wu(o,r)),t.setParked(Go(o,r)),t.setGateStates(oc(o,r));let S=new Map(r.floors.flatMap(v=>v.openings.map(w=>[w.id,w.type]))),$=new Map([...this.openingLinks].map(([v,w])=>[v,je(o,w,S.get(v))]));t.setOpeningStates($),this.setAlerts(this.alertSrc?Bo(o,r,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let A=[...c,...d.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(w=>w.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...$].map(([v,w])=>`${v}:${w.open}:${w.cover===null?"-":w.cover.toFixed(1)}`).join(";");if(A!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=A,v||this.scheduleThumbs(1500)}let z=yc(o,r,u,r.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),x=this.liveCars(o,r);for(let v of x){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let w=r.floors.flatMap(ue=>ue.furniture.filter(ge=>ge.type==="wallbox").map(ge=>({floorId:ue.id,x:ge.x,z:ge.z,y:1}))).sort((ue,ge)=>Math.hypot(ue.x-v.at.x,ue.z-v.at.z)-Math.hypot(ge.x-v.at.x,ge.z-v.at.z))[0],K=w&&w.floorId===v.at.floorId&&Math.hypot(w.x-v.at.x,w.z-v.at.z)<9,we=w??jn(r);!we||!v.car.charging&&!K||z.arcs.push({key:`car:${v.spot}`,from:we,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...K?{via:[{...we,y:.35},{floorId:v.at.floorId,x:(we.x+v.at.x)/2,z:(we.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let F=jn(r);for(let v ofLine truncated
<button class="nf-thumbs-fold" title=${M(this.hass,r?"thumbs_show":"thumbs_fold")} aria-label=${M(this.hass,r?"thumbs_show":"thumbs_fold")} @click=${i}>${r?"\u25B8":"\u25C2"}</button>
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg>
@@ -1681,16 +1681,16 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${r?f:m`<img src=${o.url} alt="" />`}
<span>${e.get(o.floorId)??""}</span>
</button>`)}
</nav>`}onDeviceHold(e,t,r){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:r}:Ae(this,e)}onDeviceSwipe(e,t,r,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||!W(this.hass,e)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&as(s).dim){let u=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:u,value:u,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let u=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:u,value:u,x:i,y:o},!0}if(l==="cover"&&ls(s)){let u=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:u,value:u,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-r/220*100)));l!==a.value&&(this._swipe={...a,value:l});let u=performance.now();u-this.swipeSent>350&&(this.swipeSent=u,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){if(this._swipe&&!W(this.hass,this._swipe.entity))return;let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,vl(this.hass,r=>this.announce(r)).then(r=>{t?r():this.stopAnnouncements=r})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!gl(e,this.screenName)||!_l(e))return;let r=bl(e.message);this._announcement={message:e.message,until:Date.now()+r},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,r),yl(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${M(this.hass,"close")} @click=${()=>this._announcement=null}>
</nav>`}onDeviceHold(e,t,r){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:r}:Ae(this,e)}onDeviceSwipe(e,t,r,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||!W(this.hass,e)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&ds(s).dim){let u=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:u,value:u,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let u=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:u,value:u,x:i,y:o},!0}if(l==="cover"&&hs(s)){let u=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:u,value:u,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-r/220*100)));l!==a.value&&(this._swipe={...a,value:l});let u=performance.now();u-this.swipeSent>350&&(this.swipeSent=u,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){if(this._swipe&&!W(this.hass,this._swipe.entity))return;let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,Sl(this.hass,r=>this.announce(r)).then(r=>{t?r():this.stopAnnouncements=r})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!vl(e,this.screenName)||!wl(e))return;let r=xl(e.message);this._announcement={message:e.message,until:Date.now()+r},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,r),kl(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${M(this.hass,"close")} @click=${()=>this._announcement=null}>
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span>
</button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return m`<div class="nf-alert-banner" role="alert">
${t.map(r=>m`<button class="nf-alert nf-alert-${r.kind}" style=${r.color?`border-left-color:${r.color}`:""} title=${Lo(this.hass,e,r)} @click=${()=>this.jumpTo(r)}>${Lo(this.hass,e,r)}</button>`)}
${t.map(r=>m`<button class="nf-alert nf-alert-${r.kind}" style=${r.color?`border-left-color:${r.color}`:""} title=${Vo(this.hass,e,r)} @click=${()=>this.jumpTo(r)}>${Vo(this.hass,e,r)}</button>`)}
${this._alerts.length>3?m`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f}
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),r=t?j(this.hass,t).filter(o=>P(o)==="scene"||P(o)==="script").slice(0,6):[];if(!r.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return m`<div class="nf-scenes">
${r.map(o=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${O(this.hass,o,i)}</button>`)}
${r.map(o=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${L(this.hass,o,i)}</button>`)}
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return m`<button class="nf-find-btn" title=${M(this.hass,"find")} aria-label=${M(this.hass,"find")} @click=${()=>this._find=""}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5" /><path d="M16 16l4.5 4.5" /></svg>
</button>`;let t=Vc(this.findIndex??=Bc(this.hass,e),this._find);return m`<div class="nf-find">
</button>`;let t=jc(this.findIndex??=Uc(this.hass,e),this._find);return m`<div class="nf-find">
<input
type="search"
placeholder=${M(this.hass,"find_placeholder")}
@@ -1701,7 +1701,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<button class="nf-find-close" aria-label=${M(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
${this._find.trim()?m`<div class="nf-find-list">
${t.length?t.map(r=>m`<button @click=${()=>this.goTo(r)}>
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${r.icon?Pr(r.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${r.icon?Lr(r.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
<span><b>${r.name}</b>${r.where?m`<small>${r.where}</small>`:f}</span>
</button>`):m`<p>${M(this.hass,"find_none")}</p>`}
</div>`:f}
@@ -1713,7 +1713,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@click=${()=>{this._central=!this._central,this._armed=null}}
>
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg>
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>oo(t,b).lights).filter(b=>W(t,b)),l=s.flatMap(b=>oo(t,b).covers).filter(b=>W(t,b)),u=a.filter(b=>t.states[b]?.state==="on").length,c=!o,d=(b,y,S,$)=>{if($.length){if(c&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(y,S,{entity_id:$})}},p=(b,y,S,$,A)=>m`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!A.length} @click=${()=>d(b,S,$,A)}>
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>uo(t,b).lights).filter(b=>W(t,b)),l=s.flatMap(b=>uo(t,b).covers).filter(b=>W(t,b)),u=a.filter(b=>t.states[b]?.state==="on").length,c=!o,d=(b,y,S,$)=>{if($.length){if(c&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(y,S,{entity_id:$})}},p=(b,y,S,$,A)=>m`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!A.length} @click=${()=>d(b,S,$,A)}>
${this._armed===b?r("central_sure"):r(y)}
</button>`,h=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!h[b]||!o||h[b]===o.id)),_=this.buttons??e.settings.buttons??[];return m`${i}
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${r("central")}>
@@ -1730,25 +1730,25 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</div>`:f}
<b>${r("central_favorites")}</b>
${g.length?m`<div class="nf-central-favs">
${g.map(b=>{let[y,S]=Ja(b),$=t.states[b],A=y==="homeassistant"&&$?.state==="on";return m`<button
${g.map(b=>{let[y,S]=tl(b),$=t.states[b],A=y==="homeassistant"&&$?.state==="on";return m`<button
class="nf-chip"
aria-pressed=${A||this._sceneFired===b}
?disabled=${I($)||!W(t,b)}
@click=${()=>{t.callService(y,S,{entity_id:b}),this._sceneFired=b,setTimeout(()=>this._sceneFired=null,600)}}
>
${O(t,b)}
${L(t,b)}
</button>`})}
</div>`:_.length?f:m`<p class="nf-central-hint">${r("central_no_favorites")}</p>`}
${_.length?m`<div class="nf-central-favs">
${_.map(b=>m`<button
class="nf-chip nf-own-btn"
aria-pressed=${Qa(t,b)}
@click=${y=>{so(t,y.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
aria-pressed=${nl(t,b)}
@click=${y=>{co(t,y.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
>
${b.icon?m`<ha-icon .icon=${b.icon.startsWith("mdi:")?b.icon:`mdi:${b.icon}`}></ha-icon>`:f}${b.label}
</button>`)}
</div>`:f}
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(nd,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),r=t-e*36e5;this._travel={history:new Map,from:r,to:t,t:r,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await Hn(this.hass,xu(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:ku(i,r,t),loading:!1}}catch{this._travel=null,this._error=M(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let r=this._travel;if(!r)return;let i=r.t+250*r.speed;i>=r.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>M(this.hass,a),t=this._travel;if(!t)return this.travelButton?m`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return m`<div class="nf-travel" role="group" aria-label=${e("travel")}>
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(sd,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),r=t-e*36e5;this._travel={history:new Map,from:r,to:t,t:r,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await On(this.hass,Mu(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:Au(i,r,t),loading:!1}}catch{this._travel=null,this._error=M(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let r=this._travel;if(!r)return;let i=r.t+250*r.speed;i>=r.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>M(this.hass,a),t=this._travel;if(!t)return this.travelButton?m`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return m`<div class="nf-travel" role="group" aria-label=${e("travel")}>
<button class="nf-travel-play" aria-label=${e(t.playing?"travel_pause":"travel_play")} ?disabled=${t.loading} @click=${()=>this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}</button>
<b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b>
<div class="nf-travel-track">
@@ -1781,12 +1781,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
>
${this.clean?ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M12 6a9.8 9.8 0 0 1 9 6 9.8 9.8 0 0 1-9 6 9.8 9.8 0 0 1-9-6 9.8 9.8 0 0 1 9-6m0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4" /></svg>`:ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M2.4 3.8 3.8 2.4l17.8 17.8-1.4 1.4-3.3-3.3A10.5 10.5 0 0 1 12 19a9.8 9.8 0 0 1-9-6 10.3 10.3 0 0 1 3.6-4.3L2.4 3.8M12 7a4 4 0 0 1 4 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3m-4 4a4 4 0 0 0 5.5 3.7l-5.2-5.2c-.2.5-.3 1-.3 1.5m4-7a9.8 9.8 0 0 1 9 6 10 10 0 0 1-2.6 3.6l-1.4-1.4A8 8 0 0 0 18.8 12 8 8 0 0 0 9.6 7.2L8 5.6A10.3 10.3 0 0 1 12 4" /></svg>`}
</button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return m`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
<span>${O(this.hass,e.entity)}</span>
<span>${L(this.hass,e.entity)}</span>
<b>${t?M(this.hass,"swipe_off"):`${e.value} %`}</b>
<i><em style="height:${e.value}%"></em></i>
</div>`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?ao(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,r);o.length>1&&(this._plate={ids:o,x:t,y:r})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,r=()=>this._plate=null;return m`<div class="nf-menu-backdrop" @click=${r}></div>
</div>`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?ho(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,r);o.length>1&&(this._plate={ids:o,x:t,y:r})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,r=()=>this._plate=null;return m`<div class="nf-menu-backdrop" @click=${r}></div>
<div class="nf-plate-menu" style="left:${Math.max(8,e.x-110)}px;top:${Math.max(8,e.y-20-e.ids.length*46)}px" role="menu">
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{r(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${O(t,i)}</span><i>${s?se(t,s):"\u2013"}</i></button>`})}
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{r(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${L(t,i)}</span><i>${s?se(t,s):"\u2013"}</i></button>`})}
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),r=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(r-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return m`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
<nf-quick-menu
style="left:${o}px;top:${s}px"
@@ -1797,12 +1797,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))}
?confirmSwitch=${this.confirmSet.has(e.entity)}
.myPosition=${this.myPositionOf(e.entity)}
.tiltEntity=${Tr(this.hass,this.building?.floors??[],e.entity)}
.tiltEntity=${Ir(this.hass,this.building?.floors??[],e.entity)}
@close=${()=>this._menu=null}
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&Xo().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});return}let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&so(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,r);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Xe(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&Ae(this,a);return}let o=P(e);if(this.hass.symconObjects!==void 0&&!W(this.hass,e)){this.hass.states[e]&&(this._menu={entity:e,x:t,y:r});return}if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:r};return}if(o==="lock"){let s=no(this.hass,e),a=O(this.hass,e);confirm(M(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Sa.has(o)){if(this.confirmSet.has(e)&&!confirm(M(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;pl(this.hass,e)}else Ae(this,e)}pluginTapped(e){let t=this.hass?.states[e],r=this.placementInfo.get(e);if(!t||!r)return!1;let i=this.building?.floors.find(o=>o.id===r.floorId)?.placements.find(o=>o.entity_id===e);return ta({hass:this.hass,entityId:e,state:t},r,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>Ae(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?m`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&rs().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});return}let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&co(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,r);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Xe(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&Ae(this,a);return}let o=P(e);if(this.hass.symconObjects!==void 0&&!W(this.hass,e)){this.hass.states[e]&&(this._menu={entity:e,x:t,y:r});return}if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:r};return}if(o==="lock"){let s=so(this.hass,e),a=L(this.hass,e);confirm(M(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Ra.has(o)){if(this.confirmSet.has(e)&&!confirm(M(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;_l(this.hass,e)}else Ae(this,e)}pluginTapped(e){let t=this.hass?.states[e],r=this.placementInfo.get(e);if(!t||!r)return!1;let i=this.building?.floors.find(o=>o.id===r.floorId)?.placements.find(o=>o.entity_id===e);return oa({hass:this.hass,entityId:e,state:t},r,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>Ae(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?m`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
<div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${M(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
<div class="nf-pw-body">${e.node}</div>
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let r=[];for(let i of e.floors)for(let o of i.furniture){if(!zc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Ec(t,s?.entity??s?.power??null);a&&r.push({id:o.id,name:o.name||ae(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},pump:a})}return r}livePrinters(e){let t=this.hass,r=[];if(!t)return r;for(let i of e.floors)for(let o of i.furniture){if(!ts(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=es(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||r.push({id:o.id,name:o.name||ae(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},printer:a})}return r}liveCars(e,t){let r=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Pc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Oo(e,o),l=a?qu(o,a):null,u=o.name||(a?ae(e,a):ae(e,o.type));r.push({spot:o.id,name:u,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+(l?.h??.2)+.6},car:s})}return r}liveMedia(e,t){let r=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&r.push({entity:s,name:o.name||ae(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.push({entity:o.entity_id,name:o.name||O(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Du(e,r)}refreshToday(e){let t=this.hass,r=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!r.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Sc(t,r,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,r=e.settings.forecast&&t?ht(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!r)return;let i=`${r}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Ac(t,r).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,r=this.hass,i=t?.settings.forecast;if(!t||!r||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=Mc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=ht(r,this.weatherEntityId??t.settings.weather_entity),a=s?r.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),u=String(a?.precipitation_unit??"mm"),c=r.language??navigator.language,d=new Intl.DateTimeFormat(c,{weekday:"short"}),p=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return m`<section class="nf-forecast" aria-label=${M(r,"forecast")}>
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let r=[];for(let i of e.floors)for(let o of i.furniture){if(!Hc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Dc(t,s?.entity??s?.power??null);a&&r.push({id:o.id,name:o.name||ae(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},pump:a})}return r}livePrinters(e){let t=this.hass,r=[];if(!t)return r;for(let i of e.floors)for(let o of i.furniture){if(!os(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=is(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||r.push({id:o.id,name:o.name||ae(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},printer:a})}return r}liveCars(e,t){let r=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Oc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Ko(e,o),l=a?Qu(o,a):null,u=o.name||(a?ae(e,a):ae(e,o.type));r.push({spot:o.id,name:u,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+(l?.h??.2)+.6},car:s})}return r}liveMedia(e,t){let r=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&r.push({entity:s,name:o.name||ae(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.push({entity:o.entity_id,name:o.name||L(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Cu(e,r)}refreshToday(e){let t=this.hass,r=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!r.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Rc(t,r,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,r=e.settings.forecast&&t?ht(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!r)return;let i=`${r}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Tc(t,r).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,r=this.hass,i=t?.settings.forecast;if(!t||!r||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=zc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=ht(r,this.weatherEntityId??t.settings.weather_entity),a=s?r.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),u=String(a?.precipitation_unit??"mm"),c=r.language??navigator.language,d=new Intl.DateTimeFormat(c,{weekday:"short"}),p=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return m`<section class="nf-forecast" aria-label=${M(r,"forecast")}>
<ul>
${o.map((h,g)=>m`<li>
<span class="nf-fc-day">${g===0?M(r,"today"):d.format(new Date(h.day))}</span>
@@ -1811,14 +1811,14 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<span class="nf-fc-rain">${h.rain!==null&&h.rain>0?`\u{1F4A7}${h.rain.toLocaleString(c,{maximumFractionDigits:1})} ${u}`:h.chance!==null&&h.chance>0?`\u{1F4A7}${Math.round(h.chance)} %`:""}</span>
</li>`)}
</ul>
</section>`}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:m`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let r=xc(t,e,Date.now(),{today:M(t,"care_bin_today"),tomorrow:M(t,"care_bin_tomorrow")}),i=kc([...r,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=c=>{if(c===1)return M(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+c),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},u=i.flatMap((c,d)=>[(c.day??0)>0&&(i[d-1]?.day??0)!==c.day?m`<li class="nf-today-day">${l(c.day??0)}</li>`:f,m`<li class=${c.past?"nf-today-past":""}><time>${c.kind==="bin"?"\u{1F5D1}":c.time||"\u25CF"}</time><span>${c.title}<small>${c.source}</small></span></li>`]);return m`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${M(t,"today")}>
</section>`}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:m`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let r=Mc(t,e,Date.now(),{today:M(t,"care_bin_today"),tomorrow:M(t,"care_bin_tomorrow")}),i=Ac([...r,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=c=>{if(c===1)return M(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+c),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},u=i.flatMap((c,d)=>[(c.day??0)>0&&(i[d-1]?.day??0)!==c.day?m`<li class="nf-today-day">${l(c.day??0)}</li>`:f,m`<li class=${c.past?"nf-today-past":""}><time>${c.kind==="bin"?"\u{1F5D1}":c.time||"\u25CF"}</time><span>${c.title}<small>${c.source}</small></span></li>`]);return m`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${M(t,"today")}>
<button class="nf-today-head" aria-expanded=${o} @click=${()=>this._todayOpen=!o}>
<b>📅 ${M(t,"today")}</b><span>${s}</span>
</button>
${o?i.length?m`<ul>
${u}
</ul>`:m`<p class="nf-today-none">${M(t,"today_none")}</p>`:f}
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let r=Xe(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:r.solar,grid:i.grid??r.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:r.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};uu(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let r=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&V(r)?We(r,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=V(r)?s?.value??null:o?.power_entity?Z(r?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${M(r,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Be(r,s):Mt(r,a)}${l}`})}for(let[l,u,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],p=d?r?.states[d]:void 0;p&&!I(p)&&i.push({icon:u,label:M(r,c),value:se(r,p)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let r=a=>En(a,e,Rn(a,e),Xe(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Su(t,r),o=Date.now(),s=o-24*36e5;Hn(t,i,s,o,!0).then(a=>{this.dayCurves=$u(t,a,s,o,r),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,r){let i=++this.hydronicGeneration,o=this.shownBuilding(r).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>ct(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(r,t,!!this._travel);return}Xo().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(r,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,u=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,c=Bn(t),d=(this.floorId?t.floors.find(p=>p.id===this.floorId):void 0)??[...t.floors].sort((p,h)=>h.elevation-p.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&u&&c&&d){let p=0,h=0,g=0;for(let _ of d.rooms)for(let[b,y]of _.points)p+=b,h+=y,g++;a.push({kind:"house",at:{floorId:d.id,x:g?p/g:c.x,z:g?h/g:c.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:r.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let p of i)a.push({kind:"car",at:p.at,spot:p.spot,name:p.name,car:p.car});for(let p of this.livePrinters(t))a.push({kind:"printer",at:p.at,name:p.name,printer:p.printer});for(let p of this.liveHeatPumps(t))a.push({kind:"heatpump",at:p.at,name:p.name,pump:p.pump});for(let p of o)a.push({kind:"media",at:{...p.at,y:p.at.y+.5},media:p})}if(this.liveCardsOn&&!this.dimmed){a.push(...gc(s,t,this.floorId,this.roomId)),a.push(..._c(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let p of t.floors)for(let h of p.furniture){if(!ct(h.type)||h.hydronic?.card===!1||this.floorId&&p.id!==this.floorId||!Ye(s,h))continue;let g=this.roomId?p.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([h.x,h.z],g.points))||a.push({kind:"hydronic",item:h,readOnly:!!this._travel,at:{floorId:p.id,x:h.x+(h.pin_offset?.x??0),z:h.z+(h.pin_offset?.z??0),y:oe(p,h)+h.h+.3+(h.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(p=>p.at),a.length?(p,h,g,_,b)=>this.placeLhCard(p,h,g,_,b):null)}placeLhCard(e,t,r,i,o){let s=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);if(!s)return;let a=this._liveCards[e],l=`${a.kind}:${a.at.floorId}:${a.at.x}:${a.at.z}`,u=s.dataset.zoomKey===l&&s.dataset.zoomVisible==="1",c=this.shadowRoot?.activeElement,d=!!c&&s.contains(c),p=d||Oc(a,o,u);s.dataset.zoomKey=l,s.dataset.zoomVisible=p?"1":"0",s.dataset.density=String(Math.round(o)),s.dataset.priority=String(d?110:is(a).priority),s.dataset.focused=d?"1":"0",s.dataset.x=String(t),s.dataset.y=String(r),s.style.visibility=i&&p?"visible":"hidden",e===this._liveCards.length-1&&Cc(this.renderRoot)}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:m`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renLine truncated
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let r=Xe(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:r.solar,grid:i.grid??r.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:r.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};pu(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let r=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&V(r)?We(r,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=V(r)?s?.value??null:o?.power_entity?Z(r?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${M(r,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Be(r,s):Mt(r,a)}${l}`})}for(let[l,u,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],p=d?r?.states[d]:void 0;p&&!I(p)&&i.push({icon:u,label:M(r,c),value:se(r,p)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let r=a=>Hn(a,e,Dn(a,e),Xe(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Ru(t,r),o=Date.now(),s=o-24*36e5;On(t,i,s,o,!0).then(a=>{this.dayCurves=Eu(t,a,s,o,r),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,r){let i=++this.hydronicGeneration,o=this.shownBuilding(r).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>ct(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(r,t,!!this._travel);return}rs().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(r,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,u=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,c=jn(t),d=(this.floorId?t.floors.find(p=>p.id===this.floorId):void 0)??[...t.floors].sort((p,h)=>h.elevation-p.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&u&&c&&d){let p=0,h=0,g=0;for(let _ of d.rooms)for(let[b,y]of _.points)p+=b,h+=y,g++;a.push({kind:"house",at:{floorId:d.id,x:g?p/g:c.x,z:g?h/g:c.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:r.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let p of i)a.push({kind:"car",at:p.at,spot:p.spot,name:p.name,car:p.car});for(let p of this.livePrinters(t))a.push({kind:"printer",at:p.at,name:p.name,printer:p.printer});for(let p of this.liveHeatPumps(t))a.push({kind:"heatpump",at:p.at,name:p.name,pump:p.pump});for(let p of o)a.push({kind:"media",at:{...p.at,y:p.at.y+.5},media:p})}if(this.liveCardsOn&&!this.dimmed){a.push(...vc(s,t,this.floorId,this.roomId)),a.push(...wc(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let p of t.floors)for(let h of p.furniture){if(!ct(h.type)||h.hydronic?.card===!1||this.floorId&&p.id!==this.floorId||!Ye(s,h))continue;let g=this.roomId?p.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([h.x,h.z],g.points))||a.push({kind:"hydronic",item:h,readOnly:!!this._travel,at:{floorId:p.id,x:h.x+(h.pin_offset?.x??0),z:h.z+(h.pin_offset?.z??0),y:oe(p,h)+h.h+.3+(h.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(p=>p.at),a.length?(p,h,g,_,b)=>this.placeLhCard(p,h,g,_,b):null)}placeLhCard(e,t,r,i,o){let s=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);if(!s)return;let a=this._liveCards[e],l=`${a.kind}:${a.at.floorId}:${a.at.x}:${a.at.z}`,u=s.dataset.zoomKey===l&&s.dataset.zoomVisible==="1",c=this.shadowRoot?.activeElement,d=!!c&&s.contains(c),p=d||Kc(a,o,u);s.dataset.zoomKey=l,s.dataset.zoomVisible=p?"1":"0",s.dataset.density=String(Math.round(o)),s.dataset.priority=String(d?110:ls(a).priority),s.dataset.focused=d?"1":"0",s.dataset.x=String(t),s.dataset.y=String(r),s.style.visibility=i&&p?"visible":"hidden",e===this._liveCards.length-1&&Wc(this.renderRoot)}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:m`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renLine truncated
${s}
${this.liveCardsOn&&this._liveCards.some(u=>u.kind==="house")?f:l.map(u=>m`<div class="nf-energy-item nf-energy-${u.cls}"><span>${u.label}</span><b>${u.value}</b></div>`)}
${this.flows!==null?f:m`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${a("flows_hint")} aria-label=${a("flows")} @click=${()=>this.toggleFlows()}>
@@ -1828,27 +1828,27 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${e}
</div>`}renderCardToggle(){return this.holograms!==null?f:m`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${M(this.hass,"holos_hint")} aria-label=${M(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
<span>${M(this.hass,"holos")}</span><b>◫</b>
</button>`}utilityOverview(e){let t=this.building?this.scopeBuilding():null;if(!t||!V(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen||!e&&!this._utilityOverviewVisible)return f;let r=t.floors.flatMap(o=>o.rooms);return(this.floorId?t.floors.filter(o=>o.id===this.floorId):t.floors).some(o=>We(this.hass,o,r).length||Zt(this.hass,o,r,!0).length)?m`<nf-utility-overview ?inline=${e} .hass=${this.hass} .floors=${t.floors} .floorId=${this.floorId} .compact=${this._narrowStage}
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:m`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=V(this.hass)?(this.building?.presence??[]).filter(u=>wa(this.hass,u.person,[0])).map(u=>m`<div class="nf-energy-item nf-presence-state"><span>${u.name||O(this.hass,u.person)}</span><b>${le(this.hass.states[u.person])===null?"\u2013":le(this.hass.states[u.person])?"Anwesend":"Abwesend"}${G(this.hass,[u.person],u.name||"Anwesenheit")}</b></div>`):[],o=V(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(u=>!!u[1]&&u[1]!=="none").map(([u,c])=>[Jc[u]||u,c]):[];V(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?m`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
</button>`}utilityOverview(e){let t=this.building?this.scopeBuilding():null;if(!t||!V(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen||!e&&!this._utilityOverviewVisible)return f;let r=t.floors.flatMap(o=>o.rooms);return(this.floorId?t.floors.filter(o=>o.id===this.floorId):t.floors).some(o=>We(this.hass,o,r).length||Jt(this.hass,o,r,!0).length)?m`<nf-utility-overview ?inline=${e} .hass=${this.hass} .floors=${t.floors} .floorId=${this.floorId} .compact=${this._narrowStage}
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:m`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=V(this.hass)?(this.building?.presence??[]).filter(u=>$a(this.hass,u.person,[0])).map(u=>m`<div class="nf-energy-item nf-presence-state"><span>${u.name||L(this.hass,u.person)}</span><b>${le(this.hass.states[u.person])===null?"\u2013":le(this.hass.states[u.person])?"Anwesend":"Abwesend"}${G(this.hass,[u.person],u.name||"Anwesenheit")}</b></div>`):[],o=V(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(u=>!!u[1]&&u[1]!=="none").map(([u,c])=>[td[u]||u,c]):[];V(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?m`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
<dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${u=>u.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.close()}>×</button></header>${o.map(([u,c])=>m`<p><span>${u}</span><b>${Ie(this.hass.states[c])}${G(this.hass,[c],u)}</b></p>`)}</dialog>`:f,a=V(this.hass)?(this.building?this.scopeBuilding().floors:[]).filter(u=>!this.floorId||u.id===this.floorId).map(u=>({floor:u,readings:We(this.hass,u,this.building?.floors.flatMap(c=>c.rooms))})).filter(u=>u.readings.length):[],l=a.length?m`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button>
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${u=>u.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${a.map(({floor:u,readings:c})=>m`<h3>${u.name}</h3><nf-utility-report .hass=${this.hass} .readings=${c}></nf-utility-report>`)}</dialog>`:f;return[t,e,...i,s,l,...r.filter(u=>this.hass.states[u]).map(u=>m`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,u)} @click=${()=>Ae(this,u)}>
<span>${O(this.hass,u)}</span><b>${se(this.hass,this.hass.states[u])}</b>
</button>${G(this.hass,[u],O(this.hass,u))}`)]}renderMapCredit(){let e=this.building?.settings.map;return ec(e)?m`<a class="nf-map-credit" href=${Vo(e).href} target="_blank" rel="noopener">${Vo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=$t(new Date,this.hass?.config?.latitude??50),t=Qr(this.heatMode,e),r=this.heatMode==="temperature",i=r?ce(this.hass,t.stops[0][0]):t.stops[0][0],o=r?ce(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=r?re(this.hass):t.unit,a=l=>M(this.hass,l);return m`<div class="nf-legend">
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${u=>u.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${a.map(({floor:u,readings:c})=>m`<h3>${u.name}</h3><nf-utility-report .hass=${this.hass} .readings=${c}></nf-utility-report>`)}</dialog>`:f;return[t,e,...i,s,l,...r.filter(u=>this.hass.states[u]).map(u=>m`<button class="nf-energy-item nf-own-sensor" title=${L(this.hass,u)} @click=${()=>Ae(this,u)}>
<span>${L(this.hass,u)}</span><b>${se(this.hass,this.hass.states[u])}</b>
</button>${G(this.hass,[u],L(this.hass,u))}`)]}renderMapCredit(){let e=this.building?.settings.map;return ic(e)?m`<a class="nf-map-credit" href=${jo(e).href} target="_blank" rel="noopener">${jo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=$t(new Date,this.hass?.config?.latitude??50),t=ri(this.heatMode,e),r=this.heatMode==="temperature",i=r?ce(this.hass,t.stops[0][0]):t.stops[0][0],o=r?ce(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=r?re(this.hass):t.unit,a=l=>M(this.hass,l);return m`<div class="nf-legend">
<b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?m` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b>
<span class="nf-legend-bar" style="background:${lu(this.heatMode,e)}"></span>
<span class="nf-legend-bar" style="background:${hu(this.heatMode,e)}"></span>
<span class="nf-legend-range"><span>${N(this.hass,i,0)} ${s}</span><span>${N(this.hass,o,0)} ${s}</span></span>
${this.heatValues.size?f:m`<span class="nf-legend-none">${a("heat_none_found")}</span>`}
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let r=(u,c)=>M(e,u,c),i=t.floors.flatMap(u=>u.furniture.filter(c=>ns(c.type)).map(c=>rs(e,this.furnitureLinks?.get(c.id)?.entity??this.furnitureLinks?.get(c.id)?.power??null))),s=i.filter(u=>!!u).reduce((u,c)=>u+(c.clients??0),0),a=t.floors.flatMap(u=>u.placements.map(c=>e.states[c.entity_id])),l=Dc(a);return m`<div class="nf-legend">
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let r=(u,c)=>M(e,u,c),i=t.floors.flatMap(u=>u.furniture.filter(c=>ss(c.type)).map(c=>as(e,this.furnitureLinks?.get(c.id)?.entity??this.furnitureLinks?.get(c.id)?.power??null))),s=i.filter(u=>!!u).reduce((u,c)=>u+(c.clients??0),0),a=t.floors.flatMap(u=>u.placements.map(c=>e.states[c.entity_id])),l=Cc(a);return m`<div class="nf-legend">
<b>📶 ${r("heat_wifi")}</b>
<span>${r("wifi_aps",{n:i.length,clients:s})}</span>
${l.online+l.offline.length?m`<span>${r("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
${l.offline.length?m`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f}
${i.length?f:m`<span class="nf-legend-none">${r("wifi_none")}</span>`}
</div>`}skyColor(){let e=In[this.theme]??In.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,u)=>Math.round(l+(a[u]-l)*t)).join(",")})`,i=In[this.theme]??In.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+Tu(this.building?.settings.backdrop);return m`<div
</div>`}skyColor(){let e=Wn[this.theme]??Wn.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,u)=>Math.round(l+(a[u]-l)*t)).join(",")})`,i=Wn[this.theme]??Wn.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+Pu(this.building?.settings.backdrop);return m`<div
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""} ${e!==f?"nf-has-utility-overview":""}"
style=${o}
>
${this._error?m`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${Nc(this.hass,this._liveCards,(s,a,l,u)=>this.hass?.callService(s,a,{entity_id:l,...u}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this._error?m`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${Bc(this.hass,this._liveCards,(s,a,l,u)=>this.hass?.callService(s,a,{entity_id:l,...u}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:m`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday(e)} ${this.renderLayers()} ${this.renderPluginWindow()}
${this.showStats&&this._stats?m`<span class="nf-stats"
@@ -1857,7 +1857,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${M(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${M(this.hass,this._stats.low?"stats_low":"stats_full",{r:N(this.hass,this._stats.pixelRatio,2)})}</span
>`:f}
</div>`}static styles=[ke,Ne,Lc,J`
</div>`}static styles=[ke,Ne,Vc,J`
:host {
display: block;
position: relative;
@@ -3458,26 +3458,26 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
inset: auto 16px 16px;
color: var(--nf-danger);
}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",hs);function pe(n,e){return Math.abs(e)>=1e3?`${N(n,e/1e3,1)} kW`:`${Math.round(e)} W`}function ds(n){return n.type==="tv_board"?n.h+.9:n.type==="tv_wall"||n.type==="kitchen_wall"?n.h+.25:n.h+.35}function fg(n,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(n,e)}var id;function od(){let n=new URL("./nextfloor-editor.js?v=33ed5635caca",new URL(import.meta.url)).href;return id??=import(n),id}var gg=.25,sd=n=>Math.round(n*1e3)/1e3,ad=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function ms(n,e,t,r,i){let o=ad(n,e,t);if(!o)return[r,i];let s=(a,l)=>H([a,l],o.points);return s(r,i)?[r,i]:s(r,t)?[r,t]:s(e,i)?[e,i]:[e,t]}function _g(n,e,t,r){return n.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(de(ee(o,t),r))<.02&&Math.abs(de(ee(a,t),r))<.02}))}var ps=(n,e)=>Math.abs((n-e+540)%360-180);function ld(n,e,t,r=gg){let i=ad(n,e.x,e.z);if(!i)return null;let o=i.points,s=wt(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=Qe(ee(c,l));if(d<.3)return;let p=[(c[0]-l[0])/d,(c[1]-l[1])/d],h=[-p[1]*s,p[0]*s],g=de(ee([e.x,e.z],l),p);if(g<0||g>d)return;let _=_g(n,i,l,h)?t/2:0,b=de(ee([e.x,e.z],l),h)-_,y=Math.atan2(-h[0],h[1])*180/Math.PI,$=[{rotation:y,extent:e.d/2},{rotation:y+90,extent:e.w/2},{rotation:y-90,extent:e.w/2}].reduce((z,x)=>ps(e.rotation,x.rotation)<ps(e.rotation,z.rotation)?x:z);if(ps(e.rotation,$.rotation)>50)return;let A=b-$.extent;Math.abs(A)>r||a&&Math.abs(A)>=Math.abs(a.gap)||(a={x:sd(e.x-h[0]*A),z:sd(e.z-h[1]*A),rotation:(Math.round($.rotation)%360+360)%360,gap:A})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function yi(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return r}function vi(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return r}function ud(n,e){let t=structuredClone(n);for(let r of t.floors)r.furniture=r.furniture.filter(i=>i.id!==e);return t}function cd(n,e){let t=structuredClone(n);for(let r of t.floors)r.placements=r.placements.filter(i=>i.entity_id!==e);return t}function dd(n,e,t,r){return vi(n,e,(i,o)=>{[i.x,i.z]=ms(o,i.x,i.z,t,r)})}function hd(n,e,t,r){let i=n.settings.wall_interior??.12;return yi(n,e,(o,s)=>{[o.x,o.z]=ms(s,o.x,o.z,t,r);let a=ld(s,o,i);a&&Object.assign(o,a)})}var fs=(n,e)=>((n+e)%360+360)%360,pd=n=>Number.parseFloat(n.replace(",",".")),Zn=(n,e)=>Math.round(n*10**e)/10**e;function gs(n){let{min:e,max:t,accepts:r=()=>!0}=n,i=o=>{let s=pd(o.target.value);!Number.isFinite(s)||!r(s)||n.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${n.title}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",gs);function pe(n,e){return Math.abs(e)>=1e3?`${N(n,e/1e3,1)} kW`:`${Math.round(e)} W`}function fs(n){return n.type==="tv_board"?n.h+.9:n.type==="tv_wall"||n.type==="kitchen_wall"?n.h+.25:n.h+.35}function yg(n,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(n,e)}var ld;function ud(){let n=new URL("./nextfloor-editor.js?v=75354d777978",new URL(import.meta.url)).href;return ld??=import(n),ld}var vg=.25,cd=n=>Math.round(n*1e3)/1e3,dd=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function bs(n,e,t,r,i){let o=dd(n,e,t);if(!o)return[r,i];let s=(a,l)=>H([a,l],o.points);return s(r,i)?[r,i]:s(r,t)?[r,t]:s(e,i)?[e,i]:[e,t]}function wg(n,e,t,r){return n.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(de(ee(o,t),r))<.02&&Math.abs(de(ee(a,t),r))<.02}))}var _s=(n,e)=>Math.abs((n-e+540)%360-180);function hd(n,e,t,r=vg){let i=dd(n,e.x,e.z);if(!i)return null;let o=i.points,s=wt(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=Qe(ee(c,l));if(d<.3)return;let p=[(c[0]-l[0])/d,(c[1]-l[1])/d],h=[-p[1]*s,p[0]*s],g=de(ee([e.x,e.z],l),p);if(g<0||g>d)return;let _=wg(n,i,l,h)?t/2:0,b=de(ee([e.x,e.z],l),h)-_,y=Math.atan2(-h[0],h[1])*180/Math.PI,$=[{rotation:y,extent:e.d/2},{rotation:y+90,extent:e.w/2},{rotation:y-90,extent:e.w/2}].reduce((z,x)=>_s(e.rotation,x.rotation)<_s(e.rotation,z.rotation)?x:z);if(_s(e.rotation,$.rotation)>50)return;let A=b-$.extent;Math.abs(A)>r||a&&Math.abs(A)>=Math.abs(a.gap)||(a={x:cd(e.x-h[0]*A),z:cd(e.z-h[1]*A),rotation:(Math.round($.rotation)%360+360)%360,gap:A})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Si(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return r}function $i(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return r}function pd(n,e){let t=structuredClone(n);for(let r of t.floors)r.furniture=r.furniture.filter(i=>i.id!==e);return t}function md(n,e){let t=structuredClone(n);for(let r of t.floors)r.placements=r.placements.filter(i=>i.entity_id!==e);return t}function fd(n,e,t,r){return $i(n,e,(i,o)=>{[i.x,i.z]=bs(o,i.x,i.z,t,r)})}function gd(n,e,t,r){let i=n.settings.wall_interior??.12;return Si(n,e,(o,s)=>{[o.x,o.z]=bs(s,o.x,o.z,t,r);let a=hd(s,o,i);a&&Object.assign(o,a)})}var ys=(n,e)=>((n+e)%360+360)%360,_d=n=>Number.parseFloat(n.replace(",",".")),er=(n,e)=>Math.round(n*10**e)/10**e;function vs(n){let{min:e,max:t,accepts:r=()=>!0}=n,i=o=>{let s=_d(o.target.value);!Number.isFinite(s)||!r(s)||n.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${n.title}
>${n.label}
<input type="number" inputmode="decimal" step=${n.step} min=${e} max=${t??f} .value=${String(Zn(n.value,2))} @change=${i} />
</label>`}var fd=(n,e)=>m`<button class="nf-chip" @click=${e}>${n.t("height_auto")}</button>`,md=(n,e)=>m`<button class="nf-chip" @click=${()=>e(-n)}>↺ ${n}°</button><button class="nf-chip" @click=${()=>e(n)}>↻ ${n}°</button>`;function bg(n,e){let t=n.building.floors.find(s=>s.furniture.some(a=>a.id===e)),r=t?.furniture.find(s=>s.id===e);if(!t||!r)return f;let i=(s,a)=>gs({label:n.t(a),title:n.t(`size_${s}`),value:r[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>n.editFurniture(e,u=>u[s]=Zn(l,3))}),o=ba(r)?m`${gs({label:"\u2195",title:n.t("mount_height"),value:r.mount_y??oe(t,r),step:.05,min:0,accepts:s=>s>=0,apply:s=>n.editFurniture(e,a=>a.mount_y=Zn(s,3))})}
${r.mount_y!=null?fd(n,()=>n.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function yg(n,e){let t=n.building.floors.find(l=>l.placements.some(u=>u.entity_id===e)),r=t?.placements.find(l=>l.entity_id===e);if(!t||!r)return f;let i=P(e),o=(l,u,c)=>m`<select class="nf-size-select" title=${n.t(l)} @change=${d=>n.editDevice(e,p=>Object.assign(p,{mount:d.target.value,y:null}))}>
<input type="number" inputmode="decimal" step=${n.step} min=${e} max=${t??f} .value=${String(er(n.value,2))} @change=${i} />
</label>`}var yd=(n,e)=>m`<button class="nf-chip" @click=${e}>${n.t("height_auto")}</button>`,bd=(n,e)=>m`<button class="nf-chip" @click=${()=>e(-n)}>↺ ${n}°</button><button class="nf-chip" @click=${()=>e(n)}>↻ ${n}°</button>`;function xg(n,e){let t=n.building.floors.find(s=>s.furniture.some(a=>a.id===e)),r=t?.furniture.find(s=>s.id===e);if(!t||!r)return f;let i=(s,a)=>vs({label:n.t(a),title:n.t(`size_${s}`),value:r[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>n.editFurniture(e,u=>u[s]=er(l,3))}),o=xa(r)?m`${vs({label:"\u2195",title:n.t("mount_height"),value:r.mount_y??oe(t,r),step:.05,min:0,accepts:s=>s>=0,apply:s=>n.editFurniture(e,a=>a.mount_y=er(s,3))})}
${r.mount_y!=null?yd(n,()=>n.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function kg(n,e){let t=n.building.floors.find(l=>l.placements.some(u=>u.entity_id===e)),r=t?.placements.find(l=>l.entity_id===e);if(!t||!r)return f;let i=P(e),o=(l,u,c)=>m`<select class="nf-size-select" title=${n.t(l)} @change=${d=>n.editDevice(e,p=>Object.assign(p,{mount:d.target.value,y:null}))}>
${u.map(([d,p])=>m`<option value=${d} ?selected=${d===c}>${p}</option>`)}
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,n.t(`lamp_${l}`)]),a=i?Ot(i,Me(t,r.x,r.z),i==="light"?r.mount??"ceiling":null):1;return m`${i==="light"?o("lamp_mount",s,r.mount??"ceiling"):f}
${gs({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,u=>u.y=Zn(l,3))})}
${r.y!==null?fd(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function gd(n,e,t){let r=n.t,i;if(e){let o=n.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=m`<span>${o?ae(n.hass,o):""}</span>
${bg(n,e)} ${md(45,s=>n.turnFurniture(e,s))}
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,n.t(`lamp_${l}`)]),a=i?Bt(i,Me(t,r.x,r.z),i==="light"?r.mount??"ceiling":null):1;return m`${i==="light"?o("lamp_mount",s,r.mount??"ceiling"):f}
${vs({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,u=>u.y=er(l,3))})}
${r.y!==null?yd(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function vd(n,e,t){let r=n.t,i;if(e){let o=n.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=m`<span>${o?ae(n.hass,o):""}</span>
${xg(n,e)} ${bd(45,s=>n.turnFurniture(e,s))}
<button class="nf-chip" title=${r("furn_mirror_hint")} @click=${()=>n.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${r("furn_mirror")}</button>
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeFurniture(e)}>${r("delete")}</button>`}else t?i=m`<span>${O(n.hass,t)}</span>
${yg(n,t)} ${md(45,o=>n.turnDevice(t,o))}
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeDevice(t)}>${r("delete")}</button>`:i=m`<span>${r("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>n.finish()}>${r("done")}</button></div>`}var _d=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeFurniture(e)}>${r("delete")}</button>`}else t?i=m`<span>${L(n.hass,t)}</span>
${kg(n,t)} ${bd(45,o=>n.turnDevice(t,o))}
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeDevice(t)}>${r("delete")}</button>`:i=m`<span>${r("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>n.finish()}>${r("done")}</button></div>`}var wd=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
<circle cx="256" cy="236" r="16" fill="#ffe08a"/>
</svg>`;var me=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),ln=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),_s={explode:me("explode",!0),keepRoof:me("roof",!1),solidWalls:me("solid_walls",!1),quality:ln("quality",["auto","low","high"],"auto"),stats:me("stats",!1),markers:ln("markers",["none","important","all"],"important"),heat:ln("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:ln("theme",si,"neon"),clock:ln("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:n=>/^#[0-9a-f]{6}$/i.test(n)?n:null,write:n=>n??""},floorStack:ln("floor_stack",["dim","stacked","single"],"dim"),roomNames:me("room_names",!0),clean:me("clean",!1),navWrap:me("nav_wrap",!1),weather:me("weather",!0),timeSlider:me("time_slider",!1),menuOpen:me("menu_open",!1),keepCamera:me("keep_camera",!1),readable:me("readable",!1),plain:me("plain",!1),rightBack:me("right_back",!1),zoom:{name:"zoom",fallback:100,read:n=>/^\d{2,3}$/.test(n)?Math.min(250,Math.max(60,Number(n))):100,write:n=>String(Math.round(Math.min(250,Math.max(60,n))))},screenName:{name:"screen_name",fallback:"",read:n=>n.slice(0,60),write:n=>n.trim().slice(0,60)},announceMuted:me("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:n=>/^\d{1,3}$/.test(n)?Math.min(100,Number(n)):20,write:n=>String(Math.round(Math.min(100,Math.max(0,n))))}};function bd(n=xi()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function yd(n=xi()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function xi(){try{return localStorage}catch{return null}}var wi=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let r of Object.keys(_s)){let i=_s[r],o=this.raw(i.name);t[r]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let r=_s[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var vd=J`
</svg>`;var me=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),cn=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),ws={explode:me("explode",!0),keepRoof:me("roof",!1),solidWalls:me("solid_walls",!1),quality:cn("quality",["auto","low","high"],"auto"),stats:me("stats",!1),markers:cn("markers",["none","important","all"],"important"),heat:cn("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:cn("theme",di,"neon"),clock:cn("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:n=>/^#[0-9a-f]{6}$/i.test(n)?n:null,write:n=>n??""},floorStack:cn("floor_stack",["dim","stacked","single"],"dim"),roomNames:me("room_names",!0),clean:me("clean",!1),navWrap:me("nav_wrap",!1),weather:me("weather",!0),timeSlider:me("time_slider",!1),menuOpen:me("menu_open",!1),keepCamera:me("keep_camera",!1),readable:me("readable",!1),plain:me("plain",!1),rightBack:me("right_back",!1),zoom:{name:"zoom",fallback:100,read:n=>/^\d{2,3}$/.test(n)?Math.min(250,Math.max(60,Number(n))):100,write:n=>String(Math.round(Math.min(250,Math.max(60,n))))},screenName:{name:"screen_name",fallback:"",read:n=>n.slice(0,60),write:n=>n.trim().slice(0,60)},announceMuted:me("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:n=>/^\d{1,3}$/.test(n)?Math.min(100,Number(n)):20,write:n=>String(Math.round(Math.min(100,Math.max(0,n))))}};function xd(n=Ai()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function kd(n=Ai()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Ai(){try{return localStorage}catch{return null}}var Mi=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let r of Object.keys(ws)){let i=ws[r],o=this.raw(i.name);t[r]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let r=ws[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var Sd=J`
.nf-dot {
display: inline-block;
width: 8px;
@@ -3969,11 +3969,11 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
gap: 12px;
margin: auto;
}
`;var wd=new WeakMap,xd=new WeakMap;function Et(n,e){let t=xd.get(n)??n,r=wd.get(t)??new WeakMap;wd.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let u of l.placements)u.entity_id.startsWith("cover.")&&o.set(u.entity_id,{tilt:u.cover_tilt==="none"?null:u.cover_tilt,position:u.position});for(let l of Ue(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,u]of o){let c=t.states[l];if(!c)continue;let d={...c.attributes,nf_cover_control:!0},p=Wt(t,u.position);p===null&&(p=typeof c.attributes.current_position=="number"?c.attributes.current_position:null),p!==null&&(d.current_position=p);let h=u.tilt?t.states[u.tilt]:c,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:u.tilt?Wt(t,u.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=c.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...c,state:_,attributes:d}}let a={...t,states:s,callService:async(l,u,c={})=>{if(l!=="cover")return t.callService(l,u,c);let d=Array.isArray(c.entity_id)?c.entity_id:[c.entity_id],p=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,u,{...c,entity_id:h});let _={...c,entity_id:h},b=u;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let y=b.includes("tilt");y&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return y&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(c.entity_id)?Promise.all(d.map(p)):p(d[0])}};return xd.set(a,t),r.set(e,a),a}var bs=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_topologyGroup:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Lt(this);store=new wi(xi());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._topologyGroup=_e,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:yt(Dt(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,r=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return m`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):r(t)}</button>
`;var $d=new WeakMap,Md=new WeakMap;function Et(n,e){let t=Md.get(n)??n,r=$d.get(t)??new WeakMap;$d.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let u of l.placements)u.entity_id.startsWith("cover.")&&o.set(u.entity_id,{tilt:u.cover_tilt==="none"?null:u.cover_tilt,position:u.position});for(let l of Ue(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,u]of o){let c=t.states[l];if(!c)continue;let d={...c.attributes,nf_cover_control:!0},p=Vt(t,u.position);p===null&&(p=typeof c.attributes.current_position=="number"?c.attributes.current_position:null),p!==null&&(d.current_position=p);let h=u.tilt?t.states[u.tilt]:c,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:u.tilt?Vt(t,u.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=c.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...c,state:_,attributes:d}}let a={...t,states:s,callService:async(l,u,c={})=>{if(l!=="cover")return t.callService(l,u,c);let d=Array.isArray(c.entity_id)?c.entity_id:[c.entity_id],p=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,u,{...c,entity_id:h});let _={...c,entity_id:h},b=u;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let y=b.includes("tilt");y&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return y&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(c.entity_id)?Promise.all(d.map(p)):p(d[0])}};return Md.set(a,t),r.set(e,a),a}var xs=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_topologyGroup:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Wt(this);store=new Mi(Ai());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._topologyGroup=_e,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:yt(Dt(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,r=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return m`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):r(t)}</button>
${t!==null?m`<label class="nf-chip nf-time-slider"
><input type="range" min="0" max="23.75" step="0.25" .value=${String(t)} aria-label=${e("time_of_day")} @input=${o=>this._timeDrag=Number(o.target.value)}
@change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
/></label>`:f}`}t=(e,t)=>M(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Or(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(r=>r.id===this._floorId)&&(this._floorId=null,this._topologyGroup=_e,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!=="view"&&!this.isAdmin||e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}topologySelection(e){return this._floorId?vt(e,this._floorId,this._roomId):this._topologyGroup}openTopology(e){let t=this.data.building;t&&(this._roomId=e.kind==="room"?e.id??null:null,this._floorId=e.kind==="room"?e.floorId??null:e.kind==="floor"?e.id??null:e.kind==="outside"?t.floors.find(r=>r.outdoor_location_id===e.id)?.id??null:null,this._topologyGroup=e,this._outside=!1)}openFloor(e){this._topologyGroup=_e,this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){if(e.topology)return Vt(this.hass,gr(e,this.topologySelection(e)),e.settings.outside_hidden);let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let r=Vt(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:r},r}openOutside(e){let t=this.data.building;if(t?.topology){let i=st(t,e?vt(t,e):this.topologySelection(t)).find(a=>a.selection.kind==="location");if(!i)return;let o=t.floors.find(a=>a.outdoor_location_id===i?.selection.id);if(o){let a=!this._outside;this.openTopology({kind:"outside",id:o.outdoor_location_id}),this._outside=a;return}let s=!this._outside;this.openTopology(i.selection),this._outside=s;return}let r=!this._outside;this.openFloor(null),this._outside=r}onRoomTap(e){let{floorId:t,roomId:r}=e.detail;if(r==="nf-outside")return this.openOutside(t);if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);r&&(this._roomId=r===this._roomId?null:r,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(r=>yi(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>vi(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>yi(r,e,i=>i.rotation=fs(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>vi(r,e,i=>i.rotation=fs(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>ud(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>cd(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(r=>({...r,floors:r.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this.data.building?.topology&&this.topologySelection(this.data.building).kind!=="all"?this.openTopology(mr(this.data.building,this.topologySelection(this.data.building))):this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&Hr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",r=f;return e&&(this._mode==="editor"&&this.isAdmin?r=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?r=this.renderExtensions():r=this.renderView(e)),m`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
/></label>`:f}`}t=(e,t)=>M(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Gr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(r=>r.id===this._floorId)&&(this._floorId=null,this._topologyGroup=_e,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!=="view"&&!this.isAdmin||e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}topologySelection(e){return this._floorId?vt(e,this._floorId,this._roomId):this._topologyGroup}openTopology(e){let t=this.data.building;t&&(this._roomId=e.kind==="room"?e.id??null:null,this._floorId=e.kind==="room"?e.floorId??null:e.kind==="floor"?e.id??null:Ot(t,e)?.id??null,this._topologyGroup=e,this._outside=!1)}openFloor(e){this._topologyGroup=_e,this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){if(e.topology)return Gt(this.hass,wr(e,this.topologySelection(e)),e.settings.outside_hidden);let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let r=Gt(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:r},r}openOutside(e){let t=this.data.building;if(t?.topology){let i=st(t,e?vt(t,e):this.topologySelection(t)),o=i.find(l=>l.selection.kind==="outside")?.selection,s=[...i].reverse().find(l=>["building","branch","location"].includes(l.selection.kind)&&Ot(t,Nt(l.selection))),a=o??(s?Nt(s.selection):i.find(l=>l.selection.kind==="location")?.selection);if(a){let l=!this._outside;this.openTopology(a),this._outside=l}return}let r=!this._outside;this.openFloor(null),this._outside=r}onRoomTap(e){let{floorId:t,roomId:r}=e.detail;if(r==="nf-outside")return this.openOutside(t);if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);r&&(this._roomId=r===this._roomId?null:r,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(r=>Si(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>$i(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>Si(r,e,i=>i.rotation=ys(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>$i(r,e,i=>i.rotation=ys(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>pd(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>md(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(r=>({...r,floors:r.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this.data.building?.topology&&this.topologySelection(this.data.building).kind!=="all"?this.openTopology(wn(this.data.building,this.topologySelection(this.data.building))):this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&Or(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",r=f;return e&&(this._mode==="editor"&&this.isAdmin?r=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?r=this.renderExtensions():r=this.renderView(e)),m`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
${t?f:m`${this.renderHeader(e)}${this.renderNotices()}`}
${this.data.error&&!e?m`<p class="nf-message">${this.t("load_error")}: ${this.data.error}</p>`:f}
${!e&&!this.data.error?m`<p class="nf-message">${this.t("loading")}</p>`:f}
@@ -3986,7 +3986,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</label>`}renderViewOptions(){let e=this._prefs;return m`<button class="nf-opts-btn" aria-expanded=${this._optsOpen} title=${this.t("view_options")} aria-label=${this.t("view_options")} @click=${()=>this._optsOpen=!this._optsOpen}>⚙</button>
<div class="nf-view-opts ${this._optsOpen?"nf-opts-open":""}">
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
${this.choiceRow("theme",si,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
${this.choiceRow("theme",di,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
<label class="nf-seg nf-clock-pick" title=${this.t("clock")}
>🕒
@@ -4025,7 +4025,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</div>
</div>`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",r=this.data.saveState,i=(s,a,l="")=>m`<button role="tab" class=${l} aria-pressed=${this._mode===s} @click=${()=>this.setMode(s)}>${a}</button>`,o=r==="saving"?"saving":r==="saved"?"saved":"save_error";return m`<header class="nf-header">
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
<h1 title=${t}>${_d}<span class="nf-view-title">${t}</span></h1>
<h1 title=${t}>${wd}<span class="nf-view-title">${t}</span></h1>
${this.isAdmin?m`<div class="nf-seg" role="tablist">${i("view",this.t("view"))}${i("editor",this.t("editor"))}${i("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
<span class="nf-grow"></span>
${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?m`<button class="nf-chip nf-room-names-toggle" aria-pressed=${this._prefs.roomNames} title=${this.t("room_names_toggle_hint")} @click=${()=>this.setPref("roomNames",!this._prefs.roomNames)}>${this.t("room_names_short")}</button>`:f}
@@ -4040,7 +4040,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<span>${this.t("draft_found",{time:r})}</span>
<button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button>
<button class="nf-btn" @click=${()=>e.discardDraft()}>${this.t("draft_discard")}</button>
</div>`)}return t.length>0?m`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(od().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),m`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>m`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
</div>`)}return t.length>0?m`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(ud().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),m`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>m`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
@packs-changed=${()=>{this.data.reloadPacks()}}
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}></nf-extensions>`)}renderEditor(e){return this.whenEditorLoaded(()=>m`<nf-editor
class="nf-body"
@@ -4050,10 +4050,10 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.roomLabels=${this._prefs.roomNames}
@room-names-change=${t=>this.setPref("roomNames",t.detail.value)}
.packs=${this.data.packs}
.loadCardEditor=${tr}
.loadCardEditor=${sr}
@packs-changed=${()=>{this.data.reloadPacks()}}
@building-changed=${t=>this.data.edit(t.detail.building)}
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return m`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let r=Dn(wu(t).map(i=>this.hass.states[i]));return r.count<2?f:m`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:r.count})} @click=${()=>{for(let i of r.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=r.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${r.count}</button>`}renderNav(e){if(e.topology){let u=e.floors.find(c=>c.id===this._floorId);return!u||u.outdoor_location_id?f:m`<nav class="nf-nav nf-topology-floor-nav" aria-label=${u.name}>
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return m`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let r=Nn($u(t).map(i=>this.hass.states[i]));return r.count<2?f:m`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:r.count})} @click=${()=>{for(let i of r.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=r.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${r.count}</button>`}renderNav(e){if(e.topology){let u=e.floors.find(c=>c.id===this._floorId);return!u||vn(u)?f:m`<nav class="nf-nav nf-topology-floor-nav" aria-label=${u.name}>
${u.rooms.map(c=>m`<button class="nf-chip nf-room-chip" aria-pressed=${c.id===this._roomId} @click=${()=>{this._roomId=this._roomId===c.id?null:c.id,this._outside=!1}}>${c.name}</button>`)}
${this.allOffChip(e)}
</nav>`}let t=e.floors.filter(u=>!this._floorId||u.id===this._floorId),r=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?m`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=r?m`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
@@ -4097,7 +4097,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}">
<nf-view3d
class="nf-body"
.hass=${bi(Et(this.hass,e.floors),e.settings)}
.hass=${ki(Et(this.hass,e.floors),e.settings)}
.building=${e}
.topologySelection=${this.topologySelection(e)}
.packs=${this.data.packs}
@@ -4117,7 +4117,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.keepRoof=${t.keepRoof}
.markerMode=${t.markers}
.heatMode=${t.heat}
.theme=${ai(t.theme,this.sunState())}
.theme=${hi(t.theme,this.sunState())}
.timeOfDay=${this._timeOfDay}
.clock=${t.clock==="none"?null:t.clock}
.announcements=${!V(this.hass)&&!t.announceMuted}
@@ -4136,9 +4136,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
?furnish=${this._furnish}
.selectedFurniture=${this._selFurniture}
@furniture-select=${i=>this._selFurniture=i.detail.id}
@furniture-move=${i=>this.applyEdit(o=>hd(o,i.detail.id,i.detail.x,i.detail.z))}
@furniture-move=${i=>this.applyEdit(o=>gd(o,i.detail.id,i.detail.x,i.detail.z))}
@device-select=${i=>this._selDevice=i.detail.id}
@device-move=${i=>this.applyEdit(o=>dd(o,i.detail.id,i.detail.x,i.detail.z))}
@device-move=${i=>this.applyEdit(o=>fd(o,i.detail.id,i.detail.x,i.detail.z))}
.quality=${t.quality}
?showStats=${t.stats}
@room-tap=${this.onRoomTap}
@@ -4168,9 +4168,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@close=${()=>this._outside=!1}
></nf-room-panel>`:f}
${t.clean?f:this.renderOverlay(e)}
${this._furnish?gd(this.furnishHost,this._selFurniture,this._selDevice):f}
${this._furnish?vd(this.furnishHost,this._selFurniture,this._selDevice):f}
</div>
`}static styles=[ke,Ne,vd,Lr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",bs);var vg=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,kd=(n,e)=>Number(n)*60+Number(e);function Yn(n,e,t=new Date){if(!n||n==="off")return!1;if(n==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let r=vg.exec(n.trim());if(!r)return!1;let i=kd(r[1],r[2]),o=kd(r[3],r[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var ki=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(Yn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Sd(n,e){return n?n.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(r=>({id:r.id,name:r.name||"\u2013",floorId:t.id}))})):[]}var $d=J`
`}static styles=[ke,Ne,Sd,Kr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",xs);var Sg=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Ad=(n,e)=>Number(n)*60+Number(e);function tr(n,e,t=new Date){if(!n||n==="off")return!1;if(n==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let r=Sg.exec(n.trim());if(!r)return!1;let i=Ad(r[1],r[2]),o=Ad(r[3],r[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var Ri=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(tr(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Rd(n,e){return n?n.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(r=>({id:r.id,name:r.name||"\u2013",floorId:t.id}))})):[]}var Ed=J`
ha-card {
overflow: hidden;
background: var(--nf-bg);
@@ -4294,12 +4294,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
justify-content: flex-end;
}
}
`;function ys(n,e){let t=n.template,r=t?e?.[t]:void 0;if(!r)return n;let{type:i,template:o,...s}=r;return{...s,...n}}function Md(n,e){let t=new Set(e),r=[];for(let o of n.floors){let s=o.rooms.filter(u=>t.has(u.id));if(!s.length)continue;let a=(u,c)=>s.some(d=>d.points.length>=3&&H([u,c],d.points)),l=new Set(s.map(u=>u.id));r.push({...o,rooms:s,openings:o.openings.filter(u=>l.has(u.room_id)),furniture:o.furniture.filter(u=>a(u.x,u.z)),placements:o.placements.filter(u=>a(u.x,u.z)),walls:(o.walls??[]).filter(u=>a((u.a[0]+u.b[0])/2,(u.a[1]+u.b[1])/2)),outdoor:[]})}let i={...n.settings.roof,type:"none",sections:[],solar:[]};return{...n,floors:r,settings:{...n.settings,roof:i}}}var zt="nf-outside",vs=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_topologyGroup:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Lt(this);kiosk=new ki({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._topologyGroup=_e,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this._topologyGroup=_e,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await tr(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=ys(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._topologyGroup=_e,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=Yn(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=ys(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Or(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let r=Yn(this._config?.night,this.hass);r!==this._night&&(this._night=r)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}topologySelection(){let e=this.plan(),t=this.stage().floorId;return e&&t?vt(e,t,this._roomId===zt?null:this._roomId):this._topologyGroup}openTopology(e){let t=this.plan();t&&(this._floorId=e.kind==="room"?e.floorId??null:e.kind==="floor"?e.id??null:e.kind==="outside"?t.floors.find(r=>r.outdoor_location_id===e.id)?.id??null:null,this._roomId=e.kind==="room"?e.id??null:null,this._topologyGroup=e)}back(){this._roomId?this._roomId=null:this.plan()?.topology?this.openTopology(mr(this.plan(),this.topologySelection())):this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let r=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==r)&&(this.roomsMemo={source:e,ids:r,result:Md(e,t)}),this.roomsMemo.result}t=e=>M(this.hass,e);stage(){let e=this.plan(),t=this._config,r=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&!e.topology&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===r)?r:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.expl Line truncated
`;function ks(n,e){let t=n.template,r=t?e?.[t]:void 0;if(!r)return n;let{type:i,template:o,...s}=r;return{...s,...n}}function zd(n,e){let t=new Set(e),r=[];for(let o of n.floors){let s=o.rooms.filter(u=>t.has(u.id));if(!s.length)continue;let a=(u,c)=>s.some(d=>d.points.length>=3&&H([u,c],d.points)),l=new Set(s.map(u=>u.id));r.push({...o,rooms:s,openings:o.openings.filter(u=>l.has(u.room_id)),furniture:o.furniture.filter(u=>a(u.x,u.z)),placements:o.placements.filter(u=>a(u.x,u.z)),walls:(o.walls??[]).filter(u=>a((u.a[0]+u.b[0])/2,(u.a[1]+u.b[1])/2)),outdoor:[]})}let i={...n.settings.roof,type:"none",sections:[],solar:[]};return{...n,floors:r,settings:{...n.settings,roof:i}}}var zt="nf-outside",Ss=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_topologyGroup:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Wt(this);kiosk=new Ri({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._topologyGroup=_e,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this._topologyGroup=_e,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await sr(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=ks(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._topologyGroup=_e,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=tr(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=ks(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Gr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let r=tr(this._config?.night,this.hass);r!==this._night&&(this._night=r)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}topologySelection(){let e=this.plan(),t=this.stage().floorId;return e&&t?vt(e,t,this._roomId===zt?null:this._roomId):this._topologyGroup}openTopology(e){let t=this.plan();t&&(this._floorId=e.kind==="room"?e.floorId??null:e.kind==="floor"?e.id??null:Ot(t,e)?.id??null,this._roomId=e.kind==="room"?e.id??null:null,this._topologyGroup=e)}back(){this._roomId?this._roomId=null:this.plan()?.topology?this.openTopology(wn(this.plan(),this.topologySelection())):this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let r=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==r)&&(this.roomsMemo={source:e,ids:r,result:zd(e,t)}),this.roomsMemo.result}t=e=>M(this.hass,e);stage(){let e=this.plan(),t=this._config,r=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&!e.topology&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===r)?r:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.control Line truncated
${e.canGoBack?m`<button class="nf-chip" @click=${()=>this.back()}>${r("back")}</button>`:f}
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",r("walls_auto")],[e.walls==="cut",()=>this._walls="cut",r("walls_cut")],[e.walls==="slope",()=>this._walls="slope",r("walls_slope")]]):f}
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,r("floors_apart")],[!e.explode,()=>this._explode=!1,r("floors_stacked")]]):f}
${i.length>0?o(r("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,r(s==="none"?"heat_off":`heat_short_${s}`)])):f}
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;if(t.topology&&(!e.floorId||t.floors.find(l=>l.id===e.floorId)?.outdoor_location_id))return f;let r=Sd(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,u)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=u===this._roomId?null:u},s=!t.topology&&Vt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===zt?null:zt};return m`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;if(t.topology&&(!e.floorId||vn(t.floors.find(l=>l.id===e.floorId))))return f;let r=Rd(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,u)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=u===this._roomId?null:u},s=!t.topology&&Gt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===zt?null:zt};return m`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
${r.map(l=>m`${i?m`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(u=>m`<button class="nf-chip" aria-pressed=${u.id===this._roomId} @click=${()=>o(l.floorId,u.id)}>${u.name}</button>`)}`)}
${s?m`<button class="nf-chip" aria-pressed=${this._roomId===zt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
</div>`}renderCorners(){let e=this._config,t=this.t,r=this._clean||!!this._roomId&&e?.room_panel!==!1;return m`${e?.fullscreen_button&&!r?m`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
@@ -4308,7 +4308,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${e?.dashboard&&!r?m`<button class="nf-card-full nf-card-dash ${e.fullscreen_button?"nf-card-dash-2":""}" title=${e.dashboard_label||e.dashboard} aria-label=${e.dashboard_label||e.dashboard} @click=${()=>this.openDashboard(e.dashboard)}>
${e.dashboard_label?m`<span>${e.dashboard_label}</span>`:"\u2302"}
</button>`:f}`}renderStage(e){let t=this.plan(),r=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=r?.controls_hidden!==void 0||(r?.controls_hide_after??0)>0;return m`<nf-view3d
.hass=${bi(Et(this.hass,t.floors),t.settings)}
.hass=${ki(Et(this.hass,t.floors),t.settings)}
.building=${t}
.topologySelection=${this.topologySelection()}
.packs=${this.data.packs}
@@ -4337,7 +4337,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.zoom=${typeof r?.zoom=="number"?r.zoom:1}
.buttons=${r?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
.heatMode=${e.heat}
.theme=${ai(r?.theme,this.hass?.states["sun.sun"]?.state)}
.theme=${hi(r?.theme,this.hass?.states["sun.sun"]?.state)}
.clock=${r?.clock&&r.clock!=="none"?r.clock:null}
.lockButton=${r?.lock_button!==!1}
.walkButton=${r?.walk_button!==!1}
@@ -4355,10 +4355,10 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.panelOpen=${!!this._roomId&&r?.room_panel!==!1}
.alerts=${r?.alerts!==!1}
.alertJump=${!!r?.alert_jump}
.announcements=${!V(this.hass)&&r?.announcements!==!1&&!yd()}
.announcements=${!V(this.hass)&&r?.announcements!==!1&&!kd()}
.sensorBar=${r?.sensor_bar!==!1}
.glassWalls=${typeof r?.glass_walls=="number"?Math.min(100,Math.max(0,r.glass_walls)):null}
.screenName=${r?.screen_name??bd()}
.screenName=${r?.screen_name??xd()}
.scenes=${r?.scenes!==!1}
.clean=${this._clean}
.cleanButton=${o}
@@ -4380,11 +4380,11 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.hass=${Et(this.hass,e.floors)}
.room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null}
.floor=${e.floors.find(t=>t.rooms.some(r=>r.id===this._roomId))??null}
.outside=${this._roomId===zt?Vt(this.hass,gr(e,this.topologySelection())):null}
.outside=${this._roomId===zt?Gt(this.hass,wr(e,this.topologySelection())):null}
.confirmEntities=${kt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
@close=${()=>this._roomId=null}
></nf-room-panel>`}render(){if(this.hass&&Hr(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let r=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return m`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
></nf-room-panel>`}render(){if(this.hass&&Or(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let r=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return m`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
<div class="nf-card-body" style="height:${i}">
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(r):m`<p class="nf-card-msg">${this.data.error??(e?M(this.hass,"no_building"):M(this.hass,"loading"))}</p>`}
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
@@ -4392,7 +4392,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${r.showBar&&e?this.renderBar(r):f}
${this.renderCorners()}
</div>
</ha-card>`}static styles=[ke,Ne,$d,Lr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",vs);let n=window;n.customCards=n.customCards??[],n.customCards.push({type:"nextfloor-card",name:M(void 0,"card_name"),description:M(void 0,"card_description"),preview:!1})}Bi();
</ha-card>`}static styles=[ke,Ne,Ed,Kr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",Ss);let n=window;n.customCards=n.customCards??[],n.customCards.push({type:"nextfloor-card",name:M(void 0,"card_name"),description:M(void 0,"card_description"),preview:!1})}ji();
/*! Bundled license information:
@lit/reactive-element/css-tag.js:
+2
View File
@@ -857,6 +857,8 @@ FLOOR_SCHEMA = vol.Schema(
vol.Required("name"): _NAME,
vol.Optional("building_id"): vol.Any(None, _ID),
vol.Optional("outdoor_location_id"): vol.Any(None, _ID),
vol.Optional("outdoor_branch_id"): vol.Any(None, _ID),
vol.Optional("outdoor_building_id"): vol.Any(None, _ID),
vol.Required("elevation"): vol.All(vol.Coerce(float), vol.Range(min=-100, max=500)),
vol.Required("height"): vol.All(vol.Coerce(float), vol.Range(min=1, max=20)),
vol.Required("cut_height"): vol.All(vol.Coerce(float), vol.Range(min=0.2, max=20)),
+3 -3
View File
@@ -21,7 +21,7 @@ import type { HomeAssistant } from "./types.ts";
import { withCoverControls } from "./entities/cover-controls.ts";
import { withSymconWeather } from "./symcon-weather.ts";
import { isSymcon } from "./entities/symcon-values.ts";
import { ALL_TOPOLOGY, floorSelection, topologyOutsideFloors, topologyParent, type TopologySelection } from "./topology.ts";
import { ALL_TOPOLOGY, floorSelection, isOutdoorFloor, outsideFloor, topologyOutsideFloors, topologyParent, type TopologySelection } from "./topology.ts";
import type { WallMode } from "./viewer/viewer3d.ts";
import { lookNow } from "./themes.ts";
@@ -212,7 +212,7 @@ export class NextFloorCard extends LitElement {
private openTopology(s:TopologySelection):void {
const b=this.plan();if(!b)return;
this._floorId=s.kind==="room"?s.floorId??null:s.kind==="floor"?s.id??null:s.kind==="outside"?b.floors.find((f)=>f.outdoor_location_id===s.id)?.id??null:null;
this._floorId=s.kind==="room"?s.floorId??null:s.kind==="floor"?s.id??null:outsideFloor(b,s)?.id??null;
this._roomId=s.kind==="room"?s.id??null:null;this._topologyGroup=s;
}
@@ -288,7 +288,7 @@ export class NextFloorCard extends LitElement {
private renderRoomButtons(s: Stage): TemplateResult | typeof nothing {
const b = this.plan();
if (!this._config?.room_buttons || !b || this._clean) return nothing;
if(b.topology&&(!s.floorId||b.floors.find((f)=>f.id===s.floorId)?.outdoor_location_id))return nothing;
if(b.topology&&(!s.floorId||isOutdoorFloor(b.floors.find((f)=>f.id===s.floorId))))return nothing;
const groups = roomButtons(b, s.floorId);
if (!groups.length) return nothing;
const several = groups.length > 1;
+71 -15
View File
@@ -1,6 +1,6 @@
import { editorFloors, editorScopeChoices, editorScopeFromKey, editorScopeKey, moveSelectedFloor, reconcileEditorContext, scopeForFloor, selectEditorScope, type EditorScope } from "./editor/editor-context.ts";
import "./editor/hierarchy-manager.ts";
import { floorSelection, floorTopologyPath, normalizeTopology, topologyFloors } from "../topology.ts";
import { floorSelection, floorTopologyPath, isOutdoorFloor, normalizeTopology, topologyFloors, topologyItems } from "../topology.ts";
// 2D editor: floors, rooms (rectangles and free shapes), snapping, undo, background template.
import { html, LitElement, nothing, svg, type PropertyValues, type TemplateResult } from "lit";
@@ -78,6 +78,7 @@ import "./editor/wall-view.ts";
import "./editor/ble-locate.ts";
import { LibraryState, renderLibrary, renderPreview, type LibraryActions } from "./editor/forms/library.ts";
import { arcFreeWall, arcRoomEdge, insertCorner } from "./editor/ops/rooms.ts";
import { moveRoomToFloor, roomMovePosition } from "./editor/ops/room-move.ts";
import type { ArcActions, ArcEdit } from "./editor/forms/arc.ts";
import { dragStep, facingAngle, gridPositionAfter, hasLeftStart, headingAngle, outlineWithCornerAt, shifted, steppedDelta, straightEnd } from "./editor/ops/drags.ts";
import { snapOutdoorMove, snapToPlan, type SnapOptions } from "./editor/ops/snapping.ts";
@@ -86,7 +87,7 @@ import { devicesLayer, furnitureLayer, notesLayer } from "./editor/canvas/items.
import { dimensionsLayer } from "./editor/canvas/plan.ts";
import { renderNoteForm } from "./editor/forms/note.ts";
import { openingsLayer } from "./editor/canvas/openings.ts";
import { cutMarksLayer, floorBelowLayer, freeWallsLayer, gridLayer, meterLayer, outdoorHandlesLayer, outdoorLayer, roomHandlesLayer, roomsLayer, wallsLayer } from "./editor/canvas/plan.ts";
import { cutMarksLayer, floorBelowLayer, freeWallsLayer, gridLayer, meterLayer, outdoorHandlesLayer, outdoorLayer, roomHandlesLayer, roomsLayer, scopeOverviewLayer, wallsLayer } from "./editor/canvas/plan.ts";
import { renderEdgeHeights, type EdgeActions } from "./editor/forms/edges.ts";
import { clearWallSlope, cutEdge, joinAtCut, moveCut, setPartHeight, setWallHeight, setWallSlope, setWallThickness } from "./editor/ops/edges.ts";
import { renderDeviceForm, type DeviceActions } from "./editor/forms/device.ts";
@@ -209,6 +210,7 @@ export class NfEditor extends LitElement {
_floorId: { state: true },
_editorScope: { state: true },
_floorMove: { state: true },
_roomMove: { state: true },
_energyNote: { state: true },
_ctx: { state: true },
_fixedHint: { state: true },
@@ -267,6 +269,7 @@ export class NfEditor extends LitElement {
private declare _floorId: string | null;
private declare _editorScope: EditorScope | null;
private declare _floorMove: {floorId:string;targetId:string} | null;
private declare _roomMove: {sourceId:string;roomId:string;buildingId:string;targetId:string;x:number;z:number;error:string} | null;
/** What the import from the energy dashboard did (shown under its button). */
private declare _energyNote: string | null;
/** Open context menu (right-click, long press) at a plan point, for one item. */
@@ -333,7 +336,7 @@ export class NfEditor extends LitElement {
this.narrow = false;
this.roomLabels = true;
this._floorId = null;
this._editorScope=null;this._floorMove=null;
this._editorScope=null;this._floorMove=null;this._roomMove=null;
this._arcEdit = null;
this._routeDraft = null;
this.roof.sectionId = null;
@@ -794,6 +797,7 @@ export class NfEditor extends LitElement {
if (!this.floor?.rooms.some((r) => r.id === this.sel.room)) this.sel.room = null;
}
if(changed.has("_doc"))this.syncEditorContext();
if(changed.has("_size")&&(this._editorScope?.kind==="branch"||this._editorScope?.kind==="location"))this.fit();
}
protected firstUpdated(): void {
@@ -1062,6 +1066,7 @@ export class NfEditor extends LitElement {
<nf-view3d
.hass=${this.hass ? withSymconWeather(withCoverControls(this.hass, this._doc3d.floors), this._doc3d.settings) : undefined}
.building=${this._doc3d}
.topologySelection=${this._editorScope}
.floorId=${this.houseTool ? null : this._floorId}
.roomId=${null}
.wallMode=${this.houseTool ? "auto" : this._wall3d}
@@ -1158,6 +1163,8 @@ export class NfEditor extends LitElement {
const valid=editorScopeFromKey(this._doc,editorScopeKey(scope));if(!valid)return;
const next=selectEditorScope(this._doc,valid);
this._editorScope=next.scope;this._floorId=next.floorId;
if(scope.kind==="branch"||scope.kind==="location")this._tool="select";
this.reframe3d=true;
this.clearPlanSelection();this.fit();
}
@@ -1167,7 +1174,7 @@ export class NfEditor extends LitElement {
}
private async openFloorMove():Promise<void> {
if(!this.isAdmin||!this.floor||this.floor.outdoor_location_id||!this._doc.topology)return;
if(!this.isAdmin||!this.floor||isOutdoorFloor(this.floor)||!this._doc.topology)return;
this._floorMove={floorId:this.floor.id,targetId:""};await this.updateComplete;
const dialog=this.renderRoot.querySelector<HTMLDialogElement>(".nf-floor-move-dialog");
if(dialog&&!dialog.open)dialog.showModal();
@@ -1181,20 +1188,62 @@ export class NfEditor extends LitElement {
this.renderRoot.querySelector<HTMLDialogElement>(".nf-floor-move-dialog")?.close();
}
private async openRoomMove():Promise<void> {
if(!this.isAdmin||!this.floor||!this.room)return;
this._roomMove={sourceId:this.floor.id,roomId:this.room.id,buildingId:"",targetId:"",x:0,z:0,error:""};
await this.updateComplete;
this.renderRoot.querySelector<HTMLDialogElement>(".nf-room-move-dialog")?.showModal();
}
private applyRoomMove():void {
const move=this._roomMove;
if(!this.isAdmin||!move||move.sourceId!==this.floor?.id||move.roomId!==this.room?.id)return;
const next=structuredClone(this._doc),target=next.floors.find((f)=>f.id===move.targetId);
if(!target||target.building_id!==move.buildingId)return;
const error=moveRoomToFloor(next,move.sourceId,move.roomId,move.targetId,[move.x,move.z]);
if(error){this._roomMove={...move,error};return;}
this.setDoc(next);this.adoptFloor(move.targetId);this.selectItem("room",move.roomId);this.fit();
this.renderRoot.querySelector<HTMLDialogElement>(".nf-room-move-dialog")?.close();
}
private renderRoomMoveDialog():TemplateResult {
const move=this._roomMove,source=this._doc.floors.find((f)=>f.id===move?.sourceId),room=source?.rooms.find((r)=>r.id===move?.roomId);
const buildings=editorScopeChoices(this._doc).filter(([key])=>key.startsWith("building:"));
const floors=this._doc.floors.filter((f)=>!isOutdoorFloor(f)&&f.building_id===move?.buildingId&&f.id!==move?.sourceId);
return html`<dialog class="nf-room-move-dialog" aria-label="Raum verschieben" @close=${(e:Event)=>{if(!(e.target as HTMLDialogElement).open)this._roomMove=null;}} @keydown=${(e:KeyboardEvent)=>e.stopPropagation()}>
<header><h2>Raum verschieben</h2><button class="nf-btn" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector<HTMLDialogElement>(".nf-room-move-dialog")?.close()}>×</button></header>
${move&&source&&room?html`<p>${floorTopologyPath(this._doc,source)} / ${room.name}</p>
<div class="nf-form">
<label class="nf-field nf-wide">Zielgebäude<select class="nf-room-move-building" @change=${(e:Event)=>this._roomMove={...move,buildingId:(e.target as HTMLSelectElement).value,targetId:"",error:""}}>
<option value="" .selected=${!move.buildingId}>Gebäude auswählen</option>${buildings.map(([key,name])=>html`<option value=${key.slice(9)} .selected=${move.buildingId===key.slice(9)}>${name}</option>`)}
</select></label>
<label class="nf-field nf-wide">Zieletage<select class="nf-room-move-floor" ?disabled=${!move.buildingId} @change=${(e:Event)=>{const targetId=(e.target as HTMLSelectElement).value,f=floors.find((f)=>f.id===targetId),[x,z]=f?roomMovePosition(f):[0,0];this._roomMove={...move,targetId,x,z,error:""};}}>
<option value="" .selected=${!move.targetId}>${move.buildingId&&!floors.length?"Keine andere Etage in diesem Gebäude":"Etage auswählen"}</option>${floors.map((f)=>html`<option value=${f.id} .selected=${move.targetId===f.id}>${f.name}</option>`)}
</select></label>
${(["x","z"] as const).map((axis)=>html`<label class="nf-field">${axis.toUpperCase()} (m)<input class="nf-room-move-${axis}" type="number" step="0.05" .value=${String(move[axis])} ?disabled=${!move.targetId} @change=${(e:Event)=>this._roomMove={...move,[axis]:(e.target as HTMLInputElement).valueAsNumber,error:""}} /></label>`)}
${hint("Der Raum wird zusammen mit seinen Türen, Fenstern, Möbeln, platzierten Geräten und Notizen verschoben. Datenpunktverknüpfungen bleiben erhalten. X und Z bestimmen die linke obere Ecke auf der Zieletage; vorgeschlagen wird ein freier Platz neben den vorhandenen Räumen.","nf-wide")}
${move.error?html`<p class="nf-room-move-error nf-wide" role="alert">${move.error}</p>`:nothing}
</div>
<button class="nf-btn nf-primary nf-room-move-apply" ?disabled=${!this.isAdmin||!floors.some((f)=>f.id===move.targetId)||![move.x,move.z].every(Number.isFinite)||this.floor?.id!==move.sourceId||this.room?.id!==move.roomId} @click=${()=>this.applyRoomMove()}>Raum „${room.name}“ verschieben</button>`:nothing}
</dialog>`;
}
private renderEditorNavigation():TemplateResult|typeof nothing {
if(!this._doc.topology)return isSymcon(this.hass)?html`<div class="nf-editor-context"><button class="nf-btn nf-hierarchy-open" @click=${()=>this.openHierarchy()}>Hierarchie</button></div>`:nothing;
const scope=this._editorScope,choices=editorScopeChoices(this._doc),floors=editorFloors(this._doc,scope);
const label=choices.find(([key])=>key===editorScopeKey(scope))?.[1]??"Gebäude auswählen";
const overview=scope?.kind==="branch"||scope?.kind==="location";
const label=choices.find(([key])=>key===editorScopeKey(scope))?.[1]??"Ansicht auswählen";
return html`<div class="nf-editor-context">
<div class="nf-editor-building-row"><label>Gebäude<select class="nf-editor-building-select" aria-label="Gebäude" title=${label} @change=${(e:Event)=>{const s=editorScopeFromKey(this._doc,(e.target as HTMLSelectElement).value);if(s)this.selectBuilding(s);}}>
${!scope?html`<option value="">Gebäude auswählen</option>`:nothing}
${choices.map(([key,name])=>html`<option value=${key} .selected=${key===editorScopeKey(scope)}>${name}</option>`)}
<div class="nf-editor-building-row"><label>Ansicht<select class="nf-editor-building-select" aria-label="Ort, Niederlassung oder Gebäude" title=${label} @change=${(e:Event)=>{const s=editorScopeFromKey(this._doc,(e.target as HTMLSelectElement).value);if(s)this.selectBuilding(s);}}>
${!scope?html`<option value="">Ansicht auswählen</option>`:nothing}
${choices.map(([key,name])=>html`<option value=${key} .selected=${key===editorScopeKey(scope)}>${key.startsWith("branch:")?"Niederlassung · ":key.startsWith("location:")?"Ort · ":""}${name}</option>`)}
</select></label><button class="nf-btn nf-hierarchy-open" @click=${()=>this.openHierarchy()}>Hierarchie</button></div>
<nav class="nf-editor-floor-nav" aria-label="Etagen des gewählten Gebäudes">
<span class="nf-muted">${scope?.kind==="outside"?"Außenplan":"Etagen"}</span>
${[...floors].reverse().map((f)=>html`<button class="nf-chip" data-editor-floor=${f.id} aria-pressed=${f.id===this._floorId} @click=${()=>{this.adoptFloor(f.id);this.fit();}}>${f.name}</button>`)}
<nav class="nf-editor-floor-nav" aria-label="Untergeordnete Pläne">
<span class="nf-muted">${overview?"Auswahl":scope?.kind==="outside"?"Außenplan":"Etagen"}</span>
${overview?topologyItems(this._doc,scope).map((n)=>html`<button class="nf-chip" data-editor-scope=${n.key} @click=${()=>this.selectBuilding(n.selection as EditorScope)}>${n.name}</button>`):[...floors].reverse().map((f)=>html`<button class="nf-chip" data-editor-floor=${f.id} aria-pressed=${f.id===this._floorId} @click=${()=>{this.adoptFloor(f.id);this.fit();}}>${f.name}</button>`)}
${scope?.kind==="building"?topologyItems(this._doc,scope).filter((n)=>n.selection.kind==="outside").map((n)=>html`<button class="nf-chip" data-editor-scope=${n.key} @click=${()=>this.selectBuilding(n.selection as EditorScope)}>🌳 Außen</button>`):nothing}
${scope?.kind==="building"?html`<button class="nf-btn nf-editor-add-floor" ?disabled=${!this.isAdmin} @click=${()=>this.addFloor(null)}>+ Etage</button>`:nothing}
${this.floor&&!this.floor.outdoor_location_id?html`<button class="nf-link nf-editor-move-floor" ?disabled=${!this.isAdmin} @click=${()=>void this.openFloorMove()}>Ausgewählte Etage verschieben…</button>`:nothing}
${this.floor&&!isOutdoorFloor(this.floor)?html`<button class="nf-link nf-editor-move-floor" ?disabled=${!this.isAdmin} @click=${()=>void this.openFloorMove()}>Ausgewählte Etage verschieben…</button>`:nothing}
</nav>
</div>`;
}
@@ -1208,7 +1257,7 @@ export class NfEditor extends LitElement {
@hierarchy-change=${(e:CustomEvent<{building:Building}>)=>{e.stopPropagation();if(this.isAdmin)this.setDoc(e.detail.building);}}
@hierarchy-open=${(e:CustomEvent<EditorScope>)=>{e.stopPropagation();this.selectBuilding(e.detail);this.renderRoot.querySelector<HTMLDialogElement>(".nf-hierarchy-dialog")?.close();}}></nf-hierarchy-manager>
</dialog>
<dialog class="nf-floor-move-dialog" aria-label="Ausgewählte Etage verschieben" @close=${()=>this._floorMove=null} @keydown=${(e:KeyboardEvent)=>e.stopPropagation()}>
<dialog class="nf-floor-move-dialog" aria-label="Ausgewählte Etage verschieben" @close=${(e:Event)=>{if(!(e.target as HTMLDialogElement).open)this._floorMove=null;}} @keydown=${(e:KeyboardEvent)=>e.stopPropagation()}>
<header><h2>Ausgewählte Etage verschieben</h2><button class="nf-btn" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector<HTMLDialogElement>(".nf-floor-move-dialog")?.close()}>×</button></header>
${move&&source?html`<p class="nf-floor-move-source">${floorTopologyPath(this._doc,source)}</p>
<label class="nf-field">Zielgebäude<select class="nf-floor-move-target" @change=${(e:Event)=>this._floorMove={...move,targetId:(e.target as HTMLSelectElement).value}}>
@@ -1308,7 +1357,8 @@ export class NfEditor extends LitElement {
}
private fit(): void {
const pts = this.floor?.rooms.flatMap((r) => r.points) ?? [];
const floors=this.floor?[this.floor]:this._doc.topology?editorFloors(this._doc,this._editorScope):[];
const pts = floors.flatMap((f)=>[...f.rooms.flatMap((r)=>r.points),...f.outdoor.flatMap((a)=>a.points),...f.furniture.map((p):Vec2=>[p.x,p.z]),...f.placements.map((p):Vec2=>[p.x,p.z])]);
const b = pts.length ? bounds(pts) : { x0: 0, z0: 0, x1: 10, z1: 8 };
const margin = 1.5;
const w = b.x1 - b.x0 + 2 * margin;
@@ -1348,6 +1398,8 @@ export class NfEditor extends LitElement {
// ------------------------------------------------------------------ pointer input
private onPointerDown(e: PointerEvent): void {
const overview=(e.target as Element)?.closest("[data-overview-floor]")?.getAttribute("data-overview-floor");
if(overview){this.adoptFloor(overview);this.fit();return;}
// a form is waiting for one place on the plan: this tap is it
if (this._pick) {
const [sx, sy] = this.localPoint(e);
@@ -2256,6 +2308,8 @@ export class NfEditor extends LitElement {
private readonly onKey = (e: KeyboardEvent) => {
const path = e.composedPath();
const overview=path.find((el)=>el instanceof Element&&el.hasAttribute("data-overview-floor")) as Element|undefined;
if(overview&&(e.key==="Enter"||e.key===" ")){e.preventDefault();this.adoptFloor(overview.getAttribute("data-overview-floor"));this.fit();return;}
if (path.some((el) => el instanceof HTMLInputElement || el instanceof HTMLSelectElement || el instanceof HTMLTextAreaElement)) return;
if (!this.isConnected || !this.offsetParent) return;
if (e.key === "Escape" && this._pick) {
@@ -2352,7 +2406,7 @@ export class NfEditor extends LitElement {
${outdoorHandlesLayer(ctx, this.outdoorArea, this._tool)}
${room && this._tool === "select" ? cutMarksLayer(ctx, room) : nothing}
${headroomLayer(ctx, floor)}`
: nothing}
: this._doc.topology?scopeOverviewLayer(ctx,editorFloors(this._doc,this._editorScope)):nothing}
${this._tool === "roof" ? svg`${roofSectionsLayer(ctx, this.roof)}${roofWindowsLayer(ctx, this.roof)}${chimneysLayer(ctx, this.roof)}` : this._tool === "energy" ? svg`${roofSectionsLayer(ctx, this.roof)}${solarLayer(ctx, this.roof)}${energyRoutesLayer(ctx, this.floor, this._doc.energy.routes ?? [], this._routeDraft)}${energyMarkersLayer(ctx, this.floor, this.sel.furniture)}` : nothing}
${draftLayer(ctx, sketch, this._tool, this._draft, this._cursor)} ${guidesLayer(ctx, this._guides, this._size)}`;
}
@@ -2497,6 +2551,7 @@ export class NfEditor extends LitElement {
removeCorner: (index) => this.deleteVertex(index),
duplicate: () => this.duplicateRoom(),
remove: () => this.deleteRoom(),
move: () => {if(this.room?.id===room.id)void this.openRoomMove();},
rememberView: () => this.rememberRoomView(),
applyPackage: (pkg) => this.applyPackage(room, pkg),
openSpots: () => {
@@ -3260,6 +3315,7 @@ export class NfEditor extends LitElement {
const walls = floor ? generateWalls(floor.rooms, { exterior: this._doc.settings.wall_exterior, interior: this._doc.settings.wall_interior }, floor.walls ?? []) : null;
return html`
${this.renderHierarchyDialogs()}
${this.renderRoomMoveDialog()}
${renderPreview(this.host, this.lib.preview)}
${this._wallView
? html`<nf-wall-view .host=${this.host} .doc=${this._doc} .roomId=${this._wallView.roomId} .edge=${this._wallView.edge} @close=${() => (this._wallView = null)}></nf-wall-view>`
+14 -1
View File
@@ -7,6 +7,7 @@ import { bounds, centroid, isFixed, polygonArea, roomsReachingUp, type Floor, ty
import type { Wall } from "../../../geometry/walls.ts";
import { edgePlus, pointsAttribute, type CanvasContext } from "./context.ts";
import { formatArea, formatLength } from "../../../units.ts";
import { isOutdoorFloor } from "../../../topology.ts";
type Layer = TemplateResult | typeof nothing;
@@ -41,7 +42,7 @@ export function gridLayer(ctx: CanvasContext, size: { w: number; h: number }): L
/** The rooms of the floor below, faintly, as orientation; rooms below that rise through this floor are hatched – it stays open there. */
export function floorBelowLayer(ctx: CanvasContext): Layer {
const current=ctx.host.doc.floors.find((f)=>f.id===ctx.floorId);
const floors = ctx.host.doc.topology?ctx.host.doc.floors.filter((f)=>current?.outdoor_location_id?f.outdoor_location_id===current.outdoor_location_id:!f.outdoor_location_id&&f.building_id===current?.building_id):ctx.host.doc.floors;
const floors = ctx.host.doc.topology?ctx.host.doc.floors.filter((f)=>isOutdoorFloor(current)?f.id===current?.id:!isOutdoorFloor(f)&&f.building_id===current?.building_id):ctx.host.doc.floors;
const at = floors.findIndex((f) => f.id === ctx.floorId);
const below = at > 0 ? floors[at - 1] : undefined;
if (!below) return nothing;
@@ -51,6 +52,18 @@ export function floorBelowLayer(ctx: CanvasContext): Layer {
)}</g>`;
}
/** Read-only overview; clicking an outline first opens its actual floor for editing. */
export function scopeOverviewLayer(ctx: CanvasContext, floors: readonly Floor[]): Layer {
return svg`<g class="nf-scope-overview">${floors.map((f)=>{
const points=[...f.rooms.flatMap((r)=>r.points),...f.outdoor.flatMap((a)=>a.points)];
const c=points.length?centroid(points):null;
return svg`<g data-overview-floor=${f.id} tabindex="0" role="button" aria-label=${f.name}>
<title>${f.name}</title>${[...f.rooms.map((r)=>r.points),...f.outdoor.map((a)=>a.points)].map((p)=>svg`<polygon points=${pointsAttribute(ctx,p)} />`)}
${c?svg`<text x=${ctx.toScreen(c)[0]} y=${ctx.toScreen(c)[1]}>${f.name}</text>`:nothing}
</g>`;
})}</g>`;
}
/** The wall pieces; outer ones are drawn stronger, and walls lower than the floor lighter. */
export function wallsLayer(ctx: CanvasContext, walls: readonly Wall[]): Layer {
const full = ctx.host.floor?.height ?? 2.5;
@@ -40,5 +40,14 @@ test("location outside plans are separate editor scopes and cannot be silently t
const scope={kind:"outside" as const,id:"u"};assert.deepEqual(editorFloors(b,scope).map((f)=>f.id),["garden"]);
assert.equal(moveSelectedFloor(b,"garden","garden","a"),false);
assert.deepEqual(editorScopeFromKey(b,"outside:u"),scope);assert.equal(editorScopeFromKey(b,"building:unknown"),null);
assert.deepEqual(editorScopeChoices(b),[["building:a","Urbach / Zentrale / RAS19"],["building:b","Urbach / Zentrale / RAS21"],["building:empty","Urbach / Zentrale / Neu"],["outside:u","Urbach / Außen"]]);
assert.deepEqual(editorScopeChoices(b),[["location:u","Urbach"],["branch:nl","Urbach / Zentrale"],["building:a","Urbach / Zentrale / RAS19"],["building:b","Urbach / Zentrale / RAS21"],["building:empty","Urbach / Zentrale / Neu"],["outside:u","Urbach / Außen"]]);
});
test("selecting an entire location or branch shows its descendants without an implicit editable floor",()=>{
const b=project(),before=structuredClone(b),scope={kind:"branch" as const,id:"nl"};
const context=selectEditorScope(b,scope);
assert.deepEqual(context,{scope,floorId:null});assert.deepEqual(reconcileEditorContext(b,context),context);
assert.deepEqual(editorFloors(b,scope).map((f)=>f.id),["eg-a","eg-b"]);
assert.deepEqual(selectEditorScope(b,{kind:"location",id:"u"}).floorId,null);
assert.deepEqual(b,before);
});
@@ -1,24 +1,27 @@
import type { Building, Floor } from "../../model.ts";
import { isOutdoorFloor, outdoorOwner, outsideFloor, outsideSelection, topologyFloors, topologyKey, topologyPath, type OutsideOwnerKind } from "../../topology.ts";
export interface EditorScope { kind: "building" | "outside"; id: string }
export interface EditorScope { kind: "location" | "branch" | "building" | "outside"; id: string; ownerKind?: OutsideOwnerKind }
export interface EditorContext { scope: EditorScope | null; floorId: string | null }
export const editorScopeKey = (s: EditorScope | null): string => s ? `${s.kind}:${s.id}` : "";
export const editorScopeKey = (s: EditorScope | null): string => s ? topologyKey(s) : "";
export function scopeForFloor(f: Floor | undefined): EditorScope | null {
if(!f)return null;
return f.outdoor_location_id ? {kind:"outside",id:f.outdoor_location_id} : f.building_id ? {kind:"building",id:f.building_id} : null;
const owner=outdoorOwner(f);
return owner ? outsideSelection(owner) as EditorScope : f.building_id ? {kind:"building",id:f.building_id} : null;
}
export function editorScopeExists(b: Building, s: EditorScope | null): boolean {
return !!s && !!b.topology && (s.kind === "building" ? b.topology.buildings.some((g)=>g.id===s.id) : b.topology.locations.some((l)=>l.id===s.id)&&b.floors.some((f)=>f.outdoor_location_id===s.id));
if(!s||!b.topology)return false;
return s.kind==="outside"?!!outsideFloor(b,s):b.topology[s.kind==="building"?"buildings":s.kind==="branch"?"branches":"locations"].some((g)=>g.id===s.id);
}
export function editorFloors(b: Building, s: EditorScope | null): Floor[] {
if (!b.topology) return b.floors;
if (!editorScopeExists(b,s)) return [];
return b.floors.filter((f)=>s!.kind==="outside"?f.outdoor_location_id===s!.id:!f.outdoor_location_id&&f.building_id===s!.id);
return topologyFloors(b,s!).filter((f)=>s!.kind!=="building"||!isOutdoorFloor(f));
}
/** Navigation returns a context only: choosing a building never edits a floor's parent. */
export function selectEditorScope(b: Building, s: EditorScope): EditorContext {
return {scope:s,floorId:editorFloors(b,s)[0]?.id??null};
return {scope:s,floorId:s.kind==="branch"||s.kind==="location"?null:editorFloors(b,s)[0]?.id??null};
}
/** In particular an empty, explicitly selected building must never fall back to another building's first floor. */
export function reconcileEditorContext(b: Building, current: EditorContext): EditorContext {
@@ -26,23 +29,22 @@ export function reconcileEditorContext(b: Building, current: EditorContext): Edi
const scope = editorScopeExists(b,current.scope) ? current.scope : scopeForFloor(b.floors.find((f)=>f.id===current.floorId)??b.floors[0])
?? (b.topology.buildings[0]?{kind:"building" as const,id:b.topology.buildings[0].id}:null);
const floors=editorFloors(b,scope);
if(scope?.kind==="branch"||scope?.kind==="location")return {scope,floorId:null};
return {scope,floorId:floors.some((f)=>f.id===current.floorId)?current.floorId:floors[0]?.id??null};
}
export function editorScopeChoices(b: Building): [string,string][] {
const t=b.topology;if(!t)return [];
return [...t.buildings.map((g):[string,string]=>{
const branch=t.branches.find((n)=>n.id===g.branch_id),location=t.locations.find((l)=>l.id===branch?.location_id);
return [`building:${g.id}`,[location?.name,branch?.name,g.name].filter(Boolean).join(" / ")];
}),...t.locations.filter((l)=>b.floors.some((f)=>f.outdoor_location_id===l.id)).map((l):[string,string]=>[`outside:${l.id}`,`${l.name} / Außen`])];
const scopes:EditorScope[]=[...t.locations.map((l):EditorScope=>({kind:"location",id:l.id})),...t.branches.map((n):EditorScope=>({kind:"branch",id:n.id})),...t.buildings.map((g):EditorScope=>({kind:"building",id:g.id})),...b.floors.filter(isOutdoorFloor).map((f)=>scopeForFloor(f)!)];
return scopes.map((s)=>[editorScopeKey(s),topologyPath(b,s).slice(1).map((n)=>n.name).join(" / ")]);
}
export function editorScopeFromKey(b: Building, key: string): EditorScope | null {
const split=key.indexOf(":"),kind=key.slice(0,split),id=key.slice(split+1);
const s=kind==="building"||kind==="outside"?{kind,id} as EditorScope:null;
const [kind,...rest]=key.split(":"),ownerKind=kind==="outside"&&rest.length>1?rest.shift() as OutsideOwnerKind:undefined,id=rest.join(":");
const s=["building","branch","location","outside"].includes(kind)?{kind,id,...(ownerKind?{ownerKind}:{})} as EditorScope:null;
return editorScopeExists(b,s)?s:null;
}
/** Explicitly moves the captured, still-selected floor; stale dialogs cannot reassign another floor. */
export function moveSelectedFloor(b: Building, selectedFloorId: string|null, sourceFloorId: string, buildingId: string): boolean {
const f=b.floors.find((f)=>f.id===sourceFloorId);
if(selectedFloorId!==sourceFloorId||!f||f.outdoor_location_id||!b.topology?.buildings.some((g)=>g.id===buildingId)||f.building_id===buildingId)return false;
if(selectedFloorId!==sourceFloorId||!f||isOutdoorFloor(f)||!b.topology?.buildings.some((g)=>g.id===buildingId)||f.building_id===buildingId)return false;
f.building_id=buildingId;return true;
}
@@ -13,6 +13,7 @@ import { formatArea } from "../../../units.ts";
import type { EditorHost } from "../host.ts";
import { freeHaFloors, linkableHaFloors, unplacedAreas } from "../ops/floors.ts";
import type { SideState } from "../side-state.ts";
import { isOutdoorFloor } from "../../../topology.ts";
/** What the floor form makes the editor do. */
export interface FloorActions {
@@ -48,7 +49,7 @@ function areaRow(host: EditorHost, floor: Floor, floorActions: FloorActions): Te
/** The chips of the floors, top floor first, and the button that adds one: straight away, or after choosing a floor of Home Assistant. */
function floorChips(host: EditorHost, state: SideState, floorActions: FloorActions, selected: string | null): TemplateResult {
const free = freeHaFloors(host.doc, host.hass?.floors);
const shown=host.doc.floors.filter((f)=>!host.doc.topology||!host.floor||(host.floor.outdoor_location_id?f.outdoor_location_id===host.floor.outdoor_location_id:f.building_id===host.floor.building_id&&!f.outdoor_location_id));
const shown=host.doc.floors.filter((f)=>!host.doc.topology||!host.floor||(isOutdoorFloor(host.floor)?f.id===host.floor.id:f.building_id===host.floor.building_id&&!isOutdoorFloor(f)));
const addClicked = () => (free.length > 0 ? (state.floorMenu = !state.floorMenu) : floorActions.addFloor(null));
return html`<div class="nf-floor-list">
${[...shown].reverse().map((f) => html`<button class="nf-chip" aria-pressed=${f.id === selected} @click=${() => floorActions.openFloor(f.id)}>${f.name}</button>`)}
@@ -76,7 +77,7 @@ function shiftRow(host: EditorHost, state: SideState, floorActions: FloorActions
${floor.start_view ? html`<button class="nf-btn" title=${host.t("floor_start_view_reset")} @click=${() => host.change((_, f) => (f.start_view = null))}>↺</button>` : nothing}
<label class="nf-check nf-wide" title=${host.t("floor_shift_all_hint")}
><input type="checkbox" .checked=${state.shiftAll} @change=${(e: Event) => (state.shiftAll = (e.target as HTMLInputElement).checked)} />
${host.doc.topology ? floor.outdoor_location_id ? "Gesamten Außenplan mitnehmen" : "Alle Stockwerke dieses Gebäudes mitnehmen" : host.t("floor_shift_all")}</label
${host.doc.topology ? isOutdoorFloor(floor) ? "Gesamten Außenplan mitnehmen" : "Alle Stockwerke dieses Gebäudes mitnehmen" : host.t("floor_shift_all")}</label
>
</div>`;
}
@@ -28,6 +28,7 @@ export interface RoomActions {
removeCorner(index: number): void;
duplicate(): void;
remove(): void;
move(): void;
rememberView(): void;
applyPackage(pkg: PackageId): void;
openSpots(): void;
@@ -164,6 +165,7 @@ export function renderRoomForm(host: EditorHost, state: SideState, room: Room, a
return html`<section>
<div class="nf-h3row"><h3>${t("room")}</h3>${actions.lockButton}</div>
${host.doc.topology&&host.floor?html`<div class="nf-room-context" title=${floorTopologyPath(host.doc,host.floor)}>${floorTopologyPath(host.doc,host.floor)}</div>`:nothing}
${host.doc.topology?html`<button class="nf-btn nf-room-move-open" ?disabled=${!host.admin} @click=${()=>actions.move()}>Raum verschieben…</button>`:nothing}
<div class="nf-form">
${textField(host, t("room_name"), room.name, (v) => actions.patch({ name: v }), { wide: true })}
${selectField(host, isSymcon(host.hass)?"Bereich (Symcon)":t("area"), room.area_id ?? "", areaChoices, (id) => actions.setArea(id), { wide: true })}
@@ -1,6 +1,6 @@
import { css, html, LitElement, nothing, type PropertyValues } from "lit";
import { uid, type Building, type PlanTopology } from "../../model.ts";
import { addLocationOutside, enableTopology } from "../../topology.ts";
import { addTopologyOutside, enableTopology, isOutdoorFloor, outsideFloor, outsideSelection, type OutsideOwner } from "../../topology.ts";
import { tokens } from "../../styles.ts";
import { hint } from "./fields.ts";
import type { EditorScope } from "./editor-context.ts";
@@ -31,6 +31,13 @@ class HierarchyManager extends LitElement {
}
private publish(next:Building){this.doc=next;this.dispatchEvent(new CustomEvent("hierarchy-change",{detail:{building:next},bubbles:true,composed:true}));}
private open(scope:EditorScope){this.dispatchEvent(new CustomEvent("hierarchy-open",{detail:scope,bubbles:true,composed:true}));}
private outsideButton(owner:OutsideOwner){
const found=!!outsideFloor(this.doc,outsideSelection(owner));
return html`<button class="outside outside-${owner.kind}" ?disabled=${!this.admin&&!found} @click=${()=>{
if(!found)this.edit((b)=>{addTopologyOutside(b,owner);});
this.open(outsideSelection(owner) as EditorScope);
}}>🌳 ${found?"Außenplan öffnen":"Außenplan anlegen"}</button>`;
}
private name(label:string,value:string,save:(name:string)=>void){
return html`<label>${label}<input maxlength="100" .value=${value} ?disabled=${!this.admin} @change=${(e:Event)=>save((e.target as HTMLInputElement).value.trim())}/></label>`;
}
@@ -44,10 +51,8 @@ class HierarchyManager extends LitElement {
<section aria-label="Orte"><h3>Orte</h3><div class="items">${t.locations.map((s)=>html`<button class="pick" data-location=${s.id} aria-pressed=${s.id===this.locationId} @click=${()=>{this.locationId=s.id;this.branchId="";this.buildingId="";}}>${s.name}</button>`)}</div>
<button class="add-location" ?disabled=${!this.admin} @click=${()=>{const id=uid("location");this.edit((_,p)=>p.locations.push({id,name:`Ort ${p.locations.length+1}`}));this.locationId=id;this.branchId="";this.buildingId="";}}>+ Ort</button>
${l?html`<div class="details">${this.name("Name des Ortes",l.name,(name)=>{if(this.locationId===l.id)this.edit((_,p)=>{p.locations.find((s)=>s.id===l.id)!.name=name;});})}
<button class="outside" ?disabled=${!this.admin&&!this.doc.floors.some((f)=>f.outdoor_location_id===l.id)} @click=${()=>{
if(!this.doc.floors.some((f)=>f.outdoor_location_id===l.id))this.edit((b)=>{addLocationOutside(b,l.id);});
this.open({kind:"outside",id:l.id});
}}>🌳 ${this.doc.floors.some((f)=>f.outdoor_location_id===l.id)?"Außenplan öffnen":"Außenplan anlegen"}</button>
<button class="open-location primary" @click=${()=>this.open({kind:"location",id:l.id})}>Ort im Editor anzeigen</button>
${this.outsideButton({kind:"location",id:l.id})}
<button class="delete" ?disabled=${!this.admin||t.branches.some((s)=>s.location_id===l.id)||this.doc.floors.some((f)=>f.outdoor_location_id===l.id)} @click=${()=>this.edit((_,p)=>{p.locations=p.locations.filter((s)=>s.id!==l.id);})}>Ort entfernen</button>
</div>`:nothing}
</section>
@@ -55,15 +60,18 @@ class HierarchyManager extends LitElement {
<button class="add-branch" ?disabled=${!this.admin||!l} @click=${()=>{if(!l)return;const id=uid("branch");this.edit((_,p)=>p.branches.push({id,name:`Niederlassung ${p.branches.length+1}`,location_id:l.id}));this.branchId=id;this.buildingId="";}}>+ Niederlassung</button>
${n?html`<div class="details">${this.name("Name der Niederlassung",n.name,(name)=>{if(this.branchId===n.id)this.edit((_,p)=>{p.branches.find((s)=>s.id===n.id)!.name=name;});})}
<label>Ort der Niederlassung<select ?disabled=${!this.admin} .value=${n.location_id} @change=${(e:Event)=>{const id=(e.target as HTMLSelectElement).value;if(this.branchId!==n.id||!t.locations.some((l)=>l.id===id))return;this.edit((_,p)=>{p.branches.find((s)=>s.id===n.id)!.location_id=id;});this.locationId=id;}}>${t.locations.map((l)=>html`<option value=${l.id} .selected=${l.id===n.location_id}>${l.name}</option>`)}</select></label>
<button class="delete" ?disabled=${!this.admin||t.buildings.some((s)=>s.branch_id===n.id)} @click=${()=>this.edit((_,p)=>{p.branches=p.branches.filter((s)=>s.id!==n.id);})}>Niederlassung entfernen</button>
<button class="open-branch primary" @click=${()=>this.open({kind:"branch",id:n.id})}>Niederlassung im Editor anzeigen</button>
${this.outsideButton({kind:"branch",id:n.id})}
<button class="delete" ?disabled=${!this.admin||t.buildings.some((s)=>s.branch_id===n.id)||this.doc.floors.some((f)=>f.outdoor_branch_id===n.id)} @click=${()=>this.edit((_,p)=>{p.branches=p.branches.filter((s)=>s.id!==n.id);})}>Niederlassung entfernen</button>
</div>`:nothing}
</section>
<section aria-label="Gebäude"><h3>Gebäude</h3><div class="items">${t.buildings.filter((s)=>s.branch_id===this.branchId).map((s)=>html`<button class="pick" data-building=${s.id} aria-pressed=${s.id===this.buildingId} @click=${()=>this.buildingId=s.id}>${s.name}<small>${this.doc.floors.filter((f)=>!f.outdoor_location_id&&f.building_id===s.id).length} Etagen</small></button>`)}</div>
<section aria-label="Gebäude"><h3>Gebäude</h3><div class="items">${t.buildings.filter((s)=>s.branch_id===this.branchId).map((s)=>html`<button class="pick" data-building=${s.id} aria-pressed=${s.id===this.buildingId} @click=${()=>this.buildingId=s.id}>${s.name}<small>${this.doc.floors.filter((f)=>!isOutdoorFloor(f)&&f.building_id===s.id).length} Etagen</small></button>`)}</div>
<button class="add-building" ?disabled=${!this.admin||!n} @click=${()=>{if(!n)return;const id=uid("building");this.edit((_,p)=>p.buildings.push({id,name:`Gebäude ${p.buildings.length+1}`,branch_id:n.id}));this.buildingId=id;}}>+ Gebäude</button>
${g?html`<div class="details">${this.name("Name des Gebäudes",g.name,(name)=>{if(this.buildingId===g.id)this.edit((_,p)=>{p.buildings.find((s)=>s.id===g.id)!.name=name;});})}
<label>Niederlassung des Gebäudes<select ?disabled=${!this.admin} .value=${g.branch_id} @change=${(e:Event)=>{const id=(e.target as HTMLSelectElement).value,branch=t.branches.find((s)=>s.id===id);if(this.buildingId!==g.id||!branch)return;this.edit((_,p)=>{p.buildings.find((s)=>s.id===g.id)!.branch_id=id;});this.branchId=id;this.locationId=branch.location_id;}}>${t.branches.map((s)=>html`<option value=${s.id} .selected=${s.id===g.branch_id}>${t.locations.find((l)=>l.id===s.location_id)?.name} / ${s.name}</option>`)}</select></label>
<button class="open-building primary" @click=${()=>this.open({kind:"building",id:g.id})}>Im Editor auswählen</button>
<button class="delete" ?disabled=${!this.admin||this.doc.floors.some((f)=>f.building_id===g.id)} @click=${()=>this.edit((_,p)=>{p.buildings=p.buildings.filter((s)=>s.id!==g.id);})}>Gebäude entfernen</button>
${this.outsideButton({kind:"building",id:g.id})}
<button class="delete" ?disabled=${!this.admin||this.doc.floors.some((f)=>f.building_id===g.id||f.outdoor_building_id===g.id)} @click=${()=>this.edit((_,p)=>{p.buildings=p.buildings.filter((s)=>s.id!==g.id);})}>Gebäude entfernen</button>
</div>`:nothing}
</section>
</div>`;
+4 -2
View File
@@ -3,11 +3,12 @@
import { floorElevation, newFloor, uid, type Building, type Floor, type Furniture } from "../../../model.ts";
import type { HassArea, HassFloor } from "../../../types.ts";
import { isOutdoorFloor, outdoorOwner, topologyKey } from "../../../topology.ts";
/** A new floor, named after a Home Assistant floor when it comes from one, and placed at that floor's level or on top of the house. */
export function newFloorFor(doc: Building, from: HassFloor | null, names: { first: string; next(n: number): string }, parent?: string | null): Floor {
const building_id = doc.topology ? parent || doc.topology.buildings[0]?.id : undefined;
const floors = doc.topology ? doc.floors.filter((f)=>!f.outdoor_location_id&&f.building_id===building_id) : doc.floors;
const floors = doc.topology ? doc.floors.filter((f)=>!isOutdoorFloor(f)&&f.building_id===building_id) : doc.floors;
const count = floors.length;
const name = from?.name ?? (count === 0 ? names.first : names.next(count));
return { ...newFloor(uid("floor"), name, floorElevation(floors, from?.level)), ha_floor: from?.floor_id ?? null, ...(building_id?{building_id}:{}) };
@@ -67,7 +68,8 @@ export interface FloorCopyOptions {
*/
export function copyOfFloor(doc: Building, floor: Floor, name: string, options: FloorCopyOptions, id: (prefix: string) => string = uid): Floor {
const copy = structuredClone(floor);
const top = doc.floors.filter((f)=>!doc.topology||f.building_id===floor.building_id).reduce((max, f) => Math.max(max, f.elevation + f.height), floor.elevation + floor.height);
const owner=outdoorOwner(floor);
const top = doc.floors.filter((f)=>!doc.topology||(owner?topologyKey(outdoorOwner(f)??{kind:"all"})===topologyKey(owner):!isOutdoorFloor(f)&&f.building_id===floor.building_id)).reduce((max, f) => Math.max(max, f.elevation + f.height), floor.elevation + floor.height);
const rooms = new Map<string, string>();
const walls = new Map<string, string>();
copy.id = id("floor");
@@ -0,0 +1,45 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { emptyBuilding, newFloor, type Placement } from "../../../model.ts";
import { box, opening } from "../../../entities/fixtures.ts";
import { moveRoomToFloor, roomMovePosition } from "./room-move.ts";
function project(){
const b=emptyBuilding(),a={...newFloor("a","EG",0),building_id:"a"},z={...newFloor("z","OG",3),building_id:"z"};
a.rooms=[{...box("it",0,0,5,5,"symcon-category-100"),name:"IT",climate:{temperature:"sensor.1"},start_view:{theta:1,phi:1,radius:5,target:{x:2,y:0,z:3}}},box("stay",8,0,12,5)];
a.furniture=[{id:"f",type:"desk",variant:null,x:1,z:1,w:1,d:1,h:1,rotation:20,power:"sensor.2"},{id:"stay-f",type:"desk",variant:null,x:9,z:2,w:1,d:1,h:1,rotation:0}];
a.placements=[{entity_id:"light.1",x:2,z:2,y:1},{entity_id:"sensor.outside",x:2,z:2,y:1,outside:true},{entity_id:"light.stay",x:9,z:2,y:1}] as Placement[];
a.openings=[opening("door","it","door"),opening("stay-o","stay","door")];
a.walls=[{id:"partition",a:[1,1],b:[2,1],height:2.5,thickness:0.1}];
a.notes=[{id:"n",text:"Filter",x:3,z:3},{id:"stay-n",text:"Elsewhere",x:10,z:2}];
z.rooms=[box("target",20,20,25,25)];b.floors=[a,z,newFloor("other","Unchanged",0)];
b.energy.routes=[{key:"grid",points:[{floor_id:"a",x:1,z:1},{floor_id:"a",x:9,z:1}]}];return b;
}
test("moving a room transfers its geometry, openings, contents and links once and preserves unrelated rooms",()=>{
const b=project(),before=structuredClone(b),pos=roomMovePosition(b.floors[1]);assert.deepEqual(pos,[26,20]);
assert.equal(moveRoomToFloor(b,"a","it","z",pos),null);
const [a,z]=b.floors,r=z.rooms.find((r)=>r.id==="it")!;
assert.deepEqual(a.rooms,[before.floors[0].rooms[1]]);assert.equal(r.area_id,"symcon-category-100");assert.equal(r.climate?.temperature,"sensor.1");
assert.deepEqual(r.points,[[26,20],[31,20],[31,25],[26,25]]);assert.deepEqual(r.start_view?.target,{x:28,y:0,z:23});
assert.deepEqual(z.furniture,[{...before.floors[0].furniture[0],x:27,z:21}]);assert.deepEqual(a.furniture,[before.floors[0].furniture[1]]);
assert.deepEqual(z.placements,[{...before.floors[0].placements[0],x:28,z:22}]);assert.deepEqual(a.placements,before.floors[0].placements.slice(1));
assert.equal(z.openings[0].id,"door");assert.equal(z.openings[0].room_id,"it");assert.deepEqual(a.openings,[before.floors[0].openings[1]]);
assert.deepEqual(z.walls?.[0].a,[27,21]);assert.equal(a.walls?.length,0);assert.deepEqual(z.notes,[{id:"n",text:"Filter",x:29,z:23}]);
assert.deepEqual(b.energy.routes?.[0].points,[{floor_id:"z",x:27,z:21},{floor_id:"a",x:9,z:1}]);
assert.deepEqual(b.floors[2],before.floors[2]);
});
test("invalid targets, duplicate devices and stale room IDs reject the entire move before any mutation",()=>{
for(const invalid of ["same","missing","outdoor","duplicate","room","position"]){
const b=project();if(invalid==="outdoor")b.floors[1].outdoor_branch_id="hq";
if(invalid==="duplicate")b.floors[1].placements.push({...b.floors[0].placements[0]});
const before=structuredClone(b);
assert.ok(moveRoomToFloor(b,"a",invalid==="room"?"gone":"it",invalid==="same"?"a":invalid==="missing"?"gone":"z",invalid==="position"?[NaN,0]:[0,0]));assert.deepEqual(b,before);
}
});
test("a shared free wall remains for its other room and only the moved opening gets a new wall host",()=>{
const b=project(),a=b.floors[0];a.walls=[{id:"shared",a:[1,1],b:[4,1],height:2.5,thickness:0.1}];
a.openings=[{...opening("own","it","door"),wall:"shared"},{...opening("other","stay","window"),wall:"shared"}];
const original=structuredClone(a.walls[0]);assert.equal(moveRoomToFloor(b,"a","it","z",[26,20]),null);
assert.deepEqual(a.walls,[original]);assert.equal(a.openings[0].wall,"shared");assert.notEqual(b.floors[1].openings[0].wall,"shared");
assert.equal(b.floors[1].openings[0].wall,b.floors[1].walls![0].id);
});
@@ -0,0 +1,53 @@
import { bounds, pointInPolygon, uid, type Building, type Floor, type Vec2 } from "../../../model.ts";
import { isOutdoorFloor } from "../../../topology.ts";
/** Offer a free spot next to the target plan; the dialog lets the user adjust both coordinates. */
export function roomMovePosition(target: Floor): Vec2 {
const points=target.rooms.flatMap((r)=>r.points);
if(!points.length)return [0,0];
const box=bounds(points);return [box.x1+1,box.z0];
}
/** Move, never copy, the room and its contents. A rejected operation leaves the document untouched. */
export function moveRoomToFloor(b: Building, sourceId: string, roomId: string, targetId: string, position: Vec2): string | null {
const source=b.floors.find((f)=>f.id===sourceId),target=b.floors.find((f)=>f.id===targetId);
const room=source?.rooms.find((r)=>r.id===roomId);
if(!source||!target||!room)return "Raum oder Zieletage ist nicht mehr vorhanden.";
if(source===target||isOutdoorFloor(target))return "Bitte eine andere Gebäudeetage auswählen.";
if(!position.every(Number.isFinite))return "Die Zielposition muss aus gültigen Zahlen bestehen.";
const belongs=(x:number,z:number)=>source.rooms.find((r)=>pointInPolygon([x,z],r.points))?.id===roomId;
const furniture=source.furniture.filter((p)=>belongs(p.x,p.z));
const placements=source.placements.filter((p)=>!p.outside&&belongs(p.x,p.z));
const notes=(source.notes??[]).filter((p)=>belongs(p.x,p.z));
const openings=source.openings.filter((o)=>o.room_id===roomId);
if(target.rooms.some((r)=>r.id===roomId)||furniture.some((p)=>target.furniture.some((q)=>q.id===p.id))||placements.some((p)=>target.placements.some((q)=>q.entity_id===p.entity_id))||openings.some((o)=>target.openings.some((q)=>q.id===o.id))||notes.some((n)=>target.notes?.some((q)=>q.id===n.id)))return "Die Zieletage enthält bereits einen Raum oder ein Gerät mit derselben Kennung.";
const originalPoints=room.points,box=bounds(originalPoints),dx=position[0]-box.x0,dz=position[1]-box.z0;
const at=([x,z]:Vec2):Vec2=>[Math.round((x+dx)*1000)/1000,Math.round((z+dz)*1000)/1000];
const shift=(p:{x:number;z:number})=>[p.x,p.z]=at([p.x,p.z]);
const movingWalls=new Set<string>(),copiedWalls=new Map<string,string>();
let wallConflict=false;
const walls=(source.walls??[]).flatMap((w)=>{
const own=openings.some((o)=>o.wall===w.id),shared=source.openings.some((o)=>o.wall===w.id&&o.room_id!==roomId);
if(!own&&(shared||!belongs(w.a[0],w.a[1])||!belongs(w.b[0],w.b[1])))return [];
if(shared){const id=uid("wall");copiedWalls.set(w.id,id);return [{...structuredClone(w),id}];}
if(target.walls?.some((q)=>q.id===w.id)){wallConflict=true;return [];}
movingWalls.add(w.id);return [w];
});
if(wallConflict||openings.some((o)=>o.wall&&!movingWalls.has(o.wall)&&!copiedWalls.has(o.wall)))return "Eine zugehörige Wand kann nicht eindeutig auf die Zieletage verschoben werden.";
source.rooms=source.rooms.filter((r)=>r!==room);target.rooms.push(room);
const transfer=<T>(items:T[],from:T[],to:T[]):T[]=>{const set=new Set(items);to.push(...items);return from.filter((p)=>!set.has(p));};
source.furniture=transfer(furniture,source.furniture,target.furniture);
source.placements=transfer(placements,source.placements,target.placements);
source.openings=transfer(openings,source.openings,target.openings);
if(notes.length){target.notes??=[];source.notes=transfer(notes,source.notes??[],target.notes);}
if(walls.length){source.walls=(source.walls??[]).filter((w)=>!movingWalls.has(w.id));target.walls??=[];target.walls.push(...walls);}
room.points=room.points.map(at);
if(room.start_view?.target)shift(room.start_view.target);
for(const item of [...furniture,...placements,...notes])shift(item);
for(const w of walls){w.a=at(w.a);w.b=at(w.b);}
for(const o of openings)if(o.wall&&copiedWalls.has(o.wall))o.wall=copiedWalls.get(o.wall)!;
for(const route of b.energy.routes??[])for(const p of route.points)if(p.floor_id===sourceId&&pointInPolygon([p.x,p.z],originalPoints)){p.floor_id=targetId;shift(p);}
return null;
}
+5 -4
View File
@@ -2,15 +2,16 @@ import { css } from "lit";
/** The editor's own styles: the plan canvas, the side panel with its forms and libraries, the 3D pane and the phone layout. */
export const editorStyles = css`
.nf-scope-overview [data-overview-floor]{cursor:pointer}.nf-scope-overview polygon{fill:#03a9f41a;stroke:#03a9f4;stroke-width:1.5}.nf-scope-overview [data-overview-floor]:hover polygon,.nf-scope-overview [data-overview-floor]:focus polygon{fill:#03a9f44d}.nf-scope-overview text{fill:var(--nf-text);font-size:11px;text-anchor:middle;pointer-events:none}.nf-room-move-open{width:100%;margin-bottom:12px}.nf-room-move-error{color:var(--nf-warm)}
.nf-editor-context{display:grid;gap:8px;padding:10px 12px;border-bottom:1px solid var(--nf-line)}
.nf-editor-building-row,.nf-editor-floor-nav{display:flex;gap:8px;align-items:center;flex-wrap:wrap;min-width:0}
.nf-editor-building-row>label{display:flex;gap:8px;align-items:center;font-size:12px;min-width:0;flex:1}
.nf-editor-building-select{font:inherit;color:var(--nf-text);background:var(--nf-chrome-solid);border:1px solid var(--nf-line);border-radius:8px;padding:7px 10px;min-width:0;width:min(100%,480px)}
.nf-editor-floor-nav{font-size:12px}.nf-editor-floor-nav .nf-editor-move-floor{margin-left:auto;font-size:11px}
.nf-hierarchy-dialog,.nf-floor-move-dialog{box-sizing:border-box;width:min(1050px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:18px;border:1px solid var(--nf-line);border-radius:14px;color:var(--nf-text);background:var(--nf-chrome-solid,#1c1c1c);box-shadow:0 20px 70px #0008;font:13px/1.4 system-ui}
.nf-hierarchy-dialog::backdrop,.nf-floor-move-dialog::backdrop{background:#050b16a6;backdrop-filter:blur(3px)}
.nf-hierarchy-dialog>header,.nf-floor-move-dialog>header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}.nf-hierarchy-dialog h2,.nf-floor-move-dialog h2{font-size:17px;margin:0}
.nf-floor-move-dialog{width:min(650px,calc(100vw - 24px))}.nf-floor-move-source{overflow-wrap:anywhere}.nf-floor-move-dialog>.nf-btn{margin-top:16px}
.nf-hierarchy-dialog,.nf-floor-move-dialog,.nf-room-move-dialog{box-sizing:border-box;width:min(1050px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:18px;border:1px solid var(--nf-line);border-radius:14px;color:var(--nf-text);background:var(--nf-chrome-solid,#1c1c1c);box-shadow:0 20px 70px #0008;font:13px/1.4 system-ui}
.nf-hierarchy-dialog::backdrop,.nf-floor-move-dialog::backdrop,.nf-room-move-dialog::backdrop{background:#050b16a6;backdrop-filter:blur(3px)}
.nf-hierarchy-dialog>header,.nf-floor-move-dialog>header,.nf-room-move-dialog>header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}.nf-hierarchy-dialog h2,.nf-floor-move-dialog h2,.nf-room-move-dialog h2{font-size:17px;margin:0}
.nf-floor-move-dialog,.nf-room-move-dialog{width:min(650px,calc(100vw - 24px))}.nf-floor-move-source,.nf-room-move-dialog p{overflow-wrap:anywhere}.nf-floor-move-dialog>.nf-btn,.nf-room-move-dialog>.nf-btn{margin-top:16px}
.nf-room-area-group h4{font-size:11px;color:var(--nf-muted);margin:12px 0 4px}.nf-room-context{font-size:11px;color:var(--nf-muted);margin:4px 0 12px;overflow-wrap:anywhere}
.nf-value-links h4 { margin: 12px 0; }
.nf-value-add { min-width: 30px; font-size: 18px; padding: 3px 8px; }
+3
View File
@@ -439,6 +439,9 @@ export interface Floor {
building_id?: string | null;
/** A separate outdoor plan belonging directly to a location, outside the building/storey hierarchy. */
outdoor_location_id?: string | null;
/** Independent outdoor plans may also belong to a branch or building. Exactly one outdoor owner is set. */
outdoor_branch_id?: string | null;
outdoor_building_id?: string | null;
elevation: number;
height: number;
cut_height: number;
+8 -8
View File
@@ -24,7 +24,7 @@ import type { HomeAssistant } from "./types.ts";
import { withCoverControls } from "./entities/cover-controls.ts";
import { withSymconWeather } from "./symcon-weather.ts";
import { isSymcon } from "./entities/symcon-values.ts";
import { ALL_TOPOLOGY, floorSelection, topologyOutsideFloors, topologyParent, topologyPath, type TopologySelection } from "./topology.ts";
import { ALL_TOPOLOGY, floorSelection, isOutdoorFloor, outsideFloor, outsideSelection, topologyOutsideFloors, topologyParent, topologyPath, type TopologySelection, type OutsideOwner } from "./topology.ts";
import { allOffPlan, floorSwitchables, type ServiceCall } from "./live/all-off.ts";
import type { FloorStack, Quality, WallMode } from "./viewer/viewer3d.ts";
@@ -192,7 +192,7 @@ export class NextFloorPanel extends LitElement {
private openTopology(selection: TopologySelection): void {
const b=this.data.building;if(!b)return;
this._roomId=selection.kind==="room"?selection.id??null:null;
this._floorId=selection.kind==="room"?selection.floorId??null:selection.kind==="floor"?selection.id??null:selection.kind==="outside"?b.floors.find((f)=>f.outdoor_location_id===selection.id)?.id??null:null;
this._floorId=selection.kind==="room"?selection.floorId??null:selection.kind==="floor"?selection.id??null:outsideFloor(b,selection)?.id??null;
this._topologyGroup=selection;this._outside=false;
}
@@ -217,11 +217,11 @@ export class NextFloorPanel extends LitElement {
private openOutside(floorId?: string): void {
const b=this.data.building;
if(b?.topology){
const location=topologyPath(b,floorId?floorSelection(b,floorId):this.topologySelection(b)).find((n)=>n.selection.kind==="location");
if(!location)return;
const f=b.floors.find((f)=>f.outdoor_location_id===location?.selection.id);
if(f){const open=!this._outside;this.openTopology({kind:"outside",id:f.outdoor_location_id!});this._outside=open;return;}
const open=!this._outside;this.openTopology(location.selection);this._outside=open;return;
const path=topologyPath(b,floorId?floorSelection(b,floorId):this.topologySelection(b));
const direct=path.find((n)=>n.selection.kind==="outside")?.selection;
const owner=[...path].reverse().find((n)=>["building","branch","location"].includes(n.selection.kind)&&outsideFloor(b,outsideSelection(n.selection as OutsideOwner)));
const target=direct??(owner?outsideSelection(owner.selection as OutsideOwner):path.find((n)=>n.selection.kind==="location")?.selection);
if(target){const open=!this._outside;this.openTopology(target);this._outside=open;}return;
}
const open = !this._outside;
this.openFloor(null);
@@ -516,7 +516,7 @@ export class NextFloorPanel extends LitElement {
private renderNav(building: Building) {
if(building.topology){
const floor=building.floors.find((f)=>f.id===this._floorId);
if(!floor||floor.outdoor_location_id)return nothing;
if(!floor||isOutdoorFloor(floor))return nothing;
return html`<nav class="nf-nav nf-topology-floor-nav" aria-label=${floor.name}>
${floor.rooms.map((room)=>html`<button class="nf-chip nf-room-chip" aria-pressed=${room.id===this._roomId} @click=${()=>{this._roomId=this._roomId===room.id?null:room.id;this._outside=false;}}>${room.name}</button>`)}
${this.allOffChip(building)}
+22 -1
View File
@@ -1,7 +1,7 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { emptyBuilding, newFloor, normalizeBuilding } from "./model.ts";
import { ALL_TOPOLOGY, addLocationOutside, enableTopology, floorSelection, floorTopologyPath, normalizeTopology, topologyFloors, topologyItems, topologyOutsideFloors, topologyParent, topologyPath, topologyTree } from "./topology.ts";
import { ALL_TOPOLOGY, addLocationOutside, addTopologyOutside, enableTopology, floorSelection, floorTopologyPath, isOutdoorFloor, normalizeTopology, outsideSelection, topologyFloors, topologyItems, topologyKey, topologyOutsideFloors, topologyParent, topologyPath, topologyTree } from "./topology.ts";
import { copyOfFloor, newFloorFor } from "./components/editor/ops/floors.ts";
import { translate } from "./components/editor/ops/transform.ts";
import { box } from "./entities/fixtures.ts";
@@ -84,3 +84,24 @@ test("automatic roofs cover each building independently and leave location outdo
assert.deepEqual(buildRoof(b).map((p)=>p.floor.building_id).sort(),["ras19","ras21","ulm1"]);
assert.equal(buildRoof({...b,floors:b.floors.filter((f)=>!!f.outdoor_location_id)}).length,0);
});
test("locations, branches and buildings own independent outdoor plans with unambiguous paths and scene membership",()=>{
const b=project(),location=addLocationOutside(b,"urbach"),branch=addTopologyOutside(b,{kind:"branch",id:"hq"}),building=addTopologyOutside(b,{kind:"building",id:"ras19"});
assert.equal(addTopologyOutside(b,{kind:"branch",id:"hq"}),branch);
assert.equal(addTopologyOutside(b,{kind:"building",id:"ras19"}),building);
assert.deepEqual(topologyPath(b,floorSelection(b,branch.id)).slice(1).map((n)=>n.name),["Urbach","Zentrale","Außen"]);
assert.equal(floorTopologyPath(b,building),"Urbach / Zentrale / RAS19 / Außen");
assert.deepEqual(topologyParent(b,floorSelection(b,building.id)),{kind:"building",id:"ras19"});
const branchIds=topologyFloors(b,{kind:"branch",id:"hq"}).map((f)=>f.id);
assert.ok(branchIds.includes(branch.id)&&branchIds.includes(building.id)&&!branchIds.includes(location.id)&&!branchIds.includes("west-eg"));
assert.deepEqual(topologyFloors(b,floorSelection(b,branch.id)).map((f)=>f.id),[branch.id]);
building.rooms=[box("garden-room",0,0,3,3)];
assert.deepEqual(topologyFloors(b,floorSelection(b,building.id,"garden-room"),true).map((f)=>f.id),[building.id],"a room in an outdoor plan does not accidentally render indoor floors");
assert.deepEqual(new Set(topologyOutsideFloors(b,floorSelection(b,building.id)).map((f)=>f.id)),new Set(["eg","og",building.id]));
assert.equal(new Set(["location","branch","building"].map((kind)=>topologyKey(outsideSelection({kind:kind as "location"|"branch"|"building",id:"same"})))).size,3);
normalizeBuilding(b);const saved=normalizeBuilding(JSON.parse(JSON.stringify(b)));
assert.equal(saved.floors.find((f)=>f.id===branch.id)?.outdoor_branch_id,"hq");
assert.equal(saved.floors.find((f)=>f.id===building.id)?.outdoor_building_id,"ras19");
b.settings.roof.type="gable";
assert.equal(buildRoof({...b,floors:b.floors.filter(isOutdoorFloor)}).length,0);
});
+48 -16
View File
@@ -1,13 +1,25 @@
import { newFloor, uid, type Building, type Floor, type PlanTopology } from "./model.ts";
export type TopologyKind = "all" | "location" | "branch" | "building" | "floor" | "room" | "outside";
export interface TopologySelection { kind: TopologyKind; id?: string; floorId?: string }
export type OutsideOwnerKind = "location" | "branch" | "building";
export interface OutsideOwner { kind: OutsideOwnerKind; id: string }
export interface TopologySelection { kind: TopologyKind; id?: string; floorId?: string; ownerKind?: OutsideOwnerKind }
export interface TopologyNode {
key: string; name: string; selection: TopologySelection; floorIds: string[]; children: TopologyNode[];
room?: { floorId: string; roomId: string };
}
export const ALL_TOPOLOGY: TopologySelection = { kind: "all" };
export const topologyKey = (s: TopologySelection): string => [s.kind, s.floorId, s.id].filter(Boolean).join(":");
export const topologyKey = (s: TopologySelection): string => [s.kind, s.ownerKind, s.floorId, s.id].filter(Boolean).join(":");
export function outdoorOwner(f: Floor | undefined): OutsideOwner | null {
return f?.outdoor_building_id ? {kind:"building",id:f.outdoor_building_id}
: f?.outdoor_branch_id ? {kind:"branch",id:f.outdoor_branch_id}
: f?.outdoor_location_id ? {kind:"location",id:f.outdoor_location_id} : null;
}
export const isOutdoorFloor = (f: Floor | undefined): boolean => !!outdoorOwner(f);
export const outsideSelection = (owner: OutsideOwner): TopologySelection => ({kind:"outside",id:owner.id,...(owner.kind!=="location"?{ownerKind:owner.kind}:{})});
export function outsideFloor(b: Building, s: TopologySelection): Floor | undefined {
return s.kind==="outside" ? b.floors.find((f)=>{const o=outdoorOwner(f);return o?.kind===(s.ownerKind??"location")&&o.id===s.id;}) : undefined;
}
/** Enable the hierarchy without moving geometry or changing the stable floor/room IDs used by grants. */
export function enableTopology(b: Building, name = "Gebäude 1"): void {
@@ -39,21 +51,31 @@ export function normalizeTopology(b: Building): void {
for (const s of t.branches) s.location_id = location(s.location_id);
for (const s of t.buildings) s.branch_id = branch(s.branch_id);
for (const f of b.floors) {
if (f.outdoor_location_id) { f.outdoor_location_id=location(f.outdoor_location_id); f.building_id=null; }
else f.building_id=building(f.building_id);
const owner=outdoorOwner(f);
if (owner) {
const id=owner.kind==="building"?building(owner.id):owner.kind==="branch"?branch(owner.id):location(owner.id);
f.outdoor_location_id=owner.kind==="location"?id:null;
f.outdoor_branch_id=owner.kind==="branch"?id:null;
f.outdoor_building_id=owner.kind==="building"?id:null;
f.building_id=null;
} else f.building_id=building(f.building_id);
}
}
export function addLocationOutside(b: Building, locationId: string): Floor {
const found=b.floors.find((f)=>f.outdoor_location_id===locationId);
return addTopologyOutside(b,{kind:"location",id:locationId});
}
export function addTopologyOutside(b: Building, owner: OutsideOwner): Floor {
const found=outsideFloor(b,outsideSelection(owner));
if(found)return found;
const f={...newFloor(uid("outside"),"Außen",0),outdoor_location_id:locationId,building_id:null};
const f={...newFloor(uid("outside"),"Außen",0),[owner.kind==="building"?"outdoor_building_id":owner.kind==="branch"?"outdoor_branch_id":"outdoor_location_id"]:owner.id,building_id:null};
b.floors.push(f);return f;
}
export function floorSelection(b: Building, floorId: string, roomId?: string | null): TopologySelection {
const f=b.floors.find((f)=>f.id===floorId);
return roomId ? {kind:"room",id:roomId,floorId} : f?.outdoor_location_id ? {kind:"outside",id:f.outdoor_location_id} : {kind:"floor",id:floorId};
const owner=outdoorOwner(f);
return roomId ? {kind:"room",id:roomId,floorId} : owner ? outsideSelection(owner) : {kind:"floor",id:floorId};
}
export function topologyTree(b: Building): TopologyNode {
@@ -64,12 +86,20 @@ export function topologyTree(b: Building): TopologyNode {
const floorNode=(f:Floor)=>make("floor",f.id,f.name,f.rooms.map((r)=>make("room",r.id,r.name,[],[f.id],{floorId:f.id,roomId:r.id})),[f.id]);
if(!b.topology)return make("all",undefined,"Alle Etagen",[...b.floors].sort((a,z)=>z.elevation-a.elevation).map(floorNode));
const t=b.topology;
return make("all",undefined,"Alle Orte",t.locations.map((l)=>{
const children=t.branches.filter((n)=>n.location_id===l.id).map((n)=>make("branch",n.id,n.name,t.buildings.filter((g)=>g.branch_id===n.id).map((g)=>make("building",g.id,g.name,b.floors.filter((f)=>!f.outdoor_location_id&&f.building_id===g.id).sort((a,z)=>z.elevation-a.elevation).map(floorNode)))));
const outside=b.floors.filter((f)=>f.outdoor_location_id===l.id);
if(outside.length)children.push(make("outside",l.id,"Außen",outside.flatMap((f)=>f.rooms.map((r)=>make("room",r.id,r.name,[],[f.id],{floorId:f.id,roomId:r.id}))),outside.map((f)=>f.id)));
return make("location",l.id,l.name,children);
}));
const withOutside=(owner:OutsideOwner,children:TopologyNode[]):TopologyNode[]=>{
const f=outsideFloor(b,outsideSelection(owner));if(!f)return children;
const node=make("outside",owner.id,"Außen",f.rooms.map((r)=>make("room",r.id,r.name,[],[f.id],{floorId:f.id,roomId:r.id})),[f.id]);
node.selection=outsideSelection(owner);node.key=topologyKey(node.selection);
return [...children,node];
};
const buildingNode=(g:PlanTopology["buildings"][number]):TopologyNode=>{
const floors=b.floors.filter((f)=>!isOutdoorFloor(f)&&f.building_id===g.id).sort((a,z)=>z.elevation-a.elevation);
return make("building",g.id,g.name,withOutside({kind:"building",id:g.id},floors.map(floorNode)));
};
const branchNode=(n:PlanTopology["branches"][number]):TopologyNode=>make("branch",n.id,n.name,
withOutside({kind:"branch",id:n.id},t.buildings.filter((g)=>g.branch_id===n.id).map(buildingNode)));
return make("all",undefined,"Alle Orte",t.locations.map((l)=>make("location",l.id,l.name,
withOutside({kind:"location",id:l.id},t.branches.filter((n)=>n.location_id===l.id).map(branchNode)))));
}
export function topologyPath(b:Building,s:TopologySelection):TopologyNode[] {
@@ -91,14 +121,16 @@ export function topologyItems(b:Building,s:TopologySelection):TopologyNode[] {
export function topologyFloors(b:Building,s:TopologySelection,withStack=false):Floor[] {
if(!b.topology||s.kind==="all")return b.floors;
const path=topologyPath(b,s);
const node=(withStack&&(s.kind==="floor"||s.kind==="room")?path.find((n)=>n.selection.kind==="building"):null)??path.at(-1)!;
const node=(withStack&&(s.kind==="floor"||s.kind==="room")?path.find((n)=>n.selection.kind==="outside")??path.find((n)=>n.selection.kind==="building"):null)??path.at(-1)!;
const ids=new Set(node.floorIds);return b.floors.filter((f)=>ids.has(f.id));
}
export const topologyPlan=(b:Building,s:TopologySelection,withStack=false):Building=>({...b,floors:topologyFloors(b,s,withStack)});
/** Outside readouts also include legacy outdoor devices drawn on a location's building floors. */
/** Outside views cover only their owner's descendants, including legacy outdoor pins on indoor floors. */
export function topologyOutsideFloors(b:Building,s:TopologySelection):Floor[] {
if(!b.topology)return b.floors;
const location=topologyPath(b,s).find((n)=>n.selection.kind==="location");
const path=topologyPath(b,s),outside=path.find((n)=>n.selection.kind==="outside");
if(outside){const owner=topologyParent(b,outside.selection);return topologyFloors(b,owner);}
const location=path.find((n)=>n.selection.kind==="location");
return location?topologyFloors(b,location.selection):[];
}
export function floorTopologyPath(b:Building,f:Floor):string {
+2 -1
View File
@@ -2,6 +2,7 @@
// house view only; the viewer lifts it and fades it out when the camera zooms in.
import type { Building } from "../../model.ts";
import { isOutdoorFloor } from "../../topology.ts";
import { pushChimneys, pushRoofWindows, pushSolar, type RoofWindowState } from "./fittings.ts";
import { buildSections } from "./sections.ts";
import { buildSingleRoof } from "./single.ts";
@@ -13,7 +14,7 @@ export function buildRoof(b: Building, windows: ReadonlyMap<string, RoofWindowSt
// Automatic roofs belong to independent buildings, never to a location's outdoor plan or the global highest storey.
if (b.topology && roof?.type !== "custom") {
const groups = new Map<string, typeof b.floors>();
for (const f of b.floors) if (!f.outdoor_location_id) {
for (const f of b.floors) if (!isOutdoorFloor(f)) {
const id = f.building_id ?? "legacy";
groups.set(id, [...(groups.get(id) ?? []), f]);
}
+2 -2
View File
@@ -1,4 +1,4 @@
import type { TopologyNode } from "../topology.ts";
import { isOutdoorFloor, type TopologyNode } from "../topology.ts";
// 3D view (separate bundle, loaded on demand). Renders only when something changes.
//
// Floors are shown in three levels: the whole house (floors pulled apart or stacked), one floor
@@ -1913,7 +1913,7 @@ export class NextFloorViewer {
}
this.floors.push({
floor,
rank: b.topology ? floor.outdoor_location_id ? 0 : ordered.filter((f)=>!f.outdoor_location_id&&f.building_id===floor.building_id).indexOf(floor) : ordered.indexOf(floor),
rank: b.topology ? isOutdoorFloor(floor) ? 0 : ordered.filter((f)=>!isOutdoorFloor(f)&&f.building_id===floor.building_id).indexOf(floor) : ordered.indexOf(floor),
group,
geo,
floorMesh,
+55 -1
View File
@@ -112,6 +112,60 @@ try {
assert.equal(await page.evaluate(() => new Set(e._doc.floors.filter((f) => f.outdoor_location_id).map((f) => f.outdoor_location_id)).size), 2);
assert.equal(await page.evaluate(() => !!e.shadowRoot.querySelector(".nf-editor-add-floor")), false, "outdoor plans do not add indoor storeys");
// Branches and buildings get their own outdoor plans, alongside existing location plans.
for(const kind of ["branch","building"]){
await page.evaluate(async(kind)=>{
e.shadowRoot.querySelector(".nf-hierarchy-open").click();await settle();
manager().shadowRoot.querySelector('[data-location="u"]').click();await manager().updateComplete;
manager().shadowRoot.querySelector('[data-branch="nl"]').click();await manager().updateComplete;
manager().shadowRoot.querySelector('[data-building="b"]').click();await manager().updateComplete;
manager().shadowRoot.querySelector(`.outside-${kind}`).click();await settle();
},kind);
assert.equal(await page.evaluate(()=>e._editorScope.ownerKind),kind);
assert.equal(await page.evaluate(()=>e.floor.building_id),null);
assert.equal(await page.evaluate(()=>e.floor.outdoor_location_id),null);
}
await page.evaluate(async()=>{
window.beforeGroup=JSON.stringify(e._doc);window.beforeGroupWrites=writes;
const s=e.shadowRoot.querySelector(".nf-editor-building-select");s.value="branch:nl";s.dispatchEvent(new Event("change",{bubbles:true}));await settle();
e._split=true;await settle();
});
assert.equal(await page.evaluate(()=>e._floorId),null,"branch overview must not implicitly edit a floor");
assert.equal(await page.evaluate(()=>JSON.stringify(e._doc)),await page.evaluate(()=>window.beforeGroup));
assert.equal(await page.evaluate(()=>writes),await page.evaluate(()=>window.beforeGroupWrites));
assert.equal(await page.evaluate(()=>!!e.shadowRoot.querySelector(".nf-editor-add-floor")),false);
assert.ok(await page.evaluate(()=>e.shadowRoot.querySelector('[data-editor-scope="outside:branch:nl"]')));
await page.waitForFunction(()=>e.shadowRoot.querySelector("nf-view3d")?.viewer);
assert.deepEqual(await page.evaluate(()=>e.shadowRoot.querySelector("nf-view3d").viewer.floors.map((f)=>f.floor.id).sort()),await page.evaluate(()=>{
const buildings=new Set(e._doc.topology.buildings.filter((g)=>g.branch_id==="nl").map((g)=>g.id));
return e._doc.floors.filter((f)=>buildings.has(f.building_id)||f.outdoor_branch_id==="nl"||buildings.has(f.outdoor_building_id)).map((f)=>f.id).sort();
}));
await page.screenshot({path:join(out,"symcon-editor-branch-overview.png")});
// A complete room move is explicit, cancellable and rejects a duplicate target device with visible feedback.
await page.evaluate(async()=>{
e._split=false;await pickBuilding("b");e.adoptFloor("eg-a");e.selectItem("room","it-a");
e.change((b,f)=>{f.furniture.push({id:"moved-desk",type:"desk",variant:null,x:1,z:1,w:1,d:1,h:1,rotation:0,power:"sensor.100"});f.placements.push({entity_id:"switch.100",x:2,z:2,y:1});b.floors.find((f)=>f.id===window.addedFloor).placements.push({entity_id:"switch.100",x:0,z:0,y:1});});await settle();
window.moveBefore=JSON.stringify(e._doc);e.shadowRoot.querySelector(".nf-room-move-open").click();await settle();
window.chooseRoomTarget=async()=>{const g=e.shadowRoot.querySelector(".nf-room-move-building");g.value="empty";g.dispatchEvent(new Event("change",{bubbles:true}));await settle();const f=e.shadowRoot.querySelector(".nf-room-move-floor");f.value=window.addedFloor;f.dispatchEvent(new Event("change",{bubbles:true}));await settle();};
await chooseRoomTarget();
});
assert.equal(await page.evaluate(()=>JSON.stringify(e._doc)),await page.evaluate(()=>window.moveBefore));
await page.evaluate(async()=>{e.shadowRoot.querySelector(".nf-room-move-apply").click();await settle();});
assert.match(await page.evaluate(()=>e.shadowRoot.querySelector(".nf-room-move-error").textContent),/Kennung/);
assert.equal(await page.evaluate(()=>JSON.stringify(e._doc)),await page.evaluate(()=>window.moveBefore));
await page.evaluate(async()=>{e.shadowRoot.querySelector(".nf-room-move-dialog header button").click();await settle();e.change((b)=>{b.floors.find((f)=>f.id===window.addedFloor).placements=[];});await settle();window.moveBefore=JSON.stringify(e._doc);e.shadowRoot.querySelector(".nf-room-move-open").click();await settle();await chooseRoomTarget();});
await page.waitForFunction(()=>e.shadowRoot.querySelector(".nf-room-move-dialog").open&&e.shadowRoot.querySelector(".nf-room-move-floor"));
await page.screenshot({path:join(out,"symcon-editor-room-move.png")});
await page.evaluate(async()=>{e.shadowRoot.querySelector(".nf-room-move-dialog header button").click();await settle();});
assert.equal(await page.evaluate(()=>JSON.stringify(e._doc)),await page.evaluate(()=>window.moveBefore),"cancelling a room move must preserve the full plan");
await page.evaluate(async()=>{e.shadowRoot.querySelector(".nf-room-move-open").click();await settle();await chooseRoomTarget();e.shadowRoot.querySelector(".nf-room-move-apply").click();await settle();});
const moved=await page.evaluate(()=>[e._floorId,e.room?.id,e.room?.name,e.room?.area_id,e.floor?.furniture[0]?.id,e.floor?.furniture[0]?.power,e.floor?.placements[0]?.entity_id]);
if(!moved.at(-1))console.log(await page.evaluate(()=>({move:e._roomMove,floors:e._doc.floors.map((f)=>({id:f.id,rooms:f.rooms.map((r)=>({id:r.id,points:r.points})),devices:f.placements,furniture:f.furniture.map((f)=>({id:f.id,x:f.x,z:f.z}))}))})));
assert.deepEqual(moved,[await page.evaluate(()=>window.addedFloor),"it-a","IT","symcon-category-200","moved-desk","sensor.100","switch.100"]);
assert.equal(await page.evaluate(()=>e._doc.floors.find((f)=>f.id==="eg-a").rooms.length),0);
assert.equal(await page.evaluate(()=>e._doc.floors.find((f)=>f.id==="eg-a").furniture.length),0);
await page.setViewport({ width: 390, height: 844 });
await page.evaluate(async () => { e.shadowRoot.querySelector(".nf-hierarchy-open").click(); await settle(); });
assert.ok(await page.evaluate(() => { const d = e.shadowRoot.querySelector(".nf-hierarchy-dialog"), r = d.getBoundingClientRect(); return r.left >= 0 && r.right <= innerWidth && r.height <= innerHeight && d.scrollWidth <= d.clientWidth; }), "hierarchy dialog must fit a phone without horizontal scrolling");
@@ -125,7 +179,7 @@ try {
assert.deepEqual(await page.evaluate(() => e._doc.floors.map(({ building_id, ...f }) => f)), await page.evaluate(() => window.legacyFloors));
assert.equal(await page.evaluate(() => new Set(e._doc.floors.map((f) => f.building_id)).size), 1);
assert.deepEqual(errors, []);
console.log("OK: separate hierarchy dialog, pure building navigation and refresh, selected-building storeys, native room category links, stale form guards, explicit/cancelled floor moves, metadata without implicit storeys, per-location outdoors, legacy migration and mobile layout");
console.log("OK: separate hierarchy dialog, pure building/branch navigation and scoped 3D overview, selected-building storeys, native room links, floor moves, independent location/branch/building outdoors, explicit/cancelled room moves with contents and duplicate-device feedback, legacy migration and mobile layout");
} finally {
await browser?.close(); await new Promise((done) => server.close(done));
}
+28 -4
View File
@@ -30,10 +30,11 @@ try{
});
await page.waitForFunction(()=>window.nfPanel.shadowRoot.querySelector("nf-view3d")?.viewer);
await page.evaluate(()=>{window.topoHost=window.nfPanel;window.topoView=()=>window.topoHost.shadowRoot.querySelector("nf-view3d");});
const select=async(kind,id)=>{
await page.waitForFunction((kind,id)=>window.topoView().shadowRoot.querySelector(`.nf-thumb[data-topology-kind="${kind}"][data-topology-key="${kind}:${id}"]`),{},kind,id);
await page.evaluate((kind,id)=>window.topoView().shadowRoot.querySelector(`.nf-thumb[data-topology-kind="${kind}"][data-topology-key="${kind}:${id}"]`).click(),kind,id);
await page.waitForFunction((kind,id)=>window.topoView().topologySelection?.kind===kind&&window.topoView().topologySelection?.id===id,{},kind,id);
const select=async(kind,id,ownerKind)=>{
const key=[kind,ownerKind,id].filter(Boolean).join(":");
await page.waitForFunction((key)=>window.topoView().shadowRoot.querySelector(`.nf-thumb[data-topology-key="${key}"]`),{},key);
await page.evaluate((key)=>window.topoView().shadowRoot.querySelector(`.nf-thumb[data-topology-key="${key}"]`).click(),key);
await page.waitForFunction((kind,id,owner)=>window.topoView().topologySelection?.kind===kind&&window.topoView().topologySelection?.id===id&&(window.topoView().topologySelection?.ownerKind??null)===(owner??null),{},kind,id,ownerKind);
};
const noTopMenu=async()=>assert.equal(await page.evaluate(()=>!!window.topoHost.shadowRoot.querySelector("nav.nf-nav,.nf-card-rooms")),false,"upper room menu is absent above the floor level and outdoors");
const scene=()=>page.evaluate(()=>window.topoView().viewer.floors.map((f)=>f.floor.id).sort());
@@ -83,11 +84,34 @@ try{
assert.deepEqual(await page.evaluate(()=>window.nfPanel.shadowRoot.querySelector("nf-room-panel").outside),["sensor.903"],"legacy outdoor pins stay within their location even without a dedicated outdoor floor");
await page.evaluate(()=>window.nfPanel.shadowRoot.querySelector("nf-room-panel").dispatchEvent(new CustomEvent("close",{bubbles:true,composed:true})));
// Branch/building outdoor views have separate scenes, breadcrumbs, values and pin targets.
await page.evaluate(async()=>{
const p=window.nfPanel,b=structuredClone(window.topologyProject),base=b.floors.find((f)=>f.id==="outside-a");
for(const [id,field,parent,sensor]of[["outside-hq","outdoor_branch_id","hq",905],["outside-ras19","outdoor_building_id","ras19",906]]){
const f={...structuredClone(base),id,outdoor_location_id:null,[field]:parent};f.outdoor[0].id=id;f.outdoor[0].temp_entity=`sensor.${sensor}`;b.floors.push(f);
p.hass={...p.hass,states:{...p.hass.states,[`sensor.${sensor}`]:{entity_id:`sensor.${sensor}`,state:"22",attributes:{symcon_id:sensor,symcon_variable_type:2,symcon_value:22,symcon_formatted:"22 °C",unit_of_measurement:"°C"}}}};
}
window.topologyProject=structuredClone(b);p.data.edit(b);p.openTopology({kind:"all"});await p.updateComplete;
});
await select("location","urbach");await select("branch","hq");assert.deepEqual(await scene(),["eg","og","outside-hq","outside-ras19"]);await noTopMenu();
await select("outside","hq","branch");assert.deepEqual(await scene(),["outside-hq"]);await noTopMenu();
await page.evaluate(()=>window.topoView().dispatchEvent(new CustomEvent("room-tap",{detail:{floorId:"outside-hq",roomId:"nf-outside"},bubbles:true,composed:true})));
await page.waitForFunction(()=>window.nfPanel._outside&&window.nfPanel.shadowRoot.querySelector("nf-room-panel")?.outside?.includes("sensor.905"));
assert.deepEqual(await page.evaluate(()=>window.nfPanel.shadowRoot.querySelector("nf-room-panel").outside.slice().sort()),["sensor.903","sensor.905","sensor.906"]);
await page.evaluate(()=>{window.nfPanel.shadowRoot.querySelector("nf-room-panel").dispatchEvent(new CustomEvent("close",{bubbles:true,composed:true}));window.topoView().shadowRoot.querySelector('.nf-topology-crumbs [data-topology-key="branch:hq"]').click();});
await select("building","ras19");await select("outside","ras19","building");assert.deepEqual(await scene(),["outside-ras19"]);await noTopMenu();
await page.evaluate(()=>window.topoView().dispatchEvent(new CustomEvent("room-tap",{detail:{floorId:"outside-ras19",roomId:"nf-outside"},bubbles:true,composed:true})));
await page.waitForFunction(()=>window.nfPanel._outside&&window.nfPanel.shadowRoot.querySelector("nf-room-panel")?.outside?.includes("sensor.906"));
assert.deepEqual(await page.evaluate(()=>window.nfPanel.shadowRoot.querySelector("nf-room-panel").outside.slice().sort()),["sensor.903","sensor.906"]);
await page.screenshot({path:join(out,"symcon-topology-building-outside.png")});
// The HTML-SDK tile uses the same hierarchy and hides its own upper menu until a floor is selected.
await page.evaluate(async()=>{const p=window.nfPanel,card=document.createElement("nextfloor-card");card.setConfig({type:"custom:nextfloor-card",fill:true,room_buttons:true,controls:true});card.hass=p.hass;card.style.cssText="display:block;height:850px";document.body.append(card);await card.updateComplete;card.data.edit(structuredClone(window.topologyProject));p.style.display="none";window.topoHost=card;window.topoCard=card;await card.updateComplete;});
await page.waitForFunction(()=>window.topoView()?.viewer&&window.topoView().shadowRoot.querySelector('[data-topology-kind="location"]'));
await noTopMenu();await select("location","urbach");await select("branch","hq");await select("building","ras19");await noTopMenu();await select("floor","eg");
await page.waitForFunction(()=>window.topoCard.shadowRoot.querySelectorAll(".nf-card-rooms button").length===2);
await page.evaluate(()=>window.topoView().shadowRoot.querySelector('.nf-topology-crumbs [data-topology-key="building:ras19"]').click());
await select("outside","ras19","building");await noTopMenu();assert.deepEqual(await scene(),["outside-ras19"]);
await page.evaluate(()=>window.topoView().shadowRoot.querySelector(".nf-thumb-house").click());await noTopMenu();
await page.setViewport({width:390,height:844});
await page.waitForFunction(()=>window.topoView().shadowRoot.querySelectorAll('[data-topology-kind="location"] img').length===2);
File diff suppressed because it is too large. Load diff
+138 -138
View File
@@ -1,13 +1,13 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var x={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=n=>n===void 0?n:JSON.parse(JSON.stringify(n)));var Xn=globalThis,er=Xn.ShadowRoot&&(Xn.ShadyCSS===void 0||Xn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ei=Symbol(),Es=new WeakMap,dn=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ei)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(er&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Es.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Es.set(t,e))}return e}toString(){return this.cssText}},Rs=n=>new dn(typeof n=="string"?n:n+"",void 0,Ei),J=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new dn(t,n,Ei)},Ts=(n,e)=>{if(er)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=Xn.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},Ri=er?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return Rs(t)})(n):n;var{is:Pd,defineProperty:Id,getOwnPropertyDescriptor:Cd,getOwnPropertyNames:Nd,getOwnPropertySymbols:Ld,getPrototypeOf:Od}=Object,tr=globalThis,zs=tr.trustedTypes,Wd=zs?zs.emptyScript:"",Bd=tr.reactiveElementPolyfillSupport,hn=(n,e)=>n,Ti={toAttribute(n,e){switch(e){case Boolean:n=n?Wd:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Ds=(n,e)=>!Pd(n,e),Fs={attribute:!0,type:String,converter:Ti,reflect:!1,useDefault:!1,hasChanged:Ds};Symbol.metadata??=Symbol("metadata"),tr.litPropertyMetadata??=new WeakMap;var Ve=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Fs){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Id(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=Cd(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Fs}static _$Ei(){if(this.hasOwnProperty(hn("elementProperties")))return;let e=Od(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(hn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(hn("properties"))){let t=this.properties,r=[...Nd(t),...Ld(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(Ri(i))}else e!==void 0&&t.push(Ri(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
\f\r]`,pn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Is=/-->/g,Cs=/>/g,ft=RegExp(`>|${zi}(?:([^\\s"'>=/]+)(${zi}*=${zi}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ns=/'/g,Ls=/"/g,Vs=/^(?:script|style|textarea|title)$/i,Li=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),m=Li(1),ne=Li(2),Lg=Li(3),bt=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Os=new WeakMap,gt=_t.createTreeWalker(_t,129);function Ks(n,e){if(!Ni(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ps!==void 0?Ps.createHTML(e):e}var Gd=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=pn;for(let a=0;a<t;a++){let l=n[a],c,u,d=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===pn?u[1]==="!--"?s=Is:u[1]!==void 0?s=Cs:u[2]!==void 0?(Vs.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=ft):u[3]!==void 0&&(s=ft):s===ft?u[0]===">"?(s=i??pn,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?ft:u[3]==='"'?Ls:Ns):s===Ls||s===Ns?s=ft:s===Is||s===Cs?s=pn:(s=ft,i=void 0);let h=s===ft&&n[a+1].startsWith("/>")?" ":"";o+=s===pn?l+Vd:d>=0?(r.push(c),l.slice(0,d)+Ws+l.slice(d)+ot+h):l+ot+(d===-2?a:h)}return[Ks(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},gn=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=Gd(e,t);if(this.el=n.createElement(c,r),gt.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=gt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(Ws)){let p=u[s++],h=i.getAttribute(d).split(ot),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?Di:g[1]==="?"?Hi:g[1]==="@"?Pi:Dt}),i.removeAttribute(d)}else d.startsWith(ot)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(Vs.test(i.tagName)){let d=i.textContent.split(ot),p=d.length-1;if(p>0){i.textContent=nr?nr.emptyScript:"";for(let h=0;h<p;h++)i.append(d[h],mn()),gt.nextNode(),l.push({type:2,index:++o});i.append(d[p],mn())}}}else if(i.nodeType===8)if(i.data===Bs)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(ot,d+1))!==-1;)l.push({type:7,index:o}),d+=ot.length-1}o++}}static createElement(e,t){let r=_t.createElement("template");return r.innerHTML=e,r}};function Ft(n,e,t=n,r){if(e===bt)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=fn(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Ft(n,i._$AS(n,e.values),i,r)),e}var Fi=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??_t).importNode(t,!0);gt.currentNode=i;let o=gt.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new _n(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new Ii(o,this,e)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=gt.nextNode(),s++)}return gt.currentNode=_t,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},_n=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ft(this,e,t),fn(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==bt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Kd(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&fn(this._$AH)?this._$AA.nextSibling.data=e:this.T(_t.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=gn.createElement(Ks(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Fi(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Os.get(e.strings);return t===void 0&&Os.set(e.strings,t=new gn(e)),t}k(e){Ni(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(mn()),this.O(mn()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=Hs(e).nextSibling;Hs(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Dt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this.Line truncated
var x={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=n=>n===void 0?n:JSON.parse(JSON.stringify(n)));var ir=globalThis,or=ir.ShadowRoot&&(ir.ShadyCSS===void 0||ir.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Di=Symbol(),Fs=new WeakMap,pn=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Di)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(or&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Fs.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Fs.set(t,e))}return e}toString(){return this.cssText}},Ds=n=>new pn(typeof n=="string"?n:n+"",void 0,Di),J=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new pn(t,n,Di)},Hs=(n,e)=>{if(or)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=ir.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},Hi=or?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return Ds(t)})(n):n;var{is:Od,defineProperty:Ld,getOwnPropertyDescriptor:Wd,getOwnPropertyNames:Bd,getOwnPropertySymbols:Vd,getPrototypeOf:Kd}=Object,sr=globalThis,Ps=sr.trustedTypes,Gd=Ps?Ps.emptyScript:"",Ud=sr.reactiveElementPolyfillSupport,mn=(n,e)=>n,Pi={toAttribute(n,e){switch(e){case Boolean:n=n?Gd:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Cs=(n,e)=>!Od(n,e),Is={attribute:!0,type:String,converter:Pi,reflect:!1,useDefault:!1,hasChanged:Cs};Symbol.metadata??=Symbol("metadata"),sr.litPropertyMetadata??=new WeakMap;var Ve=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Is){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Ld(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=Wd(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Is}static _$Ei(){if(this.hasOwnProperty(mn("elementProperties")))return;let e=Kd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(mn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(mn("properties"))){let t=this.properties,r=[...Bd(t),...Vd(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(Hi(i))}else e!==void 0&&t.push(Hi(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
\f\r]`,fn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ls=/-->/g,Ws=/>/g,ft=RegExp(`>|${Ii}(?:([^\\s"'>=/]+)(${Ii}*=${Ii}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Bs=/'/g,Vs=/"/g,js=/^(?:script|style|textarea|title)$/i,Ki=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),m=Ki(1),ne=Ki(2),Vg=Ki(3),bt=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Ks=new WeakMap,gt=_t.createTreeWalker(_t,129);function qs(n,e){if(!Vi(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Os!==void 0?Os.createHTML(e):e}var Zd=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=fn;for(let a=0;a<t;a++){let l=n[a],c,u,d=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===fn?u[1]==="!--"?s=Ls:u[1]!==void 0?s=Ws:u[2]!==void 0?(js.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=ft):u[3]!==void 0&&(s=ft):s===ft?u[0]===">"?(s=i??fn,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?ft:u[3]==='"'?Vs:Bs):s===Vs||s===Bs?s=ft:s===Ls||s===Ws?s=fn:(s=ft,i=void 0);let h=s===ft&&n[a+1].startsWith("/>")?" ":"";o+=s===fn?l+jd:d>=0?(r.push(c),l.slice(0,d)+Gs+l.slice(d)+ot+h):l+ot+(d===-2?a:h)}return[qs(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},bn=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=Zd(e,t);if(this.el=n.createElement(c,r),gt.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=gt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(Gs)){let p=u[s++],h=i.getAttribute(d).split(ot),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?Ni:g[1]==="?"?Oi:g[1]==="@"?Li:Dt}),i.removeAttribute(d)}else d.startsWith(ot)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(js.test(i.tagName)){let d=i.textContent.split(ot),p=d.length-1;if(p>0){i.textContent=ar?ar.emptyScript:"";for(let h=0;h<p;h++)i.append(d[h],gn()),gt.nextNode(),l.push({type:2,index:++o});i.append(d[p],gn())}}}else if(i.nodeType===8)if(i.data===Us)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(ot,d+1))!==-1;)l.push({type:7,index:o}),d+=ot.length-1}o++}}static createElement(e,t){let r=_t.createElement("template");return r.innerHTML=e,r}};function Ft(n,e,t=n,r){if(e===bt)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=_n(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Ft(n,i._$AS(n,e.values),i,r)),e}var Ci=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??_t).importNode(t,!0);gt.currentNode=i;let o=gt.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new yn(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new Wi(o,this,e)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=gt.nextNode(),s++)}return gt.currentNode=_t,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},yn=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ft(this,e,t),_n(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==bt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):qd(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&_n(this._$AH)?this._$AA.nextSibling.data=e:this.T(_t.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=bn.createElement(qs(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Ci(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Ks.get(e.strings);return t===void 0&&Ks.set(e.strings,t=new bn(e)),t}k(e){Vi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(gn()),this.O(gn()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=Ns(e).nextSibling;Ns(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Dt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this.Line truncated
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated
:host {
--nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b);
@@ -35,7 +35,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
font-family: var(--nf-font);
color: var(--nf-text);
}
`,Wr=J`
`,Ur=J`
:host([readable]) {
--secondary-text-color: var(--primary-text-color, #e1e1e1);
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
@@ -209,9 +209,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
min-height: 40px;
}
}
`;function Br(n){return n?.themes?.darkMode===!1?"light":"dark"}function Mn(n,e){let t=new Set;return e.flatMap(r=>{let i=String(n?.states[r]?.attributes.symcon_source_entity||r),o=n?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var Tl,wo=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(Tl??=import(t).catch(i=>{throw Tl=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!Mn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return m`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
`;function jr(n){return n?.themes?.darkMode===!1?"light":"dark"}function zn(n,e){let t=new Set;return e.flatMap(r=>{let i=String(n?.states[r]?.attributes.symcon_source_entity||r),o=n?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var Hl,$o=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(Hl??=import(t).catch(i=>{throw Hl=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!zn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return m`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
</button>${this.error?m`<span role="alert">${this.error}</span>`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",wo);function G(n,e,t=""){let r=Mn(n,e);return r.length?m`<nf-trend-button .hass=${n} .ids=${r} .label=${t}></nf-trend-button>`:f}var xo=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,r,i){if(W(this.hass,e)){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,r,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}}value(e,t,r){let i=this.hass.states[t],o=ye(i),s=i?.attributes,a=r&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return m`<div class="value"><span>${e}</span><b>${Ie(i)}${G(this.hass,[t],e)}</b>
</button>${this.error?m`<span role="alert">${this.error}</span>`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",$o);function G(n,e,t=""){let r=zn(n,e);return r.length?m`<nf-trend-button .hass=${n} .ids=${r} .label=${t}></nf-trend-button>`:f}var Mo=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,r,i){if(W(this.hass,e)){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,r,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}}value(e,t,r){let i=this.hass.states[t],o=ye(i),s=i?.attributes,a=r&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return m`<div class="value"><span>${e}</span><b>${Ie(i)}${G(this.hass,[t],e)}</b>
${r&&s?.symcon_has_action&&s.symcon_variable_type===0?m`<button class="nf-chip" aria-pressed=${le(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!le(i)})}}>${le(i)?"Ein":"Aus"}</button>`:r&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?m`<input type="number" aria-label=${e} .value=${String(ve(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
@change=${l=>{let c=l.target;c.value.trim()&&c.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(c.value)})}} />`:f}
</div>`}schedule(e){let t=this.hass.states[e];if(!t?.attributes.symcon_schedule)return m`<p class="missing">Schaltuhr nicht verfügbar</p>`;let r=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=r.find(c=>c.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=c=>`${String(c.hour).padStart(2,"0")}:${String(c.minute).padStart(2,"0")}${c.second?`:${String(c.second).padStart(2,"0")}`:""}`;return m`<details class="schedule"><summary>${String(t.attributes.friendly_name??"Schaltuhr")}</summary>
@@ -220,7 +220,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${i.length?i.map(c=>m`<div class="schedule-group"><b>${a.filter((u,d)=>c.days&1<<d).join(" \xB7 ")}</b><div class="points">
${[...c.points].sort((u,d)=>u.hour*3600+u.minute*60+u.second-(d.hour*3600+d.minute*60+d.second)).map(u=>{let d=r.find(p=>p.id===u.action);return m`<span class="point"><time>${l(u)}</time><span class="dot" style=${`background:#${Number(d?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${d?.name||"Aktion"}</span>`})}
</div></div>`):m`<p class="missing">Keine Schaltpunkte vorhanden.</p>`}
</details>`}render(){if(!this.hass||!this.room)return f;let e=Rl.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],r=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return m`${r||e.length?m`<section><h3>Raumklima</h3>${r?this.value("Fu\xDFbodenheizung",r,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
</details>`}render(){if(!this.hass||!this.room)return f;let e=Dl.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],r=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return m`${r||e.length?m`<section><h3>Raumklima</h3>${r?this.value("Fu\xDFbodenheizung",r,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
${t.length?m`<section><h3>Schaltuhren</h3>${t.map(i=>this.schedule(i))}</section>`:f}
${this._error?m`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[ke,Ne,J`
:host { display:block; }
@@ -240,12 +240,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.point time { font-variant-numeric:tabular-nums; }
.dot { width:8px; height:8px; border-radius:50%; }
.error { color:var(--nf-danger,#ff6b7a); font-size:12px; }
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",xo);var Ap=new Set(["on","home","open","true","active","playing","heat","heating"]);function Ye(n,e){let t=e.show_when;if(!t?.entity||!n)return!0;let r=n.states[t.entity];if(!r||I(r))return!0;let i=String(r.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):Ap.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function zl(n,e){let t=[];for(let r of e.floors)for(let i of r.furniture)Ye(n,i)||t.push(i.id);return t.sort()}function Fl(n,e){if(!e.length)return n;let t=new Set(e);return{...n,floors:n.floors.map(r=>r.furniture.some(i=>t.has(i.id))?{...r,furniture:r.furniture.filter(i=>!t.has(i.id))}:r)}}function ae(n,e){if(!qi(e))return M(n,`furn_${e}`);let t=X(e);return t?Ep(t,e,n?.language??navigator.language):M(n,"pack_missing_item")}function Ep(n,e,t){return n.name[t.split("-")[0]]??pl(t,e)??ga(n,t)}var ee=(n,e)=>[n[0]-e[0],n[1]-e[1]],Le=(n,e)=>[n[0]+e[0],n[1]+e[1]],Ee=(n,e)=>[n[0]*e,n[1]*e],de=(n,e)=>n[0]*e[0]+n[1]*e[1],Je=(n,e)=>n[0]*e[1]-n[1]*e[0],Qe=n=>Math.hypot(n[0],n[1]),Re=n=>{let e=Qe(n)||1;return[n[0]/e,n[1]/e]},ko=n=>[-n[1],n[0]],So=n=>[n[1],-n[0]];function Dl(n){let e=n.heightEnd!==void 0;return{...n,a:n.b,b:n.a,left:n.right,right:n.left,roomLeft:n.roomRight,roomRight:n.roomLeft,height:e?n.heightEnd:n.height,heightEnd:e?n.height:void 0}}function Rp(n,e){let t=n.map(r=>({...r}));for(let r of e){let i=t.find(o=>o.room_id===r.room_id&&o.edge===r.edge&&(Math.abs(o.t1-r.t0)<1e-6||Math.abs(r.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,r.t0),i.t1=Math.max(i.t1,r.t1)):t.push({...r})}return t}function Tp(n,e,t){if(n.a===e.b)return!1;let r=Re(ee(t[n.b],t[n.a])),i=Re(ee(t[e.b],t[e.a]));return Math.abs(Je(r,i))>1e-6||de(r,i)<=0||n.free||e.free||n.heightEnd!==void 0||e.heightEnd!==void 0?!1:n.height===e.height&&n.exterior===e.exterior&&n.roomLeft===e.roomLeft&&n.roomRight===e.roomRight&&Math.abs(n.left-e.left)<=1e-9&&Math.abs(n.right-e.right)<=1e-9}function Hl(n,e,t=new Set){let r=n.slice();for(;;){let i=new Map;r.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=r[a[0]].b===s?r[a[0]]:Dl(r[a[0]]),c=r[a[1]].a===s?r[a[1]]:Dl(r[a[1]]);if(!Tp(l,c,e))continue;let u={...l,b:c.b,sources:Rp(l.sources,c.sources)};o=[...r.filter((d,p)=>p!==a[0]&&p!==a[1]),u];break}if(!o)return r;r=o}}function Pl(n,e){let t=new Map;n.forEach((i,o)=>{let s=Re(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:Ee(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let r=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)r.set(l.key,{left:Le(s,Ee(ko(l.d),l.left)),right:Le(s,Ee(So(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=Le(s,Ee(ko(l.d),l.left)),p=Le(s,Ee(So(u.d),u.right)),h=Je(l.d,u.d);if(Math.abs(h)<1e-4)return;let g=Le(d,Ee(l.d,Je(ee(p,d),u.d)/h));Qe(ee(g,s))>a||(r.get(l.key).left=g,r.get(u.key).right=g)})}return r}function Il(n,e){let t=n.filter((r,i)=>Qe(ee(r,n[(i+1)%n.length]))>e);for(;;){if(t.length<=3)return t;let r=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[ee(i,s),ee(a,i)];return Math.abs(Je(Re(l),Re(c)))<1e-7&&de(l,c)>0});if(r===-1)return t;t=t.filter((i,o)=>o!==r)}}function zp(n){let e=[];return{points:e,idOf(t){let r=e.findIndex(i=>Math.abs(i[0]-t[0])<=n&&Math.abs(i[1]-t[1])<=n);return r>=0?r:(e.push([t[0],t[1]]),e.length-1)}}}function Fp(n,e){let t=[];for(let r of n){let i=r.points;if(i.length<3||Math.abs(xt(i))<1e-6)continue;let o=xt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:r.id,edge:l,forward:!0}:{u:c,v:a,room:r.id,edge:l,forward:!1})})}return t}function Dp(n,e,t){let r=[];for(let i of n){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=Qe(a),c=Ee(a,1/l),u=e.map((p,h)=>({id:h,rel:ee(p,o)})).filter(({id:p,rel:h})=>p!==i.u&&p!==i.v&&de(h,c)>t&&de(h,c)<l-t&&Math.abs(Je(c,h))<=t).map(({id:p,rel:h})=>({t:de(h,c),id:p})).sort((p,h)=>p.t-h.t),d=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let p=0;p+1<d.length;p++){let[h,g]=[d[p],d[p+1]];r.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return r}var Cl=n=>({room_id:n.room,edge:n.edge,t0:n.t0,t1:n.t1});function Hp(n,e){let t=new Map(n.map(a=>[a.id,a])),r=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;r.set(l,[...r.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(r.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null; Line truncated
<h4>${Dn[e]} ${Oe[e]}</h4>
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",Mo);var zp=new Set(["on","home","open","true","active","playing","heat","heating"]);function Ye(n,e){let t=e.show_when;if(!t?.entity||!n)return!0;let r=n.states[t.entity];if(!r||I(r))return!0;let i=String(r.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):zp.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function Pl(n,e){let t=[];for(let r of e.floors)for(let i of r.furniture)Ye(n,i)||t.push(i.id);return t.sort()}function Il(n,e){if(!e.length)return n;let t=new Set(e);return{...n,floors:n.floors.map(r=>r.furniture.some(i=>t.has(i.id))?{...r,furniture:r.furniture.filter(i=>!t.has(i.id))}:r)}}function ae(n,e){if(!Xi(e))return M(n,`furn_${e}`);let t=X(e);return t?Fp(t,e,n?.language??navigator.language):M(n,"pack_missing_item")}function Fp(n,e,t){return n.name[t.split("-")[0]]??_l(t,e)??va(n,t)}var ee=(n,e)=>[n[0]-e[0],n[1]-e[1]],Oe=(n,e)=>[n[0]+e[0],n[1]+e[1]],Ee=(n,e)=>[n[0]*e,n[1]*e],de=(n,e)=>n[0]*e[0]+n[1]*e[1],Je=(n,e)=>n[0]*e[1]-n[1]*e[0],Qe=n=>Math.hypot(n[0],n[1]),Re=n=>{let e=Qe(n)||1;return[n[0]/e,n[1]/e]},Ao=n=>[-n[1],n[0]],Eo=n=>[n[1],-n[0]];function Cl(n){let e=n.heightEnd!==void 0;return{...n,a:n.b,b:n.a,left:n.right,right:n.left,roomLeft:n.roomRight,roomRight:n.roomLeft,height:e?n.heightEnd:n.height,heightEnd:e?n.height:void 0}}function Dp(n,e){let t=n.map(r=>({...r}));for(let r of e){let i=t.find(o=>o.room_id===r.room_id&&o.edge===r.edge&&(Math.abs(o.t1-r.t0)<1e-6||Math.abs(r.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,r.t0),i.t1=Math.max(i.t1,r.t1)):t.push({...r})}return t}function Hp(n,e,t){if(n.a===e.b)return!1;let r=Re(ee(t[n.b],t[n.a])),i=Re(ee(t[e.b],t[e.a]));return Math.abs(Je(r,i))>1e-6||de(r,i)<=0||n.free||e.free||n.heightEnd!==void 0||e.heightEnd!==void 0?!1:n.height===e.height&&n.exterior===e.exterior&&n.roomLeft===e.roomLeft&&n.roomRight===e.roomRight&&Math.abs(n.left-e.left)<=1e-9&&Math.abs(n.right-e.right)<=1e-9}function Nl(n,e,t=new Set){let r=n.slice();for(;;){let i=new Map;r.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=r[a[0]].b===s?r[a[0]]:Cl(r[a[0]]),c=r[a[1]].a===s?r[a[1]]:Cl(r[a[1]]);if(!Hp(l,c,e))continue;let u={...l,b:c.b,sources:Dp(l.sources,c.sources)};o=[...r.filter((d,p)=>p!==a[0]&&p!==a[1]),u];break}if(!o)return r;r=o}}function Ol(n,e){let t=new Map;n.forEach((i,o)=>{let s=Re(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:Ee(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let r=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)r.set(l.key,{left:Oe(s,Ee(Ao(l.d),l.left)),right:Oe(s,Ee(Eo(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=Oe(s,Ee(Ao(l.d),l.left)),p=Oe(s,Ee(Eo(u.d),u.right)),h=Je(l.d,u.d);if(Math.abs(h)<1e-4)return;let g=Oe(d,Ee(l.d,Je(ee(p,d),u.d)/h));Qe(ee(g,s))>a||(r.get(l.key).left=g,r.get(u.key).right=g)})}return r}function Ll(n,e){let t=n.filter((r,i)=>Qe(ee(r,n[(i+1)%n.length]))>e);for(;;){if(t.length<=3)return t;let r=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[ee(i,s),ee(a,i)];return Math.abs(Je(Re(l),Re(c)))<1e-7&&de(l,c)>0});if(r===-1)return t;t=t.filter((i,o)=>o!==r)}}function Pp(n){let e=[];return{points:e,idOf(t){let r=e.findIndex(i=>Math.abs(i[0]-t[0])<=n&&Math.abs(i[1]-t[1])<=n);return r>=0?r:(e.push([t[0],t[1]]),e.length-1)}}}function Ip(n,e){let t=[];for(let r of n){let i=r.points;if(i.length<3||Math.abs(xt(i))<1e-6)continue;let o=xt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:r.id,edge:l,forward:!0}:{u:c,v:a,room:r.id,edge:l,forward:!1})})}return t}function Cp(n,e,t){let r=[];for(let i of n){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=Qe(a),c=Ee(a,1/l),u=e.map((p,h)=>({id:h,rel:ee(p,o)})).filter(({id:p,rel:h})=>p!==i.u&&p!==i.v&&de(h,c)>t&&de(h,c)<l-t&&Math.abs(Je(c,h))<=t).map(({id:p,rel:h})=>({t:de(h,c),id:p})).sort((p,h)=>p.t-h.t),d=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let p=0;p+1<d.length;p++){let[h,g]=[d[p],d[p+1]];r.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return r}var Wl=n=>({room_id:n.room,edge:n.edge,t0:n.t0,t1:n.t1});function Np(n,e){let t=new Map(n.map(a=>[a.id,a])),r=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;r.set(l,[...r.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(r.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null; Line truncated
<h4>${Nn[e]} ${Le[e]}</h4>
${this.readings.filter(t=>t.kind===e).map(t=>m`<div class="reading" title=${`${t.manual?"Eigener Z\xE4hler":"Bereichsz\xE4hler"}${t.incomplete?" \xB7 Err: Mindestens ein Wert fehlt; angezeigt wird die Summe der verf\xFCgbaren Werte.":""}
${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states[r]?.attributes.friendly_name||r).join(`
`)}`}>
<span>${Jt(t)}${t.manual?m` <small>· Zähler</small>`:""}</span><b>${Be(this.hass,t)}${G(this.hass,t.sources,`${Oe[t.kind]} \xB7 ${Jt(t)}`)}</b>
<span>${Xt(t)}${t.manual?m` <small>· Zähler</small>`:""}</span><b>${Be(this.hass,t)}${G(this.hass,t.sources,`${Le[t.kind]} \xB7 ${Xt(t)}`)}</b>
</div>`)}
</section>`)}`}static styles=J`
:host { display:block; color:var(--nf-text); font:inherit; }
@@ -256,12 +256,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.reading span { color:var(--nf-muted,#aaa); }
b { white-space:nowrap; font-variant-numeric:tabular-nums; }
small { font-size:.85em; }
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",zo);var Do=Math.PI/180,ic=3,oc=.1,Fo=1/6,sc=(n,e)=>[Math.sin((e+n)*Do),-Math.cos((e+n)*Do)],Qp=["N","NE","E","SE","S","SW","W","NW"];function Xp(n,e,t){return ac(n,e,t).map(r=>r.normal)}function ac(n,e,t){let r=[];for(let i of n.openings){if(i.room_id!==e.id||i.type==="garage")continue;let o=Ol(i,n.rooms,n.walls??[]),s=o?Bl(t,i,o):null;if(!s||!s.wall.exterior)continue;let{wall:a}=s,l=Math.hypot(a.b[0]-a.a[0],a.b[1]-a.a[1]);if(l<1e-6)continue;let c=[-(a.b[1]-a.a[1])/l,(a.b[0]-a.a[0])/l],u=a.roomLeft===e.id?c:[-c[0],-c[1]];r.push({opening:i,normal:[-u[0],-u[1]]})}return r}function em(n,e){let t=((Math.atan2(n[0],-n[1])/Do-e)%360+360)%360;return Qp[Math.round(t/45)%8]}var nc=new WeakMap;function lc(n,e){let t=nc.get(e);return t||(t=jt(e.rooms,{exterior:n.settings.wall_exterior,interior:n.settings.wall_interior},e.walls??[]).walls,nc.set(e,t)),t}var rc=new WeakMap;function Qt(n,e,t,r,i=new Date){let o=`${t.id}|${i.toISOString().slice(0,10)}|${n.settings.north??0}|${r.latitude},${r.longitude},${r.zone??""}`,s=rc.get(e);s||rc.set(e,s=new Map);let a=s.get(o);if(a)return a;let l=tm(n,e,t,r,i);return s.set(o,l),l}function tm(n,e,t,r,i){let o=n.settings.north??0,s=Xp(e,t,lc(n,e)),a=[...new Set(s.map(c=>em(c,o)))];if(!s.length)return{hours:0,facing:a};let l=0;for(let c=Fo/2;c<24;c+=Fo){let u=vt(Ht(c,r.zone,i),r.latitude,r.longitude);if(u.elevation<ic)continue;let d=sc(u.azimuth,o);s.some(p=>p[0]*d[0]+p[1]*d[1]>oc)&&l++}return{hours:Math.round(l*Fo*10)/10,facing:a}}function cc(n,e,t,r,i=new Date().getFullYear()){return Array.from({length:12},(o,s)=>Qt(n,e,t,r,new Date(Date.UTC(i,s,15,12))).hours)}function uc(n,e,t,r,i=new Date){let o=vt(i,r.latitude,r.longitude);if(o.elevation<ic)return[];let s=sc(o.azimuth,n.settings.north??0);return ac(e,t,lc(n,e)).filter(a=>a.normal[0]*s[0]+a.normal[1]*s[1]>oc).map(a=>a.opening)}var dc=n=>6.112*Math.exp(17.62*n/(243.12+n));function Xt(n,e,t=4){if(n===null||e===null)return null;let r=Math.min(100,e*dc(n)/dc(n-t));return Math.round(Math.min(100,Math.max(0,(r-65)/20*100)))}function Qr(n,e,t){return t!==null&&t>=70?"mould":n!==null&&n>=1e3?"co2":e!==null&&e>=65?"humidity":null}function Mt(n=new Date,e=50){let t=n.getMonth(),r=t>=4&&t<=8;return e<0?!r:r}function Xr(n,e,t,r=!1){let i=[];if(n!==null){let[s,a]=r?[22,26]:[20,23],l=n<s?s-n:n>a?n-a:0;i.push(Math.max(0,100-l*15))}if(e!==null){let s=e<40?40-e:e>60?e-60:0;i.push(Math.max(0,100-s*4))}if(t!==null&&i.push(Math.max(0,Math.min(100,100-(t-800)/600*100))),!i.length)return null;let o=i.reduce((s,a)=>s+a,0)/i.length;return Math.round(Math.min(o,Math.min(...i)+30))}var nm={temperature:{deviceClass:"temperature",unit:"\xB0C",stops:[[16,[.2,.45,1]],[20,[.15,.85,.75]],[22.5,[.95,.8,.3]],[26,[1,.28,.18]]]},humidity:{deviceClass:"humidity",unit:"%",stops:[[30,[.95,.6,.2]],[45,[.3,.88,.5]],[60,[.2,.78,1]],[75,[.32,.4,.98]]]},co2:{deviceClass:"carbon_dioxide",unit:"ppm",stops:[[450,[.3,.88,.5]],[800,[.98,.84,.3]],[1200,[1,.5,.2]],[1600,[.98,.25,.25]]]},mould:{deviceClass:"",unit:"%",stops:[[0,[.3,.88,.5]],[40,[.98,.84,.3]],[70,[1,.5,.2]],[100,[.75,.2,.55]]]},comfort:{deviceClass:"",unit:"",stops:[[0,[.98,.25,.25]],[40,[1,.5,.2]],[65,[.98,.84,.3]],[85,[.3,.88,.5]],[100,[.2,.8,.7]]]},power:{deviceClass:"power",unit:"W",stops:[[0,[.25,.4,.6]],[100,[.3,.88,.5]],[500,[.98,.84,.3]],[1500,[1,.5,.2]],[3e3,[.98,.25,.25]]]},sun:{deviceClass:"",unit:"h",stops:[[0,[.22,.3,.55]],[2,[.35,.6,.85]],[4,[.98,.84,.3]],[7,[1,.62,.2]],[10,[1,.42,.25]]]}},rm={deviceClass:"temperature",unit:"\xB0C",stops:[[19,[.2,.45,1]],[22.5,[.15,.85,.75]],[25.5,[.95,.8,.3]],[29,[1,.28,.18]]]};function ei(n,e=!1){return n==="temperature"&&e?rm:nm[n]}var im=(n,e,t)=>[n[0]+(e[0]-n[0])*t,n[1]+(e[1]-n[1])*t,n[2]+(e[2]-n[2])*t];function hc(n,e,t=!1){let{stops:r}=ei(n,t),i=r.findIndex(([c])=>e<=c);if(i===-1)return r[r.length-1][1];if(i===0)return r[0][1];let[o,s]=r[i-1],[a,l]=r[i];return im(s,l,(e-o)/(a-o))}function Ho(n,e,t,r){let i=Zt(n,r,e.floors?.flatMap(s=>s.rooms)??t.rooms).filter(s=>s.kind==="electricity"&&s.metric==="power");if(i.length)return i.find(s=>s.unit==="W")?.value??null;let o=null;for(let s of Po(n,e,t,r)){let a=Z(n.states[s]);a!==null&&(o=(o??0)+Math.max(0,a))}return o}function Po(n,e,t,r){let i=Zt(n,r,e.floors?.flatMap(d=>d.rooms)??t.rooms).filter(d=>d.kind==="electricity"&&d.metric==="power");if(i.length)return i.filter(d=>d.unit==="W").flatMap(d=>d.sources);let{grid:o,solar:s,battery:a}=e.energy,l=new Set([o,s,a].filter(Boolean)),c=new Set,u=(d,p)=>r.points.length>=3&&H([d,p],r.points);for(let d of t.placements){let p=u(d.x,d.z)?Se(n,d.entity_id):null;p&&c.add(p)}for(let d of t.furniture){if(!u(d.x,d.z))continue;let p=d.power&&d.power!=="none"?d.power:d.entity&&d.entity!=="none"?Se(n,d.entity):null;p&&c.add(p);for(let h of d.gang_entities??[]){let g=h&&h!=="none"?Se(n,h):null;g&&c.add(g)}}return[...c].filter(d=>!l.has(d))}function pc(n,e,t){let r=new Map;for(let i of e.floors)for( Line truncated
<path d=${Cr(n)} />
</svg>`,ii={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},No=n=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${n} /></svg>`,Fm=24,Dm=10,Lo=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of ni(e))this.call("light",t.service,t.data)}renderMoods(e,t){let r=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!r.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>j(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...r,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(ti)}]),this._moodName=null};return m`<div class="nf-rp-moods">
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",Po);var Co=Math.PI/180,lc=3,cc=.1,Io=1/6,uc=(n,e)=>[Math.sin((e+n)*Co),-Math.cos((e+n)*Co)],nm=["N","NE","E","SE","S","SW","W","NW"];function rm(n,e,t){return dc(n,e,t).map(r=>r.normal)}function dc(n,e,t){let r=[];for(let i of n.openings){if(i.room_id!==e.id||i.type==="garage")continue;let o=Kl(i,n.rooms,n.walls??[]),s=o?Ul(t,i,o):null;if(!s||!s.wall.exterior)continue;let{wall:a}=s,l=Math.hypot(a.b[0]-a.a[0],a.b[1]-a.a[1]);if(l<1e-6)continue;let c=[-(a.b[1]-a.a[1])/l,(a.b[0]-a.a[0])/l],u=a.roomLeft===e.id?c:[-c[0],-c[1]];r.push({opening:i,normal:[-u[0],-u[1]]})}return r}function im(n,e){let t=((Math.atan2(n[0],-n[1])/Co-e)%360+360)%360;return nm[Math.round(t/45)%8]}var sc=new WeakMap;function hc(n,e){let t=sc.get(e);return t||(t=Zt(e.rooms,{exterior:n.settings.wall_exterior,interior:n.settings.wall_interior},e.walls??[]).walls,sc.set(e,t)),t}var ac=new WeakMap;function en(n,e,t,r,i=new Date){let o=`${t.id}|${i.toISOString().slice(0,10)}|${n.settings.north??0}|${r.latitude},${r.longitude},${r.zone??""}`,s=ac.get(e);s||ac.set(e,s=new Map);let a=s.get(o);if(a)return a;let l=om(n,e,t,r,i);return s.set(o,l),l}function om(n,e,t,r,i){let o=n.settings.north??0,s=rm(e,t,hc(n,e)),a=[...new Set(s.map(c=>im(c,o)))];if(!s.length)return{hours:0,facing:a};let l=0;for(let c=Io/2;c<24;c+=Io){let u=vt(Ht(c,r.zone,i),r.latitude,r.longitude);if(u.elevation<lc)continue;let d=uc(u.azimuth,o);s.some(p=>p[0]*d[0]+p[1]*d[1]>cc)&&l++}return{hours:Math.round(l*Io*10)/10,facing:a}}function pc(n,e,t,r,i=new Date().getFullYear()){return Array.from({length:12},(o,s)=>en(n,e,t,r,new Date(Date.UTC(i,s,15,12))).hours)}function mc(n,e,t,r,i=new Date){let o=vt(i,r.latitude,r.longitude);if(o.elevation<lc)return[];let s=uc(o.azimuth,n.settings.north??0);return dc(e,t,hc(n,e)).filter(a=>a.normal[0]*s[0]+a.normal[1]*s[1]>cc).map(a=>a.opening)}var fc=n=>6.112*Math.exp(17.62*n/(243.12+n));function tn(n,e,t=4){if(n===null||e===null)return null;let r=Math.min(100,e*fc(n)/fc(n-t));return Math.round(Math.min(100,Math.max(0,(r-65)/20*100)))}function ri(n,e,t){return t!==null&&t>=70?"mould":n!==null&&n>=1e3?"co2":e!==null&&e>=65?"humidity":null}function Mt(n=new Date,e=50){let t=n.getMonth(),r=t>=4&&t<=8;return e<0?!r:r}function ii(n,e,t,r=!1){let i=[];if(n!==null){let[s,a]=r?[22,26]:[20,23],l=n<s?s-n:n>a?n-a:0;i.push(Math.max(0,100-l*15))}if(e!==null){let s=e<40?40-e:e>60?e-60:0;i.push(Math.max(0,100-s*4))}if(t!==null&&i.push(Math.max(0,Math.min(100,100-(t-800)/600*100))),!i.length)return null;let o=i.reduce((s,a)=>s+a,0)/i.length;return Math.round(Math.min(o,Math.min(...i)+30))}var sm={temperature:{deviceClass:"temperature",unit:"\xB0C",stops:[[16,[.2,.45,1]],[20,[.15,.85,.75]],[22.5,[.95,.8,.3]],[26,[1,.28,.18]]]},humidity:{deviceClass:"humidity",unit:"%",stops:[[30,[.95,.6,.2]],[45,[.3,.88,.5]],[60,[.2,.78,1]],[75,[.32,.4,.98]]]},co2:{deviceClass:"carbon_dioxide",unit:"ppm",stops:[[450,[.3,.88,.5]],[800,[.98,.84,.3]],[1200,[1,.5,.2]],[1600,[.98,.25,.25]]]},mould:{deviceClass:"",unit:"%",stops:[[0,[.3,.88,.5]],[40,[.98,.84,.3]],[70,[1,.5,.2]],[100,[.75,.2,.55]]]},comfort:{deviceClass:"",unit:"",stops:[[0,[.98,.25,.25]],[40,[1,.5,.2]],[65,[.98,.84,.3]],[85,[.3,.88,.5]],[100,[.2,.8,.7]]]},power:{deviceClass:"power",unit:"W",stops:[[0,[.25,.4,.6]],[100,[.3,.88,.5]],[500,[.98,.84,.3]],[1500,[1,.5,.2]],[3e3,[.98,.25,.25]]]},sun:{deviceClass:"",unit:"h",stops:[[0,[.22,.3,.55]],[2,[.35,.6,.85]],[4,[.98,.84,.3]],[7,[1,.62,.2]],[10,[1,.42,.25]]]}},am={deviceClass:"temperature",unit:"\xB0C",stops:[[19,[.2,.45,1]],[22.5,[.15,.85,.75]],[25.5,[.95,.8,.3]],[29,[1,.28,.18]]]};function oi(n,e=!1){return n==="temperature"&&e?am:sm[n]}var lm=(n,e,t)=>[n[0]+(e[0]-n[0])*t,n[1]+(e[1]-n[1])*t,n[2]+(e[2]-n[2])*t];function gc(n,e,t=!1){let{stops:r}=oi(n,t),i=r.findIndex(([c])=>e<=c);if(i===-1)return r[r.length-1][1];if(i===0)return r[0][1];let[o,s]=r[i-1],[a,l]=r[i];return lm(s,l,(e-o)/(a-o))}function No(n,e,t,r){let i=Jt(n,r,e.floors?.flatMap(s=>s.rooms)??t.rooms).filter(s=>s.kind==="electricity"&&s.metric==="power");if(i.length)return i.find(s=>s.unit==="W")?.value??null;let o=null;for(let s of Oo(n,e,t,r)){let a=Z(n.states[s]);a!==null&&(o=(o??0)+Math.max(0,a))}return o}function Oo(n,e,t,r){let i=Jt(n,r,e.floors?.flatMap(d=>d.rooms)??t.rooms).filter(d=>d.kind==="electricity"&&d.metric==="power");if(i.length)return i.filter(d=>d.unit==="W").flatMap(d=>d.sources);let{grid:o,solar:s,battery:a}=e.energy,l=new Set([o,s,a].filter(Boolean)),c=new Set,u=(d,p)=>r.points.length>=3&&H([d,p],r.points);for(let d of t.placements){let p=u(d.x,d.z)?Se(n,d.entity_id):null;p&&c.add(p)}for(let d of t.furniture){if(!u(d.x,d.z))continue;let p=d.power&&d.power!=="none"?d.power:d.entity&&d.entity!=="none"?Se(n,d.entity):null;p&&c.add(p);for(let h of d.gang_entities??[]){let g=h&&h!=="none"?Se(n,h):null;g&&c.add(g)}}return[...c].filter(d=>!l.has(d))}function _c(n,e,t){let r=new Map;for(let i of e.floors)for( Line truncated
<path d=${Br(n)} />
</svg>`,ci={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Bo=n=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${n} /></svg>`,Im=24,Cm=10,Vo=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of ai(e))this.call("light",t.service,t.data)}renderMoods(e,t){let r=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!r.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>j(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...r,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(si)}]),this._moodName=null};return m`<div class="nf-rp-moods">
${r.map(l=>m`<span class="nf-rp-mood">
<button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button>
${o.length?m`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,d=o.find(p=>p.id===u.value);u.value="",d&&this.runMood(Mc(l,s(d)))}}>
${o.length?m`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,d=o.find(p=>p.id===u.value);u.value="",d&&this.runMood(Tc(l,s(d)))}}>
<option value="">→</option>
${o.map(c=>m`<option value=${c.id}>${c.name}</option>`)}
</select>`:f}
@@ -271,33 +271,33 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
><input type="text" maxlength="40" placeholder=${this.t("mood_new")} .value=${this._moodName} @input=${l=>this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} />
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
>`:f}
</div>`}async loadCurve(e){let t=xe(this.hass,this.floor,e,"temperature"),r=t.length?t:j(this.hass,e).filter(s=>s.startsWith("climate."));if(!r.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await In(this.hass,r,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=en(this.hass,s,o+(i-o)*l/96),u=r.map(d=>d.startsWith("climate.")?Number(c.states[d]?.attributes.current_temperature):Number(c.states[d]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((d,p)=>d+p,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(V(this.hass)){this._energy=null;return}let t=Po(this.hass,this.building,this.floor,e);try{let r=await _c(this.hass,t);this.room?.id===e.id&&(this._energy=r)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let r=j(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!r.length||r.some(s=>s.state!=="off"))return f;let i=Math.max(...r.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<Dm?f:m`<div class="nf-rp-shade">
</div>`}async loadCurve(e){let t=xe(this.hass,this.floor,e,"temperature"),r=t.length?t:j(this.hass,e).filter(s=>s.startsWith("climate."));if(!r.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await Wn(this.hass,r,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=nn(this.hass,s,o+(i-o)*l/96),u=r.map(d=>d.startsWith("climate.")?Number(c.states[d]?.attributes.current_temperature):Number(c.states[d]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((d,p)=>d+p,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(V(this.hass)){this._energy=null;return}let t=Oo(this.hass,this.building,this.floor,e);try{let r=await wc(this.hass,t);this.room?.id===e.id&&(this._energy=r)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let r=j(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!r.length||r.some(s=>s.state!=="off"))return f;let i=Math.max(...r.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<Cm?f:m`<div class="nf-rp-shade">
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span>
<button class="nf-btn nf-rp-small" ?disabled=${!t.some(s=>W(this.hass,s.entity_id))} @click=${()=>this.call("light","turn_off",{entity_id:t.filter(s=>W(this.hass,s.entity_id)).map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let r=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!r.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of r){if(!W(this.hass,a.entity_id))continue;(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})}};return m`<div class="nf-rp-shade nf-rp-open-heat">
<span>🪟 ${this.t("open_heating_hint",{n:o.length})}</span>
<button class="nf-btn nf-rp-small" ?disabled=${!r.some(a=>W(this.hass,a.entity_id))} @click=${s}>${this.t("open_heating_off")}</button>
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i=Y(this.hass,this.floor,e,"temperature");if(i===null||i<Fm)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||I(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(uc(this.building,this.floor,e,{latitude:t,longitude:r}).flatMap(a=>[a.cover,a.cover2].filter(o)))].filter(a=>W(this.hass,a));return s.length?m`<div class="nf-rp-shade">
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i=Y(this.hass,this.floor,e,"temperature");if(i===null||i<Im)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||I(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(mc(this.building,this.floor,e,{latitude:t,longitude:r}).flatMap(a=>[a.cover,a.cover2].filter(o)))].filter(a=>W(this.hass,a));return s.length?m`<div class="nf-rp-shade">
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${N(this.hass,ue(this.hass,i),1)} ${re(this.hass)}`})}</span>
<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button>
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i={latitude:t,longitude:r};if(!Qt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=m`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i={latitude:t,longitude:r};if(!en(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=m`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
☀ ${this.t("room_sun_year")}
</button>`;if(!this._sunYear)return s;let a=cc(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return m`${s}
</button>`;if(!this._sunYear)return s;let a=pc(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return m`${s}
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,d)=>`${c[d]} ${N(this.hass,u,1)} h`).join(", ")}>
${a.map((u,d)=>m`<span title=${`${N(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[d]}</b></span>`)}
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,r=t?this.hass.states[t]:void 0,i=r?{value:Number(r.state),unit:String(r.attributes.unit_of_measurement??"")}:null,o=bc(e.month,i),s=a=>`${N(this.hass,a,a<10?2:1)} kWh`;return m`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,r=t?this.hass.states[t]:void 0,i=r?{value:Number(r.state),unit:String(r.attributes.unit_of_measurement??"")}:null,o=xc(e.month,i),s=a=>`${N(this.hass,a,a<10?2:1)} kWh`;return m`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${N(this.hass,o.value,2)} ${o.currency}`:""}
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),r=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-r),s=e.map(c=>c===null?null:c-r+o*.1),a=Cn(s,220,36,o*1.2),l=c=>`${N(this.hass,ue(this.hass,c),1)}\xB0`;return m`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),r=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-r),s=e.map(c=>c===null?null:c-r+o*.1),a=Bn(s,220,36,o*1.2),l=c=>`${N(this.hass,ue(this.hass,c),1)}\xB0`;return m`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${ne`<path d=${a}></path>`}</svg>
<span>24 h · ${l(r)} – ${l(i)}</span>
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return M(this.hass,e,t)}call(e,t,r){(Array.isArray(r.entity_id)?r.entity_id:[r.entity_id]).some(o=>typeof o!="string"||!W(this.hass,o))||this.hass.callService(e,t,r)}renderClean(e){let t=e.clean_entity,r=t?this.hass.states[t]:void 0;if(!t||!r||!W(this.hass,t))return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(r)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=Pn(e.filter(r=>W(this.hass,r.entity_id)));for(let r of t.off)this.call(r.domain,r.service,r.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return m`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=Pn(e.filter(r=>W(this.hass,r.entity_id)));return t<2?f:m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let r of t.placements)if(r.entity_id===e)return r}name(e){return this.placedAs(e)?.name?.trim()||O(this.hass,e,this.areaName)}nameButton(e){return m`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>Ae(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,r){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||r()};return m`<button
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return M(this.hass,e,t)}call(e,t,r){(Array.isArray(r.entity_id)?r.entity_id:[r.entity_id]).some(o=>typeof o!="string"||!W(this.hass,o))||this.hass.callService(e,t,r)}renderClean(e){let t=e.clean_entity,r=t?this.hass.states[t]:void 0;if(!t||!r||!W(this.hass,t))return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(r)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=Ln(e.filter(r=>W(this.hass,r.entity_id)));for(let r of t.off)this.call(r.domain,r.service,r.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return m`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=Ln(e.filter(r=>W(this.hass,r.entity_id)));return t<2?f:m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let r of t.placements)if(r.entity_id===e)return r}name(e){return this.placedAs(e)?.name?.trim()||L(this.hass,e,this.areaName)}nameButton(e){return m`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>Ae(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,r){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||r()};return m`<button
class="nf-switch"
role="switch"
aria-checked=${t?"true":"false"}
aria-label=${this.name(e.entity_id)}
?disabled=${I(e)||!W(this.hass,e.entity_id)}
@click=${i}
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let r=e??j(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Xa(this.hass,this.floor,t):{shown:r,more:[]}},a=oo(this.hass,s).map(k=>k.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(k=>!!k&&k!=="none"),u=new Set(c.map(k=>this.hass.states[k]?.attributes.symcon_id).filter(Boolean)),d=(this._showAll?[...o,...a]:o).filter(k=>!V(this.hass)||!u.has(this.hass.states[k]?.attributes.symcon_id)),p=k=>d.filter(F=>k.includes(P(F))).map(F=>this.hass.states[F]),h=p(["light"]),g=p(["cover"]),_=p(["climate"]),b=p(["media"]),y=p(["switch","fan","lock"]),S=p(["sensor","binary"]),$=p(["scene","script"]),A=t.symcon_read_room===!1?[]:this.facts(_),T=h.filter(k=>k.state==="on");return m`<section class="nf-rp" aria-label=${t.name}>
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let r=e??j(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?rl(this.hass,this.floor,t):{shown:r,more:[]}},a=co(this.hass,s).map(k=>k.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(k=>!!k&&k!=="none"),u=new Set(c.map(k=>this.hass.states[k]?.attributes.symcon_id).filter(Boolean)),d=(this._showAll?[...o,...a]:o).filter(k=>!V(this.hass)||!u.has(this.hass.states[k]?.attributes.symcon_id)),p=k=>d.filter(F=>k.includes(P(F))).map(F=>this.hass.states[F]),h=p(["light"]),g=p(["cover"]),_=p(["climate"]),b=p(["media"]),y=p(["switch","fan","lock"]),S=p(["sensor","binary"]),$=p(["scene","script"]),A=t.symcon_read_room===!1?[]:this.facts(_),T=h.filter(k=>k.state==="on");return m`<section class="nf-rp" aria-label=${t.name}>
<header class="nf-rp-head">
<div>
<h2>${t.name}</h2>
@@ -313,7 +313,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</button>
</header>
<div class="nf-rp-body" ?hidden=${this._folded}>
<nf-utility-report .hass=${this.hass} .readings=${Zt(this.hass,t,this.building?.floors.flatMap(k=>k.rooms))}></nf-utility-report>
<nf-utility-report .hass=${this.hass} .readings=${Jt(this.hass,t,this.building?.floors.flatMap(k=>k.rooms))}></nf-utility-report>
${this.renderAllOff([...h,...b,...y])}
${this.renderClean(t)}
${t.symcon_read_room===!1?m`<p class="nf-rp-note">${this.t(d.length?"access_room_devices":"access_room_geometry")}</p>`:!t.area_id&&!e&&!(V(this.hass)&&c.length)?m`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!d.length&&!(V(this.hass)&&c.length)?m`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
@@ -331,9 +331,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</button>`:f}${T.some(k=>W(this.hass,k.entity_id))?m`<button class="nf-btn nf-rp-small" ?disabled=${!T.some(k=>W(this.hass,k.entity_id))} @click=${()=>this.call("light","turn_off",{entity_id:T.filter(k=>W(this.hass,k.entity_id)).map(k=>k.entity_id)})}>
${this.t("panel_all_off")}
</button>`:f}`):f}
${g.length?this.section("panel_covers",g.map(k=>W(this.hass,k.entity_id)?this.coverRow(k):this.sensorRow(k)),g.length>1&&kr(g.filter(k=>W(this.hass,k.entity_id)),this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:kr(g.filter(k=>W(this.hass,k.entity_id)),this.confirmEntities)})}>
${g.length?this.section("panel_covers",g.map(k=>W(this.hass,k.entity_id)?this.coverRow(k):this.sensorRow(k)),g.length>1&&Er(g.filter(k=>W(this.hass,k.entity_id)),this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Er(g.filter(k=>W(this.hass,k.entity_id)),this.confirmEntities)})}>
${this.t("panel_all_open")}</button
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:kr(g.filter(k=>W(this.hass,k.entity_id)),this.confirmEntities)})}>
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Er(g.filter(k=>W(this.hass,k.entity_id)),this.confirmEntities)})}>
${this.t("panel_all_close")}
</button>`:f):f}
${V(this.hass)?m`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f}
@@ -342,25 +342,25 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${y.length?this.section("panel_switches",y.map(k=>W(this.hass,k.entity_id)?this.switchRow(k):this.sensorRow(k))):f}
${S.length?this.section("panel_sensors",S.map(k=>this.sensorRow(k))):f}
${this.extraValues(t)}
${!V(this.hass)&&El(this.hass)&&Al(this.hass,this.floor,t)?this.announceSection(t):f}
${!V(this.hass)&&Fl(this.hass)&&zl(this.hass,this.floor,t)?this.announceSection(t):f}
${this.pluginSections(t,d)}
${l?m`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}>
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
</button>`:f}
</div>
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(r=>!r.outside&&H([r.x,r.z],e.points)).map(r=>({name:r.name||O(this.hass,r.entity_id),rows:Nr(this.hass,r.values)})),...this.floor.furniture.filter(r=>H([r.x,r.z],e.points)).map(r=>({name:r.name||(r.entity&&r.entity!=="none"?O(this.hass,r.entity):ae(this.hass,r.type)),rows:[...ri(this.hass,r),...Nr(this.hass,r.values)]}))].filter(r=>r.rows.length);return t.length?this.section("device_values",t.map(r=>m`<div class="nf-extra-values"><b>${r.name}</b>${r.rows.map(i=>m`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${G(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],r=this.room;if(!r)return t;let i=(z,R)=>{let E=Y(this.hass,this.floor,r,z);if(E===null)return null;if(z==="temperature")return`${N(this.hass,ue(this.hass,E),1)} ${re(this.hass)}`;let C=xe(this.hass,this.floor,r,z)[0],L=this.hass.states[C]?.attributes.unit_of_measurement??R;return`${N(this.hass,E,1)} ${L}`},o=e.find(z=>typeof z.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(m`${s}${G(this.hass,xe(this.hass,this.floor,r,"temperature"),"Temperatur")}`):o&&r.climate?.temperature!=="none"&&t.push(m`${N(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(m`${a}${G(this.hass,xe(this.hass,this.floor,r,"humidity"),"Luftfeuchte")}`);let l=Y(this.hass,this.floor??null,r,"illuminance");l!==null&&t.push(m`☀ ${N(this.hass,l,0)} lx${G(this.hass,xe(this.hass,this.floor,r,"illuminance"),"Helligkeit")}`);let c=Zt(this.hass,r,this.building?.floors.flatMap(z=>z.rooms)).find(z=>z.kind==="electricity"&&z.metric==="power"&&z.unit==="W"),u=!c&&this.floor&&this.building?Ho(this.hass,this.building,this.floor,r):null;c?t.push(m`⚡ ${Be(this.hass,c)}${G(this.hass,c.sources,"Leistung")}`):u!==null&&t.push(`\u26A1 ${At(this.hass,u)}`);let d=this.floor?this.floor.openings.filter(z=>z.room_id===r.id).flatMap(z=>[z.contact,z.contact2,z.tilt,z.tilt2]).map(z=>z&&z!=="none"?this.hass.states[z]:void 0).filter(z=>z?.state==="on").map(z=>Date.parse(String(z.last_changed??""))).filter(Number.isFinite):[];d.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Io(Date.now()-Math.min(...d))})}`);let p=j(this.hass,r).map(z=>this.hass.states[z]).filter(z=>!!z&&z.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(z.attributes.device_class)));if(p.length)if(p.some(z=>z.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let z=Math.max(...p.map(R=>Date.parse(String(R.last_changed??""))||0));z>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Io(Date.now()-z)})}`)}let h=this.building?wc(this.hass,this.building).filter(z=>z.roomId===r.id&&z.level<vc):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(z=>`${this.name(z.entity)} ${Math.round(z.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(z=>z.rooms.includes(r.id)).map(z=>z.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:y,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&y!==void 0&&this.building&&!_.includes("sun")){let z=Qt(this.building,this.floor,r,{latitude:b,longitude:y,zone:S});z.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:N(this.hass,z.hours,1),facing:z.facing.join(", ")})}`)}let $=Y(this.hass,this.floor,r,"temperature"),A=Y(this.hass,this.floor,r,"humidity"),T=Qr(Y(this.hass,this.floor,r,"co2"),A,Xt($,A));T&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${T}`)}`);let k=Xr($,A,Y(this.hass,this.floor,r,"co2"),Mt(new Date,this.hass.config?.latitude)),F=r.hvac?.status;return F&&F!=="none"?t.push(m`${Ie(this.hass.states[F])}${G(this.hass,[F],"Raumstatus")}`):k!==null&&($!==null||A!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:k})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),r=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");r(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(o=>m`<button class="nf-btn" @click=${()=>r(o)}>${o}</button>`)}</div>
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(r=>!r.outside&&H([r.x,r.z],e.points)).map(r=>({name:r.name||L(this.hass,r.entity_id),rows:Vr(this.hass,r.values)})),...this.floor.furniture.filter(r=>H([r.x,r.z],e.points)).map(r=>({name:r.name||(r.entity&&r.entity!=="none"?L(this.hass,r.entity):ae(this.hass,r.type)),rows:[...li(this.hass,r),...Vr(this.hass,r.values)]}))].filter(r=>r.rows.length);return t.length?this.section("device_values",t.map(r=>m`<div class="nf-extra-values"><b>${r.name}</b>${r.rows.map(i=>m`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${G(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],r=this.room;if(!r)return t;let i=(z,R)=>{let E=Y(this.hass,this.floor,r,z);if(E===null)return null;if(z==="temperature")return`${N(this.hass,ue(this.hass,E),1)} ${re(this.hass)}`;let C=xe(this.hass,this.floor,r,z)[0],O=this.hass.states[C]?.attributes.unit_of_measurement??R;return`${N(this.hass,E,1)} ${O}`},o=e.find(z=>typeof z.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(m`${s}${G(this.hass,xe(this.hass,this.floor,r,"temperature"),"Temperatur")}`):o&&r.climate?.temperature!=="none"&&t.push(m`${N(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(m`${a}${G(this.hass,xe(this.hass,this.floor,r,"humidity"),"Luftfeuchte")}`);let l=Y(this.hass,this.floor??null,r,"illuminance");l!==null&&t.push(m`☀ ${N(this.hass,l,0)} lx${G(this.hass,xe(this.hass,this.floor,r,"illuminance"),"Helligkeit")}`);let c=Jt(this.hass,r,this.building?.floors.flatMap(z=>z.rooms)).find(z=>z.kind==="electricity"&&z.metric==="power"&&z.unit==="W"),u=!c&&this.floor&&this.building?No(this.hass,this.building,this.floor,r):null;c?t.push(m`⚡ ${Be(this.hass,c)}${G(this.hass,c.sources,"Leistung")}`):u!==null&&t.push(`\u26A1 ${At(this.hass,u)}`);let d=this.floor?this.floor.openings.filter(z=>z.room_id===r.id).flatMap(z=>[z.contact,z.contact2,z.tilt,z.tilt2]).map(z=>z&&z!=="none"?this.hass.states[z]:void 0).filter(z=>z?.state==="on").map(z=>Date.parse(String(z.last_changed??""))).filter(Number.isFinite):[];d.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Lo(Date.now()-Math.min(...d))})}`);let p=j(this.hass,r).map(z=>this.hass.states[z]).filter(z=>!!z&&z.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(z.attributes.device_class)));if(p.length)if(p.some(z=>z.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let z=Math.max(...p.map(R=>Date.parse(String(R.last_changed??""))||0));z>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Lo(Date.now()-z)})}`)}let h=this.building?$c(this.hass,this.building).filter(z=>z.roomId===r.id&&z.level<Sc):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(z=>`${this.name(z.entity)} ${Math.round(z.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(z=>z.rooms.includes(r.id)).map(z=>z.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:y,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&y!==void 0&&this.building&&!_.includes("sun")){let z=en(this.building,this.floor,r,{latitude:b,longitude:y,zone:S});z.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:N(this.hass,z.hours,1),facing:z.facing.join(", ")})}`)}let $=Y(this.hass,this.floor,r,"temperature"),A=Y(this.hass,this.floor,r,"humidity"),T=ri(Y(this.hass,this.floor,r,"co2"),A,tn($,A));T&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${T}`)}`);let k=ii($,A,Y(this.hass,this.floor,r,"co2"),Mt(new Date,this.hass.config?.latitude)),F=r.hvac?.status;return F&&F!=="none"?t.push(m`${Ie(this.hass.states[F])}${G(this.hass,[F],"Raumstatus")}`):k!==null&&($!==null||A!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:k})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),r=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");r(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(o=>m`<button class="nf-btn" @click=${()=>r(o)}>${o}</button>`)}</div>
<form class="nf-rp-say" @submit=${i}>
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
</form>
${this._said?m`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return la({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
${this._said?m`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return ha({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
<div class="nf-rp-sec-head"><h3>${i.title}</h3></div>
${typeof i.content=="string"?m`<p class="nf-rp-note">${i.content}</p>`:i.content}
</div>`)}section(e,t,r=f){return m`<div class="nf-rp-sec">
<div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${r}</div>
${t}
</div>`}lightRow(e){let t=e.attributes,r=e.state==="on",i=t.supported_color_modes??[],o=i.some(h=>h!=="onoff"),s=i.includes("color_temp"),a=i.some(h=>["hs","rgb","rgbw","rgbww","xy"].includes(h)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,c=t.min_color_temp_kelvin??2200,u=t.max_color_temp_kelvin??6500,d=e.entity_id,p=!!this.placedAs(d)?.simple;return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${r?"nf-rp-on":""}">${nn("light")}</span>
<span class="nf-rp-icon ${r?"nf-rp-on":""}">${on("light")}</span>
${this.nameButton(d)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
${this.toggle(e,r,()=>this.call("light","toggle",{entity_id:d}))}
@@ -384,23 +384,23 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@change=${h=>this.call("light","turn_on",{entity_id:d,color_temp_kelvin:Number(h.target.value)})}
/></label>`:f}
${r&&a&&!p?m`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
${zm.map(h=>m`<button
${Pm.map(h=>m`<button
class="nf-rp-swatch"
style="--c: rgb(${h.join(",")})"
aria-label="rgb(${h.join(", ")})"
@click=${()=>this.call("light","turn_on",{entity_id:d,rgb_color:h})}
></button>`)}
</div>`:f}
</div>`}coverRow(e){let t=Dr(this.hass,this.building?.floors??[],e.entity_id);e=Hr(this.hass,e,t);let r=e.attributes,i=r.supported_features??0,o=e.entity_id,s=I(e)&&!wn(e);return m`<div class="nf-rp-row">
<span class="nf-rp-icon">${nn("cover")}</span>
</div>`}coverRow(e){let t=Nr(this.hass,this.building?.floors??[],e.entity_id);e=Or(this.hass,e,t);let r=e.attributes,i=r.supported_features??0,o=e.entity_id,s=I(e)&&!Mn(e);return m`<div class="nf-rp-row">
<span class="nf-rp-icon">${on("cover")}</span>
${this.nameButton(o)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
<div class="nf-rp-buttons">
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","open_cover",{entity_id:o})}>${this.t("cover_open")}</button>
${i&Tm?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
${i&Hm?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","close_cover",{entity_id:o})}>${this.t("cover_close")}</button>
</div>
${i&Rm&&typeof r.current_position=="number"?m`<label class="nf-rp-slider"
${i&Dm&&typeof r.current_position=="number"?m`<label class="nf-rp-slider"
><span>${this.t("position")}</span>
<input
type="range"
@@ -424,7 +424,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${i&32?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:o})}>${this.t("cover_tilt_close")}</button>`:f}
</div>`:f}
</div>`}climateRow(e){let t=e.attributes,r=e.entity_id,i=typeof t.temperature=="number"?t.temperature:null,o=t.target_temp_step??.5,s=t.min_temp??5,a=t.max_temp??30,l=t.hvac_modes??[],c=u=>this.call("climate","set_temperature",{entity_id:r,temperature:Math.min(a,Math.max(s,Math.round(u/o)*o))});return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${nn("climate")}</span>
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${on("climate")}</span>
${this.nameButton(r)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
${i!==null?m`<div class="nf-rp-stepper nf-rp-wide">
@@ -442,19 +442,19 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</button>`)}
</div>`:f}
</div>`}stateOf(e,t=se(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let r=P(e.entity_id);return e.state==="unknown"&&r!=="sensor"&&r!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,r=this.t(t);return r===t?e:r}mediaRow(e){let t=e.attributes,r=e.entity_id,i=I(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${nn("media")}</span>
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${on("media")}</span>
${this.nameButton(r)}
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}${G(this.hass,[e.entity_id])}</span>
${o?m`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f}
<div class="nf-rp-buttons nf-rp-wide">
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:r})}>
${No(ii.previous)}
${Bo(ci.previous)}
</button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${I(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:r})}>
${No(e.state==="playing"?ii.pause:ii.play)}
${Bo(e.state==="playing"?ci.pause:ci.play)}
</button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:r})}>
${No(ii.next)}
${Bo(ci.next)}
</button>
</div>
${typeof t.volume_level=="number"?m`<label class="nf-rp-slider"
@@ -467,12 +467,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@change=${s=>this.call("media_player","volume_set",{entity_id:r,volume_level:Number(s.target.value)/100})}
/></label>`:f}
</div>`}switchRow(e){let t=e.entity_id,r=P(t),i=t.slice(0,t.indexOf(".")),o=r==="lock"?e.state==="unlocked"||e.state==="open":te(e),s=()=>r==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${nn(r)}</span>
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${on(r)}</span>
${this.nameButton(t)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
${this.toggle(e,o,s)}
</div>`}sensorRow(e){let t=P(e.entity_id),r=t==="binary"&&e.state==="on";return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${r?"nf-rp-on":""}">${nn(t)}</span>
<span class="nf-rp-icon ${r?"nf-rp-on":""}">${on(t)}</span>
${this.nameButton(e.entity_id)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[ke,Ne,J`
@@ -856,41 +856,41 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
outline: 2px solid var(--nf-accent);
outline-offset: 2px;
}
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Lo);function Ic(n,e,t,r,i,o,s,a){let l=st(n,e),c=_r(n,e),u={all:"\u2302",location:"\u2316",branch:"\u25C7",building:"\u25A5",floor:"\u25A4",room:"\u25A1",outside:"\u{1F333}"};return m`<nav class="nf-thumbs nf-topology-navigation ${s?"nf-thumbs-small":""} ${a?"nf-thumbs-short":""} ${i?"nf-thumbs-compact":""}" aria-label="Topologie">
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Vo);function Lc(n,e,t,r,i,o,s,a){let l=st(n,e),c=xr(n,e),u={all:"\u2302",location:"\u2316",branch:"\u25C7",building:"\u25A5",floor:"\u25A4",room:"\u25A1",outside:"\u{1F333}"};return m`<nav class="nf-thumbs nf-topology-navigation ${s?"nf-thumbs-small":""} ${a?"nf-thumbs-short":""} ${i?"nf-thumbs-compact":""}" aria-label="Topologie">
<style>.nf-topology-crumbs{display:grid;gap:3px}.nf-topology-crumbs button{min-width:0;text-align:left;padding:5px 7px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px}.nf-topology-navigation .nf-thumb>span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nf-topology-placeholder{height:74px;display:grid;place-items:center;font-size:25px;opacity:.45}.nf-topology-navigation{overflow:auto;overscroll-behavior:contain;max-height:calc(100% - 130px)}.nf-topology-navigation .nf-thumbs-fold{position:static;align-self:flex-start;flex-shrink:0}.nf-topology-navigation .nf-thumb-house{flex-shrink:0}.nf-topology-navigation .nf-thumb{flex-shrink:0}</style>
<button class="nf-thumbs-fold" aria-label=${i?"Topologie aufklappen":"Topologie einklappen"} @click=${o}>${i?"\u25B8":"\u25C2"}</button>
<button class="nf-thumb nf-thumb-house" aria-pressed=${e.kind==="all"} @click=${()=>r(_e)}>⌂ <span>Alle Orte</span></button>
${l.length>1?m`<div class="nf-topology-crumbs">${l.slice(1).map(d=>m`<button class="nf-chip" data-topology-key=${d.key} title=${l.slice(1,l.indexOf(d)+1).map(p=>p.name).join(" / ")} aria-current=${d===l.at(-1)?"location":f} @click=${()=>r(d.selection)}>${u[d.selection.kind]} ${d.name}</button>`)}</div>`:f}
${c.map(d=>m`<button class="nf-thumb" data-topology-key=${d.key} data-topology-kind=${d.selection.kind} aria-pressed=${fr(e)===d.key} title=${d.name} @click=${()=>r(d.selection)}>
${c.map(d=>m`<button class="nf-thumb" data-topology-key=${d.key} data-topology-kind=${d.selection.kind} aria-pressed=${wn(e)===d.key} title=${d.name} @click=${()=>r(d.selection)}>
${i?f:t.get(d.key)?m`<img src=${t.get(d.key)} alt=""/>`:m`<div class="nf-topology-placeholder" aria-hidden="true">${u[d.selection.kind]}</div>`}
<span>${d.name}</span>
</button>`)}
</nav>`}function Cc(n){if(!n)return"";let e=Math.min(.8,Math.max(0,n.dim??.35)),t=n.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(n.image)?n.image:null,r=n.color&&/^#[0-9a-f]{6}$/i.test(n.color)?n.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${r?` ${r}`:""}`:r?`;background:${r}`:""}var Hm=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],Nc=[34,211,238];function Oo(n){return n?Hm.find(([e])=>e.test(n))?.[1]??Nc:Nc}function Wo(n){if(n.state==="playing"||n.state==="paused")return!0;let e=t=>typeof n.attributes[t]=="string"&&n.attributes[t]!=="";return n.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Bo=n=>n.state==="playing"||n.state==="on"&&Wo(n);function Lc(n,e){let t=[],r=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||r.has(i.entity))continue;r.add(i.entity);let o=n.states[i.entity];if(!o)continue;let s=o.attributes,a=u=>typeof s[u]=="string"?s[u]:"",l=a("app_name")||a("source")||a("app_id")||null,c=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:Bo(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:c,color:Oo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==i.entity):[],rings:i.rings??1})}return t}function Oc(n){let e=new Map(n.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],r=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!r.has(a)&&(r.add(a),t.push([i,s]))}return t}var Pm=3;function Wc(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(n.states[s])||r.push({id:o.id,at:{floorId:i.id,x:o.x,y:oe(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Pm))})}return r}var oi=n=>n&&n!=="none"?n:null,Bc=n=>Math.min(1,Math.max(0,n));function Vc(n,e){let t=new Map;for(let r of e.settings.roof?.windows??[]){let i=je(n,{cover:oi(r.cover),contact:oi(r.contact),tilt:oi(r.tilt)},"window"),o=oi(r.window),s=o?n.states[o]:void 0,a=i.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?Bc(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(r.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function Im(n,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return n.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var dt=(n,e)=>typeof n[e]=="string"?n[e]:"";function Kc(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!Tr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Im(i,o),l=a?n.states[a]:void 0;if(!l||!Wo(l))continue;let c=l.attributes,u=dt(c,"app_name")||dt(c,"source")||null;r.push({id:o.id,furnitureId:o.id,floorId:i.id,color:Oo(u),title:dt(c,"media_title")||dt(c,"media_channel")||u||"",subtitle:dt(c,"media_artist")||dt(c,"media_series_title")||dt(c,"media_album_name"),app:u,picture:dt(c,"entity_picture")||null,playing:Bo(l),ambilight:o.ambilight??1})}return r}function Gc(n){let e=n.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function Uc(n,e){return(n===null?0:Bc((n+4)/16))*(1-.45*e)}function ht(n,e){return n.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&n.states[e]?e:Object.keys(n.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var si=new Set(["contact_lost","unlocked_night","own"]);function Cm(n,e){let t=n.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let r=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(r);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return r.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Nm=600*1e3,Lm=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Om=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),jc=(n,e)=>{if(e.startsWith("binary_sensor."))return Om.get(String(n.states[e]?.attributes.device_class))};function Wm(n,e){let t=new Set,r=[];for(let i of n.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),r.push({floorId:i.id,roomId:o.room_id,entity:a}))}return r}function qc(n,e,t,r){let i=[];for(let a of e.floors)for(let l of a.rooms){let c=j(n,l).filter(u=>jc(n,u));c.length>0&&Line truncated
</nav>`}function Wc(n){if(!n)return"";let e=Math.min(.8,Math.max(0,n.dim??.35)),t=n.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(n.image)?n.image:null,r=n.color&&/^#[0-9a-f]{6}$/i.test(n.color)?n.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${r?` ${r}`:""}`:r?`;background:${r}`:""}var Nm=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],Bc=[34,211,238];function Ko(n){return n?Nm.find(([e])=>e.test(n))?.[1]??Bc:Bc}function Go(n){if(n.state==="playing"||n.state==="paused")return!0;let e=t=>typeof n.attributes[t]=="string"&&n.attributes[t]!=="";return n.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Uo=n=>n.state==="playing"||n.state==="on"&&Go(n);function Vc(n,e){let t=[],r=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||r.has(i.entity))continue;r.add(i.entity);let o=n.states[i.entity];if(!o)continue;let s=o.attributes,a=u=>typeof s[u]=="string"?s[u]:"",l=a("app_name")||a("source")||a("app_id")||null,c=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:Uo(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:c,color:Ko(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==i.entity):[],rings:i.rings??1})}return t}function Kc(n){let e=new Map(n.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],r=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!r.has(a)&&(r.add(a),t.push([i,s]))}return t}var Om=3;function Gc(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(n.states[s])||r.push({id:o.id,at:{floorId:i.id,x:o.x,y:oe(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Om))})}return r}var ui=n=>n&&n!=="none"?n:null,Uc=n=>Math.min(1,Math.max(0,n));function jc(n,e){let t=new Map;for(let r of e.settings.roof?.windows??[]){let i=je(n,{cover:ui(r.cover),contact:ui(r.contact),tilt:ui(r.tilt)},"window"),o=ui(r.window),s=o?n.states[o]:void 0,a=i.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?Uc(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(r.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function Lm(n,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return n.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var dt=(n,e)=>typeof n[e]=="string"?n[e]:"";function qc(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!Pr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Lm(i,o),l=a?n.states[a]:void 0;if(!l||!Go(l))continue;let c=l.attributes,u=dt(c,"app_name")||dt(c,"source")||null;r.push({id:o.id,furnitureId:o.id,floorId:i.id,color:Ko(u),title:dt(c,"media_title")||dt(c,"media_channel")||u||"",subtitle:dt(c,"media_artist")||dt(c,"media_series_title")||dt(c,"media_album_name"),app:u,picture:dt(c,"entity_picture")||null,playing:Uo(l),ambilight:o.ambilight??1})}return r}function Zc(n){let e=n.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function Yc(n,e){return(n===null?0:Uc((n+4)/16))*(1-.45*e)}function ht(n,e){return n.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&n.states[e]?e:Object.keys(n.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var di=new Set(["contact_lost","unlocked_night","own"]);function Wm(n,e){let t=n.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let r=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(r);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return r.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Bm=600*1e3,Vm=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Km=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),Jc=(n,e)=>{if(e.startsWith("binary_sensor."))return Km.get(String(n.states[e]?.attributes.device_class))};function Gm(n,e){let t=new Set,r=[];for(let i of n.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),r.push({floorId:i.id,roomId:o.room_id,entity:a}))}return r}function Qc(n,e,t,r){let i=[];for(let a of e.floors)for(let l of a.rooms){let c=j(n,l).filter(u=>Jc(n,u));c.length>0&&Line truncated
${ne`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(r*Math.max(0,Math.min(1,n))).toFixed(1)} ${r.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
</svg>`}function Jf(n,e,t,r){let i=e.summary,o=c=>M(n,c),s=e.autarky,a=r?m`<button class="live-fold" title=${o(r.folded?"live_unfold":"live_fold")} aria-label=${o(r.folded?"live_unfold":"live_fold")} aria-expanded=${!r.folded} @click=${r.toggle}>${r.folded?"+":"\u2212"}</button>`:f;if(r?.folded){let c=i.solar!==null?`\u2600 ${He(n,i.solar)}`:i.consumption!==null?`\u2302 ${He(n,i.consumption)}`:null;return m`<div class="live-card live-card-house live-folded" data-i=${t}>
${s!==null?m`<div class="live-own">${jn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
</svg>`}function tg(n,e,t,r){let i=e.summary,o=c=>M(n,c),s=e.autarky,a=r?m`<button class="live-fold" title=${o(r.folded?"live_unfold":"live_fold")} aria-label=${o(r.folded?"live_unfold":"live_fold")} aria-expanded=${!r.folded} @click=${r.toggle}>${r.folded?"+":"\u2212"}</button>`:f;if(r?.folded){let c=i.solar!==null?`\u2600 ${He(n,i.solar)}`:i.consumption!==null?`\u2302 ${He(n,i.consumption)}`:null;return m`<div class="live-card live-card-house live-folded" data-i=${t}>
${s!==null?m`<div class="live-own">${Qn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
${c?m`<b>${c}</b>`:s===null?m`<b>⌂</b>`:f}
${a}
</div>`}let l=[];if(i.solar!==null&&l.push(m`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${He(n,i.solar)}</b></div>`),i.consumption!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${He(n,i.consumption)}</b></div>`),i.rest!==void 0&&i.rest!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${o("energy_rest")}</span><b>${He(n,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let c=i.battery===null||Math.abs(i.battery)<15?"":i.battery>0?" \u2193":" \u2191";l.push(m`<div class="live-row live-battery"><span>▮ ${o("energy_battery")}${c}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${He(n,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let c=i.grid<-15;l.push(m`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${o(c?"energy_grid_export":"energy_grid_import")}</span><b>${He(n,i.grid)}</b></div>`)}for(let c of e.meters??[])l.push(m`<div class="live-row live-meter"><span>${c.icon} ${c.label}</span><b>${c.value}</b></div>`);return m`<div class="live-card live-card-house" data-i=${t}>
${a}
${s!==null?m`<div class="live-own">${jn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
${s!==null?m`<div class="live-own">${Qn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
<div class="live-rows">${l}</div>
${Xf(n,e.curves)} ${Qf(n,e.week)}
</div>`}function Qf(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let r=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(c,u,d)=>c===null||c<=0?f:ne`<rect x=${u.toFixed(1)} y=${(o-c/r*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/r*o).toFixed(1)} class=${d}></rect>`,l=c=>c.reduce((u,d)=>u+(d??0),0);return m`<div class="live-day live-week" title=${M(n,"live_week_hint",{solar:N(n,l(e.solar),0),use:N(n,l(e.use),0)})}>
${rg(n,e.curves)} ${ng(n,e.week)}
</div>`}function ng(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let r=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(c,u,d)=>c===null||c<=0?f:ne`<rect x=${u.toFixed(1)} y=${(o-c/r*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/r*o).toFixed(1)} class=${d}></rect>`,l=c=>c.reduce((u,d)=>u+(d??0),0);return m`<div class="live-day live-week" title=${M(n,"live_week_hint",{solar:N(n,l(e.solar),0),use:N(n,l(e.use),0)})}>
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
${e.days.map((c,u)=>ne`${a(e.solar[u],u*s+s*.1,"live-week-solar")}${a(e.use[u],u*s+s*.5,"live-week-use")}`)}
</svg>
<span>7 ${M(n,"live_days")}</span>
</div>`}function Xf(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let r=Math.max(...t)*1.08||1,[i,o]=[150,34],s=Cn(e.solar,i,o,r),a=Cn(e.use,i,o,r);return m`<div class="live-day" title=${M(n,"live_day_hint")}>
</div>`}function rg(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let r=Math.max(...t)*1.08||1,[i,o]=[150,34],s=Bn(e.solar,i,o,r),a=Bn(e.use,i,o,r);return m`<div class="live-day" title=${M(n,"live_day_hint")}>
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
${s?ne`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f}
${a?ne`<path d=${a} class="live-day-use"></path>`:f}
</svg>
<span>24 h</span>
</div>`}function eg(n,e,t,r){let i=e.car,o=(u,d)=>M(n,u,d),s=Bu(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${He(n,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${N(n,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,c=(u,d,p,h)=>m`<button class="live-btn ${u?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${u??!1} @click=${g=>(g.stopPropagation(),h())}>${p}</button>`;return m`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
</div>`}function ig(n,e,t,r){let i=e.car,o=(u,d)=>M(n,u,d),s=Uu(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${He(n,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${N(n,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,c=(u,d,p,h)=>m`<button class="live-btn ${u?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${u??!1} @click=${g=>(g.stopPropagation(),h())}>${p}</button>`;return m`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
<div class="live-own">
${jn((i.soc??0)/100,s)}
${Qn((i.soc??0)/100,s)}
<div class="live-own-text"><b>${i.soc!==null?`${Math.round(i.soc)} %`:"\u2013"}</b><span>${i.range!==null?`${Math.round(i.range)} ${i.rangeUnit}`:""}</span></div>
</div>
<div class="live-rows">
@@ -905,7 +905,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${l.charge&&i.home?c(i.charging,o("live_car_charge"),"\u26A1",()=>r(l.charge.split(".")[0],"toggle",l.charge)):f}
</div>
</div>
</div>`}function tg(n,e,t,r){let i=e.media,o=l=>M(n,l),s=`rgb(${i.color.join(",")})`,a=(l,c,u)=>m`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),r("media_player",u,i.entity))}>${c}</button>`;return m`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
</div>`}function og(n,e,t,r){let i=e.media,o=l=>M(n,l),s=`rgb(${i.color.join(",")})`,a=(l,c,u)=>m`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),r("media_player",u,i.entity))}>${c}</button>`;return m`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
${i.picture?m`<img class="live-cover" src=${i.picture} alt="" loading="lazy" />`:m`<div class="live-cover live-cover-none">♪</div>`}
<div class="live-rows">
<div class="live-title" title=${i.title}>${i.title||i.name}</div>
@@ -924,9 +924,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
/>`:f}
</div>
</div>
</div>`}function Vu(n){let e=[...n.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"&&s.offsetWidth>0),t=[],r=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],c=r?r>l+16?Math.min(Math.max(a,l/2+8),r-l/2-8):r/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-c)}px`),{el:s,x:c,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>Number(a.el.dataset.priority||0)-Number(s.el.dataset.priority||0)||a.y-s.y);for(let s of o){let a=s.y;if((s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging"))&&r>s.w+16&&i>s.h+16){let d=[s.x,s.w/2+8,r-s.w/2-8,...t.flatMap(g=>[g.x0-s.w/2-8,g.x1+s.w/2+8])].filter(g=>g>=s.w/2+8&&g<=r-s.w/2-8).sort((g,_)=>Math.abs(g-s.x)-Math.abs(_-s.x)),p=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(g=>[g.y0-8,g.y1+s.h+8])].filter(g=>g>=s.h+8&&g<=i-8),h;for(let g of p){for(let _ of d)if(!t.some(b=>_-s.w/2<b.x1+6&&_+s.w/2>b.x0-6&&g-s.h<b.y1+6&&g>b.y0-6)){h={x:_,y:g};break}if(h)break}h&&(s.x=h.x,a=h.y)}for(let d=0;d<12;d++){let p={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},h=t.find(g=>p.x0<g.x1+6&&p.x1>g.x0-6&&p.y0<g.y1+6&&p.y1>g.y0-6);if(!h)break;a=h.y0-8}let l=s.y-a,c=!s.el.classList.contains("live-card-house")&&!s.el.classList.contains("live-card-roomclimate")&&s.el.dataset.focused!=="1",u=s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging");if(c&&i>0&&(a-s.h<8||a>i-8||!u&&Math.abs(l)>Math.max(100,Math.min(180,i*.25)))){s.el.style.visibility="hidden";continue}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a}),s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function ng(n,e,t){let r=e.printer,i=(c,u)=>M(n,c,u),o=r.progress??0,s=c=>new Intl.DateTimeFormat(n?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=r.remaining!==null?r.remaining>=60?`${Math.floor(r.remaining/60)} h ${Math.round(r.remaining%60)} min`:`${Math.round(r.remaining)} min`:null,l=[r.nozzle!==null?`${i("printer_nozzle")} ${Math.round(r.nozzle)}\xB0`:null,r.bed!==null?`${i("printer_bed")} ${Math.round(r.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return m`<div class="live-card live-card-printer ${r.printing?"live-charging":""}" data-i=${t}>
</div>`}function ju(n){let e=[...n.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"&&s.offsetWidth>0),t=[],r=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],c=r?r>l+16?Math.min(Math.max(a,l/2+8),r-l/2-8):r/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-c)}px`),{el:s,x:c,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>Number(a.el.dataset.priority||0)-Number(s.el.dataset.priority||0)||a.y-s.y);for(let s of o){let a=s.y;if((s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging"))&&r>s.w+16&&i>s.h+16){let d=[s.x,s.w/2+8,r-s.w/2-8,...t.flatMap(g=>[g.x0-s.w/2-8,g.x1+s.w/2+8])].filter(g=>g>=s.w/2+8&&g<=r-s.w/2-8).sort((g,_)=>Math.abs(g-s.x)-Math.abs(_-s.x)),p=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(g=>[g.y0-8,g.y1+s.h+8])].filter(g=>g>=s.h+8&&g<=i-8),h;for(let g of p){for(let _ of d)if(!t.some(b=>_-s.w/2<b.x1+6&&_+s.w/2>b.x0-6&&g-s.h<b.y1+6&&g>b.y0-6)){h={x:_,y:g};break}if(h)break}h&&(s.x=h.x,a=h.y)}for(let d=0;d<12;d++){let p={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},h=t.find(g=>p.x0<g.x1+6&&p.x1>g.x0-6&&p.y0<g.y1+6&&p.y1>g.y0-6);if(!h)break;a=h.y0-8}let l=s.y-a,c=!s.el.classList.contains("live-card-house")&&!s.el.classList.contains("live-card-roomclimate")&&s.el.dataset.focused!=="1",u=s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging");if(c&&i>0&&(a-s.h<8||a>i-8||!u&&Math.abs(l)>Math.max(100,Math.min(180,i*.25)))){s.el.style.visibility="hidden";continue}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a}),s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function sg(n,e,t){let r=e.printer,i=(c,u)=>M(n,c,u),o=r.progress??0,s=c=>new Intl.DateTimeFormat(n?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=r.remaining!==null?r.remaining>=60?`${Math.floor(r.remaining/60)} h ${Math.round(r.remaining%60)} min`:`${Math.round(r.remaining)} min`:null,l=[r.nozzle!==null?`${i("printer_nozzle")} ${Math.round(r.nozzle)}\xB0`:null,r.bed!==null?`${i("printer_bed")} ${Math.round(r.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return m`<div class="live-card live-card-printer ${r.printing?"live-charging":""}" data-i=${t}>
<div class="live-own">
${r.picture?m`<img class="live-print-pic" src=${r.picture} alt="" />`:jn(o/100,r.printing?"#38bdf8":"#8aa0c8")}
${r.picture?m`<img class="live-print-pic" src=${r.picture} alt="" />`:Qn(o/100,r.printing?"#38bdf8":"#8aa0c8")}
<div class="live-own-text"><b>${r.progress!==null?`${Math.round(o)} %`:"\u2013"}</b><span>${i(`printer_${r.printing?"printing":/finish|complete|fertig/.test(r.status)?"done":/pause/.test(r.status)?"paused":/error|fail/.test(r.status)?"error":"idle"}`)}</span></div>
</div>
<div class="live-rows">
@@ -937,9 +937,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${l?m`<div class="live-status">🌡 ${l}</div>`:f}
${r.filaments.length?m`<div class="live-filaments">${r.filaments.map(c=>m`<i style=${`background:${c}`}></i>`)}</div>`:f}
</div>
</div>`}function rg(n,e,t){let r=e.pump,i=a=>M(n,a),o=a=>a===null?"\u2013":`${N(n,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[r.mode];return m`<div class="live-card live-card-heatpump ${r.mode==="idle"?"":"live-charging"}" data-i=${t}>
</div>`}function ag(n,e,t){let r=e.pump,i=a=>M(n,a),o=a=>a===null?"\u2013":`${N(n,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[r.mode];return m`<div class="live-card live-card-heatpump ${r.mode==="idle"?"":"live-charging"}" data-i=${t}>
<div class="live-own">
${jn(Math.min(1,(r.cop??0)/6),(r.cop??0)>=3.5?"#4ade80":(r.cop??0)>=2.5?"#facc15":"#fb923c")}
${Qn(Math.min(1,(r.cop??0)/6),(r.cop??0)>=3.5?"#4ade80":(r.cop??0)>=2.5?"#facc15":"#fb923c")}
<div class="live-own-text"><b>${r.cop!==null?N(n,r.cop,1):s}</b><span>${r.cop!==null?"COP":""}</span></div>
</div>
<div class="live-rows">
@@ -950,17 +950,17 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${r.power!==null?m`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${He(n,r.power)}</b></div>`:f}
${r.outside!==null?m`<div class="live-status">🌡 ${i("heatpump_outside")} ${o(r.outside)}</div>`:f}
</div>
</div>`}function ig(n,e,t){let r=(o,s,a)=>o===null?"\u2013":`${N(n,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>Mn(n,o).length>0);return m`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||M(n,"room")} \xB7 ${M(n,"climate")}`}>
</div>`}function lg(n,e,t){let r=(o,s,a)=>o===null?"\u2013":`${N(n,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>zn(n,o).length>0);return m`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||M(n,"room")} \xB7 ${M(n,"climate")}`}>
${e.showTemperature?m`<div class="live-row live-climate-temperature"><span title=${M(n,"climate_temperature")} aria-label=${M(n,"climate_temperature")}>🌡</span><b>${r(e.temperature===null?null:n?ue(n,e.temperature):e.temperature,1,n?re(n):"\xB0C")}</b>${G(n,e.sources?.temperature??[],M(n,"climate_temperature"))}</div>`:f}
${e.showHumidity?m`<div class="live-row live-climate-humidity"><span title=${M(n,"climate_humidity")} aria-label=${M(n,"climate_humidity")}>💧</span><b>${r(e.humidity,0,"%")}</b>${G(n,e.sources?.humidity??[],M(n,"climate_humidity"))}</div>`:f}
${e.showCo2?m`<div class="live-row live-climate-co2"><span title=${M(n,"climate_co2")} aria-label=${M(n,"climate_co2")}>☁</span><b>${r(e.co2,0,"ppm")}</b>${G(n,e.sources?.co2??[],M(n,"climate_co2"))}</div>`:f}
${e.showIlluminance?m`<div class="live-row live-climate-illuminance"><span title=${M(n,"climate_illuminance")} aria-label=${M(n,"climate_illuminance")}>☀</span><b>${r(e.illuminance,0,"lx")}</b>${G(n,e.sources?.illuminance??[],M(n,"climate_illuminance"))}</div>`:f}
</div>`}function og(n,e,t){let r=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${He(n,e.power)}`;return m`<div class="live-card live-card-power ${(e.readings??[]).length?"live-card-charging":""}" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}>
</div>`}function cg(n,e,t){let r=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${He(n,e.power)}`;return m`<div class="live-card live-card-power ${(e.readings??[]).length?"live-card-charging":""}" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}>
<div class="live-power-name">${e.name}</div>${e.powerEntity?m`<div class="live-row"><span aria-hidden="true">⚡</span><b>${r}</b>${G(n,[e.powerEntity],e.name)}</div>`:f}
${(e.readings??[]).map(i=>m`<div class="live-row live-charging-row" data-reading=${i.id}><span class="live-charging-label" title=${i.label}><span aria-hidden="true">${i.icon}</span> ${i.label}</span><b title=${i.text}>${i.text}</b>${G(n,[i.entity],i.label)}</div>`)}
</div>`}function Ku(n,e,t,r,i=!1){return e.length?m`<div class="live-cards">
${e.map((o,s)=>o.kind==="roomclimate"?ig(n,o,s):o.kind==="power"?og(n,o,s):o.kind==="hydronic"?m`<div class="live-card live-card-hydronic" data-i=${s} data-furniture=${o.item.id}><nf-hydronic-card .hass=${n} .item=${o.item} .readOnly=${o.readOnly}></nf-hydronic-card></div>`:i?f:o.kind==="house"?Jf(n,o,s,r):o.kind==="car"?eg(n,o,s,t):o.kind==="printer"?ng(n,o,s):o.kind==="heatpump"?rg(n,o,s):tg(n,o,s,t))}
</div>`:f}var Gu=J`
</div>`}function qu(n,e,t,r,i=!1){return e.length?m`<div class="live-cards">
${e.map((o,s)=>o.kind==="roomclimate"?lg(n,o,s):o.kind==="power"?cg(n,o,s):o.kind==="hydronic"?m`<div class="live-card live-card-hydronic" data-i=${s} data-furniture=${o.item.id}><nf-hydronic-card .hass=${n} .item=${o.item} .readOnly=${o.readOnly}></nf-hydronic-card></div>`:i?f:o.kind==="house"?tg(n,o,s,r):o.kind==="car"?ig(n,o,s,t):o.kind==="printer"?sg(n,o,s):o.kind==="heatpump"?ag(n,o,s):og(n,o,s,t))}
</div>`:f}var Zu=J`
.live-card.live-card-power { display:grid; gap:4px; min-width:90px; max-width:220px; box-sizing:border-box; }
.live-power-name { font-size:11px; color:var(--nf-muted); overflow:hidden; text-overflow:ellipsis; }
.live-card-power .live-row { align-items:center; gap:6px; }
@@ -1307,7 +1307,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
text-transform: uppercase;
letter-spacing: 0.04em;
}
`;function cs(n){switch(n.kind){case"house":return{density:0,priority:100};case"roomclimate":return{density:24,priority:80};case"hydronic":return{density:42,priority:45};case"power":return n.power!==null&&Math.abs(n.power)>1?{density:48,priority:60}:n.readings?.length?{density:56,priority:30}:{density:n.power===null?64:72,priority:20};case"car":return{density:n.car.charging?36:60,priority:n.car.charging?60:20};case"printer":return{density:n.printer.printing?36:60,priority:n.printer.printing?60:20};case"heatpump":return{density:n.pump.mode!=="idle"?36:60,priority:n.pump.mode!=="idle"?60:20};case"media":return{density:48,priority:40}}}function Uu(n,e,t){let r=cs(n).density;return r?Number.isFinite(e)&&e>=r*(t?.88:1.12):!0}function yi(n){return n.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var us=n=>n.points.length>=3;function ju(n,e,t){return n.rooms.filter(us).find(r=>H([e,t],r.points))}function sg(n,e,t,r){let i=[];for(let a of e.rooms.filter(us)){let[l,c]=Pe(a.points);i.push({kind:"room",name:a.name,where:r?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in n.states))return;o.add(a);let d=ju(e,l,c),p=[d?.name,r?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:O(n,a),where:p,floorId:e.id,roomId:d?.id??null,entity:a,icon:P(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??Wt(P(a.entity_id)??"sensor",Me(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=Me(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=ju(e,a.x,a.z),c=[l?.name,r?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function qu(n,e){let t=qe(n,e.floors),r=e.floors.length>1,i=e.floors.flatMap(o=>sg(n,o,t,r));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(p=>o.rooms.includes(p.id)&&us(p)).map(p=>({f:d,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=Pe(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return i}function ag(n,e){return(yi(n.name).startsWith(e)?0:2)+(n.kind==="room"?0:1)}function Zu(n,e,t=8){let r=yi(e).split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=yi(e.trim());return n.filter(o=>{let s=yi([o.name,o.where,o.entity].filter(Boolean).join(" "));return r.every(a=>s.includes(a))}).map(o=>({item:o,cost:ag(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var lg=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],cg=[2200,2700,3200,4e3,5e3,6500],ug=["hs","rgb","rgbw","rgbww","xy"],dg=4,Yu=16,Ju=32,hg=128;function hs(n){let e=n.attributes.supported_color_modes??[],t=e.some(r=>ug.includes(r));return{dim:e.some(r=>r!=="onoff"),color:t,temp:e.includes("color_temp")}}function ps(n){return((n.attributes.supported_features??0)&dg)!==0&&typeof n.attributes.current_position=="number"}var ds=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return M(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,r={}){W(this.hass,this.entity)&&this.hass.callService(e,t,{entity_id:this.entity,...r})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){Ae(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((r,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${r}</div>`})}renderLight(e){let t=hs(e),r=e.state==="on",i=r&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):r?100:0,o=t.color?lg.map(s=>m`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?cg.map(s=>m`<button class="qm-swatch" style="background:${pg(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
`;function ps(n){switch(n.kind){case"house":return{density:0,priority:100};case"roomclimate":return{density:24,priority:80};case"hydronic":return{density:42,priority:45};case"power":return n.power!==null&&Math.abs(n.power)>1?{density:48,priority:60}:n.readings?.length?{density:56,priority:30}:{density:n.power===null?64:72,priority:20};case"car":return{density:n.car.charging?36:60,priority:n.car.charging?60:20};case"printer":return{density:n.printer.printing?36:60,priority:n.printer.printing?60:20};case"heatpump":return{density:n.pump.mode!=="idle"?36:60,priority:n.pump.mode!=="idle"?60:20};case"media":return{density:48,priority:40}}}function Yu(n,e,t){let r=ps(n).density;return r?Number.isFinite(e)&&e>=r*(t?.88:1.12):!0}function Si(n){return n.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var ms=n=>n.points.length>=3;function Ju(n,e,t){return n.rooms.filter(ms).find(r=>H([e,t],r.points))}function ug(n,e,t,r){let i=[];for(let a of e.rooms.filter(ms)){let[l,c]=Pe(a.points);i.push({kind:"room",name:a.name,where:r?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in n.states))return;o.add(a);let d=Ju(e,l,c),p=[d?.name,r?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:L(n,a),where:p,floorId:e.id,roomId:d?.id??null,entity:a,icon:P(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??Vt(P(a.entity_id)??"sensor",Me(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=Me(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Ju(e,a.x,a.z),c=[l?.name,r?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Qu(n,e){let t=qe(n,e.floors),r=e.floors.length>1,i=e.floors.flatMap(o=>ug(n,o,t,r));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(p=>o.rooms.includes(p.id)&&ms(p)).map(p=>({f:d,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=Pe(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return i}function dg(n,e){return(Si(n.name).startsWith(e)?0:2)+(n.kind==="room"?0:1)}function Xu(n,e,t=8){let r=Si(e).split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=Si(e.trim());return n.filter(o=>{let s=Si([o.name,o.where,o.entity].filter(Boolean).join(" "));return r.every(a=>s.includes(a))}).map(o=>({item:o,cost:dg(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var hg=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],pg=[2200,2700,3200,4e3,5e3,6500],mg=["hs","rgb","rgbw","rgbww","xy"],fg=4,ed=16,td=32,gg=128;function gs(n){let e=n.attributes.supported_color_modes??[],t=e.some(r=>mg.includes(r));return{dim:e.some(r=>r!=="onoff"),color:t,temp:e.includes("color_temp")}}function _s(n){return((n.attributes.supported_features??0)&fg)!==0&&typeof n.attributes.current_position=="number"}var fs=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return M(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,r={}){W(this.hass,this.entity)&&this.hass.callService(e,t,{entity_id:this.entity,...r})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){Ae(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((r,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${r}</div>`})}renderLight(e){let t=gs(e),r=e.state==="on",i=r&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):r?100:0,o=t.color?hg.map(s=>m`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?pg.map(s=>m`<button class="qm-swatch" style="background:${_g(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
${this.ring(o)}
<button class="qm-power ${r?"qm-on":""}" aria-pressed=${r} @click=${()=>this.ask()&&this.call("light","toggle")}>
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
@@ -1322,7 +1322,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.value=${String(Math.max(1,i))}
aria-label=${this.t("brightness")}
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
/>`:f}`}renderCover(e){e=Hr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,r=e.state==="opening"||e.state==="closing",i=ps(e),o=(u,d,p,h=!1)=>m`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${d} @click=${p}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),r)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||r||e.state==="open"||e.state==="closed";return m`<div class="qm-ring">
/>`:f}`}renderCover(e){e=Or(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,r=e.state==="opening"||e.state==="closing",i=_s(e),o=(u,d,p,h=!1)=>m`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${d} @click=${p}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),r)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||r||e.state==="open"||e.state==="closed";return m`<div class="qm-ring">
${this.ring(a)}
<button
class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
@@ -1344,7 +1344,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
aria-label=${this.t("position")}
@change=${u=>this.call("cover","set_cover_position",{position:Number(u.target.value)})}
/>`:f}
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,r=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&hg&&r!==null?m`<label class="qm-tilt"
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,r=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&gg&&r!==null?m`<label class="qm-tilt"
><span>${this.t("cover_tilt")} · ${Math.round(r)} %</span>
<input
class="qm-slider"
@@ -1354,9 +1354,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.value=${String(r)}
aria-label=${this.t("cover_tilt")}
@change=${i=>this.call("cover","set_cover_tilt_position",{entity_id:e.attributes.nf_cover_control?this.entity:this.tiltEntity||this.entity,tilt_position:Number(i.target.value)})}
/></label>`:t&(Yu|Ju)?m`<div class="qm-tilt-buttons">
${t&Yu?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&Ju?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
/></label>`:t&(ed|td)?m`<div class="qm-tilt-buttons">
${t&ed?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&td?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
</div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",r=e.entity_id.split(".")[0];return m`<div class="qm-ring qm-ring-small">
<button
class="qm-power ${t?"qm-on":""}"
@@ -1378,8 +1378,8 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${s.length?m`<div class="qm-play-head">${this.t("media_sources")}</div>
<div class="qm-play">${s.map(d=>m`<button class="qm-chip ${i.source===d?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:d})}>${d}</button>`)}</div>`:f}
${this.presets?.length?m`<div class="qm-play-head">${this.t("presets")}</div>
<div class="qm-play">${this.presets.map(d=>m`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:d.type,media_content_id:d.content})}>${d.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=P(this.entity),r=!W(this.hass,this.entity)||I(e)&&!wn(e)?m`<p class="qm-note">${se(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return m`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}>
<div class="qm-title">${O(this.hass,this.entity)}</div>
<div class="qm-play">${this.presets.map(d=>m`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:d.type,media_content_id:d.content})}>${d.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=P(this.entity),r=!W(this.hass,this.entity)||I(e)&&!Mn(e)?m`<p class="qm-note">${se(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return m`<div class="qm" role="dialog" aria-label=${L(this.hass,this.entity)}>
<div class="qm-title">${L(this.hass,this.entity)}</div>
${r}
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
</div>`}static styles=[ke,J`
@@ -1625,7 +1625,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.qm-note {
color: var(--nf-muted);
}
`]};function pg(n){let e=Math.min(1,Math.max(0,(n-2200)/4300)),t=(r,i)=>Math.round(r+(i-r)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",ds);var mg=new URL(import.meta.url),fg=new URL("./nextfloor-3d.js?v=2aa97dea1ed8",mg).href,Qu;function Xu(){return Qu??=import(fg),Qu}function ed(n){if(!n||n.state!=="on")return 0;let e=typeof n.attributes.percentage=="number"?n.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var td="weather.nextfloor_symcon",rd={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},nd=new WeakMap;function gg(n){let e=n.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function vi(n,e){if(!V(n))return n;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return n;let r=nd.get(n)??new WeakMap;nd.set(n,r);let i=r.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?n.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=ve(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=ve(g);_!==null&&(o[h]=di(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=ye(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=gg(Ie(s("condition"))),c=e.rain_sensor?n.states[e.rain_sensor]:void 0,u=le(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),le(s("lightning"))?l=u?"lightning-rainy":"lightning":le(s("snow"))?l=u?"snowy-rainy":"snowy":le(s("fog"))?l="fog":u===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&u===!1&&(l="sunny");let d={entity_id:td,state:l??"unknown",attributes:o},p={...n,states:{...n.states,[td]:d}};return r.set(e,p),p}var ms=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?m`<span class="value" title=${`${Jt(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Be(this.hass,e)}</b>${e.period!=="total"?m`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${G(this.hass,e.sources,`${Oe[e.kind]} \xB7 ${Jt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return Ke.map(t=>{let r=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(r.length,i.length)},(o,s)=>m`<div class="row"><span class="kind" title=${Oe[t]}>${s?"":`${Dn[t]} ${Oe[t]}`}</span>${r[s]?this.value(r[s]):m`<span></span>`}${i[s]?this.value(i[s]):m`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?We(this.hass,t,e):ec(this.hass,this.floors);return m`${Ke.map(a=>{let l=s.filter(c=>c.kind===a);return l.length?m`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Oe[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${Dn[a]} ${Oe[a]}</span><div class="values">${l.map(c=>this.value(c))}</div></div>`:f})}`}let i=(t?Yt(this.hass,t,e,!0).map(s=>({...s,hasDetails:s.rooms.length>0})):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:We(this.hass,s,e),rooms:[],hasDetails:Yt(this.hass,s,e,!0).length>0}))).filter(s=>s.readings.length||s.hasDetails);if(!i.lLine truncated
`]};function _g(n){let e=Math.min(1,Math.max(0,(n-2200)/4300)),t=(r,i)=>Math.round(r+(i-r)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",fs);var bg=new URL(import.meta.url),yg=new URL("./nextfloor-3d.js?v=dbb5f8d395a4",bg).href,nd;function rd(){return nd??=import(yg),nd}function id(n){if(!n||n.state!=="on")return 0;let e=typeof n.attributes.percentage=="number"?n.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var od="weather.nextfloor_symcon",ad={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},sd=new WeakMap;function vg(n){let e=n.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function $i(n,e){if(!V(n))return n;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return n;let r=sd.get(n)??new WeakMap;sd.set(n,r);let i=r.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?n.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=ve(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=ve(g);_!==null&&(o[h]=gi(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=ye(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=vg(Ie(s("condition"))),c=e.rain_sensor?n.states[e.rain_sensor]:void 0,u=le(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),le(s("lightning"))?l=u?"lightning-rainy":"lightning":le(s("snow"))?l=u?"snowy-rainy":"snowy":le(s("fog"))?l="fog":u===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&u===!1&&(l="sunny");let d={entity_id:od,state:l??"unknown",attributes:o},p={...n,states:{...n.states,[od]:d}};return r.set(e,p),p}var bs=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?m`<span class="value" title=${`${Xt(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Be(this.hass,e)}</b>${e.period!=="total"?m`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${G(this.hass,e.sources,`${Le[e.kind]} \xB7 ${Xt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return Ke.map(t=>{let r=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(r.length,i.length)},(o,s)=>m`<div class="row"><span class="kind" title=${Le[t]}>${s?"":`${Nn[t]} ${Le[t]}`}</span>${r[s]?this.value(r[s]):m`<span></span>`}${i[s]?this.value(i[s]):m`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?We(this.hass,t,e):ic(this.hass,this.floors);return m`${Ke.map(a=>{let l=s.filter(c=>c.kind===a);return l.length?m`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Le[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${Nn[a]} ${Le[a]}</span><div class="values">${l.map(c=>this.value(c))}</div></div>`:f})}`}let i=(t?Qt(this.hass,t,e,!0).map(s=>({...s,hasDetails:s.rooms.length>0})):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:We(this.hass,s,e),rooms:[],hasDetails:Qt(this.hass,s,e,!0).length>0}))).filter(s=>s.readings.length||s.hasDetails);if(!i.lLine truncated
<button class="heading" aria-expanded=${!o} @click=${()=>{this.folded=!o}}><span>${t?"Bereiche":"Stockwerke"}<small>${t?.name||"Gesamtgeb\xE4ude"}</small></span><span aria-hidden="true">${o?"+":"\u2212"}</span></button>
${o?f:m`<div class="entries"><div class="columns"><span></span><span title="Leistung bzw. Durchfluss">Leistung</span><span>Energie / Verbrauch</span></div>
${i.map(s=>m`<section class="entry" data-area=${t?s.id:f}>
@@ -1669,9 +1669,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.kind { color:var(--nf-muted); font-size:10px; white-space:nowrap; }
.row .value b { font-size:11px; font-weight:normal; }
@media(max-width:600px) { .entries { max-height:32vh; } }
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",ms);var id="image:";function fs(n,e,t){let r=(e??"").trim();if(!r)return null;if(r.startsWith(id))return t(r.slice(id.length));if(/^(https?:\/\/|\/)/.test(r))return r;if(/^[a-z_]+\.[a-z0-9_]+$/.test(r)){let i=n?.states[r]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var qn=n=>Number(n);function Yn(n){if(Array.isArray(n)){let[o,s]=[qn(n[0]),qn(n[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!n||typeof n!="object")return null;let{x:e,y:t}=n,[r,i]=[qn(e),qn(t)];return Number.isFinite(r)&&Number.isFinite(i)?[r,i]:null}function od(n){return n?Yn(n.charger)??Yn(n.charger_position):null}function sd(n){for(let[e,t]of Object.entries(n.states))if(e.startsWith("camera.")&&(Yn(t.attributes?.vacuum_position)??od(t.attributes)))return e;return null}var _g=n=>Array.isArray(n)?typeof n[0]=="number":!!n&&typeof n=="object",Zn=(n,e)=>e?[n[0],-n[1]]:n;function bg(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Zn(n.ga,e),[i,o]=Zn(n.gb,e),[s,a]=n.a,[l,c]=n.b,[u,d]=[i-t,o-r],[p,h]=[l-s,c-a],g=Math.hypot(u,d),_=Math.hypot(p,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,y=Math.atan2(h,p)-Math.atan2(d,u),[S,$]=[Math.cos(y),Math.sin(y)];return A=>{let T=Zn(A,e),[k,F]=[T[0]-t,T[1]-r];return[s+b*(k*S-F*$),a+b*(k*$+F*S)]}}function yg(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Zn(n.ga,e),[i,o]=Zn(n.gb,e),s=Math.atan2(n.b[1]-n.a[1],n.b[0]-n.a[0])-Math.atan2(o-r,i-t);return Number.isFinite(s)?s:null}function ad(n,e,t){if(!e)return null;let r=n.states[e]?.attributes;if(!r)return null;let i=bg(t)??(g=>g),o=yg(t)??0,s=t?.mirror===!0?-1:1,a=r.vacuum_position,l=Yn(a),c=l?(()=>{let[g,_]=i(l),b=qn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let y=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(y),Math.sin(y))}})():null,u=od(r),d=Array.isArray(r.path)?r.path:[],p=d.length>0&&_g(d[0])?[d]:d,h=[];for(let g of p){let _=[];for(let b of Array.isArray(g)?g:[]){let y=Yn(b);y&&_.push(i(y))}_.length>1&&h.push(_)}return!c&&!u&&!h.length?null:{pose:c,charger:u?i(u):null,path:h}}var ld="nextfloor.lock3d",cd=520,_s=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},topologySelection:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;topologyImages=new Map;scopedFor=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig Line truncated
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",bs);var ld="image:";function ys(n,e,t){let r=(e??"").trim();if(!r)return null;if(r.startsWith(ld))return t(r.slice(ld.length));if(/^(https?:\/\/|\/)/.test(r))return r;if(/^[a-z_]+\.[a-z0-9_]+$/.test(r)){let i=n?.states[r]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Xn=n=>Number(n);function tr(n){if(Array.isArray(n)){let[o,s]=[Xn(n[0]),Xn(n[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!n||typeof n!="object")return null;let{x:e,y:t}=n,[r,i]=[Xn(e),Xn(t)];return Number.isFinite(r)&&Number.isFinite(i)?[r,i]:null}function cd(n){return n?tr(n.charger)??tr(n.charger_position):null}function ud(n){for(let[e,t]of Object.entries(n.states))if(e.startsWith("camera.")&&(tr(t.attributes?.vacuum_position)??cd(t.attributes)))return e;return null}var wg=n=>Array.isArray(n)?typeof n[0]=="number":!!n&&typeof n=="object",er=(n,e)=>e?[n[0],-n[1]]:n;function xg(n){if(!n)return null;let e=n.mirror===!0,[t,r]=er(n.ga,e),[i,o]=er(n.gb,e),[s,a]=n.a,[l,c]=n.b,[u,d]=[i-t,o-r],[p,h]=[l-s,c-a],g=Math.hypot(u,d),_=Math.hypot(p,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,y=Math.atan2(h,p)-Math.atan2(d,u),[S,$]=[Math.cos(y),Math.sin(y)];return A=>{let T=er(A,e),[k,F]=[T[0]-t,T[1]-r];return[s+b*(k*S-F*$),a+b*(k*$+F*S)]}}function kg(n){if(!n)return null;let e=n.mirror===!0,[t,r]=er(n.ga,e),[i,o]=er(n.gb,e),s=Math.atan2(n.b[1]-n.a[1],n.b[0]-n.a[0])-Math.atan2(o-r,i-t);return Number.isFinite(s)?s:null}function dd(n,e,t){if(!e)return null;let r=n.states[e]?.attributes;if(!r)return null;let i=xg(t)??(g=>g),o=kg(t)??0,s=t?.mirror===!0?-1:1,a=r.vacuum_position,l=tr(a),c=l?(()=>{let[g,_]=i(l),b=Xn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let y=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(y),Math.sin(y))}})():null,u=cd(r),d=Array.isArray(r.path)?r.path:[],p=d.length>0&&wg(d[0])?[d]:d,h=[];for(let g of p){let _=[];for(let b of Array.isArray(g)?g:[]){let y=tr(b);y&&_.push(i(y))}_.length>1&&h.push(_)}return!c&&!u&&!h.length?null:{pose:c,charger:u?i(u):null,path:h}}var hd="nextfloor.lock3d",pd=520,ws=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},topologySelection:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;topologyImages=new Map;scopedFor=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig Line truncated
${e.map(t=>m`<button class="nf-chip" aria-pressed=${!this.hiddenLayers.has(t.id)} @click=${()=>this.toggleLayer(t.id)}>${this.hiddenLayers.has(t.id)?"\u25CC":"\u{1F441}"} ${t.name}</button>`)}
</div>`}syncDevices(e){let t=this.viewer,r=this.building?this.scopeBuilding():null;if(!t||!r||!this.hass)return;let i=this._travel,o=i&&!i.loading?en(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Ue(o,r.floors),this.furnitureLinks=qe(o,r.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?qc(o,r,this.weatherEntityId,this.openingLinks):null,this.watched=tu({hass:o,building:r,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(v=>this.shownStates.get(v)!==o.states[v])))return;let a=this.shownFor?.shown,l=this.shownBuilding(o);l!==a&&t.setBuilding(l),this.shownStates=new Map(this.watched.map(v=>[v,o.states[v]])),this.syncHydronics(t,r,o),this.refreshToday(r),this.refreshForecast(r);let c=Tn(o,r),u=_l(o,r.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(o):r);this.placementInfo=new Map(u.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let d=this.furnitureMarkers(o,r,new Set(u.map(v=>v.id)),new Set(c.map(v=>v.powerEntity)));c.push(...d.consumers);let p=zn(o,r,c,Xe(r,v=>this.furnitureLinks?.get(v.id)?.power??null)),h=new Map(c.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=St(o,r.floors);let g=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of r.floors)for(let w of v.outdoor??[]){if(!w.area_id&&!w.temp_entity&&!w.pump_entity)continue;let K=w.temp_entity?o.states[w.temp_entity]:void 0,we=w.pump_entity?o.states[w.pump_entity]:void 0,[ce,ge]=Pe(w.points),Dd=K&&Number.isFinite(Number(K.state))?`${N(o,ue(o,$r(Number(K.state),K.attributes.unit_of_measurement)),1)} ${re(o)}`:"",As=!!we&&te(we);u.push({id:w.area_id?`outdoor:${w.id}`:w.pump_entity??w.temp_entity,floorId:v.id,roomId:null,x:ce,z:ge,y:yr(v,w,ce,ge)+.7,icon:Ce(w.type==="pool"?"pool":w.type==="terrace"?"table-chair":"tree-outline"),name:w.area_id&&o.areas?.[w.area_id]?.name||M(o,`out_${w.type}`),text:[Dd,As?M(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:As,unavailable:!1,glow:null,show:"always"})}let _=new Map;for(let v of r.floors){for(let w of v.placements)w.pin_offset&&_.set(`${v.id}:${w.entity_id}`,w.pin_offset);for(let w of v.furniture)w.pin_offset&&_.set(`f:${w.id}`,w.pin_offset)}let b=v=>{let w=v.lamp?void 0:(v.furnitureId?_.get(`f:${v.furnitureId}`):void 0)??_.get(`${v.floorId}:${v.id}`);return w?{...v,x:v.x+(w.x??0),z:v.z+(w.z??0),y:v.y+(w.y??0)}:v};t.setDevices([...[...u,...d.markers].map(b).map(v=>{let w=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:h.get(v.id)??null,K={...v,power:w,powerText:w===null?void 0:pe(o,w),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(o,r,p,v.furnitureId)??v.text},we=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",ce=g.has(v.id)||!!v.furnitureId&&g.has(v.furnitureId);return{...K,pin:this.showPin(K)&&!ce,full:v.show==="always",caption:we}})]),t.setPickTargets(d.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(d.screens),t.setFridgeDoors(Qa(o,r.floors)),t.setCovers(cl(o,r)),t.setRobots(this.robotInfos(o,r));let y=new Map;for(let v of r.floors)for(let w of v.furniture)!X(w.type)?.pet||!w.room_sensor||w.room_sensor==="none"||y.set(w.id,co(o,v.rooms.filter(K=>K.points.length>=3),null,w.room_sensor)?.id??null);y.size&&t.setPetRooms(y),t.setRoofWindows(Vc(o,r)),t.setParked(Uo(o,r)),t.setGateStates(au(o,r));let S=new Map(r.floors.flatMap(v=>v.openings.map(w=>[w.id,w.type]))),$=new Map([...this.openingLinks].map(([v,w])=>[v,je(o,w,S.get(v))]));t.setOpeningStates($),this.setAlerts(this.alertSrc?Vo(o,r,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let A=[...u,...d.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(w=>w.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...$].map(([v,w])=>`${v}:${w.open}:${w.cover===null?"-":w.cover.toFixed(1)}`).join(";");if(A!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=A,v||this.scheduleThumbs(1500)}let T=wu(o,r,c,r.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),k=this.liveCars(o,r);for(let v of k){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let w=r.floors.flatMap(ce=>ce.furniture.filter(ge=>ge.type==="wallbox").map(ge=>({floorId:ce.id,x:ge.x,z:ge.z,y:1}))).sort((ce,ge)=>Math.hypot(ce.x-v.at.x,ce.z-v.at.z)-Math.hypot(ge.x-v.at.x,ge.z-v.at.z))[0],K=w&&w.floorId===v.at.floorId&&Math.hypot(w.x-v.at.x,w.z-v.at.z)<9,we=w??Kn(r);!we||!v.car.charging&&!K||T.arcs.push({key:`car:${v.spot}`,from:we,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...K?{via:[{...we,y:.35},{floorId:v.at.floorId,x:(we.x+v.at.x)/2,z:(we.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let F=Kn(r);for(let v ofLine truncated
</div>`}syncDevices(e){let t=this.viewer,r=this.building?this.scopeBuilding():null;if(!t||!r||!this.hass)return;let i=this._travel,o=i&&!i.loading?nn(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Ue(o,r.floors),this.furnitureLinks=qe(o,r.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Qc(o,r,this.weatherEntityId,this.openingLinks):null,this.watched=ou({hass:o,building:r,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(v=>this.shownStates.get(v)!==o.states[v])))return;let a=this.shownFor?.shown,l=this.shownBuilding(o);l!==a&&t.setBuilding(l),this.shownStates=new Map(this.watched.map(v=>[v,o.states[v]])),this.syncHydronics(t,r,o),this.refreshToday(r),this.refreshForecast(r);let c=Pn(o,r),u=wl(o,r.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(o):r);this.placementInfo=new Map(u.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let d=this.furnitureMarkers(o,r,new Set(u.map(v=>v.id)),new Set(c.map(v=>v.powerEntity)));c.push(...d.consumers);let p=In(o,r,c,Xe(r,v=>this.furnitureLinks?.get(v.id)?.power??null)),h=new Map(c.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=St(o,r.floors);let g=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of r.floors)for(let w of v.outdoor??[]){if(!w.area_id&&!w.temp_entity&&!w.pump_entity)continue;let K=w.temp_entity?o.states[w.temp_entity]:void 0,we=w.pump_entity?o.states[w.pump_entity]:void 0,[ce,ge]=Pe(w.points),Cd=K&&Number.isFinite(Number(K.state))?`${N(o,ue(o,Tr(Number(K.state),K.attributes.unit_of_measurement)),1)} ${re(o)}`:"",zs=!!we&&te(we);u.push({id:w.area_id?`outdoor:${w.id}`:w.pump_entity??w.temp_entity,floorId:v.id,roomId:null,x:ce,z:ge,y:Sr(v,w,ce,ge)+.7,icon:Ce(w.type==="pool"?"pool":w.type==="terrace"?"table-chair":"tree-outline"),name:w.area_id&&o.areas?.[w.area_id]?.name||M(o,`out_${w.type}`),text:[Cd,zs?M(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:zs,unavailable:!1,glow:null,show:"always"})}let _=new Map;for(let v of r.floors){for(let w of v.placements)w.pin_offset&&_.set(`${v.id}:${w.entity_id}`,w.pin_offset);for(let w of v.furniture)w.pin_offset&&_.set(`f:${w.id}`,w.pin_offset)}let b=v=>{let w=v.lamp?void 0:(v.furnitureId?_.get(`f:${v.furnitureId}`):void 0)??_.get(`${v.floorId}:${v.id}`);return w?{...v,x:v.x+(w.x??0),z:v.z+(w.z??0),y:v.y+(w.y??0)}:v};t.setDevices([...[...u,...d.markers].map(b).map(v=>{let w=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:h.get(v.id)??null,K={...v,power:w,powerText:w===null?void 0:pe(o,w),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(o,r,p,v.furnitureId)??v.text},we=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",ce=g.has(v.id)||!!v.furnitureId&&g.has(v.furnitureId);return{...K,pin:this.showPin(K)&&!ce,full:v.show==="always",caption:we}})]),t.setPickTargets(d.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(d.screens),t.setFridgeDoors(nl(o,r.floors)),t.setCovers(pl(o,r)),t.setRobots(this.robotInfos(o,r));let y=new Map;for(let v of r.floors)for(let w of v.furniture)!X(w.type)?.pet||!w.room_sensor||w.room_sensor==="none"||y.set(w.id,mo(o,v.rooms.filter(K=>K.points.length>=3),null,w.room_sensor)?.id??null);y.size&&t.setPetRooms(y),t.setRoofWindows(jc(o,r)),t.setParked(Yo(o,r)),t.setGateStates(du(o,r));let S=new Map(r.floors.flatMap(v=>v.openings.map(w=>[w.id,w.type]))),$=new Map([...this.openingLinks].map(([v,w])=>[v,je(o,w,S.get(v))]));t.setOpeningStates($),this.setAlerts(this.alertSrc?jo(o,r,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let A=[...u,...d.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(w=>w.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...$].map(([v,w])=>`${v}:${w.open}:${w.cover===null?"-":w.cover.toFixed(1)}`).join(";");if(A!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=A,v||this.scheduleThumbs(1500)}let T=$u(o,r,c,r.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),k=this.liveCars(o,r);for(let v of k){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let w=r.floors.flatMap(ce=>ce.furniture.filter(ge=>ge.type==="wallbox").map(ge=>({floorId:ce.id,x:ge.x,z:ge.z,y:1}))).sort((ce,ge)=>Math.hypot(ce.x-v.at.x,ce.z-v.at.z)-Math.hypot(ge.x-v.at.x,ge.z-v.at.z))[0],K=w&&w.floorId===v.at.floorId&&Math.hypot(w.x-v.at.x,w.z-v.at.z)<9,we=w??Zn(r);!we||!v.car.charging&&!K||T.arcs.push({key:`car:${v.spot}`,from:we,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...K?{via:[{...we,y:.35},{floorId:v.at.floorId,x:(we.x+v.at.x)/2,z:(we.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let F=Zn(r);for(let v ofLine truncated
<button class="nf-thumbs-fold" title=${M(this.hass,r?"thumbs_show":"thumbs_fold")} aria-label=${M(this.hass,r?"thumbs_show":"thumbs_fold")} @click=${i}>${r?"\u25B8":"\u25C2"}</button>
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg>
@@ -1681,16 +1681,16 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${r?f:m`<img src=${o.url} alt="" />`}
<span>${e.get(o.floorId)??""}</span>
</button>`)}
</nav>`}onDeviceHold(e,t,r){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:r}:Ae(this,e)}onDeviceSwipe(e,t,r,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||!W(this.hass,e)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&hs(s).dim){let c=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&ps(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-r/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){if(this._swipe&&!W(this.hass,this._swipe.entity))return;let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,Ml(this.hass,r=>this.announce(r)).then(r=>{t?r():this.stopAnnouncements=r})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!xl(e,this.screenName)||!kl(e))return;let r=Sl(e.message);this._announcement={message:e.message,until:Date.now()+r},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,r),$l(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${M(this.hass,"close")} @click=${()=>this._announcement=null}>
</nav>`}onDeviceHold(e,t,r){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:r}:Ae(this,e)}onDeviceSwipe(e,t,r,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||!W(this.hass,e)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&gs(s).dim){let c=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&_s(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-r/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){if(this._swipe&&!W(this.hass,this._swipe.entity))return;let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,Tl(this.hass,r=>this.announce(r)).then(r=>{t?r():this.stopAnnouncements=r})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!Ml(e,this.screenName)||!Al(e))return;let r=El(e.message);this._announcement={message:e.message,until:Date.now()+r},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,r),Rl(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${M(this.hass,"close")} @click=${()=>this._announcement=null}>
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span>
</button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return m`<div class="nf-alert-banner" role="alert">
${t.map(r=>m`<button class="nf-alert nf-alert-${r.kind}" style=${r.color?`border-left-color:${r.color}`:""} title=${Ko(this.hass,e,r)} @click=${()=>this.jumpTo(r)}>${Ko(this.hass,e,r)}</button>`)}
${t.map(r=>m`<button class="nf-alert nf-alert-${r.kind}" style=${r.color?`border-left-color:${r.color}`:""} title=${qo(this.hass,e,r)} @click=${()=>this.jumpTo(r)}>${qo(this.hass,e,r)}</button>`)}
${this._alerts.length>3?m`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f}
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),r=t?j(this.hass,t).filter(o=>P(o)==="scene"||P(o)==="script").slice(0,6):[];if(!r.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return m`<div class="nf-scenes">
${r.map(o=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${O(this.hass,o,i)}</button>`)}
${r.map(o=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${L(this.hass,o,i)}</button>`)}
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return m`<button class="nf-find-btn" title=${M(this.hass,"find")} aria-label=${M(this.hass,"find")} @click=${()=>this._find=""}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5" /><path d="M16 16l4.5 4.5" /></svg>
</button>`;let t=Zu(this.findIndex??=qu(this.hass,e),this._find);return m`<div class="nf-find">
</button>`;let t=Xu(this.findIndex??=Qu(this.hass,e),this._find);return m`<div class="nf-find">
<input
type="search"
placeholder=${M(this.hass,"find_placeholder")}
@@ -1701,7 +1701,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<button class="nf-find-close" aria-label=${M(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
${this._find.trim()?m`<div class="nf-find-list">
${t.length?t.map(r=>m`<button @click=${()=>this.goTo(r)}>
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${r.icon?Cr(r.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${r.icon?Br(r.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
<span><b>${r.name}</b>${r.where?m`<small>${r.where}</small>`:f}</span>
</button>`):m`<p>${M(this.hass,"find_none")}</p>`}
</div>`:f}
@@ -1713,7 +1713,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@click=${()=>{this._central=!this._central,this._armed=null}}
>
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg>
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>uo(t,b).lights).filter(b=>W(t,b)),l=s.flatMap(b=>uo(t,b).covers).filter(b=>W(t,b)),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,d=(b,y,S,$)=>{if($.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(y,S,{entity_id:$})}},p=(b,y,S,$,A)=>m`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!A.length} @click=${()=>d(b,S,$,A)}>
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>fo(t,b).lights).filter(b=>W(t,b)),l=s.flatMap(b=>fo(t,b).covers).filter(b=>W(t,b)),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,d=(b,y,S,$)=>{if($.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(y,S,{entity_id:$})}},p=(b,y,S,$,A)=>m`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!A.length} @click=${()=>d(b,S,$,A)}>
${this._armed===b?r("central_sure"):r(y)}
</button>`,h=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!h[b]||!o||h[b]===o.id)),_=this.buttons??e.settings.buttons??[];return m`${i}
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${r("central")}>
@@ -1730,25 +1730,25 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</div>`:f}
<b>${r("central_favorites")}</b>
${g.length?m`<div class="nf-central-favs">
${g.map(b=>{let[y,S]=rl(b),$=t.states[b],A=y==="homeassistant"&&$?.state==="on";return m`<button
${g.map(b=>{let[y,S]=al(b),$=t.states[b],A=y==="homeassistant"&&$?.state==="on";return m`<button
class="nf-chip"
aria-pressed=${A||this._sceneFired===b}
?disabled=${I($)||!W(t,b)}
@click=${()=>{t.callService(y,S,{entity_id:b}),this._sceneFired=b,setTimeout(()=>this._sceneFired=null,600)}}
>
${O(t,b)}
${L(t,b)}
</button>`})}
</div>`:_.length?f:m`<p class="nf-central-hint">${r("central_no_favorites")}</p>`}
${_.length?m`<div class="nf-central-favs">
${_.map(b=>m`<button
class="nf-chip nf-own-btn"
aria-pressed=${il(t,b)}
@click=${y=>{ho(t,y.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
aria-pressed=${ll(t,b)}
@click=${y=>{go(t,y.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
>
${b.icon?m`<ha-icon .icon=${b.icon.startsWith("mdi:")?b.icon:`mdi:${b.icon}`}></ha-icon>`:f}${b.label}
</button>`)}
</div>`:f}
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(ld,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),r=t-e*36e5;this._travel={history:new Map,from:r,to:t,t:r,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await In(this.hass,Ec(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:Rc(i,r,t),loading:!1}}catch{this._travel=null,this._error=M(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let r=this._travel;if(!r)return;let i=r.t+250*r.speed;i>=r.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>M(this.hass,a),t=this._travel;if(!t)return this.travelButton?m`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return m`<div class="nf-travel" role="group" aria-label=${e("travel")}>
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(hd,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),r=t-e*36e5;this._travel={history:new Map,from:r,to:t,t:r,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await Wn(this.hass,Fc(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:Dc(i,r,t),loading:!1}}catch{this._travel=null,this._error=M(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let r=this._travel;if(!r)return;let i=r.t+250*r.speed;i>=r.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>M(this.hass,a),t=this._travel;if(!t)return this.travelButton?m`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return m`<div class="nf-travel" role="group" aria-label=${e("travel")}>
<button class="nf-travel-play" aria-label=${e(t.playing?"travel_pause":"travel_play")} ?disabled=${t.loading} @click=${()=>this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}</button>
<b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b>
<div class="nf-travel-track">
@@ -1781,12 +1781,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
>
${this.clean?ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M12 6a9.8 9.8 0 0 1 9 6 9.8 9.8 0 0 1-9 6 9.8 9.8 0 0 1-9-6 9.8 9.8 0 0 1 9-6m0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4" /></svg>`:ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M2.4 3.8 3.8 2.4l17.8 17.8-1.4 1.4-3.3-3.3A10.5 10.5 0 0 1 12 19a9.8 9.8 0 0 1-9-6 10.3 10.3 0 0 1 3.6-4.3L2.4 3.8M12 7a4 4 0 0 1 4 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3m-4 4a4 4 0 0 0 5.5 3.7l-5.2-5.2c-.2.5-.3 1-.3 1.5m4-7a9.8 9.8 0 0 1 9 6 10 10 0 0 1-2.6 3.6l-1.4-1.4A8 8 0 0 0 18.8 12 8 8 0 0 0 9.6 7.2L8 5.6A10.3 10.3 0 0 1 12 4" /></svg>`}
</button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return m`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
<span>${O(this.hass,e.entity)}</span>
<span>${L(this.hass,e.entity)}</span>
<b>${t?M(this.hass,"swipe_off"):`${e.value} %`}</b>
<i><em style="height:${e.value}%"></em></i>
</div>`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?po(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,r);o.length>1&&(this._plate={ids:o,x:t,y:r})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,r=()=>this._plate=null;return m`<div class="nf-menu-backdrop" @click=${r}></div>
</div>`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?_o(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,r);o.length>1&&(this._plate={ids:o,x:t,y:r})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,r=()=>this._plate=null;return m`<div class="nf-menu-backdrop" @click=${r}></div>
<div class="nf-plate-menu" style="left:${Math.max(8,e.x-110)}px;top:${Math.max(8,e.y-20-e.ids.length*46)}px" role="menu">
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{r(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${O(t,i)}</span><i>${s?se(t,s):"\u2013"}</i></button>`})}
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{r(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${L(t,i)}</span><i>${s?se(t,s):"\u2013"}</i></button>`})}
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),r=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(r-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return m`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
<nf-quick-menu
style="left:${o}px;top:${s}px"
@@ -1797,12 +1797,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))}
?confirmSwitch=${this.confirmSet.has(e.entity)}
.myPosition=${this.myPositionOf(e.entity)}
.tiltEntity=${Dr(this.hass,this.building?.floors??[],e.entity)}
.tiltEntity=${Nr(this.hass,this.building?.floors??[],e.entity)}
@close=${()=>this._menu=null}
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&is().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});return}let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&ho(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,r);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Xe(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&Ae(this,a);return}let o=P(e);if(this.hass.symconObjects!==void 0&&!W(this.hass,e)){this.hass.states[e]&&(this._menu={entity:e,x:t,y:r});return}if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:r};return}if(o==="lock"){let s=ao(this.hass,e),a=O(this.hass,e);confirm(M(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Ta.has(o)){if(this.confirmSet.has(e)&&!confirm(M(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;yl(this.hass,e)}else Ae(this,e)}pluginTapped(e){let t=this.hass?.states[e],r=this.placementInfo.get(e);if(!t||!r)return!1;let i=this.building?.floors.find(o=>o.id===r.floorId)?.placements.find(o=>o.entity_id===e);return aa({hass:this.hass,entityId:e,state:t},r,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>Ae(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?m`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&ls().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});return}let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&go(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,r);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Xe(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&Ae(this,a);return}let o=P(e);if(this.hass.symconObjects!==void 0&&!W(this.hass,e)){this.hass.states[e]&&(this._menu={entity:e,x:t,y:r});return}if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:r};return}if(o==="lock"){let s=ho(this.hass,e),a=L(this.hass,e);confirm(M(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Ha.has(o)){if(this.confirmSet.has(e)&&!confirm(M(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;kl(this.hass,e)}else Ae(this,e)}pluginTapped(e){let t=this.hass?.states[e],r=this.placementInfo.get(e);if(!t||!r)return!1;let i=this.building?.floors.find(o=>o.id===r.floorId)?.placements.find(o=>o.entity_id===e);return da({hass:this.hass,entityId:e,state:t},r,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>Ae(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?m`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
<div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${M(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
<div class="nf-pw-body">${e.node}</div>
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let r=[];for(let i of e.floors)for(let o of i.furniture){if(!Iu(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Pu(t,s?.entity??s?.power??null);a&&r.push({id:o.id,name:o.name||ae(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},pump:a})}return r}livePrinters(e){let t=this.hass,r=[];if(!t)return r;for(let i of e.floors)for(let o of i.furniture){if(!ss(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=os(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||r.push({id:o.id,name:o.name||ae(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},printer:a})}return r}liveCars(e,t){let r=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Wu(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Go(e,o),l=a?eu(o,a):null,c=o.name||(a?ae(e,a):ae(e,o.type));r.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+(l?.h??.2)+.6},car:s})}return r}liveMedia(e,t){let r=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&r.push({entity:s,name:o.name||ae(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.push({entity:o.entity_id,name:o.name||O(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Lc(e,r)}refreshToday(e){let t=this.hass,r=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!r.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Tu(t,r,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,r=e.settings.forecast&&t?ht(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!r)return;let i=`${r}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Du(t,r).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,r=this.hass,i=t?.settings.forecast;if(!t||!r||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=Fu(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=ht(r,this.weatherEntityId??t.settings.weather_entity),a=s?r.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=r.language??navigator.language,d=new Intl.DateTimeFormat(u,{weekday:"short"}),p=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return m`<section class="nf-forecast" aria-label=${M(r,"forecast")}>
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let r=[];for(let i of e.floors)for(let o of i.furniture){if(!Lu(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Ou(t,s?.entity??s?.power??null);a&&r.push({id:o.id,name:o.name||ae(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},pump:a})}return r}livePrinters(e){let t=this.hass,r=[];if(!t)return r;for(let i of e.floors)for(let o of i.furniture){if(!us(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=cs(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||r.push({id:o.id,name:o.name||ae(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},printer:a})}return r}liveCars(e,t){let r=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Gu(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Zo(e,o),l=a?iu(o,a):null,c=o.name||(a?ae(e,a):ae(e,o.type));r.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+(l?.h??.2)+.6},car:s})}return r}liveMedia(e,t){let r=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&r.push({entity:s,name:o.name||ae(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.push({entity:o.entity_id,name:o.name||L(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Vc(e,r)}refreshToday(e){let t=this.hass,r=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!r.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Hu(t,r,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,r=e.settings.forecast&&t?ht(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!r)return;let i=`${r}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Cu(t,r).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,r=this.hass,i=t?.settings.forecast;if(!t||!r||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=Iu(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=ht(r,this.weatherEntityId??t.settings.weather_entity),a=s?r.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=r.language??navigator.language,d=new Intl.DateTimeFormat(u,{weekday:"short"}),p=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return m`<section class="nf-forecast" aria-label=${M(r,"forecast")}>
<ul>
${o.map((h,g)=>m`<li>
<span class="nf-fc-day">${g===0?M(r,"today"):d.format(new Date(h.day))}</span>
@@ -1811,14 +1811,14 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<span class="nf-fc-rain">${h.rain!==null&&h.rain>0?`\u{1F4A7}${h.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:h.chance!==null&&h.chance>0?`\u{1F4A7}${Math.round(h.chance)} %`:""}</span>
</li>`)}
</ul>
</section>`}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:m`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let r=Eu(t,e,Date.now(),{today:M(t,"care_bin_today"),tomorrow:M(t,"care_bin_tomorrow")}),i=Ru([...r,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return M(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},c=i.flatMap((u,d)=>[(u.day??0)>0&&(i[d-1]?.day??0)!==u.day?m`<li class="nf-today-day">${l(u.day??0)}</li>`:f,m`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return m`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${M(t,"today")}>
</section>`}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:m`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let r=Fu(t,e,Date.now(),{today:M(t,"care_bin_today"),tomorrow:M(t,"care_bin_tomorrow")}),i=Du([...r,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return M(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},c=i.flatMap((u,d)=>[(u.day??0)>0&&(i[d-1]?.day??0)!==u.day?m`<li class="nf-today-day">${l(u.day??0)}</li>`:f,m`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return m`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${M(t,"today")}>
<button class="nf-today-head" aria-expanded=${o} @click=${()=>this._todayOpen=!o}>
<b>📅 ${M(t,"today")}</b><span>${s}</span>
</button>
${o?i.length?m`<ul>
${c}
</ul>`:m`<p class="nf-today-none">${M(t,"today_none")}</p>`:f}
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let r=Xe(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:r.solar,grid:i.grid??r.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:r.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};fc(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let r=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&V(r)?We(r,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=V(r)?s?.value??null:o?.power_entity?Z(r?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${M(r,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Be(r,s):At(r,a)}${l}`})}for(let[l,c,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],p=d?r?.states[d]:void 0;p&&!I(p)&&i.push({icon:c,label:M(r,u),value:se(r,p)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let r=a=>zn(a,e,Tn(a,e),Xe(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Tc(t,r),o=Date.now(),s=o-24*36e5;In(t,i,s,o,!0).then(a=>{this.dayCurves=zc(t,a,s,o,r),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,r){let i=++this.hydronicGeneration,o=this.shownBuilding(r).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>ut(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(r,t,!!this._travel);return}is().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(r,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=Kn(t),d=(this.floorId?t.floors.find(p=>p.id===this.floorId):void 0)??[...t.floors].sort((p,h)=>h.elevation-p.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&d){let p=0,h=0,g=0;for(let _ of d.rooms)for(let[b,y]of _.points)p+=b,h+=y,g++;a.push({kind:"house",at:{floorId:d.id,x:g?p/g:u.x,z:g?h/g:u.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:r.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let p of i)a.push({kind:"car",at:p.at,spot:p.spot,name:p.name,car:p.car});for(let p of this.livePrinters(t))a.push({kind:"printer",at:p.at,name:p.name,printer:p.printer});for(let p of this.liveHeatPumps(t))a.push({kind:"heatpump",at:p.at,name:p.name,pump:p.pump});for(let p of o)a.push({kind:"media",at:{...p.at,y:p.at.y+.5},media:p})}if(this.liveCardsOn&&!this.dimmed){a.push(...xu(s,t,this.floorId,this.roomId)),a.push(...ku(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let p of t.floors)for(let h of p.furniture){if(!ut(h.type)||h.hydronic?.card===!1||this.floorId&&p.id!==this.floorId||!Ye(s,h))continue;let g=this.roomId?p.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([h.x,h.z],g.points))||a.push({kind:"hydronic",item:h,readOnly:!!this._travel,at:{floorId:p.id,x:h.x+(h.pin_offset?.x??0),z:h.z+(h.pin_offset?.z??0),y:oe(p,h)+h.h+.3+(h.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(p=>p.at),a.length?(p,h,g,_,b)=>this.placeLhCard(p,h,g,_,b):null)}placeLhCard(e,t,r,i,o){let s=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);if(!s)return;let a=this._liveCards[e],l=`${a.kind}:${a.at.floorId}:${a.at.x}:${a.at.z}`,c=s.dataset.zoomKey===l&&s.dataset.zoomVisible==="1",u=this.shadowRoot?.activeElement,d=!!u&&s.contains(u),p=d||Uu(a,o,c);s.dataset.zoomKey=l,s.dataset.zoomVisible=p?"1":"0",s.dataset.density=String(Math.round(o)),s.dataset.priority=String(d?110:cs(a).priority),s.dataset.focused=d?"1":"0",s.dataset.x=String(t),s.dataset.y=String(r),s.style.visibility=i&&p?"visible":"hidden",e===this._liveCards.length-1&&Vu(this.renderRoot)}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:m`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renLine truncated
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let r=Xe(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:r.solar,grid:i.grid??r.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:r.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};yc(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let r=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&V(r)?We(r,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=V(r)?s?.value??null:o?.power_entity?Z(r?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${M(r,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Be(r,s):At(r,a)}${l}`})}for(let[l,c,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],p=d?r?.states[d]:void 0;p&&!I(p)&&i.push({icon:c,label:M(r,u),value:se(r,p)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let r=a=>In(a,e,Pn(a,e),Xe(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Hc(t,r),o=Date.now(),s=o-24*36e5;Wn(t,i,s,o,!0).then(a=>{this.dayCurves=Pc(t,a,s,o,r),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,r){let i=++this.hydronicGeneration,o=this.shownBuilding(r).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>ut(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(r,t,!!this._travel);return}ls().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(r,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=Zn(t),d=(this.floorId?t.floors.find(p=>p.id===this.floorId):void 0)??[...t.floors].sort((p,h)=>h.elevation-p.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&d){let p=0,h=0,g=0;for(let _ of d.rooms)for(let[b,y]of _.points)p+=b,h+=y,g++;a.push({kind:"house",at:{floorId:d.id,x:g?p/g:u.x,z:g?h/g:u.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:r.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let p of i)a.push({kind:"car",at:p.at,spot:p.spot,name:p.name,car:p.car});for(let p of this.livePrinters(t))a.push({kind:"printer",at:p.at,name:p.name,printer:p.printer});for(let p of this.liveHeatPumps(t))a.push({kind:"heatpump",at:p.at,name:p.name,pump:p.pump});for(let p of o)a.push({kind:"media",at:{...p.at,y:p.at.y+.5},media:p})}if(this.liveCardsOn&&!this.dimmed){a.push(...Mu(s,t,this.floorId,this.roomId)),a.push(...Au(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let p of t.floors)for(let h of p.furniture){if(!ut(h.type)||h.hydronic?.card===!1||this.floorId&&p.id!==this.floorId||!Ye(s,h))continue;let g=this.roomId?p.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([h.x,h.z],g.points))||a.push({kind:"hydronic",item:h,readOnly:!!this._travel,at:{floorId:p.id,x:h.x+(h.pin_offset?.x??0),z:h.z+(h.pin_offset?.z??0),y:oe(p,h)+h.h+.3+(h.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(p=>p.at),a.length?(p,h,g,_,b)=>this.placeLhCard(p,h,g,_,b):null)}placeLhCard(e,t,r,i,o){let s=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);if(!s)return;let a=this._liveCards[e],l=`${a.kind}:${a.at.floorId}:${a.at.x}:${a.at.z}`,c=s.dataset.zoomKey===l&&s.dataset.zoomVisible==="1",u=this.shadowRoot?.activeElement,d=!!u&&s.contains(u),p=d||Yu(a,o,c);s.dataset.zoomKey=l,s.dataset.zoomVisible=p?"1":"0",s.dataset.density=String(Math.round(o)),s.dataset.priority=String(d?110:ps(a).priority),s.dataset.focused=d?"1":"0",s.dataset.x=String(t),s.dataset.y=String(r),s.style.visibility=i&&p?"visible":"hidden",e===this._liveCards.length-1&&ju(this.renderRoot)}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:m`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renLine truncated
${s}
${this.liveCardsOn&&this._liveCards.some(c=>c.kind==="house")?f:l.map(c=>m`<div class="nf-energy-item nf-energy-${c.cls}"><span>${c.label}</span><b>${c.value}</b></div>`)}
${this.flows!==null?f:m`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${a("flows_hint")} aria-label=${a("flows")} @click=${()=>this.toggleFlows()}>
@@ -1828,27 +1828,27 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${e}
</div>`}renderCardToggle(){return this.holograms!==null?f:m`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${M(this.hass,"holos_hint")} aria-label=${M(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
<span>${M(this.hass,"holos")}</span><b>◫</b>
</button>`}utilityOverview(e){let t=this.building?this.scopeBuilding():null;if(!t||!V(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen||!e&&!this._utilityOverviewVisible)return f;let r=t.floors.flatMap(o=>o.rooms);return(this.floorId?t.floors.filter(o=>o.id===this.floorId):t.floors).some(o=>We(this.hass,o,r).length||Yt(this.hass,o,r,!0).length)?m`<nf-utility-overview ?inline=${e} .hass=${this.hass} .floors=${t.floors} .floorId=${this.floorId} .compact=${this._narrowStage}
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:m`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=V(this.hass)?(this.building?.presence??[]).filter(c=>Aa(this.hass,c.person,[0])).map(c=>m`<div class="nf-energy-item nf-presence-state"><span>${c.name||O(this.hass,c.person)}</span><b>${le(this.hass.states[c.person])===null?"\u2013":le(this.hass.states[c.person])?"Anwesend":"Abwesend"}${G(this.hass,[c.person],c.name||"Anwesenheit")}</b></div>`):[],o=V(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(c=>!!c[1]&&c[1]!=="none").map(([c,u])=>[rd[c]||c,u]):[];V(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?m`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
</button>`}utilityOverview(e){let t=this.building?this.scopeBuilding():null;if(!t||!V(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen||!e&&!this._utilityOverviewVisible)return f;let r=t.floors.flatMap(o=>o.rooms);return(this.floorId?t.floors.filter(o=>o.id===this.floorId):t.floors).some(o=>We(this.hass,o,r).length||Qt(this.hass,o,r,!0).length)?m`<nf-utility-overview ?inline=${e} .hass=${this.hass} .floors=${t.floors} .floorId=${this.floorId} .compact=${this._narrowStage}
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:m`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=V(this.hass)?(this.building?.presence??[]).filter(c=>za(this.hass,c.person,[0])).map(c=>m`<div class="nf-energy-item nf-presence-state"><span>${c.name||L(this.hass,c.person)}</span><b>${le(this.hass.states[c.person])===null?"\u2013":le(this.hass.states[c.person])?"Anwesend":"Abwesend"}${G(this.hass,[c.person],c.name||"Anwesenheit")}</b></div>`):[],o=V(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(c=>!!c[1]&&c[1]!=="none").map(([c,u])=>[ad[c]||c,u]):[];V(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?m`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
<dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${c=>c.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.close()}>×</button></header>${o.map(([c,u])=>m`<p><span>${c}</span><b>${Ie(this.hass.states[u])}${G(this.hass,[u],c)}</b></p>`)}</dialog>`:f,a=V(this.hass)?(this.building?this.scopeBuilding().floors:[]).filter(c=>!this.floorId||c.id===this.floorId).map(c=>({floor:c,readings:We(this.hass,c,this.building?.floors.flatMap(u=>u.rooms))})).filter(c=>c.readings.length):[],l=a.length?m`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button>
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${c=>c.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${a.map(({floor:c,readings:u})=>m`<h3>${c.name}</h3><nf-utility-report .hass=${this.hass} .readings=${u}></nf-utility-report>`)}</dialog>`:f;return[t,e,...i,s,l,...r.filter(c=>this.hass.states[c]).map(c=>m`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,c)} @click=${()=>Ae(this,c)}>
<span>${O(this.hass,c)}</span><b>${se(this.hass,this.hass.states[c])}</b>
</button>${G(this.hass,[c],O(this.hass,c))}`)]}renderMapCredit(){let e=this.building?.settings.map;return su(e)?m`<a class="nf-map-credit" href=${qo(e).href} target="_blank" rel="noopener">${qo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=Mt(new Date,this.hass?.config?.latitude??50),t=ei(this.heatMode,e),r=this.heatMode==="temperature",i=r?ue(this.hass,t.stops[0][0]):t.stops[0][0],o=r?ue(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=r?re(this.hass):t.unit,a=l=>M(this.hass,l);return m`<div class="nf-legend">
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${c=>c.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${a.map(({floor:c,readings:u})=>m`<h3>${c.name}</h3><nf-utility-report .hass=${this.hass} .readings=${u}></nf-utility-report>`)}</dialog>`:f;return[t,e,...i,s,l,...r.filter(c=>this.hass.states[c]).map(c=>m`<button class="nf-energy-item nf-own-sensor" title=${L(this.hass,c)} @click=${()=>Ae(this,c)}>
<span>${L(this.hass,c)}</span><b>${se(this.hass,this.hass.states[c])}</b>
</button>${G(this.hass,[c],L(this.hass,c))}`)]}renderMapCredit(){let e=this.building?.settings.map;return uu(e)?m`<a class="nf-map-credit" href=${Qo(e).href} target="_blank" rel="noopener">${Qo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=Mt(new Date,this.hass?.config?.latitude??50),t=oi(this.heatMode,e),r=this.heatMode==="temperature",i=r?ue(this.hass,t.stops[0][0]):t.stops[0][0],o=r?ue(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=r?re(this.hass):t.unit,a=l=>M(this.hass,l);return m`<div class="nf-legend">
<b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?m` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b>
<span class="nf-legend-bar" style="background:${mc(this.heatMode,e)}"></span>
<span class="nf-legend-bar" style="background:${bc(this.heatMode,e)}"></span>
<span class="nf-legend-range"><span>${N(this.hass,i,0)} ${s}</span><span>${N(this.hass,o,0)} ${s}</span></span>
${this.heatValues.size?f:m`<span class="nf-legend-none">${a("heat_none_found")}</span>`}
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let r=(c,u)=>M(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>as(u.type)).map(u=>ls(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Lu(a);return m`<div class="nf-legend">
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let r=(c,u)=>M(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>ds(u.type)).map(u=>hs(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Vu(a);return m`<div class="nf-legend">
<b>📶 ${r("heat_wifi")}</b>
<span>${r("wifi_aps",{n:i.length,clients:s})}</span>
${l.online+l.offline.length?m`<span>${r("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
${l.offline.length?m`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f}
${i.length?f:m`<span class="nf-legend-none">${r("wifi_none")}</span>`}
</div>`}skyColor(){let e=Nn[this.theme]??Nn.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,c)=>Math.round(l+(a[c]-l)*t)).join(",")})`,i=Nn[this.theme]??Nn.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+Cc(this.building?.settings.backdrop);return m`<div
</div>`}skyColor(){let e=Vn[this.theme]??Vn.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,c)=>Math.round(l+(a[c]-l)*t)).join(",")})`,i=Vn[this.theme]??Vn.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+Wc(this.building?.settings.backdrop);return m`<div
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""} ${e!==f?"nf-has-utility-overview":""}"
style=${o}
>
${this._error?m`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${Ku(this.hass,this._liveCards,(s,a,l,c)=>this.hass?.callService(s,a,{entity_id:l,...c}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this._error?m`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${qu(this.hass,this._liveCards,(s,a,l,c)=>this.hass?.callService(s,a,{entity_id:l,...c}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:m`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday(e)} ${this.renderLayers()} ${this.renderPluginWindow()}
${this.showStats&&this._stats?m`<span class="nf-stats"
@@ -1857,7 +1857,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${M(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${M(this.hass,this._stats.low?"stats_low":"stats_full",{r:N(this.hass,this._stats.pixelRatio,2)})}</span
>`:f}
</div>`}static styles=[ke,Ne,Gu,J`
</div>`}static styles=[ke,Ne,Zu,J`
:host {
display: block;
position: relative;
@@ -3458,26 +3458,26 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
inset: auto 16px 16px;
color: var(--nf-danger);
}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",_s);function pe(n,e){return Math.abs(e)>=1e3?`${N(n,e/1e3,1)} kW`:`${Math.round(e)} W`}function gs(n){return n.type==="tv_board"?n.h+.9:n.type==="tv_wall"||n.type==="kitchen_wall"?n.h+.25:n.h+.35}function wg(n,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(n,e)}var ud;function dd(){let n=new URL("./nextfloor-editor.js?v=33ed5635caca",new URL(import.meta.url)).href;return ud??=import(n),ud}var xg=.25,hd=n=>Math.round(n*1e3)/1e3,pd=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function ys(n,e,t,r,i){let o=pd(n,e,t);if(!o)return[r,i];let s=(a,l)=>H([a,l],o.points);return s(r,i)?[r,i]:s(r,t)?[r,t]:s(e,i)?[e,i]:[e,t]}function kg(n,e,t,r){return n.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(de(ee(o,t),r))<.02&&Math.abs(de(ee(a,t),r))<.02}))}var bs=(n,e)=>Math.abs((n-e+540)%360-180);function md(n,e,t,r=xg){let i=pd(n,e.x,e.z);if(!i)return null;let o=i.points,s=xt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=Qe(ee(u,l));if(d<.3)return;let p=[(u[0]-l[0])/d,(u[1]-l[1])/d],h=[-p[1]*s,p[0]*s],g=de(ee([e.x,e.z],l),p);if(g<0||g>d)return;let _=kg(n,i,l,h)?t/2:0,b=de(ee([e.x,e.z],l),h)-_,y=Math.atan2(-h[0],h[1])*180/Math.PI,$=[{rotation:y,extent:e.d/2},{rotation:y+90,extent:e.w/2},{rotation:y-90,extent:e.w/2}].reduce((T,k)=>bs(e.rotation,k.rotation)<bs(e.rotation,T.rotation)?k:T);if(bs(e.rotation,$.rotation)>50)return;let A=b-$.extent;Math.abs(A)>r||a&&Math.abs(A)>=Math.abs(a.gap)||(a={x:hd(e.x-h[0]*A),z:hd(e.z-h[1]*A),rotation:(Math.round($.rotation)%360+360)%360,gap:A})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function wi(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return r}function xi(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return r}function fd(n,e){let t=structuredClone(n);for(let r of t.floors)r.furniture=r.furniture.filter(i=>i.id!==e);return t}function gd(n,e){let t=structuredClone(n);for(let r of t.floors)r.placements=r.placements.filter(i=>i.entity_id!==e);return t}function _d(n,e,t,r){return xi(n,e,(i,o)=>{[i.x,i.z]=ys(o,i.x,i.z,t,r)})}function bd(n,e,t,r){let i=n.settings.wall_interior??.12;return wi(n,e,(o,s)=>{[o.x,o.z]=ys(s,o.x,o.z,t,r);let a=md(s,o,i);a&&Object.assign(o,a)})}var vs=(n,e)=>((n+e)%360+360)%360,yd=n=>Number.parseFloat(n.replace(",",".")),Jn=(n,e)=>Math.round(n*10**e)/10**e;function ws(n){let{min:e,max:t,accepts:r=()=>!0}=n,i=o=>{let s=yd(o.target.value);!Number.isFinite(s)||!r(s)||n.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${n.title}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",ws);function pe(n,e){return Math.abs(e)>=1e3?`${N(n,e/1e3,1)} kW`:`${Math.round(e)} W`}function vs(n){return n.type==="tv_board"?n.h+.9:n.type==="tv_wall"||n.type==="kitchen_wall"?n.h+.25:n.h+.35}function $g(n,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(n,e)}var md;function fd(){let n=new URL("./nextfloor-editor.js?v=75354d777978",new URL(import.meta.url)).href;return md??=import(n),md}var Mg=.25,gd=n=>Math.round(n*1e3)/1e3,_d=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function ks(n,e,t,r,i){let o=_d(n,e,t);if(!o)return[r,i];let s=(a,l)=>H([a,l],o.points);return s(r,i)?[r,i]:s(r,t)?[r,t]:s(e,i)?[e,i]:[e,t]}function Ag(n,e,t,r){return n.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(de(ee(o,t),r))<.02&&Math.abs(de(ee(a,t),r))<.02}))}var xs=(n,e)=>Math.abs((n-e+540)%360-180);function bd(n,e,t,r=Mg){let i=_d(n,e.x,e.z);if(!i)return null;let o=i.points,s=xt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=Qe(ee(u,l));if(d<.3)return;let p=[(u[0]-l[0])/d,(u[1]-l[1])/d],h=[-p[1]*s,p[0]*s],g=de(ee([e.x,e.z],l),p);if(g<0||g>d)return;let _=Ag(n,i,l,h)?t/2:0,b=de(ee([e.x,e.z],l),h)-_,y=Math.atan2(-h[0],h[1])*180/Math.PI,$=[{rotation:y,extent:e.d/2},{rotation:y+90,extent:e.w/2},{rotation:y-90,extent:e.w/2}].reduce((T,k)=>xs(e.rotation,k.rotation)<xs(e.rotation,T.rotation)?k:T);if(xs(e.rotation,$.rotation)>50)return;let A=b-$.extent;Math.abs(A)>r||a&&Math.abs(A)>=Math.abs(a.gap)||(a={x:gd(e.x-h[0]*A),z:gd(e.z-h[1]*A),rotation:(Math.round($.rotation)%360+360)%360,gap:A})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Mi(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return r}function Ai(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return r}function yd(n,e){let t=structuredClone(n);for(let r of t.floors)r.furniture=r.furniture.filter(i=>i.id!==e);return t}function vd(n,e){let t=structuredClone(n);for(let r of t.floors)r.placements=r.placements.filter(i=>i.entity_id!==e);return t}function wd(n,e,t,r){return Ai(n,e,(i,o)=>{[i.x,i.z]=ks(o,i.x,i.z,t,r)})}function xd(n,e,t,r){let i=n.settings.wall_interior??.12;return Mi(n,e,(o,s)=>{[o.x,o.z]=ks(s,o.x,o.z,t,r);let a=bd(s,o,i);a&&Object.assign(o,a)})}var Ss=(n,e)=>((n+e)%360+360)%360,kd=n=>Number.parseFloat(n.replace(",",".")),nr=(n,e)=>Math.round(n*10**e)/10**e;function $s(n){let{min:e,max:t,accepts:r=()=>!0}=n,i=o=>{let s=kd(o.target.value);!Number.isFinite(s)||!r(s)||n.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${n.title}
>${n.label}
<input type="number" inputmode="decimal" step=${n.step} min=${e} max=${t??f} .value=${String(Jn(n.value,2))} @change=${i} />
</label>`}var wd=(n,e)=>m`<button class="nf-chip" @click=${e}>${n.t("height_auto")}</button>`,vd=(n,e)=>m`<button class="nf-chip" @click=${()=>e(-n)}>↺ ${n}°</button><button class="nf-chip" @click=${()=>e(n)}>↻ ${n}°</button>`;function Sg(n,e){let t=n.building.floors.find(s=>s.furniture.some(a=>a.id===e)),r=t?.furniture.find(s=>s.id===e);if(!t||!r)return f;let i=(s,a)=>ws({label:n.t(a),title:n.t(`size_${s}`),value:r[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>n.editFurniture(e,c=>c[s]=Jn(l,3))}),o=Sa(r)?m`${ws({label:"\u2195",title:n.t("mount_height"),value:r.mount_y??oe(t,r),step:.05,min:0,accepts:s=>s>=0,apply:s=>n.editFurniture(e,a=>a.mount_y=Jn(s,3))})}
${r.mount_y!=null?wd(n,()=>n.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function $g(n,e){let t=n.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),r=t?.placements.find(l=>l.entity_id===e);if(!t||!r)return f;let i=P(e),o=(l,c,u)=>m`<select class="nf-size-select" title=${n.t(l)} @change=${d=>n.editDevice(e,p=>Object.assign(p,{mount:d.target.value,y:null}))}>
<input type="number" inputmode="decimal" step=${n.step} min=${e} max=${t??f} .value=${String(nr(n.value,2))} @change=${i} />
</label>`}var $d=(n,e)=>m`<button class="nf-chip" @click=${e}>${n.t("height_auto")}</button>`,Sd=(n,e)=>m`<button class="nf-chip" @click=${()=>e(-n)}>↺ ${n}°</button><button class="nf-chip" @click=${()=>e(n)}>↻ ${n}°</button>`;function Eg(n,e){let t=n.building.floors.find(s=>s.furniture.some(a=>a.id===e)),r=t?.furniture.find(s=>s.id===e);if(!t||!r)return f;let i=(s,a)=>$s({label:n.t(a),title:n.t(`size_${s}`),value:r[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>n.editFurniture(e,c=>c[s]=nr(l,3))}),o=Ea(r)?m`${$s({label:"\u2195",title:n.t("mount_height"),value:r.mount_y??oe(t,r),step:.05,min:0,accepts:s=>s>=0,apply:s=>n.editFurniture(e,a=>a.mount_y=nr(s,3))})}
${r.mount_y!=null?$d(n,()=>n.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function Rg(n,e){let t=n.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),r=t?.placements.find(l=>l.entity_id===e);if(!t||!r)return f;let i=P(e),o=(l,c,u)=>m`<select class="nf-size-select" title=${n.t(l)} @change=${d=>n.editDevice(e,p=>Object.assign(p,{mount:d.target.value,y:null}))}>
${c.map(([d,p])=>m`<option value=${d} ?selected=${d===u}>${p}</option>`)}
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,n.t(`lamp_${l}`)]),a=i?Wt(i,Me(t,r.x,r.z),i==="light"?r.mount??"ceiling":null):1;return m`${i==="light"?o("lamp_mount",s,r.mount??"ceiling"):f}
${ws({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,c=>c.y=Jn(l,3))})}
${r.y!==null?wd(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function xd(n,e,t){let r=n.t,i;if(e){let o=n.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=m`<span>${o?ae(n.hass,o):""}</span>
${Sg(n,e)} ${vd(45,s=>n.turnFurniture(e,s))}
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,n.t(`lamp_${l}`)]),a=i?Vt(i,Me(t,r.x,r.z),i==="light"?r.mount??"ceiling":null):1;return m`${i==="light"?o("lamp_mount",s,r.mount??"ceiling"):f}
${$s({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,c=>c.y=nr(l,3))})}
${r.y!==null?$d(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function Md(n,e,t){let r=n.t,i;if(e){let o=n.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=m`<span>${o?ae(n.hass,o):""}</span>
${Eg(n,e)} ${Sd(45,s=>n.turnFurniture(e,s))}
<button class="nf-chip" title=${r("furn_mirror_hint")} @click=${()=>n.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${r("furn_mirror")}</button>
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeFurniture(e)}>${r("delete")}</button>`}else t?i=m`<span>${O(n.hass,t)}</span>
${$g(n,t)} ${vd(45,o=>n.turnDevice(t,o))}
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeDevice(t)}>${r("delete")}</button>`:i=m`<span>${r("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>n.finish()}>${r("done")}</button></div>`}var kd=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeFurniture(e)}>${r("delete")}</button>`}else t?i=m`<span>${L(n.hass,t)}</span>
${Rg(n,t)} ${Sd(45,o=>n.turnDevice(t,o))}
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeDevice(t)}>${r("delete")}</button>`:i=m`<span>${r("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>n.finish()}>${r("done")}</button></div>`}var Ad=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
<circle cx="256" cy="236" r="16" fill="#ffe08a"/>
</svg>`;var me=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),cn=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),xs={explode:me("explode",!0),keepRoof:me("roof",!1),solidWalls:me("solid_walls",!1),quality:cn("quality",["auto","low","high"],"auto"),stats:me("stats",!1),markers:cn("markers",["none","important","all"],"important"),heat:cn("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:cn("theme",li,"neon"),clock:cn("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:n=>/^#[0-9a-f]{6}$/i.test(n)?n:null,write:n=>n??""},floorStack:cn("floor_stack",["dim","stacked","single"],"dim"),roomNames:me("room_names",!0),clean:me("clean",!1),navWrap:me("nav_wrap",!1),weather:me("weather",!0),timeSlider:me("time_slider",!1),menuOpen:me("menu_open",!1),keepCamera:me("keep_camera",!1),readable:me("readable",!1),plain:me("plain",!1),rightBack:me("right_back",!1),zoom:{name:"zoom",fallback:100,read:n=>/^\d{2,3}$/.test(n)?Math.min(250,Math.max(60,Number(n))):100,write:n=>String(Math.round(Math.min(250,Math.max(60,n))))},screenName:{name:"screen_name",fallback:"",read:n=>n.slice(0,60),write:n=>n.trim().slice(0,60)},announceMuted:me("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:n=>/^\d{1,3}$/.test(n)?Math.min(100,Number(n)):20,write:n=>String(Math.round(Math.min(100,Math.max(0,n))))}};function Sd(n=Si()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function $d(n=Si()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Si(){try{return localStorage}catch{return null}}var ki=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let r of Object.keys(xs)){let i=xs[r],o=this.raw(i.name);t[r]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let r=xs[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var Md=J`
</svg>`;var me=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),dn=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),Ms={explode:me("explode",!0),keepRoof:me("roof",!1),solidWalls:me("solid_walls",!1),quality:dn("quality",["auto","low","high"],"auto"),stats:me("stats",!1),markers:dn("markers",["none","important","all"],"important"),heat:dn("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:dn("theme",pi,"neon"),clock:dn("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:n=>/^#[0-9a-f]{6}$/i.test(n)?n:null,write:n=>n??""},floorStack:dn("floor_stack",["dim","stacked","single"],"dim"),roomNames:me("room_names",!0),clean:me("clean",!1),navWrap:me("nav_wrap",!1),weather:me("weather",!0),timeSlider:me("time_slider",!1),menuOpen:me("menu_open",!1),keepCamera:me("keep_camera",!1),readable:me("readable",!1),plain:me("plain",!1),rightBack:me("right_back",!1),zoom:{name:"zoom",fallback:100,read:n=>/^\d{2,3}$/.test(n)?Math.min(250,Math.max(60,Number(n))):100,write:n=>String(Math.round(Math.min(250,Math.max(60,n))))},screenName:{name:"screen_name",fallback:"",read:n=>n.slice(0,60),write:n=>n.trim().slice(0,60)},announceMuted:me("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:n=>/^\d{1,3}$/.test(n)?Math.min(100,Number(n)):20,write:n=>String(Math.round(Math.min(100,Math.max(0,n))))}};function Ed(n=Ri()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Rd(n=Ri()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Ri(){try{return localStorage}catch{return null}}var Ei=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let r of Object.keys(Ms)){let i=Ms[r],o=this.raw(i.name);t[r]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let r=Ms[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var Td=J`
.nf-dot {
display: inline-block;
width: 8px;
@@ -3969,11 +3969,11 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
gap: 12px;
margin: auto;
}
`;var Ad=new WeakMap,Ed=new WeakMap;function Tt(n,e){let t=Ed.get(n)??n,r=Ad.get(t)??new WeakMap;Ad.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Ue(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let d={...u.attributes,nf_cover_control:!0},p=Bt(t,c.position);p===null&&(p=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),p!==null&&(d.current_position=p);let h=c.tilt?t.states[c.tilt]:u,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?Bt(t,c.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=u.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:d}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let d=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],p=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,c,{...u,entity_id:h});let _={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let y=b.includes("tilt");y&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return y&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(d.map(p)):p(d[0])}};return Ed.set(a,t),r.set(e,a),a}var ks=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_topologyGroup:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Ot(this);store=new ki(Si());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._topologyGroup=_e,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:vt(Ht(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,r=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return m`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):r(t)}</button>
`;var zd=new WeakMap,Fd=new WeakMap;function Tt(n,e){let t=Fd.get(n)??n,r=zd.get(t)??new WeakMap;zd.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Ue(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let d={...u.attributes,nf_cover_control:!0},p=Kt(t,c.position);p===null&&(p=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),p!==null&&(d.current_position=p);let h=c.tilt?t.states[c.tilt]:u,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?Kt(t,c.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=u.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:d}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let d=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],p=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,c,{...u,entity_id:h});let _={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let y=b.includes("tilt");y&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return y&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(d.map(p)):p(d[0])}};return Fd.set(a,t),r.set(e,a),a}var As=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_topologyGroup:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Bt(this);store=new Ei(Ri());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._topologyGroup=_e,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:vt(Ht(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,r=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return m`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):r(t)}</button>
${t!==null?m`<label class="nf-chip nf-time-slider"
><input type="range" min="0" max="23.75" step="0.25" .value=${String(t)} aria-label=${e("time_of_day")} @input=${o=>this._timeDrag=Number(o.target.value)}
@change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
/></label>`:f}`}t=(e,t)=>M(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Br(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(r=>r.id===this._floorId)&&(this._floorId=null,this._topologyGroup=_e,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!=="view"&&!this.isAdmin||e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}topologySelection(e){return this._floorId?wt(e,this._floorId,this._roomId):this._topologyGroup}openTopology(e){let t=this.data.building;t&&(this._roomId=e.kind==="room"?e.id??null:null,this._floorId=e.kind==="room"?e.floorId??null:e.kind==="floor"?e.id??null:e.kind==="outside"?t.floors.find(r=>r.outdoor_location_id===e.id)?.id??null:null,this._topologyGroup=e,this._outside=!1)}openFloor(e){this._topologyGroup=_e,this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){if(e.topology)return Kt(this.hass,br(e,this.topologySelection(e)),e.settings.outside_hidden);let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let r=Kt(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:r},r}openOutside(e){let t=this.data.building;if(t?.topology){let i=st(t,e?wt(t,e):this.topologySelection(t)).find(a=>a.selection.kind==="location");if(!i)return;let o=t.floors.find(a=>a.outdoor_location_id===i?.selection.id);if(o){let a=!this._outside;this.openTopology({kind:"outside",id:o.outdoor_location_id}),this._outside=a;return}let s=!this._outside;this.openTopology(i.selection),this._outside=s;return}let r=!this._outside;this.openFloor(null),this._outside=r}onRoomTap(e){let{floorId:t,roomId:r}=e.detail;if(r==="nf-outside")return this.openOutside(t);if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);r&&(this._roomId=r===this._roomId?null:r,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(r=>wi(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>xi(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>wi(r,e,i=>i.rotation=vs(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>xi(r,e,i=>i.rotation=vs(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>fd(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>gd(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(r=>({...r,floors:r.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this.data.building?.topology&&this.topologySelection(this.data.building).kind!=="all"?this.openTopology(gr(this.data.building,this.topologySelection(this.data.building))):this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&Ir(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",r=f;return e&&(this._mode==="editor"&&this.isAdmin?r=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?r=this.renderExtensions():r=this.renderView(e)),m`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
/></label>`:f}`}t=(e,t)=>M(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=jr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(r=>r.id===this._floorId)&&(this._floorId=null,this._topologyGroup=_e,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!=="view"&&!this.isAdmin||e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}topologySelection(e){return this._floorId?wt(e,this._floorId,this._roomId):this._topologyGroup}openTopology(e){let t=this.data.building;t&&(this._roomId=e.kind==="room"?e.id??null:null,this._floorId=e.kind==="room"?e.floorId??null:e.kind==="floor"?e.id??null:Lt(t,e)?.id??null,this._topologyGroup=e,this._outside=!1)}openFloor(e){this._topologyGroup=_e,this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){if(e.topology)return Ut(this.hass,kr(e,this.topologySelection(e)),e.settings.outside_hidden);let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let r=Ut(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:r},r}openOutside(e){let t=this.data.building;if(t?.topology){let i=st(t,e?wt(t,e):this.topologySelection(t)),o=i.find(l=>l.selection.kind==="outside")?.selection,s=[...i].reverse().find(l=>["building","branch","location"].includes(l.selection.kind)&&Lt(t,Ot(l.selection))),a=o??(s?Ot(s.selection):i.find(l=>l.selection.kind==="location")?.selection);if(a){let l=!this._outside;this.openTopology(a),this._outside=l}return}let r=!this._outside;this.openFloor(null),this._outside=r}onRoomTap(e){let{floorId:t,roomId:r}=e.detail;if(r==="nf-outside")return this.openOutside(t);if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);r&&(this._roomId=r===this._roomId?null:r,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(r=>Mi(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>Ai(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>Mi(r,e,i=>i.rotation=Ss(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>Ai(r,e,i=>i.rotation=Ss(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>yd(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>vd(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(r=>({...r,floors:r.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this.data.building?.topology&&this.topologySelection(this.data.building).kind!=="all"?this.openTopology(kn(this.data.building,this.topologySelection(this.data.building))):this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&Wr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",r=f;return e&&(this._mode==="editor"&&this.isAdmin?r=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?r=this.renderExtensions():r=this.renderView(e)),m`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
${t?f:m`${this.renderHeader(e)}${this.renderNotices()}`}
${this.data.error&&!e?m`<p class="nf-message">${this.t("load_error")}: ${this.data.error}</p>`:f}
${!e&&!this.data.error?m`<p class="nf-message">${this.t("loading")}</p>`:f}
@@ -3986,7 +3986,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</label>`}renderViewOptions(){let e=this._prefs;return m`<button class="nf-opts-btn" aria-expanded=${this._optsOpen} title=${this.t("view_options")} aria-label=${this.t("view_options")} @click=${()=>this._optsOpen=!this._optsOpen}>⚙</button>
<div class="nf-view-opts ${this._optsOpen?"nf-opts-open":""}">
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
${this.choiceRow("theme",li,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
${this.choiceRow("theme",pi,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
<label class="nf-seg nf-clock-pick" title=${this.t("clock")}
>🕒
@@ -4025,7 +4025,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</div>
</div>`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",r=this.data.saveState,i=(s,a,l="")=>m`<button role="tab" class=${l} aria-pressed=${this._mode===s} @click=${()=>this.setMode(s)}>${a}</button>`,o=r==="saving"?"saving":r==="saved"?"saved":"save_error";return m`<header class="nf-header">
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
<h1 title=${t}>${kd}<span class="nf-view-title">${t}</span></h1>
<h1 title=${t}>${Ad}<span class="nf-view-title">${t}</span></h1>
${this.isAdmin?m`<div class="nf-seg" role="tablist">${i("view",this.t("view"))}${i("editor",this.t("editor"))}${i("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
<span class="nf-grow"></span>
${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?m`<button class="nf-chip nf-room-names-toggle" aria-pressed=${this._prefs.roomNames} title=${this.t("room_names_toggle_hint")} @click=${()=>this.setPref("roomNames",!this._prefs.roomNames)}>${this.t("room_names_short")}</button>`:f}
@@ -4040,7 +4040,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<span>${this.t("draft_found",{time:r})}</span>
<button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button>
<button class="nf-btn" @click=${()=>e.discardDraft()}>${this.t("draft_discard")}</button>
</div>`)}return t.length>0?m`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(dd().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),m`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>m`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
</div>`)}return t.length>0?m`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(fd().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),m`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>m`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
@packs-changed=${()=>{this.data.reloadPacks()}}
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}></nf-extensions>`)}renderEditor(e){return this.whenEditorLoaded(()=>m`<nf-editor
class="nf-body"
@@ -4050,10 +4050,10 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.roomLabels=${this._prefs.roomNames}
@room-names-change=${t=>this.setPref("roomNames",t.detail.value)}
.packs=${this.data.packs}
.loadCardEditor=${rr}
.loadCardEditor=${lr}
@packs-changed=${()=>{this.data.reloadPacks()}}
@building-changed=${t=>this.data.edit(t.detail.building)}
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return m`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let r=Pn(Ac(t).map(i=>this.hass.states[i]));return r.count<2?f:m`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:r.count})} @click=${()=>{for(let i of r.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=r.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${r.count}</button>`}renderNav(e){if(e.topology){let c=e.floors.find(u=>u.id===this._floorId);return!c||c.outdoor_location_id?f:m`<nav class="nf-nav nf-topology-floor-nav" aria-label=${c.name}>
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return m`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let r=Ln(zc(t).map(i=>this.hass.states[i]));return r.count<2?f:m`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:r.count})} @click=${()=>{for(let i of r.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=r.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${r.count}</button>`}renderNav(e){if(e.topology){let c=e.floors.find(u=>u.id===this._floorId);return!c||xn(c)?f:m`<nav class="nf-nav nf-topology-floor-nav" aria-label=${c.name}>
${c.rooms.map(u=>m`<button class="nf-chip nf-room-chip" aria-pressed=${u.id===this._roomId} @click=${()=>{this._roomId=this._roomId===u.id?null:u.id,this._outside=!1}}>${u.name}</button>`)}
${this.allOffChip(e)}
</nav>`}let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),r=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?m`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=r?m`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
@@ -4097,7 +4097,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}">
<nf-view3d
class="nf-body"
.hass=${vi(Tt(this.hass,e.floors),e.settings)}
.hass=${$i(Tt(this.hass,e.floors),e.settings)}
.building=${e}
.topologySelection=${this.topologySelection(e)}
.packs=${this.data.packs}
@@ -4117,7 +4117,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.keepRoof=${t.keepRoof}
.markerMode=${t.markers}
.heatMode=${t.heat}
.theme=${ci(t.theme,this.sunState())}
.theme=${mi(t.theme,this.sunState())}
.timeOfDay=${this._timeOfDay}
.clock=${t.clock==="none"?null:t.clock}
.announcements=${!V(this.hass)&&!t.announceMuted}
@@ -4136,9 +4136,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
?furnish=${this._furnish}
.selectedFurniture=${this._selFurniture}
@furniture-select=${i=>this._selFurniture=i.detail.id}
@furniture-move=${i=>this.applyEdit(o=>bd(o,i.detail.id,i.detail.x,i.detail.z))}
@furniture-move=${i=>this.applyEdit(o=>xd(o,i.detail.id,i.detail.x,i.detail.z))}
@device-select=${i=>this._selDevice=i.detail.id}
@device-move=${i=>this.applyEdit(o=>_d(o,i.detail.id,i.detail.x,i.detail.z))}
@device-move=${i=>this.applyEdit(o=>wd(o,i.detail.id,i.detail.x,i.detail.z))}
.quality=${t.quality}
?showStats=${t.stats}
@room-tap=${this.onRoomTap}
@@ -4168,9 +4168,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@close=${()=>this._outside=!1}
></nf-room-panel>`:f}
${t.clean?f:this.renderOverlay(e)}
${this._furnish?xd(this.furnishHost,this._selFurniture,this._selDevice):f}
${this._furnish?Md(this.furnishHost,this._selFurniture,this._selDevice):f}
</div>
`}static styles=[ke,Ne,Md,Wr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",ks);var Mg=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Rd=(n,e)=>Number(n)*60+Number(e);function Qn(n,e,t=new Date){if(!n||n==="off")return!1;if(n==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let r=Mg.exec(n.trim());if(!r)return!1;let i=Rd(r[1],r[2]),o=Rd(r[3],r[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var $i=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(Qn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Td(n,e){return n?n.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(r=>({id:r.id,name:r.name||"\u2013",floorId:t.id}))})):[]}var zd=J`
`}static styles=[ke,Ne,Td,Ur]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",As);var Tg=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Dd=(n,e)=>Number(n)*60+Number(e);function rr(n,e,t=new Date){if(!n||n==="off")return!1;if(n==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let r=Tg.exec(n.trim());if(!r)return!1;let i=Dd(r[1],r[2]),o=Dd(r[3],r[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var Ti=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(rr(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Hd(n,e){return n?n.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(r=>({id:r.id,name:r.name||"\u2013",floorId:t.id}))})):[]}var Pd=J`
ha-card {
overflow: hidden;
background: var(--nf-bg);
@@ -4294,12 +4294,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
justify-content: flex-end;
}
}
`;function Ss(n,e){let t=n.template,r=t?e?.[t]:void 0;if(!r)return n;let{type:i,template:o,...s}=r;return{...s,...n}}function Fd(n,e){let t=new Set(e),r=[];for(let o of n.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(d=>d.points.length>=3&&H([c,u],d.points)),l=new Set(s.map(c=>c.id));r.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...n.settings.roof,type:"none",sections:[],solar:[]};return{...n,floors:r,settings:{...n.settings,roof:i}}}var zt="nf-outside",$s=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_topologyGroup:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Ot(this);kiosk=new $i({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._topologyGroup=_e,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this._topologyGroup=_e,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await rr(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=Ss(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._topologyGroup=_e,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=Qn(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=Ss(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Br(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let r=Qn(this._config?.night,this.hass);r!==this._night&&(this._night=r)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}topologySelection(){let e=this.plan(),t=this.stage().floorId;return e&&t?wt(e,t,this._roomId===zt?null:this._roomId):this._topologyGroup}openTopology(e){let t=this.plan();t&&(this._floorId=e.kind==="room"?e.floorId??null:e.kind==="floor"?e.id??null:e.kind==="outside"?t.floors.find(r=>r.outdoor_location_id===e.id)?.id??null:null,this._roomId=e.kind==="room"?e.id??null:null,this._topologyGroup=e)}back(){this._roomId?this._roomId=null:this.plan()?.topology?this.openTopology(gr(this.plan(),this.topologySelection())):this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let r=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==r)&&(this.roomsMemo={source:e,ids:r,result:Fd(e,t)}),this.roomsMemo.result}t=e=>M(this.hass,e);stage(){let e=this.plan(),t=this._config,r=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&!e.topology&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===r)?r:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.expl Line truncated
`;function Es(n,e){let t=n.template,r=t?e?.[t]:void 0;if(!r)return n;let{type:i,template:o,...s}=r;return{...s,...n}}function Id(n,e){let t=new Set(e),r=[];for(let o of n.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(d=>d.points.length>=3&&H([c,u],d.points)),l=new Set(s.map(c=>c.id));r.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...n.settings.roof,type:"none",sections:[],solar:[]};return{...n,floors:r,settings:{...n.settings,roof:i}}}var zt="nf-outside",Rs=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_topologyGroup:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Bt(this);kiosk=new Ti({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._topologyGroup=_e,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this._topologyGroup=_e,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await lr(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=Es(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._topologyGroup=_e,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=rr(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=Es(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=jr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let r=rr(this._config?.night,this.hass);r!==this._night&&(this._night=r)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}topologySelection(){let e=this.plan(),t=this.stage().floorId;return e&&t?wt(e,t,this._roomId===zt?null:this._roomId):this._topologyGroup}openTopology(e){let t=this.plan();t&&(this._floorId=e.kind==="room"?e.floorId??null:e.kind==="floor"?e.id??null:Lt(t,e)?.id??null,this._roomId=e.kind==="room"?e.id??null:null,this._topologyGroup=e)}back(){this._roomId?this._roomId=null:this.plan()?.topology?this.openTopology(kn(this.plan(),this.topologySelection())):this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let r=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==r)&&(this.roomsMemo={source:e,ids:r,result:Id(e,t)}),this.roomsMemo.result}t=e=>M(this.hass,e);stage(){let e=this.plan(),t=this._config,r=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&!e.topology&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===r)?r:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.control Line truncated
${e.canGoBack?m`<button class="nf-chip" @click=${()=>this.back()}>${r("back")}</button>`:f}
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",r("walls_auto")],[e.walls==="cut",()=>this._walls="cut",r("walls_cut")],[e.walls==="slope",()=>this._walls="slope",r("walls_slope")]]):f}
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,r("floors_apart")],[!e.explode,()=>this._explode=!1,r("floors_stacked")]]):f}
${i.length>0?o(r("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,r(s==="none"?"heat_off":`heat_short_${s}`)])):f}
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;if(t.topology&&(!e.floorId||t.floors.find(l=>l.id===e.floorId)?.outdoor_location_id))return f;let r=Td(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=!t.topology&&Kt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===zt?null:zt};return m`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;if(t.topology&&(!e.floorId||xn(t.floors.find(l=>l.id===e.floorId))))return f;let r=Hd(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=!t.topology&&Ut(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===zt?null:zt};return m`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
${r.map(l=>m`${i?m`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(c=>m`<button class="nf-chip" aria-pressed=${c.id===this._roomId} @click=${()=>o(l.floorId,c.id)}>${c.name}</button>`)}`)}
${s?m`<button class="nf-chip" aria-pressed=${this._roomId===zt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
</div>`}renderCorners(){let e=this._config,t=this.t,r=this._clean||!!this._roomId&&e?.room_panel!==!1;return m`${e?.fullscreen_button&&!r?m`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
@@ -4308,7 +4308,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${e?.dashboard&&!r?m`<button class="nf-card-full nf-card-dash ${e.fullscreen_button?"nf-card-dash-2":""}" title=${e.dashboard_label||e.dashboard} aria-label=${e.dashboard_label||e.dashboard} @click=${()=>this.openDashboard(e.dashboard)}>
${e.dashboard_label?m`<span>${e.dashboard_label}</span>`:"\u2302"}
</button>`:f}`}renderStage(e){let t=this.plan(),r=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=r?.controls_hidden!==void 0||(r?.controls_hide_after??0)>0;return m`<nf-view3d
.hass=${vi(Tt(this.hass,t.floors),t.settings)}
.hass=${$i(Tt(this.hass,t.floors),t.settings)}
.building=${t}
.topologySelection=${this.topologySelection()}
.packs=${this.data.packs}
@@ -4337,7 +4337,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.zoom=${typeof r?.zoom=="number"?r.zoom:1}
.buttons=${r?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
.heatMode=${e.heat}
.theme=${ci(r?.theme,this.hass?.states["sun.sun"]?.state)}
.theme=${mi(r?.theme,this.hass?.states["sun.sun"]?.state)}
.clock=${r?.clock&&r.clock!=="none"?r.clock:null}
.lockButton=${r?.lock_button!==!1}
.walkButton=${r?.walk_button!==!1}
@@ -4355,10 +4355,10 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.panelOpen=${!!this._roomId&&r?.room_panel!==!1}
.alerts=${r?.alerts!==!1}
.alertJump=${!!r?.alert_jump}
.announcements=${!V(this.hass)&&r?.announcements!==!1&&!$d()}
.announcements=${!V(this.hass)&&r?.announcements!==!1&&!Rd()}
.sensorBar=${r?.sensor_bar!==!1}
.glassWalls=${typeof r?.glass_walls=="number"?Math.min(100,Math.max(0,r.glass_walls)):null}
.screenName=${r?.screen_name??Sd()}
.screenName=${r?.screen_name??Ed()}
.scenes=${r?.scenes!==!1}
.clean=${this._clean}
.cleanButton=${o}
@@ -4380,11 +4380,11 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.hass=${Tt(this.hass,e.floors)}
.room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null}
.floor=${e.floors.find(t=>t.rooms.some(r=>r.id===this._roomId))??null}
.outside=${this._roomId===zt?Kt(this.hass,br(e,this.topologySelection())):null}
.outside=${this._roomId===zt?Ut(this.hass,kr(e,this.topologySelection())):null}
.confirmEntities=${St(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
@close=${()=>this._roomId=null}
></nf-room-panel>`}render(){if(this.hass&&Ir(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let r=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return m`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
></nf-room-panel>`}render(){if(this.hass&&Wr(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let r=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return m`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
<div class="nf-card-body" style="height:${i}">
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(r):m`<p class="nf-card-msg">${this.data.error??(e?M(this.hass,"no_building"):M(this.hass,"loading"))}</p>`}
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
@@ -4392,7 +4392,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${r.showBar&&e?this.renderBar(r):f}
${this.renderCorners()}
</div>
</ha-card>`}static styles=[ke,Ne,zd,Wr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",$s);let n=window;n.customCards=n.customCards??[],n.customCards.push({type:"nextfloor-card",name:M(void 0,"card_name"),description:M(void 0,"card_description"),preview:!1})}Ui();var mt=class extends Error{},Ag="nextfloor-chunks-v1",Eg=64*1024*1024;async function Ms(n,e,t){let r=await fetch(`${n.endpoint}/api${n.csrf?"":n.token?`?token=${encodeURIComponent(n.token)}`:""}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...n.csrf?{"X-NextFloor-CSRF":n.csrf}:{}},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:Ag})}),i=await r.text();if(r.status===401)throw new mt("Die Anmeldung ist abgelaufen. Bitte erneut anmelden.");let o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${r.status}).`)}if(!r.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${r.status}`;throw s==="csrf_invalid"?new mt("Die Anmeldung hat sich ge\xE4ndert. Bitte erneut laden."):new Error(String(s))}return o}async function un(n,e,t={}){let r=await Ms(n,e,t);if(!("_nextfloor_transfer"in r))return r;let i=r._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>Eg||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<i.chunks;a++){let l=await Ms(n,"transport/read",{transfer_id:i.id,index:a});if(l.index!==a||typeof l.data!="string")throw new Error("Ein Symcon-Datenpaket fehlt oder ist ung\xFCltig.");let c=Uint8Array.from(atob(l.data),u=>u.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await Ms(n,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function Rg(){let n=window.__NEXTFLOOR_SYMCON__;if(!n?.endpoint||!n.csrf&&!n.token)throw new Error("NextFloor Symcon host configuration is missing");return n}var Mi=class{onExpired;settings=Rg();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:this.settings.user??{is_admin:!1,name:"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let r=i=>e({revision:i});return this.buildingListeners.add(r),async()=>{this.buildingListeners.delete(r)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,r)=>this.callService(e,t,r),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await un(this.settings,"bootstrap");return e.access&&(this.facade.user=e.access),this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(t=>{t instanceof mt&&(this.stop(),this.states={},this.entities={},this.onExpired?.())})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await un(this.settings,"bootstrap"):await un(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let r of this.changeListeners)r()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let r of this.buildingListeners)r(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{enLine truncated
</ha-card>`}static styles=[ke,Ne,Pd,Ur]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",Rs);let n=window;n.customCards=n.customCards??[],n.customCards.push({type:"nextfloor-card",name:M(void 0,"card_name"),description:M(void 0,"card_description"),preview:!1})}Ji();var mt=class extends Error{},zg="nextfloor-chunks-v1",Fg=64*1024*1024;async function Ts(n,e,t){let r=await fetch(`${n.endpoint}/api${n.csrf?"":n.token?`?token=${encodeURIComponent(n.token)}`:""}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...n.csrf?{"X-NextFloor-CSRF":n.csrf}:{}},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:zg})}),i=await r.text();if(r.status===401)throw new mt("Die Anmeldung ist abgelaufen. Bitte erneut anmelden.");let o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${r.status}).`)}if(!r.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${r.status}`;throw s==="csrf_invalid"?new mt("Die Anmeldung hat sich ge\xE4ndert. Bitte erneut laden."):new Error(String(s))}return o}async function hn(n,e,t={}){let r=await Ts(n,e,t);if(!("_nextfloor_transfer"in r))return r;let i=r._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>Fg||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<i.chunks;a++){let l=await Ts(n,"transport/read",{transfer_id:i.id,index:a});if(l.index!==a||typeof l.data!="string")throw new Error("Ein Symcon-Datenpaket fehlt oder ist ung\xFCltig.");let c=Uint8Array.from(atob(l.data),u=>u.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await Ts(n,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function Dg(){let n=window.__NEXTFLOOR_SYMCON__;if(!n?.endpoint||!n.csrf&&!n.token)throw new Error("NextFloor Symcon host configuration is missing");return n}var zi=class{onExpired;settings=Dg();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:this.settings.user??{is_admin:!1,name:"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let r=i=>e({revision:i});return this.buildingListeners.add(r),async()=>{this.buildingListeners.delete(r)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,r)=>this.callService(e,t,r),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await hn(this.settings,"bootstrap");return e.access&&(this.facade.user=e.access),this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(t=>{t instanceof mt&&(this.stop(),this.states={},this.entities={},this.onExpired?.())})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await hn(this.settings,"bootstrap"):await hn(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let r of this.changeListeners)r()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let r of this.buildingListeners)r(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{enLine truncated
/*! Bundled license information:
@lit/reactive-element/css-tag.js:
File diff suppressed because it is too large. Load diff
+33 -2
View File
@@ -32,6 +32,37 @@ trait NextFloorPermissions
private function planKey(string $kind, array $floor, string $id): string { return $kind . ':' . rawurlencode((string) $floor['id']) . ':' . rawurlencode($id); }
/** Keep existing grants on uniquely identified rooms/devices when an admin moves them to another floor. */
private function migrateMovedPlanGrants(array $before, array $after): void
{
$index = function (array $plan): array {
$result = [];
foreach ($plan['floors'] ?? [] as $floor) foreach (['rooms', 'furniture', 'openings', 'placements'] as $group) foreach ($floor[$group] ?? [] as $item) {
$id = (string) ($item['id'] ?? $item['entity_id'] ?? '');
if ($id === '') continue;
$kind = $group === 'rooms' ? 'room' : $group;
$result[$kind . ':' . $id][] = $this->planKey($kind, $floor, $id);
}
return $result;
};
$old = $index($before); $new = $index($after); $moves = [];
foreach ($old as $id => $keys) if (count($keys) === 1 && count($new[$id] ?? []) === 1 && $keys[0] !== $new[$id][0]) $moves[$keys[0]] = $new[$id][0];
if ($moves === []) return;
$accounts = $this->accounts(); $changed = false;
foreach ($accounts as &$account) foreach (['rooms', 'devices'] as $group) {
$rows = [];
foreach ($account[$group] ?? [] as $row) {
$target = (string) $row['target'];
if (isset($moves[$target])) { $target = $moves[$target]; $changed = true; }
$level = $row['access'] === 'control' || ($rows[$target]['access'] ?? '') === 'control' ? 'control' : 'view';
$rows[$target] = ['target' => $target, 'access' => $level];
}
$account[$group] = array_values($rows);
}
unset($account);
if ($changed) { $this->writeJsonAttribute('Accounts', $accounts); $this->requestScope = null; }
}
private function accessCatalog(): array
{
$rooms = []; $devices = [];
@@ -42,8 +73,8 @@ trait NextFloorPermissions
return [];
};
foreach ($building['floors'] ?? [] as $floor) {
$group = $find('buildings', $floor['building_id'] ?? null);
$branch = $find('branches', $group['branch_id'] ?? null);
$group = $find('buildings', $floor['outdoor_building_id'] ?? $floor['building_id'] ?? null);
$branch = $find('branches', $floor['outdoor_branch_id'] ?? $group['branch_id'] ?? null);
$location = $find('locations', $floor['outdoor_location_id'] ?? $branch['location_id'] ?? null);
$parts = [$location['name'] ?? '', $branch['name'] ?? '', $group['name'] ?? '', $floor['name'] ?? 'Etage'];
$prefix = implode(' / ', array_filter($parts, static fn(string $v): bool => $v !== '')) . ' / ';
+3
View File
@@ -712,11 +712,14 @@ class NextFloor extends IPSModuleStrict
if (strlen($encoded) > self::MAX_BUILDING_BYTES) {
throw new InvalidArgumentException('building_too_large');
}
return $this->accessLock(function () use ($building, $encoded): int {
$this->migrateMovedPlanGrants($this->building(), $building);
$this->WriteAttributeString('Building', $encoded);
$revision = $this->ReadAttributeInteger('BuildingRevision') + 1;
$this->WriteAttributeInteger('BuildingRevision', $revision);
$this->UpdateVisualizationValue(json_encode(['building_revision' => $revision]));
return $revision;
});
}
private function imageGet(string $imageID): array
+20 -6
View File
@@ -18,7 +18,7 @@ In **Kerninstanzen → Modules** wird dieses Repository verwendet:
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
Nach der Aktualisierung auf **0.4.1 / Build 39** die Konsole neu laden. Unter
Nach der Aktualisierung auf **0.4.2 / Build 40** die Konsole neu laden. Unter
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
## Hierarchie und Etagen
@@ -31,7 +31,11 @@ Im separaten Dialog Orte, Niederlassungen und Gebäude benennen und weitere anle
Die drei Listen zeigen jeweils die Einträge der ausgewählten übergeordneten Ebene.
Beispiel: **Urbach / Zentrale / RAS19 / EG / IT**.
- Oben im Editor das **Gebäude** auswählen. Darunter erscheinen nur seine Etagen.
- Oben im Editor unter **Ansicht** einen **Ort**, eine **Niederlassung** oder ein
**Gebäude** auswählen. Ort und Niederlassung zeigen eine Gesamtübersicht ihrer
untergeordneten Pläne, auch in der 3D-Hälfte. Die Knöpfe darunter öffnen die nächste
Ebene. Eine Gesamtübersicht wählt keine Etage automatisch zur Bearbeitung aus.
Bei Auswahl eines Gebäudes erscheinen darunter nur seine Etagen und sein Außenplan.
**+ Etage** legt ein Stockwerk in genau diesem Gebäude an, mit eigener Höhenfolge.
Ein Gebäudewechsel ändert keine Zuordnung und erzeugt keine Etage. Ein leeres
Gebäude bleibt auch nach einem Neuladen der Daten ausgewählt und leer.
@@ -44,10 +48,20 @@ Beispiel: **Urbach / Zentrale / RAS19 / EG / IT**.
**Ausgewählte Etage verschieben…** wählen. Der Dialog nennt ihren vollständigen
Pfad. Erst die Schaltfläche **Etage „…“ verschieben** übernimmt das Zielgebäude;
eine bloße Zielauswahl oder das Schließen des Dialogs ändert nichts.
- Pro Ort im Hierarchiedialog über **Außenplan anlegen** einen eigenen Außenplan erstellen und im Editor wie
gewohnt Außenflächen, Geräte und Möbel platzieren. Er gehört direkt zum Ort.
Das Außen-Popup berücksichtigt auch bisher auf Gebäudestockwerken platzierte
Außen-Datenpunkte dieses Ortes, ohne Werte anderer Orte einzumischen.
- Für einen einzelnen Raum rechts **Raum verschieben…** öffnen. Zielgebäude und
Zieletage auswählen, bei Bedarf die vorgeschlagene Position X/Z anpassen und erst
dann **Raum „…“ verschieben** drücken. Raumdaten, Datenpunktverknüpfungen,
Türen/Fenster, enthaltene Möbel, platzierte Geräte und Notizen ziehen mit um.
Der Dialog meldet Konflikte mit bereits vorhandenen Gerätekennungen. Vorhandene
Benutzerfreigaben folgen eindeutig identifizierbaren Räumen und Geräten, auch
beim Rückgängigmachen; Ansicht bleibt Ansicht und Bedienung bleibt Bedienung.
- Pro **Ort**, **Niederlassung** und **Gebäude** im Hierarchiedialog über
**Außenplan anlegen** einen eigenen Außenplan erstellen und im Editor wie
gewohnt Außenflächen, Geräte und Möbel platzieren.
Jeder Außenplan gehört direkt zur jeweiligen Ebene und erscheint dort auch in
der linken Navigation mit einer passenden Vorschau. Das Außen-Popup berücksichtigt
auch bisher auf untergeordneten Gebäudestockwerken platzierte Außen-Datenpunkte,
ohne Werte benachbarter Niederlassungen oder Gebäude einzumischen.
- Die linke Navigation in Designer und Kachel folgt der Topologie. Die kleinen
Pfadknöpfe führen zu den übergeordneten Ebenen zurück. Die Vorschaubilder zeigen
nur die Stockwerke des Eintrags; Raumvorschauen werden auf den Raum zugeschnitten.
+2 -2
View File
@@ -6,7 +6,7 @@
"compatibility": {
"version": "9.0"
},
"version": "0.4.1",
"build": 39,
"version": "0.4.2",
"build": 40,
"date": 1795046400
}
+40
View File
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
require __DIR__ . '/support/access-runtime.php';
$module = new AccessFixtureModule(); initializeAccessFixture($module);
$method = static fn(string $name, mixed ...$args): mixed => (new ReflectionMethod($module, $name))->invoke($module, ...$args);
$as = static function (string $name) use ($module, $method): void {
foreach ($method('accounts') as $id => $a) if ($a['name'] === $name) {
(new ReflectionProperty(NextFloor::class, 'requestUser'))->setValue($module, [...$a, 'id' => $id, 'session_id' => 'fixture-' . $name, 'csrf' => 'fixture']);
(new ReflectionProperty(NextFloor::class, 'requestScope'))->setValue($module, null); return;
}
};
$before = $method('building'); $after = $before;
$source = &$after['floors'][0];
$target = [...$source, 'id' => 'og', 'name' => 'Obergeschoss', 'elevation' => 3, 'rooms' => [], 'furniture' => [], 'placements' => []];
$target['rooms'][] = array_shift($source['rooms']);
$target['furniture'][] = array_shift($source['furniture']);
$target['placements'][] = array_shift($source['placements']);
unset($source); $after['floors'][] = $target;
$as('admin'); $method('saveBuilding', $after);
$accounts = array_column($method('accounts'), null, 'name');
check($accounts['office']['rooms'] === [['target' => 'room:og:office2', 'access' => 'control']], 'Room control rights follow the moved room');
check($accounts['officeview']['rooms'] === [['target' => 'room:og:office2', 'access' => 'view']], 'Readonly room rights stay readonly');
check($accounts['device']['devices'] === [['target' => 'furniture:og:wallbox', 'access' => 'control']], 'Explicit device rights follow its unique identity');
check($accounts['empty']['rooms'] === [] && $accounts['empty']['devices'] === [], 'Moving cannot create a new grant');
$as('office'); $tree = $method('visibleTree', $method('objectTree'));
$ids = array_column(array_column($tree['variables'], 'attributes'), 'symcon_id'); sort($ids);
check($ids === [101, 102, 103, 104, 105], 'The moved room still exposes exactly its original native variables');
$as('device'); $method('authorizeApi', 'variables/action', ['data' => ['entity_id' => 'light.102']]);
$as('admin'); $method('saveBuilding', $before);
$accounts = array_column($method('accounts'), null, 'name');
check($accounts['office']['rooms'][0]['target'] === 'room:eg:office2', 'Undo restores the original grant key');
check($accounts['device']['devices'][0]['target'] === 'furniture:eg:wallbox', 'Undo also restores the explicit device key');
// An ambiguous ID may be a duplicate rather than a move; never guess and widen its grant.
$ambiguous = $after; $ambiguous['floors'][0]['furniture'][] = $target['furniture'][0];
$method('saveBuilding', $ambiguous);
$accounts = array_column($method('accounts'), null, 'name');
check($accounts['device']['devices'][0]['target'] === 'furniture:eg:wallbox', 'Duplicate identities never trigger automatic grant migration');
echo "OK: room/device grants follow unique floor moves and undo, preserve view/control levels and native visibility, reject ambiguous identities and create no grants\n";
+5 -1
View File
@@ -19,11 +19,15 @@ $b['floors'][0]['building_id'] = 'ras19';
$outside = ['id' => 'garden', 'name' => 'Außen', 'building_id' => null, 'outdoor_location_id' => 'urbach', 'elevation' => 0, 'height' => 2.5,
'rooms' => [], 'openings' => [], 'placements' => [], 'outdoor' => [], 'furniture' => [['id' => 'garden-meter', 'type' => 'wallbox', 'name' => 'Gartengerät', 'entity' => 'sensor.203', 'x' => 1, 'z' => 2]]];
$b['floors'][] = $outside;
$b['floors'][] = [...$outside, 'id' => 'branch-garden', 'outdoor_location_id' => null, 'outdoor_branch_id' => 'hq', 'furniture' => [[...$outside['furniture'][0], 'id' => 'branch-meter', 'name' => 'Hofgerät']]];
$b['floors'][] = [...$outside, 'id' => 'building-garden', 'outdoor_location_id' => null, 'outdoor_building_id' => 'ras19', 'furniture' => [[...$outside['furniture'][0], 'id' => 'building-meter', 'name' => 'Terrassengerät']]];
$as('admin'); $method('authorizeApi', 'building/save', ['building' => $b]); $method('saveBuilding', $b);
check($method('building')['topology'] === $b['topology'], 'The complete hierarchy persists without changing native links');
$form = $module->GetConfigurationForm();
check(str_contains($form, 'Urbach / Zentrale / RAS19 / Erdgeschoss / Büro 2'), 'Room choices include their complete topology path');
check(str_contains($form, 'Urbach / Außen / Gartengerät'), 'Outdoor device grants belong to the location path');
check(str_contains($form, 'Urbach / Zentrale / Außen / Hofgerät'), 'Branch outdoor device grants use their own full path');
check(str_contains($form, 'Urbach / Zentrale / RAS19 / Außen / Terrassengerät'), 'Building outdoor device grants use their own full path');
$as('office');
$tree = $method('visibleTree', $method('objectTree'));
@@ -34,4 +38,4 @@ check($visible['topology'] === $b['topology'], 'Users retain the complete logica
check($visible['floors'][1]['furniture'][0]['entity'] === 'none', 'Unapproved outdoor status is still filtered server-side');
$as('empty');
check($method('visibleTree', $method('objectTree'))['variables'] === [], 'Adding topology cannot grant access to an empty account');
echo "OK: persisted five-level topology and location outdoors; complete grant choice paths; unchanged room keys; scoped state and native permissions\n";
echo "OK: persisted five-level topology with location/branch/building outdoors; complete grant choice paths; unchanged room keys; scoped state and native permissions\n";
+5
View File
@@ -55,6 +55,11 @@ def test_topology_and_per_location_outdoor_membership_survive_validation() -> No
assert result["topology"] == topology
assert result["floors"][0]["building_id"] == "ras19"
assert result["floors"][1]["outdoor_location_id"] == "urbach"
for field, owner in (("outdoor_branch_id", "hq"), ("outdoor_building_id", "ras19")):
item = {**outdoor, "outdoor_location_id": None, field: owner}
assert BUILDING_SCHEMA({**b, "floors": [floor, item]})["floors"][1][field] == owner
with pytest.raises(vol.Invalid):
BUILDING_SCHEMA({**b, "floors": [{**item, field: 123}]})
assert "topology" not in BUILDING_SCHEMA(empty_building())
for bad in (
{**b, "topology": {**topology, "branches": [{"id": "hq", "name": "Zentrale", "location_id": 12}]}},