feat: add floating room climate cards and fix Symcon humidity selection

This commit is contained in:
jhartworks committed 2026-11-09 17:04:46 +01:00
1 parent 24188f96f7
commit ff54f4461a
21 files changed
+764 -398

No files matched your search

+4
View File
@@ -6,6 +6,8 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad
### Added
- **Floating room climate cards:** Each room can show temperature, humidity and CO₂ in a glass card above its own position, using its selected sensors. Cards follow live values and room/floor navigation and can be toggled without configuring an energy meter.
- **IP-Symcon variable reload:** A button in the designer title bar reloads the complete object tree, variables and current presentation metadata without closing the plan, with progress, success and error feedback.
- **IP-Symcon object-tree picker:** Data point fields open a modal dialog with the real Symcon hierarchy, including instances, links, hidden objects and empty categories, ordered as in the console. Search keeps matching objects in their original branches; confirmation, cancellation and keyboard navigation are supported.
@@ -18,6 +20,8 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad
### Fixed
- **IP-Symcon room humidity selection:** Manual room-climate fields accept numeric Integer/Float variables even without inferred classes or profiles. German “Feuchtigkeit” and subscript “CO₂” names are recognized, and parent category names no longer override measurement classes.
- **IP-Symcon dimmers and venetian blinds:** Numeric variables can be explicitly linked as dimmers or blind controls independently of inferred names. Native integer/float ranges and steps are respected in both directions. Separate blind-height and slat-position variables can be selected in the object tree and controlled independently in the room panel and quick menu; dimmer sliders stay available while off.
- **IP-Symcon KNX room temperatures:** Current Symcon presentation units are read alongside legacy profiles. Numeric temperature variables remain selectable and readable even when a parent name caused an actuator classification; saved mappings stay intact.
@@ -1,7 +1,7 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var S={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"};var bo=globalThis,yo=bo.ShadowRoot&&(bo.ShadyCSS===void 0||bo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qi=Symbol(),Ll=new WeakMap,cr=class{constructor(e,n,r){if(this._$cssResult$=!0,r!==qi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o,n=this.t;if(yo&&e===void 0){let r=n!==void 0&&n.length===1;r&&(e=Ll.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Ll.set(n,e))}return e}toString(){return this.cssText}},Cl=t=>new cr(typeof t=="string"?t:t+"",void 0,qi),se=(t,...e)=>{let n=t.length===1?t[0]:e.reduce((r,o,i)=>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.")})(o)+t[i+1],t[0]);return new cr(n,t,qi)},Nl=(t,e)=>{if(yo)t.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of e){let r=document.createElement("style"),o=bo.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=n.cssText,t.appendChild(r)}},Yi=yo?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(let r of e.cssRules)n+=r.cssText;return Cl(n)})(t):t;var{is:Xg,defineProperty:Qg,getOwnPropertyDescriptor:Jg,getOwnPropertyNames:e_,getOwnPropertySymbols:t_,getPrototypeOf:n_}=Object,wo=globalThis,Bl=wo.trustedTypes,r_=Bl?Bl.emptyScript:"",o_=wo.reactiveElementPolyfillSupport,dr=(t,e)=>t,Xi={toAttribute(t,e){switch(e){case Boolean:t=t?r_:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},Vl=(t,e)=>!Xg(t,e),Wl={attribute:!0,type:String,converter:Xi,reflect:!1,useDefault:!1,hasChanged:Vl};Symbol.metadata??=Symbol("metadata"),wo.litPropertyMetadata??=new WeakMap;var mt=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,n=Wl){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(e,r,n);o!==void 0&&Qg(this.prototype,e,o)}}static getPropertyDescriptor(e,n,r){let{get:o,set:i}=Jg(this.prototype,e)??{get(){return this[n]},set(s){this[n]=s}};return{get:o,set(s){let l=o?.call(this);i?.call(this,s),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Wl}static _$Ei(){if(this.hasOwnProperty(dr("elementProperties")))return;let e=n_(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(dr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(dr("properties"))){let n=this.properties,r=[...e_(n),...t_(n)];for(let o of r)this.createProperty(o,n[o])}let e=this[Symbol.metadata];if(e!==null){let n=litPropertyMetadata.get(e);if(n!==void 0)for(let[r,o]of n)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[n,r]of this.elementProperties){let o=this._$Eu(n,r);o!==void 0&&this._$Eh.set(o,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let n=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let o of r)n.unshift(Yi(o))}else e!==void 0&&n.push(Yi(e));return n}static _$Eu(e,n){let r=n.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,n=this.constructor.elementProperties;for(let r of n.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Nl(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.Line truncated
\f\r]`,ur=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,jl=/-->/g,Ul=/>/g,Gt=RegExp(`>|${Qi}(?:([^\\s"'>=/]+)(${Qi}*=${Qi}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Zl=/'/g,ql=/"/g,Ql=/^(?:script|style|textarea|title)$/i,rs=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),m=rs(1),R=rs(2),Ak=rs(3),Qe=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Yl=new WeakMap,jt=Ut.createTreeWalker(Ut,129);function Jl(t,e){if(!ns(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gl!==void 0?Gl.createHTML(e):e}var ec=(t,e)=>{let n=t.length-1,r=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=ur;for(let l=0;l<n;l++){let a=t[l],c,d,u=-1,p=0;for(;p<a.length&&(s.lastIndex=p,d=s.exec(a),d!==null);)p=s.lastIndex,s===ur?d[1]==="!--"?s=jl:d[1]!==void 0?s=Ul:d[2]!==void 0?(Ql.test(d[2])&&(o=RegExp("</"+d[2],"g")),s=Gt):d[3]!==void 0&&(s=Gt):s===Gt?d[0]===">"?(s=o??ur,u=-1):d[1]===void 0?u=-2:(u=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Gt:d[3]==='"'?ql:Zl):s===ql||s===Zl?s=Gt:s===jl||s===Ul?s=ur:(s=Gt,o=void 0);let h=s===Gt&&t[l+1].startsWith("/>")?" ":"";i+=s===ur?a+i_:u>=0?(r.push(c),a.slice(0,u)+es+a.slice(u)+gt+h):a+gt+(u===-2?l:h)}return[Jl(t,i+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},fr=class t{constructor({strings:e,_$litType$:n},r){let o;this.parts=[];let i=0,s=0,l=e.length-1,a=this.parts,[c,d]=ec(e,n);if(this.el=t.createElement(c,r),jt.currentNode=this.el.content,n===2||n===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(o=jt.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let u of o.getAttributeNames())if(u.endsWith(es)){let p=d[s++],h=o.getAttribute(u).split(gt),f=/([.?@])?(.*)/.exec(p);a.push({type:1,index:i,name:f[2],strings:h,ctor:f[1]==="."?xo:f[1]==="?"?$o:f[1]==="@"?So:qt}),o.removeAttribute(u)}else u.startsWith(gt)&&(a.push({type:6,index:i}),o.removeAttribute(u));if(Ql.test(o.tagName)){let u=o.textContent.split(gt),p=u.length-1;if(p>0){o.textContent=vo?vo.emptyScript:"";for(let h=0;h<p;h++)o.append(u[h],hr()),jt.nextNode(),a.push({type:2,index:++i});o.append(u[p],hr())}}}else if(o.nodeType===8)if(o.data===ts)a.push({type:2,index:i});else{let u=-1;for(;(u=o.data.indexOf(gt,u+1))!==-1;)a.push({type:7,index:i}),u+=gt.length-1}i++}}static createElement(e,n){let r=Ut.createElement("template");return r.innerHTML=e,r}};function Zt(t,e,n=t,r){if(e===Qe)return e;let o=r!==void 0?n._$Co?.[r]:n._$Cl,i=pr(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(t),o._$AT(t,n,r)),r!==void 0?(n._$Co??=[])[r]=o:n._$Cl=o),o!==void 0&&(e=Zt(t,o._$AS(t,e.values),o,r)),e}var ko=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:n},parts:r}=this._$AD,o=(e?.creationScope??Ut).importNode(n,!0);jt.currentNode=o;let i=jt.nextNode(),s=0,l=0,a=r[0];for(;a!==void 0;){if(s===a.index){let c;a.type===2?c=new yn(i,i.nextSibling,this,e):a.type===1?c=new a.ctor(i,a.name,a.strings,this,e):a.type===6&&(c=new Mo(i,this,e)),this._$AV.push(c),a=r[++l]}s!==a?.index&&(i=jt.nextNode(),s++)}return jt.currentNode=Ut,o}p(e){let n=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,n),n+=r.strings.length-2):r._$AI(e[n])),n++}},yn=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,r,o){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=Zt(this,e,n),pr(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==Qe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xl(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!==_&&pr(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ut.createTextNode(e)),this._$AH=e}$(e){let{values:n,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=fr.createElement(Jl(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(n);else{let i=new ko(o,this),s=i.u(this.options);i.p(n),this.T(s),this._$AH=i}}_$AC(e){let n=Yl.get(e.strings);return n===void 0&&Yl.set(e.strings,n=new fr(e)),n}k(e){ns(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,o=0;for(let i of e)o===n.length?n.push(r=new t(this.O(hr()),this.O(hr()),this,this.options)):r=n[o],r._$AI(i),o++;o<n.length&&(this._$AR(r&&r._$AB.nextSibling,o),n.length=o)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){let r=Kl(e).nextSibling;Kl(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},qt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,r,o,i){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=n,this._$AM=o,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._Line truncated
\f\r"'\`<>=]|("|')|))|$)`,"g"),Zl=/'/g,ql=/"/g,Ql=/^(?:script|style|textarea|title)$/i,rs=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),m=rs(1),R=rs(2),Ak=rs(3),Qe=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Yl=new WeakMap,jt=Ut.createTreeWalker(Ut,129);function Jl(t,e){if(!ns(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gl!==void 0?Gl.createHTML(e):e}var ec=(t,e)=>{let n=t.length-1,r=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=ur;for(let l=0;l<n;l++){let a=t[l],c,d,u=-1,p=0;for(;p<a.length&&(s.lastIndex=p,d=s.exec(a),d!==null);)p=s.lastIndex,s===ur?d[1]==="!--"?s=jl:d[1]!==void 0?s=Ul:d[2]!==void 0?(Ql.test(d[2])&&(o=RegExp("</"+d[2],"g")),s=Gt):d[3]!==void 0&&(s=Gt):s===Gt?d[0]===">"?(s=o??ur,u=-1):d[1]===void 0?u=-2:(u=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Gt:d[3]==='"'?ql:Zl):s===ql||s===Zl?s=Gt:s===jl||s===Ul?s=ur:(s=Gt,o=void 0);let h=s===Gt&&t[l+1].startsWith("/>")?" ":"";i+=s===ur?a+i_:u>=0?(r.push(c),a.slice(0,u)+es+a.slice(u)+gt+h):a+gt+(u===-2?l:h)}return[Jl(t,i+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},fr=class t{constructor({strings:e,_$litType$:n},r){let o;this.parts=[];let i=0,s=0,l=e.length-1,a=this.parts,[c,d]=ec(e,n);if(this.el=t.createElement(c,r),jt.currentNode=this.el.content,n===2||n===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(o=jt.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let u of o.getAttributeNames())if(u.endsWith(es)){let p=d[s++],h=o.getAttribute(u).split(gt),f=/([.?@])?(.*)/.exec(p);a.push({type:1,index:i,name:f[2],strings:h,ctor:f[1]==="."?xo:f[1]==="?"?$o:f[1]==="@"?So:qt}),o.removeAttribute(u)}else u.startsWith(gt)&&(a.push({type:6,index:i}),o.removeAttribute(u));if(Ql.test(o.tagName)){let u=o.textContent.split(gt),p=u.length-1;if(p>0){o.textContent=vo?vo.emptyScript:"";for(let h=0;h<p;h++)o.append(u[h],hr()),jt.nextNode(),a.push({type:2,index:++i});o.append(u[p],hr())}}}else if(o.nodeType===8)if(o.data===ts)a.push({type:2,index:i});else{let u=-1;for(;(u=o.data.indexOf(gt,u+1))!==-1;)a.push({type:7,index:i}),u+=gt.length-1}i++}}static createElement(e,n){let r=Ut.createElement("template");return r.innerHTML=e,r}};function Zt(t,e,n=t,r){if(e===Qe)return e;let o=r!==void 0?n._$Co?.[r]:n._$Cl,i=pr(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(t),o._$AT(t,n,r)),r!==void 0?(n._$Co??=[])[r]=o:n._$Cl=o),o!==void 0&&(e=Zt(t,o._$AS(t,e.values),o,r)),e}var ko=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:n},parts:r}=this._$AD,o=(e?.creationScope??Ut).importNode(n,!0);jt.currentNode=o;let i=jt.nextNode(),s=0,l=0,a=r[0];for(;a!==void 0;){if(s===a.index){let c;a.type===2?c=new yn(i,i.nextSibling,this,e):a.type===1?c=new a.ctor(i,a.name,a.strings,this,e):a.type===6&&(c=new Mo(i,this,e)),this._$AV.push(c),a=r[++l]}s!==a?.index&&(i=jt.nextNode(),s++)}return jt.currentNode=Ut,o}p(e){let n=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,n),n+=r.strings.length-2):r._$AI(e[n])),n++}},yn=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,r,o){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=Zt(this,e,n),pr(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==Qe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xl(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!==_&&pr(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ut.createTextNode(e)),this._$AH=e}$(e){let{values:n,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=fr.createElement(Jl(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(n);else{let i=new ko(o,this),s=i.u(this.options);i.p(n),this.T(s),this._$AH=i}}_$AC(e){let n=Yl.get(e.strings);return n===void 0&&Yl.set(e.strings,n=new fr(e)),n}k(e){ns(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,o=0;for(let i of e)o===n.length?n.push(r=new t(this.O(hr()),this.O(hr()),this,this.options)):r=n[o],r._$AI(i),o++;o<n.length&&(this._$AR(r&&r._$AB.nextSibling,o),n.length=o)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){let r=Kl(e).nextSibling;Kl(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},qt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,r,o,i){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=n,this._$AM=o,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._Line truncated
:host {
--nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b);
@@ -971,9 +971,11 @@ ${i}`}else o=ju(s)}}catch(s){let l=s.message,a={not_json:"import_error_not_json"
${M(t.t("devices_panel_hint"))}
${t.admin?m`<div class="nf-seg nf-dev-source">${d.map(([p,h])=>m`<button aria-pressed=${a===p} @click=${()=>e.deviceSource=p}>${h}</button>`)}</div>`:_}
${a!=="area"?m`${u}${M0(t,e,n,l,a)}`:R0(t,e,n,l,s,i,r)}
</section>`}function zp(t,e,n){let{hass:r}=t;if(!r)return _;let o=!!e.climate&&Object.values(e.climate).some(l=>l!=null),i=(l,a)=>{let c={...e.climate??{},[l]:a};n({climate:Object.values(c).every(d=>d==null)?null:c})},s=(l,a)=>{let c=pd(r,t.floor??null,{...e,climate:null},l),d=L(r,y=>Ms(r,y,l)),u=Fp(d,y=>(Tt(r,y)===e.area_id?0:1)+(Rs(r,y)?0:2)),p=[e.climate?.[l]??null].flat(),h=y=>{let b=y.filter(v=>!!v&&v!=="none");i(l,y[0]==="none"?"none":b.length>1?b:b[0]??null)},g=p[0]&&p[0]!=="none"?[...p,null]:p;return g.map((y,b)=>P(t,b?t.t("climate_more"):a,y,b?void 0:c[0]??null,u,v=>h(g.map((w,x)=>x===b?v:w))))};return m`<details class="nf-points" ?open=${o}>
</section>`}function zp(t,e,n){let{hass:r}=t;if(!r)return _;let o=!!e.climate&&Object.values(e.climate).some(l=>l!=null),i=(l,a)=>{let c={...e.climate??{},[l]:a};n({climate:Object.values(c).every(d=>d==null)?null:c})},s=(l,a)=>{let c=pd(r,t.floor??null,{...e,climate:null},l),d=[e.climate?.[l]??null].flat(),u=L(r,y=>Ms(r,y,l,!0)&&(!r.states[y]?.attributes.symcon_source_entity||d.includes(y))),p=Fp(u,y=>(Tt(r,y)===e.area_id?0:1)+(Rs(r,y)?0:2)),h=y=>{let b=y.filter(v=>!!v&&v!=="none");i(l,y[0]==="none"?"none":b.length>1?b:b[0]??null)},g=d[0]&&d[0]!=="none"?[...d,null]:d;return g.map((y,b)=>P(t,b?t.t("climate_more"):a,y,b?void 0:c[0]??null,p,v=>h(g.map((w,x)=>x===b?v:w))))};return m`<details class="nf-points" ?open=${o||!!e.climate_card}>
<summary>${t.t("climate")}</summary>
<div class="nf-form">${s("temperature",t.t("climate_temperature"))} ${s("humidity",t.t("climate_humidity"))} ${s("co2",t.t("climate_co2"))}</div>
${H(t,t.t("climate_card"),!!e.climate_card,l=>n({climate_card:l||void 0}))}
${M(t.t("climate_card_hint"))}
${M(t.t("climate_hint"))}
</details>`}var Na="metric",Ip=t=>{Na=t==="imperial"?"imperial":"metric"};var Pp=.3048;function he(t,e,n=2,r=Na){if(r==="metric")return`${j(t,e,n)} m`;let o=e<0?"\u2212":"",i=Math.round(Math.abs(e)/.0254*2),s=Math.floor(i/24),l=i-s*24,a=`${Math.floor(l/2)}${l%2?"\xBD":""}`;return s?`${o}${s}\u2032 ${a}\u2033`:`${o}${a}\u2033`}function Ae(t,e,n=Na){return n==="metric"?`${j(t,e,1)} m\xB2`:`${j(t,e/(Pp*Pp),0)} ft\xB2`}var E0=.15,A0=(t,e)=>Math.abs((t-e+540)%360-180);function F0(t,e,n,r){return t.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let l=o.points[(s+1)%o.points.length];return Math.abs(Q(K(i,n),r))<.02&&Math.abs(Q(K(l,n),r))<.02}))}function Wa(t,e,n,r){let o=e.points,[i,s]=[o[n],o[(n+1)%o.length]],l=fe(K(s,i)),a=ge(o)>=0?1:-1,c=[(s[0]-i[0])/l,(s[1]-i[1])/l],d=[-c[1]*a||0,c[0]*a||0],u=c[0]*d[1]-c[1]*d[0]>0,p=e.wall_heights?.[n],h=e.ceiling??t.height,f=typeof p=="number"?p:Array.isArray(p)?Math.max(...p.map(b=>b??h)):h,g=e.wall_slopes?.[n],y=typeof g=="number"&&typeof p=="number"?g:f;return{origin:u?i:s,along:u?c:[-c[0],-c[1]],normal:d,length:l,face:F0(t,e,i,d)?r/2:0,heightLeft:u?f:y,heightRight:u?y:f}}function Ba(t,e){let n=K(e,t.origin);return{u:Q(n,t.along),depth:Q(n,t.normal)-t.face}}function T0(t,e){let n=t.rooms.find(s=>s.id===e.room_id);if(!n||e.wall)return null;let[r,o]=[n.points[e.edge],n.points[(e.edge+1)%n.points.length]];if(!r||!o)return null;let i=fe(K(o,r))||1;return[r[0]+(o[0]-r[0])*e.offset/i,r[1]+(o[1]-r[1])*e.offset/i]}var Dp=t=>G(t.type)?.mount==="wall"||t.type==="lamp_wall"||t.mount_y!=null;function Op(t,e,n){let r=[];for(let i of t.openings){let s=T0(t,i);if(!s)continue;let{u:l,depth:a}=Ba(n,s);Math.abs(a+n.face)>.3||l<-.01||l>n.length+.01||r.push({id:i.id,kind:"opening",type:i.type,x0:l-i.width/2,x1:l+i.width/2,y0:i.sill,y1:i.sill+i.height,lifts:i.type==="window"})}let o=Math.atan2(-n.normal[0],n.normal[1])*180/Math.PI;for(let i of t.furniture){if(!N([i.x,i.z],e.points)||A0(i.rotation,o)>20)continue;let{u:s,depth:l}=Ba(n,[i.x,i.z]);if(l-i.d/2>E0||s<0||s>n.length)continue;let a=At(t,i);r.push({id:i.id,kind:"furniture",type:i.type,x0:s-i.w/2,x1:s+i.w/2,y0:a,y1:a+i.h,lifts:Dp(i)})}return r.sort((i,s)=>+(i.kind==="furniture")-+(s.kind==="furniture")||i.x0-s.x0)}var ao=t=>Math.round(t*1e3)/1e3;function Hp(t,e,n,r){let o=Ba(t,[e.x,e.z]).depth,i=Math.min(t.length-e.w/2,Math.max(e.w/2,n+e.w/2)),s=[t.origin[0]+t.along[0]*i+t.normal[0]*(o+t.face),t.origin[1]+t.along[1]*i+t.normal[1]*(o+t.face)];return{x:ao(s[0]),z:ao(s[1]),...r!==null&&Dp(e)?{mount_y:ao(Math.max(0,r))}:{}}}function Lp(t,e,n,r,o){let[i]=[e.points[n.edge]],s=Math.min(t.length-n.width/2,Math.max(n.width/2,r+n.width/2)),l=fe(K(i,t.origin))<1e-6?s:t.length-s;return{offset:ao(l),...o!==null&&n.type==="window"?{sill:ao(Math.max(0,o))}:{}}}var Cp=.01,Np=t=>Math.round(t/Cp)*Cp,Va=class extends ne{static properties={host:{attribute:!1},doc:{attribute:!1},roomId:{},edge:{type:Number},_sel:{state:!0},_drag:{state:!0}};constructor(){super(),this._sel=null,this._drag=null}get room(){return this.host.floor?.rooms.find(e=>e.id===this.roomId)}frame(){let e=this.room;return e&&this.host.floor?Wa(this.host.floor,e,this.edge,this.host.doc.settings.wall_interior):null}boxes(){let e=this.room,n=this.frame();return e&&n&&this.host.floor?Op(this.host.floor,e,n):[]}place(e,n,r){let o=this.room,i=this.frame();!o||!i||this.host.change((s,l)=>{if(e.kind==="furniture"){let a=l.furniture.find(c=>c.id===e.id);a&&Object.assign(a,Hp(i,a,n,e.lifts?r:null))}else{let a=l.openings.find(d=>d.id===e.id),c=l.rooms.find(d=>d.id===a?.room_id);a&&c&&Object.assign(a,Lp(c.id===o.id?i:Wa(l,c,a.edge,this.host.doc.settings.wall_interior),c,a,n,e.lifts?r:null))}})}toWall(e){let r=this.renderRoot.querySelector("svg").getScreenCTM()?.inverse();if(!r)return[0,0];let o=new DOMPoint(e.clientX,e.clientY).matrixTransform(r);return[o.x,-o.y]}down(e,n){if(this._sel=n.id,!this.host.admin)return;e.currentTarget.setPointerCapture(e.pointerId);let[r,o]=this.toWall(e);this._drag={id:n.id,x0:n.x0,y0:n.y0,startU:r,startY:o,fromX:n.x0,fromY:n.y0}}move(e,n){let r=this._drag;if(!r||r.id!==n.id)return;let[o,i]=this.toWall(e),s=this.frame(),l=n.x1-n.x0,a=Math.min((s?.length??0)-l,Math.max(0,Np(r.fromX+o-r.startU))),c=n.lifts?Math.max(0,Np(r.fromY+i-r.startY)):r.fromY;this._drag={...r,x0:a,y0:c}}up(e){let n=this._drag;this._drag=null,!(!n||n.id!==e.id||Math.abs(n.x0-n.fromX)<1e-6&&Math.abs(n.y0-n.fromY)<1e-6)&&this.place(e,n.x0,n.y0)}nameOf(e){if(e.kind==="furniture")return this.host.floor?.furniture.find(o=>o.id===e.id)?.name||qe(this.host.hass,e.type);let n=this.host.floor?.openings.find(r=>r.id===e.id);return n?this.host.t(`preset_${xn(n)}`):e.type}updated(e){(e.has("edge")||e.has("roomId"))&&(this._sel=null)}render(){let e=this.host.t,n=this.room,r=this.frame();if(!n||!r)return _;let o=n.points.length,i=h=>he(this.host.hass,h),s=this.boxes().map(h=>this._drag?.id===h.id?{...h,x1:this._drag.x0+(h.x1-h.x0),y1:this._drag.y0+(h.y1-h.y0),x0:this._drag.x0,y0:this._drag.y0}:h),l=Math.max(r.heLine truncated
<line x1="0" x2=${d.x0} y1=${-(d.y0+d.y1)/2} y2=${-(d.y0+d.y1)/2} />
+223 -202
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 M={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=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var yn=globalThis,xn=yn.ShadowRoot&&(yn.ShadyCSS===void 0||yn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Hr=Symbol(),wi=new WeakMap,Ht=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Hr)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(xn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=wi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&wi.set(t,e))}return e}toString(){return this.cssText}},vi=r=>new Ht(typeof r=="string"?r:r+"",void 0,Hr),te=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,o,i)=>n+(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.")})(o)+r[i+1],r[0]);return new Ht(t,r,Hr)},yi=(r,e)=>{if(xn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=yn.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Ir=xn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return vi(t)})(r):r;var{is:Zu,defineProperty:Yu,getOwnPropertyDescriptor:Ju,getOwnPropertyNames:Qu,getOwnPropertySymbols:Xu,getPrototypeOf:ec}=Object,kn=globalThis,xi=kn.trustedTypes,tc=xi?xi.emptyScript:"",nc=kn.reactiveElementPolyfillSupport,It=(r,e)=>r,Cr={toAttribute(r,e){switch(e){case Boolean:r=r?tc:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Si=(r,e)=>!Zu(r,e),ki={attribute:!0,type:String,converter:Cr,reflect:!1,useDefault:!1,hasChanged:Si};Symbol.metadata??=Symbol("metadata"),kn.litPropertyMetadata??=new WeakMap;var $e=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=ki){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 n=Symbol(),o=this.getPropertyDescriptor(e,n,t);o!==void 0&&Yu(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=Ju(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:o,set(s){let a=o?.call(this);i?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ki}static _$Ei(){if(this.hasOwnProperty(It("elementProperties")))return;let e=ec(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(It("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(It("properties"))){let t=this.properties,n=[...Qu(t),...Xu(t)];for(let o of n)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,o]of t)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let o=this._$Eu(t,n);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let o of n)t.unshift(Ir(o))}else e!==void 0&&t.push(Ir(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shaLine truncated
\f\r]`,Ct=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ai=/-->/g,Ei=/>/g,Ze=RegExp(`>|${Nr}(?:([^\\s"'>=/]+)(${Nr}*=${Nr}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ri=/'/g,zi=/"/g,Pi=/^(?:script|style|textarea|title)$/i,Ur=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Ur(1),J=Ur(2),Dm=Ur(3),Qe=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Ti=new WeakMap,Ye=Je.createTreeWalker(Je,129);function Hi(r,e){if(!Gr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return $i!==void 0?$i.createHTML(e):e}var ic=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=Ct;for(let a=0;a<t;a++){let l=r[a],u,c,d=-1,p=0;for(;p<l.length&&(s.lastIndex=p,c=s.exec(l),c!==null);)p=s.lastIndex,s===Ct?c[1]==="!--"?s=Ai:c[1]!==void 0?s=Ei:c[2]!==void 0?(Pi.test(c[2])&&(o=RegExp("</"+c[2],"g")),s=Ze):c[3]!==void 0&&(s=Ze):s===Ze?c[0]===">"?(s=o??Ct,d=-1):c[1]===void 0?d=-2:(d=s.lastIndex-c[2].length,u=c[1],s=c[3]===void 0?Ze:c[3]==='"'?zi:Ri):s===zi||s===Ri?s=Ze:s===Ai||s===Ei?s=Ct:(s=Ze,o=void 0);let h=s===Ze&&r[a+1].startsWith("/>")?" ":"";i+=s===Ct?l+rc:d>=0?(n.push(u),l.slice(0,d)+Fi+l.slice(d)+Oe+h):l+Oe+(d===-2?a:h)}return[Hi(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Wt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[u,c]=ic(e,t);if(this.el=r.createElement(u,n),Ye.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(o=Ye.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let d of o.getAttributeNames())if(d.endsWith(Fi)){let p=c[s++],h=o.getAttribute(d).split(Oe),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:i,name:g[2],strings:h,ctor:g[1]==="."?Wr:g[1]==="?"?Lr:g[1]==="@"?Br:ht}),o.removeAttribute(d)}else d.startsWith(Oe)&&(l.push({type:6,index:i}),o.removeAttribute(d));if(Pi.test(o.tagName)){let d=o.textContent.split(Oe),p=d.length-1;if(p>0){o.textContent=Sn?Sn.emptyScript:"";for(let h=0;h<p;h++)o.append(d[h],Nt()),Ye.nextNode(),l.push({type:2,index:++i});o.append(d[p],Nt())}}}else if(o.nodeType===8)if(o.data===Di)l.push({type:2,index:i});else{let d=-1;for(;(d=o.data.indexOf(Oe,d+1))!==-1;)l.push({type:7,index:i}),d+=Oe.length-1}i++}}static createElement(e,t){let n=Je.createElement("template");return n.innerHTML=e,n}};function dt(r,e,t=r,n){if(e===Qe)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Ot(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(r),o._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=o:t._$Cl=o),o!==void 0&&(e=dt(r,o._$AS(r,e.values),o,n)),e}var Or=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:n}=this._$AD,o=(e?.creationScope??Je).importNode(t,!0);Ye.currentNode=o;let i=Ye.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new Lt(i,i.nextSibling,this,e):l.type===1?u=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(u=new Vr(i,this,e)),this._$AV.push(u),l=n[++a]}s!==l?.index&&(i=Ye.nextNode(),s++)}return Ye.currentNode=Je,o}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Lt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,o){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cv=o?.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=dt(this,e,t),Ot(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==Qe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):oc(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&&Ot(this._$AH)?this._$AA.nextSibling.data=e:this.T(Je.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,o=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Wt.createElement(Hi(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Or(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=Ti.get(e.strings);return t===void 0&&Ti.set(e.strings,t=new Wt(e)),t}k(e){Gr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(Nt()),this.O(Nt()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Mi(e).nextSibling;Mi(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ht=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,o,i){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._Line truncated
var $={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=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var xn=globalThis,kn=xn.ShadowRoot&&(xn.ShadyCSS===void 0||xn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Hr=Symbol(),bi=new WeakMap,It=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Hr)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(kn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=bi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&bi.set(t,e))}return e}toString(){return this.cssText}},wi=r=>new It(typeof r=="string"?r:r+"",void 0,Hr),ne=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,o,i)=>n+(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.")})(o)+r[i+1],r[0]);return new It(t,r,Hr)},vi=(r,e)=>{if(kn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=xn.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Ir=kn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return wi(t)})(r):r;var{is:Jc,defineProperty:Qc,getOwnPropertyDescriptor:Xc,getOwnPropertyNames:eu,getOwnPropertySymbols:tu,getPrototypeOf:nu}=Object,Sn=globalThis,yi=Sn.trustedTypes,ru=yi?yi.emptyScript:"",ou=Sn.reactiveElementPolyfillSupport,Ct=(r,e)=>r,Cr={toAttribute(r,e){switch(e){case Boolean:r=r?ru:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},ki=(r,e)=>!Jc(r,e),xi={attribute:!0,type:String,converter:Cr,reflect:!1,useDefault:!1,hasChanged:ki};Symbol.metadata??=Symbol("metadata"),Sn.litPropertyMetadata??=new WeakMap;var Ae=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=xi){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 n=Symbol(),o=this.getPropertyDescriptor(e,n,t);o!==void 0&&Qc(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=Xc(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:o,set(s){let a=o?.call(this);i?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??xi}static _$Ei(){if(this.hasOwnProperty(Ct("elementProperties")))return;let e=nu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ct("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ct("properties"))){let t=this.properties,n=[...eu(t),...tu(t)];for(let o of n)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,o]of t)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let o=this._$Eu(t,n);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let o of n)t.unshift(Ir(o))}else e!==void 0&&t.push(Ir(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shaLine truncated
\f\r]`,Nt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Mi=/-->/g,Ai=/>/g,Ze=RegExp(`>|${Nr}(?:([^\\s"'>=/]+)(${Nr}*=${Nr}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ei=/'/g,Ri=/"/g,Di=/^(?:script|style|textarea|title)$/i,Ur=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Ur(1),J=Ur(2),Cm=Ur(3),Qe=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),zi=new WeakMap,Ye=Je.createTreeWalker(Je,129);function Pi(r,e){if(!Gr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return $i!==void 0?$i.createHTML(e):e}var au=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=Nt;for(let a=0;a<t;a++){let l=r[a],c,u,h=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===Nt?u[1]==="!--"?s=Mi:u[1]!==void 0?s=Ai:u[2]!==void 0?(Di.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=Ze):u[3]!==void 0&&(s=Ze):s===Ze?u[0]===">"?(s=o??Nt,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Ze:u[3]==='"'?Ri:Ei):s===Ri||s===Ei?s=Ze:s===Mi||s===Ai?s=Nt:(s=Ze,o=void 0);let d=s===Ze&&r[a+1].startsWith("/>")?" ":"";i+=s===Nt?l+iu:h>=0?(n.push(c),l.slice(0,h)+Ti+l.slice(h)+We+d):l+We+(h===-2?a:d)}return[Pi(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Lt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[c,u]=au(e,t);if(this.el=r.createElement(c,n),Ye.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=Ye.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(Ti)){let p=u[s++],d=o.getAttribute(h).split(We),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:i,name:g[2],strings:d,ctor:g[1]==="."?Wr:g[1]==="?"?Lr:g[1]==="@"?Br:ht}),o.removeAttribute(h)}else h.startsWith(We)&&(l.push({type:6,index:i}),o.removeAttribute(h));if(Di.test(o.tagName)){let h=o.textContent.split(We),p=h.length-1;if(p>0){o.textContent=$n?$n.emptyScript:"";for(let d=0;d<p;d++)o.append(h[d],Ot()),Ye.nextNode(),l.push({type:2,index:++i});o.append(h[p],Ot())}}}else if(o.nodeType===8)if(o.data===Fi)l.push({type:2,index:i});else{let h=-1;for(;(h=o.data.indexOf(We,h+1))!==-1;)l.push({type:7,index:i}),h+=We.length-1}i++}}static createElement(e,t){let n=Je.createElement("template");return n.innerHTML=e,n}};function dt(r,e,t=r,n){if(e===Qe)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Wt(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(r),o._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=o:t._$Cl=o),o!==void 0&&(e=dt(r,o._$AS(r,e.values),o,n)),e}var Or=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:n}=this._$AD,o=(e?.creationScope??Je).importNode(t,!0);Ye.currentNode=o;let i=Ye.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Bt(i,i.nextSibling,this,e):l.type===1?c=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(c=new Vr(i,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=Ye.nextNode(),s++)}return Ye.currentNode=Je,o}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Bt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,o){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cv=o?.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=dt(this,e,t),Wt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==Qe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):su(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&&Wt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Je.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,o=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Lt.createElement(Pi(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Or(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=zi.get(e.strings);return t===void 0&&zi.set(e.strings,t=new Lt(e)),t}k(e){Gr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(Ot()),this.O(Ot()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Si(e).nextSibling;Si(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ht=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,o,i){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[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);
}
`,hr=te`
`,hr=ne`
:host([readable]) {
--secondary-text-color: var(--primary-text-color, #e1e1e1);
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
@@ -46,7 +46,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
:host([readable]) .nf-overlay {
zoom: 1.2;
}
`,Ke=te`
`,Ke=ne`
/* a group of switches: one rounded pill, the active one tinted with the accent */
.nf-seg {
display: inline-flex;
@@ -209,53 +209,53 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
min-height: 40px;
}
}
`;function pr(r){return r?.themes?.darkMode===!1?"light":"dark"}var Rh=4,zh=8,Th=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],At=r=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
`;function pr(r){return r?.themes?.darkMode===!1?"light":"dark"}var Fh=4,Dh=8,Ph=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],Et=r=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d=${nr(r)} />
</svg>`,mr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Do=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Fh=24,Dh=10,Po=class extends re{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 dr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],o=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!o)return f;let i=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>K(this.hass,l).filter(u=>u.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(cr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
</svg>`,mr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Do=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Hh=24,Ih=10,Po=class extends re{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 dr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],o=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!o)return f;let i=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>K(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(ur)}]),this._moodName=null};return m`<div class="nf-rp-moods">
${n.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>
${i.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=i.find(p=>p.id===c.value);c.value="",d&&this.runMood(Xa(l,s(d)))}}>
${i.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,h=i.find(p=>p.id===u.value);u.value="",h&&this.runMood(Xa(l,s(h)))}}>
<option value="">→</option>
${i.map(u=>m`<option value=${u.id}>${u.name}</option>`)}
${i.map(c=>m`<option value=${c.id}>${c.name}</option>`)}
</select>`:f}
${o?m`<button class="nf-btn nf-rp-small" aria-label=${this.t("delete")} @click=${()=>this.fireMoods(e,n.filter(u=>u.id!==l.id))}>✕</button>`:f}
${o?m`<button class="nf-btn nf-rp-small" aria-label=${this.t("delete")} @click=${()=>this.fireMoods(e,n.filter(c=>c.id!==l.id))}>✕</button>`:f}
</span>`)}
${o?this._moodName===null?m`<button class="nf-btn nf-rp-small" title=${this.t("mood_save_hint")} @click=${()=>this._moodName=""}>+ ${this.t("mood_save")}</button>`:m`<span class="nf-rp-mood"
><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=qn(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let o=Date.now(),i=o-24*36e5;try{let s=await rn(this.hass,n,i,o,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let u=$t(this.hass,s,i+(o-i)*l/96),c=n.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;let t=To(this.hass,this.building,this.floor,e);try{let n=await Ka(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=K(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(!n.length||n.some(s=>s.state!=="off"))return f;let o=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),i=Math.floor((Date.now()-o)/6e4);return!o||i<Dh?f:m`<div class="nf-rp-shade">
</div>`}async loadCurve(e){let t=vt(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let o=Date.now(),i=o-24*36e5;try{let s=await on(this.hass,n,i,o,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=At(this.hass,s,i+(o-i)*l/96),u=n.map(h=>h.startsWith("climate.")?Number(c.states[h]?.attributes.current_temperature):Number(c.states[h]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((h,p)=>h+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;let t=To(this.hass,this.building,this.floor,e);try{let n=await Ka(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=K(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(!n.length||n.some(s=>s.state!=="off"))return f;let o=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),i=Math.floor((Date.now()-o)/6e4);return!o||i<Ih?f:m`<div class="nf-rp-shade">
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:i})}</span>
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.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 n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.length)return f;let o=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",i=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(o));if(!i.length)return f;let s=()=>{for(let a of n)(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:i.length})}</span>
<button class="nf-btn nf-rp-small" @click=${s}>${this.t("open_heating_off")}</button>
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o=Y(this.hass,this.floor,e,"temperature");if(o===null||o<Fh)return f;let i=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(Ca(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(i)))];return s.length?m`<div class="nf-rp-shade">
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${O(this.hass,ce(this.hass,o),1)} ${ne(this.hass)}`})}</span>
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o=Z(this.hass,this.floor,e,"temperature");if(o===null||o<Hh)return f;let i=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(Ca(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(i)))];return s.length?m`<div class="nf-rp-shade">
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${O(this.hass,oe(this.hass,o),1)} ${X(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:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o={latitude:t,longitude:n};if(!St(this.building,this.floor,e,{...o,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:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o={latitude:t,longitude:n};if(!$t(this.building,this.floor,e,{...o,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=Ia(this.building,this.floor,e,o),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]} ${O(this.hass,c,1)} h`).join(", ")}>
${a.map((c,d)=>m`<span title=${`${O(this.hass,c,1)} h`}><i style=${`height:${Math.round(c/l*100)}%`}></i><b>${u[d]}</b></span>`)}
</button>`;if(!this._sunYear)return s;let a=Ia(this.building,this.floor,e,o),l=Math.max(1,...a),c=Array.from({length:12},(u,h)=>new Date(2026,h,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return m`${s}
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,h)=>`${c[h]} ${O(this.hass,u,1)} h`).join(", ")}>
${a.map((u,h)=>m`<span title=${`${O(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[h]}</b></span>`)}
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,o=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,i=Ga(e.month,o),s=a=>`${O(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)})}${i?` \xB7 ${O(this.hass,i.value,2)} ${i.currency}`:""}
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(u=>u!==null),n=Math.min(...t),o=Math.max(...t),i=Math.max(1,o-n),s=e.map(u=>u===null?null:u-n+i*.1),a=on(s,220,36,i*1.2),l=u=>`${O(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(c=>c!==null),n=Math.min(...t),o=Math.max(...t),i=Math.max(1,o-n),s=e.map(c=>c===null?null:c-n+i*.1),a=sn(s,220,36,i*1.2),l=c=>`${O(this.hass,oe(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">${J`<path d=${a}></path>`}</svg>
<span>24 h · ${l(n)} – ${l(o)}</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 R(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let o=t.slice(0,t.indexOf(".")),i=()=>o==="script"?this.call("script","turn_on",{entity_id:t}):this.call(o,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(n)} title=${this.t("room_clean_run_hint")} @click=${i}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=nn(e);for(let n of t.off)this.call(n.domain,n.service,n.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);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 n of t.placements)if(n.entity_id===e)return n}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=${()=>fe(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,n){let o=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};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 E(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let o=t.slice(0,t.indexOf(".")),i=()=>o==="script"?this.call("script","turn_on",{entity_id:t}):this.call(o,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(n)} title=${this.t("room_clean_run_hint")} @click=${i}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=rn(e);for(let n of t.off)this.call(n.domain,n.service,n.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}=rn(e);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 n of t.placements)if(n.entity_id===e)return n}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=${()=>fe(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,n){let o=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return m`<button
class="nf-switch"
role="switch"
aria-checked=${t?"true":"false"}
aria-label=${this.name(e.entity_id)}
?disabled=${I(e)}
@click=${o}
></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 n=e??K(this.hass,t),o=this.memo,{shown:i,more:s}=e?{shown:e,more:[]}:o&&o.entities===this.hass.entities&&o.floor===this.floor&&o.room===t?o:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Os(this.hass,this.floor,t):{shown:n,more:[]}},a=ho(this.hass,s).map(x=>x.primary),l=a.length,u=this._showAll?[...i,...a]:i,c=x=>u.filter(y=>x.includes(D(y))).map(y=>this.hass.states[y]),d=c(["light"]),p=c(["cover"]),h=c(["climate"]),g=c(["media"]),b=c(["switch","fan","lock"]),_=c(["sensor","binary"]),w=c(["scene","script"]),S=this.facts(h),$=d.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 n=e??K(this.hass,t),o=this.memo,{shown:i,more:s}=e?{shown:e,more:[]}:o&&o.entities===this.hass.entities&&o.floor===this.floor&&o.room===t?o:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Os(this.hass,this.floor,t):{shown:n,more:[]}},a=ho(this.hass,s).map(x=>x.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=x=>c.filter(y=>x.includes(D(y))).map(y=>this.hass.states[y]),h=u(["light"]),p=u(["cover"]),d=u(["climate"]),g=u(["media"]),b=u(["switch","fan","lock"]),_=u(["sensor","binary"]),w=u(["scene","script"]),S=this.facts(d),M=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>
${S.length?m`<p class="nf-rp-facts">${S.join(" \xB7 ")}</p>`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()}
${this.renderOpenWhileHeating(h)} ${this.renderEmptyLights(t,$)}
${this.renderOpenWhileHeating(d)} ${this.renderEmptyLights(t,M)}
${this.renderCurve()}
</div>
<button class="nf-rp-close" aria-label=${this.t(this._folded?"panel_unfold":"panel_fold")} title=${this.t(this._folded?"panel_unfold":"panel_fold")} aria-expanded=${this._folded?"false":"true"} @click=${()=>this._folded=!this._folded}>
@@ -266,9 +266,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</button>
</header>
<div class="nf-rp-body" ?hidden=${this._folded}>
${this.renderAllOff([...d,...g,...b])}
${this.renderAllOff([...h,...g,...b])}
${this.renderClean(t)}
${!t.area_id&&!e?m`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:u.length?f:m`<p class="nf-rp-note">${this.t("panel_empty")}</p>`}
${!t.area_id&&!e?m`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:c.length?f:m`<p class="nf-rp-note">${this.t("panel_empty")}</p>`}
${w.length?this.section("panel_scenes",[m`<div class="nf-rp-scenes">
${w.map(x=>m`<button
class="nf-btn"
@@ -278,42 +278,42 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${this.name(x.entity_id)}
</button>`)}
</div>`]):f}
${d.length?this.section("panel_lights",[...d.map(x=>this.lightRow(x)),...t?[this.renderMoods(t,d)]:[]],m`${$.length<d.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_on",{entity_id:d.filter(x=>!I(x)).map(x=>x.entity_id)})}>
${h.length?this.section("panel_lights",[...h.map(x=>this.lightRow(x)),...t?[this.renderMoods(t,h)]:[]],m`${M.length<h.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_on",{entity_id:h.filter(x=>!I(x)).map(x=>x.entity_id)})}>
${this.t("panel_all_on")}
</button>`:f}${$.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:$.map(x=>x.entity_id)})}>
</button>`:f}${M.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:M.map(x=>x.entity_id)})}>
${this.t("panel_all_off")}
</button>`:f}`):f}
${p.length?this.section("panel_covers",p.map(x=>this.coverRow(x)),p.length>1&&Ln(p,this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Ln(p,this.confirmEntities)})}>
${p.length?this.section("panel_covers",p.map(x=>this.coverRow(x)),p.length>1&&Bn(p,this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Bn(p,this.confirmEntities)})}>
${this.t("panel_all_open")}</button
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Ln(p,this.confirmEntities)})}>
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Bn(p,this.confirmEntities)})}>
${this.t("panel_all_close")}
</button>`:f):f}
${h.length?this.section("panel_climate",h.map(x=>this.climateRow(x))):f}
${d.length?this.section("panel_climate",d.map(x=>this.climateRow(x))):f}
${g.length?this.section("panel_media",g.map(x=>this.mediaRow(x))):f}
${b.length?this.section("panel_switches",b.map(x=>this.switchRow(x))):f}
${_.length?this.section("panel_sensors",_.map(x=>this.sensorRow(x))):f}
${ma(this.hass)&&pa(this.hass,this.floor,t)?this.announceSection(t):f}
${this.pluginSections(t,u)}
${this.pluginSections(t,c)}
${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>`}facts(e){let t=[],n=this.room;if(!n)return t;let o=(y,F)=>{let T=Y(this.hass,this.floor,n,y);if(T===null)return null;if(y==="temperature")return`${O(this.hass,ce(this.hass,T),1)} ${ne(this.hass)}`;let C=qn(this.hass,this.floor,n,y)[0],E=this.hass.states[C]?.attributes.unit_of_measurement??F;return`${O(this.hass,T,1)} ${E}`},i=e.find(y=>typeof y.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${O(this.hass,i.attributes.current_temperature,1)} ${ne(this.hass)}`);let a=o("humidity","%");a&&t.push(a);let l=this.floor&&this.building?zo(this.hass,this.building,this.floor,n):null;l!==null&&t.push(`\u26A1 ${at(this.hass,l)}`);let u=this.floor?this.floor.openings.filter(y=>y.room_id===n.id).flatMap(y=>[y.contact,y.contact2,y.tilt,y.tilt2]).map(y=>y&&y!=="none"?this.hass.states[y]:void 0).filter(y=>y?.state==="on").map(y=>Date.parse(String(y.last_changed??""))).filter(Number.isFinite):[];u.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Fo(Date.now()-Math.min(...u))})}`);let c=K(this.hass,n).map(y=>this.hass.states[y]).filter(y=>!!y&&y.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(y.attributes.device_class)));if(c.length)if(c.some(y=>y.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let y=Math.max(...c.map(F=>Date.parse(String(F.last_changed??""))||0));y>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Fo(Date.now()-y)})}`)}let d=this.building?qa(this.hass,this.building).filter(y=>y.roomId===n.id&&y.level<ja):[];d.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:d.length,names:d.map(y=>`${this.name(y.entity)} ${Math.round(y.level)} %`).join(", ")})}`);let p=(this.building?.settings.circuits??[]).filter(y=>y.rooms.includes(n.id)).map(y=>y.name),h=this.building?.settings.room_facts_off??[];p.length&&!h.includes("circuits")&&t.push(`\u{1F50C} ${p.join(", ")}`);let{latitude:g,longitude:b,time_zone:_}=this.hass.config??{};if(this.floor&&g!==void 0&&b!==void 0&&this.building&&!h.includes("sun")){let y=St(this.building,this.floor,n,{latitude:g,longitude:b,zone:_});y.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:O(this.hass,y.hours,1),facing:y.facing.join(", ")})}`)}let w=Y(this.hass,this.floor,n,"temperature"),S=Y(this.hass,this.floor,n,"humidity"),$=ar(Y(this.hass,this.floor,n,"co2"),S,Mt(w,S));$&&!h.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${$}`)}`);let x=lr(w,S,Y(this.hass,this.floor,n,"co2"),st(new Date,this.hass.config?.latitude));return x!==null&&(w!==null||S!==null)&&!h.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(i=>this.t(`announce_phrase_${i}`)),n=i=>{let s=i.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))},o=i=>{i.preventDefault();let s=i.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(i=>m`<button class="nf-btn" @click=${()=>n(i)}>${i}</button>`)}</div>
</section>`}facts(e){let t=[],n=this.room;if(!n)return t;let o=(y,F)=>{let T=Z(this.hass,this.floor,n,y);if(T===null)return null;if(y==="temperature")return`${O(this.hass,oe(this.hass,T),1)} ${X(this.hass)}`;let C=vt(this.hass,this.floor,n,y)[0],R=this.hass.states[C]?.attributes.unit_of_measurement??F;return`${O(this.hass,T,1)} ${R}`},i=e.find(y=>typeof y.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${O(this.hass,i.attributes.current_temperature,1)} ${X(this.hass)}`);let a=o("humidity","%");a&&t.push(a);let l=this.floor&&this.building?zo(this.hass,this.building,this.floor,n):null;l!==null&&t.push(`\u26A1 ${at(this.hass,l)}`);let c=this.floor?this.floor.openings.filter(y=>y.room_id===n.id).flatMap(y=>[y.contact,y.contact2,y.tilt,y.tilt2]).map(y=>y&&y!=="none"?this.hass.states[y]:void 0).filter(y=>y?.state==="on").map(y=>Date.parse(String(y.last_changed??""))).filter(Number.isFinite):[];c.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Fo(Date.now()-Math.min(...c))})}`);let u=K(this.hass,n).map(y=>this.hass.states[y]).filter(y=>!!y&&y.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(y.attributes.device_class)));if(u.length)if(u.some(y=>y.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let y=Math.max(...u.map(F=>Date.parse(String(F.last_changed??""))||0));y>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Fo(Date.now()-y)})}`)}let h=this.building?qa(this.hass,this.building).filter(y=>y.roomId===n.id&&y.level<ja):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(y=>`${this.name(y.entity)} ${Math.round(y.level)} %`).join(", ")})}`);let p=(this.building?.settings.circuits??[]).filter(y=>y.rooms.includes(n.id)).map(y=>y.name),d=this.building?.settings.room_facts_off??[];p.length&&!d.includes("circuits")&&t.push(`\u{1F50C} ${p.join(", ")}`);let{latitude:g,longitude:b,time_zone:_}=this.hass.config??{};if(this.floor&&g!==void 0&&b!==void 0&&this.building&&!d.includes("sun")){let y=$t(this.building,this.floor,n,{latitude:g,longitude:b,zone:_});y.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:O(this.hass,y.hours,1),facing:y.facing.join(", ")})}`)}let w=Z(this.hass,this.floor,n,"temperature"),S=Z(this.hass,this.floor,n,"humidity"),M=ar(Z(this.hass,this.floor,n,"co2"),S,Mt(w,S));M&&!d.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${M}`)}`);let x=lr(w,S,Z(this.hass,this.floor,n,"co2"),st(new Date,this.hass.config?.latitude));return x!==null&&(w!==null||S!==null)&&!d.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(i=>this.t(`announce_phrase_${i}`)),n=i=>{let s=i.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))},o=i=>{i.preventDefault();let s=i.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(i=>m`<button class="nf-btn" @click=${()=>n(i)}>${i}</button>`)}</div>
<form class="nf-rp-say" @submit=${o}>
<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 Xi({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(o=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${o.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 Qi({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(o=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${o.key}>
<div class="nf-rp-sec-head"><h3>${o.title}</h3></div>
${typeof o.content=="string"?m`<p class="nf-rp-note">${o.content}</p>`:o.content}
</div>`)}section(e,t,n=f){return m`<div class="nf-rp-sec">
<div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${n}</div>
${t}
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",o=t.supported_color_modes??[],i=o.some(h=>h!=="onoff"),s=o.includes("color_temp"),a=o.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 ${n?"nf-rp-on":""}">${At("light")}</span>
${this.nameButton(d)}
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",o=t.supported_color_modes??[],i=o.some(d=>d!=="onoff"),s=o.includes("color_temp"),a=o.some(d=>["hs","rgb","rgbw","rgbww","xy"].includes(d)),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,h=e.entity_id,p=!!this.placedAs(h)?.simple;return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Et("light")}</span>
${this.nameButton(h)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:d}))}
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:h}))}
${i&&!p?m`<label class="nf-rp-slider"
><span>${this.t("brightness")}</span>
<input
@@ -321,36 +321,36 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
min="1"
max="100"
.value=${String(l)}
@change=${h=>this.call("light","turn_on",{entity_id:d,brightness_pct:Number(h.target.value)})}
@change=${d=>this.call("light","turn_on",{entity_id:h,brightness_pct:Number(d.target.value)})}
/></label>`:f}
${n&&s&&!p?m`<label class="nf-rp-slider nf-rp-ct"
><span>${this.t("color_temp")}</span>
<input
type="range"
min=${u}
max=${c}
min=${c}
max=${u}
step="50"
.value=${String(t.color_temp_kelvin??u)}
@change=${h=>this.call("light","turn_on",{entity_id:d,color_temp_kelvin:Number(h.target.value)})}
.value=${String(t.color_temp_kelvin??c)}
@change=${d=>this.call("light","turn_on",{entity_id:h,color_temp_kelvin:Number(d.target.value)})}
/></label>`:f}
${n&&a&&!p?m`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
${Th.map(h=>m`<button
${Ph.map(d=>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})}
style="--c: rgb(${d.join(",")})"
aria-label="rgb(${d.join(", ")})"
@click=${()=>this.call("light","turn_on",{entity_id:h,rgb_color:d})}
></button>`)}
</div>`:f}
</div>`}coverRow(e){let t=Qn(this.hass,this.building?.floors??[],e.entity_id);e=Xn(this.hass,e,t);let n=e.attributes,o=n.supported_features??0,i=e.entity_id,s=I(e)&&!Gt(e);return m`<div class="nf-rp-row">
<span class="nf-rp-icon">${At("cover")}</span>
</div>`}coverRow(e){let t=Qn(this.hass,this.building?.floors??[],e.entity_id);e=Xn(this.hass,e,t);let n=e.attributes,o=n.supported_features??0,i=e.entity_id,s=I(e)&&!Ut(e);return m`<div class="nf-rp-row">
<span class="nf-rp-icon">${Et("cover")}</span>
${this.nameButton(i)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
<div class="nf-rp-buttons">
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(i)&&this.call("cover","open_cover",{entity_id:i})}>${this.t("cover_open")}</button>
${o&zh?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:i})}>${this.t("cover_stop")}</button>`:f}
${o&Dh?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:i})}>${this.t("cover_stop")}</button>`:f}
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(i)&&this.call("cover","close_cover",{entity_id:i})}>${this.t("cover_close")}</button>
</div>
${o&Rh&&typeof n.current_position=="number"?m`<label class="nf-rp-slider"
${o&Fh&&typeof n.current_position=="number"?m`<label class="nf-rp-slider"
><span>${this.t("position")}</span>
<input
type="range"
@@ -373,26 +373,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${o&16?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","open_cover_tilt",{entity_id:i})}>${this.t("cover_tilt_open")}</button>`:f}
${o&32?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:i})}>${this.t("cover_tilt_close")}</button>`:f}
</div>`:f}
</div>`}climateRow(e){let t=e.attributes,n=e.entity_id,o=typeof t.temperature=="number"?t.temperature:null,i=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:n,temperature:Math.min(a,Math.max(s,Math.round(c/i)*i))});return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${At("climate")}</span>
</div>`}climateRow(e){let t=e.attributes,n=e.entity_id,o=typeof t.temperature=="number"?t.temperature:null,i=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:n,temperature:Math.min(a,Math.max(s,Math.round(u/i)*i))});return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Et("climate")}</span>
${this.nameButton(n)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
${o!==null?m`<div class="nf-rp-stepper nf-rp-wide">
<button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>u(o-i)}>−</button>
<span><small>${this.t("target_temp")}</small> ${O(this.hass,o,1)} ${ne(this.hass)}</span>
<button class="nf-btn" aria-label=${this.t("temp_up")} @click=${()=>u(o+i)}>+</button>
<button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>c(o-i)}>−</button>
<span><small>${this.t("target_temp")}</small> ${O(this.hass,o,1)} ${X(this.hass)}</span>
<button class="nf-btn" aria-label=${this.t("temp_up")} @click=${()=>c(o+i)}>+</button>
</div>`:f}
${l.length>1?m`<div class="nf-rp-chips">
${l.map(c=>m`<button
${l.map(u=>m`<button
class="nf-chip"
aria-pressed=${e.state===c}
@click=${()=>this.call("climate","set_hvac_mode",{entity_id:n,hvac_mode:c})}
aria-pressed=${e.state===u}
@click=${()=>this.call("climate","set_hvac_mode",{entity_id:n,hvac_mode:u})}
>
${this.stateLabel(c)}
${this.stateLabel(u)}
</button>`)}
</div>`:f}
</div>`}stateOf(e,t=ee(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=D(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,o=I(e)||e.state==="off",i=[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":""}">${At("media")}</span>
</div>`}stateOf(e,t=te(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=D(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,o=I(e)||e.state==="off",i=[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":""}">${Et("media")}</span>
${this.nameButton(n)}
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}</span>
${i?m`<p class="nf-rp-media nf-rp-wide">${i}</p>`:f}
@@ -417,15 +417,15 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})}
/></label>`:f}
</div>`}switchRow(e){let t=e.entity_id,n=D(t),o=t.slice(0,t.indexOf(".")),i=n==="lock"?e.state==="unlocked"||e.state==="open":Q(e),s=()=>n==="lock"?this.call("lock",i?"lock":"unlock",{entity_id:t}):this.call(o,"toggle",{entity_id:t});return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${i?"nf-rp-on":""}">${At(n)}</span>
<span class="nf-rp-icon ${i?"nf-rp-on":""}">${Et(n)}</span>
${this.nameButton(t)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
${this.toggle(e,i,s)}
</div>`}sensorRow(e){let t=D(e.entity_id),n=t==="binary"&&e.state==="on";return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${At(t)}</span>
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Et(t)}</span>
${this.nameButton(e.entity_id)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[Se,Ke,te`
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[$e,Ke,ne`
:host {
display: block;
}
@@ -806,32 +806,32 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
outline: 2px solid var(--nf-accent);
outline-offset: 2px;
}
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Po);function il(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var Ph=[[/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]]],sl=[34,211,238];function Ho(r){return r?Ph.find(([e])=>e.test(r))?.[1]??sl:sl}function Io(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Co=r=>r.state==="playing"||r.state==="on"&&Io(r);function al(r,e){let t=[],n=new Set;for(let o of e){if(!o.entity.startsWith("media_player.")||n.has(o.entity))continue;n.add(o.entity);let i=r.states[o.entity];if(!i)continue;let s=i.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:o.entity,name:o.name,at:o.at,playing:Co(i),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:Ho(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(c=>typeof c=="string"&&c!==o.entity):[],rings:o.rings??1})}return t}function ll(r){let e=new Map(r.filter(o=>o.playing).map(o=>[o.entity,o])),t=[],n=new Set;for(let o of e.values())for(let i of o.group){let s=e.get(i),a=[o.entity,i].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([o,s]))}return t}var Hh=3;function ul(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!i.type.endsWith(":sprinkler"))continue;let s=t?.get(i.id)?.entity??null;!s||!Q(r.states[s])||n.push({id:i.id,at:{floorId:o.id,x:i.x,y:le(o,i)+i.h,z:i.z},reach:Math.min(15,Math.max(.5,i.spray??Hh))})}return n}var fr=r=>r&&r!=="none"?r:null,cl=r=>Math.min(1,Math.max(0,r));function dl(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=Ee(r,{cover:fr(n.cover),contact:fr(n.contact),tilt:fr(n.tilt)},"window"),i=fr(n.window),s=i?r.states[i]:void 0,a=o.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?cl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:o.tilt,cover:o.cover??0})}return t}function Ih(r,e){let t=o=>Math.hypot(o.x-e.x,o.z-e.z);return r.placements.filter(o=>o.entity_id.startsWith("media_player.")&&t(o)<Math.max(2,e.w)).sort((o,i)=>t(o)-t(i))[0]?.entity_id??null}var Ge=(r,e)=>typeof r[e]=="string"?r[e]:"";function hl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Zn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:Ih(o,i),l=a?r.states[a]:void 0;if(!l||!Io(l))continue;let u=l.attributes,c=Ge(u,"app_name")||Ge(u,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Ho(c),title:Ge(u,"media_title")||Ge(u,"media_channel")||c||"",subtitle:Ge(u,"media_artist")||Ge(u,"media_series_title")||Ge(u,"media_album_name"),app:c,picture:Ge(u,"entity_picture")||null,playing:Co(l),ambilight:i.ambilight??1})}return n}function pl(r){let e=r.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function ml(r,e){return(r===null?0:cl((r+4)/16))*(1-.45*e)}function Ue(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var gr=new Set(["contact_lost","unlocked_night","own"]);function Ch(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),o=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(o){let i=Number(t.state),s=Number(o[2].replace(",","."));return Number.isFinite(i)&&(o[1]==="<"?i<s:i>s)}return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Nh=600*1e3,Oh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Wh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),fl=(r,e)=>{if(e.startsWith("binary_sensor."))return Wh.get(String(r.states[e]?.attributes.device_class))};function Lh(r,e){let t=new Set,n=[];for(let o of r.floors)for(let i of o.openings){let s=e.get(i.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:o.id,roomId:i.room_id,entity:a}))}return n}function gl(r,e,t,n){let o=[];for(let a of e.floors)for(let l of a.rooms){let u=K(r,l).filter(c=>fl(r,c)); Line truncated
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Po);function il(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var Ch=[[/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]]],sl=[34,211,238];function Ho(r){return r?Ch.find(([e])=>e.test(r))?.[1]??sl:sl}function Io(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Co=r=>r.state==="playing"||r.state==="on"&&Io(r);function al(r,e){let t=[],n=new Set;for(let o of e){if(!o.entity.startsWith("media_player.")||n.has(o.entity))continue;n.add(o.entity);let i=r.states[o.entity];if(!i)continue;let s=i.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:o.entity,name:o.name,at:o.at,playing:Co(i),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:Ho(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==o.entity):[],rings:o.rings??1})}return t}function ll(r){let e=new Map(r.filter(o=>o.playing).map(o=>[o.entity,o])),t=[],n=new Set;for(let o of e.values())for(let i of o.group){let s=e.get(i),a=[o.entity,i].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([o,s]))}return t}var Nh=3;function cl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!i.type.endsWith(":sprinkler"))continue;let s=t?.get(i.id)?.entity??null;!s||!Q(r.states[s])||n.push({id:i.id,at:{floorId:o.id,x:i.x,y:ce(o,i)+i.h,z:i.z},reach:Math.min(15,Math.max(.5,i.spray??Nh))})}return n}var fr=r=>r&&r!=="none"?r:null,ul=r=>Math.min(1,Math.max(0,r));function dl(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=Re(r,{cover:fr(n.cover),contact:fr(n.contact),tilt:fr(n.tilt)},"window"),i=fr(n.window),s=i?r.states[i]:void 0,a=o.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?ul(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:o.tilt,cover:o.cover??0})}return t}function Oh(r,e){let t=o=>Math.hypot(o.x-e.x,o.z-e.z);return r.placements.filter(o=>o.entity_id.startsWith("media_player.")&&t(o)<Math.max(2,e.w)).sort((o,i)=>t(o)-t(i))[0]?.entity_id??null}var Ge=(r,e)=>typeof r[e]=="string"?r[e]:"";function hl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Zn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:Oh(o,i),l=a?r.states[a]:void 0;if(!l||!Io(l))continue;let c=l.attributes,u=Ge(c,"app_name")||Ge(c,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Ho(u),title:Ge(c,"media_title")||Ge(c,"media_channel")||u||"",subtitle:Ge(c,"media_artist")||Ge(c,"media_series_title")||Ge(c,"media_album_name"),app:u,picture:Ge(c,"entity_picture")||null,playing:Co(l),ambilight:i.ambilight??1})}return n}function pl(r){let e=r.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function ml(r,e){return(r===null?0:ul((r+4)/16))*(1-.45*e)}function Ue(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var gr=new Set(["contact_lost","unlocked_night","own"]);function Wh(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),o=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(o){let i=Number(t.state),s=Number(o[2].replace(",","."));return Number.isFinite(i)&&(o[1]==="<"?i<s:i>s)}return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Lh=600*1e3,Bh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Vh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),fl=(r,e)=>{if(e.startsWith("binary_sensor."))return Vh.get(String(r.states[e]?.attributes.device_class))};function Kh(r,e){let t=new Set,n=[];for(let o of r.floors)for(let i of o.openings){let s=e.get(i.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:o.id,roomId:i.room_id,entity:a}))}return n}function gl(r,e,t,n){let o=[];for(let a of e.floors)for(let l of a.rooms){let c=K(r,l).filter(u=>fl(r,u)); Line truncated
${J`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
</svg>`}function Jp(r,e,t,n){let o=e.summary,i=u=>R(r,u),s=e.autarky,a=n?m`<button class="live-fold" title=${i(n.folded?"live_unfold":"live_fold")} aria-label=${i(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let u=o.solar!==null?`\u2600 ${Me(r,o.solar)}`:o.consumption!==null?`\u2302 ${Me(r,o.consumption)}`:null;return m`<div class="live-card live-card-house live-folded" data-i=${t}>
${s!==null?m`<div class="live-own">${fn(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}
</svg>`}function em(r,e,t,n){let o=e.summary,i=c=>E(r,c),s=e.autarky,a=n?m`<button class="live-fold" title=${i(n.folded?"live_unfold":"live_fold")} aria-label=${i(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=o.solar!==null?`\u2600 ${Me(r,o.solar)}`:o.consumption!==null?`\u2302 ${Me(r,o.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}
${c?m`<b>${c}</b>`:s===null?m`<b>⌂</b>`:f}
${a}
</div>`}let l=[];if(o.solar!==null&&l.push(m`<div class="live-row live-solar"><span>☀ ${i("energy_solar")}</span><b>${Me(r,o.solar)}</b></div>`),o.consumption!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${i("energy_consumption")}</span><b>${Me(r,o.consumption)}</b></div>`),o.rest!==void 0&&o.rest!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${i("energy_rest")}</span><b>${Me(r,o.rest)}</b></div>`),o.battery!==null||o.soc!==null){let u=o.battery===null||Math.abs(o.battery)<15?"":o.battery>0?" \u2193":" \u2191";l.push(m`<div class="live-row live-battery"><span>▮ ${i("energy_battery")}${u}</span><b>${o.soc!==null?`${Math.round(o.soc)} %`:""}${o.battery!==null&&Math.abs(o.battery)>=15?` \xB7 ${Me(r,o.battery)}`:""}</b></div>`)}if(o.grid!==null){let u=o.grid<-15;l.push(m`<div class="live-row ${u?"live-export":"live-import"}"><span>⇄ ${i(u?"energy_grid_export":"energy_grid_import")}</span><b>${Me(r,o.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}>
</div>`}let l=[];if(o.solar!==null&&l.push(m`<div class="live-row live-solar"><span>☀ ${i("energy_solar")}</span><b>${Me(r,o.solar)}</b></div>`),o.consumption!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${i("energy_consumption")}</span><b>${Me(r,o.consumption)}</b></div>`),o.rest!==void 0&&o.rest!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${i("energy_rest")}</span><b>${Me(r,o.rest)}</b></div>`),o.battery!==null||o.soc!==null){let c=o.battery===null||Math.abs(o.battery)<15?"":o.battery>0?" \u2193":" \u2191";l.push(m`<div class="live-row live-battery"><span>▮ ${i("energy_battery")}${c}</span><b>${o.soc!==null?`${Math.round(o.soc)} %`:""}${o.battery!==null&&Math.abs(o.battery)>=15?` \xB7 ${Me(r,o.battery)}`:""}</b></div>`)}if(o.grid!==null){let c=o.grid<-15;l.push(m`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${i(c?"energy_grid_export":"energy_grid_import")}</span><b>${Me(r,o.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">${fn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${i("live_autarky")}</span></div></div>`:f}
${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>${i("live_autarky")}</span></div></div>`:f}
<div class="live-rows">${l}</div>
${Xp(r,e.curves)} ${Qp(r,e.week)}
</div>`}function Qp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(u=>u!==null&&u>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[o,i]=[150,30],s=o/7,a=(u,c,d)=>u===null||u<=0?f:J`<rect x=${c.toFixed(1)} y=${(i-u/n*i).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(u/n*i).toFixed(1)} class=${d}></rect>`,l=u=>u.reduce((c,d)=>c+(d??0),0);return m`<div class="live-day live-week" title=${R(r,"live_week_hint",{solar:O(r,l(e.solar),0),use:O(r,l(e.use),0)})}>
${nm(r,e.curves)} ${tm(r,e.week)}
</div>`}function tm(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[o,i]=[150,30],s=o/7,a=(c,u,h)=>c===null||c<=0?f:J`<rect x=${u.toFixed(1)} y=${(i-c/n*i).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*i).toFixed(1)} class=${h}></rect>`,l=c=>c.reduce((u,h)=>u+(h??0),0);return m`<div class="live-day live-week" title=${E(r,"live_week_hint",{solar:O(r,l(e.solar),0),use:O(r,l(e.use),0)})}>
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
${e.days.map((u,c)=>J`${a(e.solar[c],c*s+s*.1,"live-week-solar")}${a(e.use[c],c*s+s*.5,"live-week-use")}`)}
${e.days.map((c,u)=>J`${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 ${R(r,"live_days")}</span>
</div>`}function Xp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[o,i]=[150,34],s=on(e.solar,o,i,n),a=on(e.use,o,i,n);return m`<div class="live-day" title=${R(r,"live_day_hint")}>
<span>7 ${E(r,"live_days")}</span>
</div>`}function nm(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[o,i]=[150,34],s=sn(e.solar,o,i,n),a=sn(e.use,o,i,n);return m`<div class="live-day" title=${E(r,"live_day_hint")}>
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
${s?J`<path d=${`${s}L${o},${i}L0,${i}Z`} class="live-day-solar"></path>`:f}
${a?J`<path d=${a} class="live-day-use"></path>`:f}
</svg>
<span>24 h</span>
</div>`}function em(r,e,t,n){let o=e.car,i=(c,d)=>R(r,c,d),s=lu(o.soc),a=o.home?o.charging?`\u26A1 ${i("live_car_charging")}${o.chargingW?` \xB7 ${Me(r,o.chargingW)}`:""}`:o.plugged?`\u{1F50C} ${i("live_car_plugged")}`:"":`${i("live_car_away")}${o.where?` \xB7 ${o.where}`:""}${o.distance!==null?` \xB7 ${O(r,o.distance,o.distance<10?1:0)} km`:""}`,l=o.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 ${o.charging?"live-charging":""} ${o.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
</div>`}function rm(r,e,t,n){let o=e.car,i=(u,h)=>E(r,u,h),s=uc(o.soc),a=o.home?o.charging?`\u26A1 ${i("live_car_charging")}${o.chargingW?` \xB7 ${Me(r,o.chargingW)}`:""}`:o.plugged?`\u{1F50C} ${i("live_car_plugged")}`:"":`${i("live_car_away")}${o.where?` \xB7 ${o.where}`:""}${o.distance!==null?` \xB7 ${O(r,o.distance,o.distance<10?1:0)} km`:""}`,l=o.entities,c=(u,h,p,d)=>m`<button class="live-btn ${u?"live-on":""}" title=${h} aria-label=${h} aria-pressed=${u??!1} @click=${g=>(g.stopPropagation(),d())}>${p}</button>`;return m`<div class="live-card live-card-car ${o.charging?"live-charging":""} ${o.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
<div class="live-own">
${fn((o.soc??0)/100,s)}
${gn((o.soc??0)/100,s)}
<div class="live-own-text"><b>${o.soc!==null?`${Math.round(o.soc)} %`:"\u2013"}</b><span>${o.range!==null?`${Math.round(o.range)} ${o.rangeUnit}`:""}</span></div>
</div>
<div class="live-rows">
@@ -841,12 +841,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${o.departure?m`<div class="live-status">⏰ ${i("live_car_departure",{time:o.departure})}</div>`:f}
${o.open.length?m`<div class="live-status live-warn">⚠ ${i("live_car_open",{parts:o.open.join(", ")})}</div>`:f}
<div class="live-actions">
${l.lock?u(o.locked,i(o.locked?"live_car_unlock":"live_car_lock"),o.locked?"\u{1F512}":"\u{1F513}",()=>{o.locked&&!confirm(i("live_car_unlock_confirm",{name:e.name}))||n("lock",o.locked?"unlock":"lock",l.lock)}):f}
${l.climate?u(o.climateOn,i("live_car_climate"),"\u2744",()=>n(l.climate.split(".")[0],o.climateOn?"turn_off":"turn_on",l.climate)):f}
${l.charge&&o.home?u(o.charging,i("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f}
${l.lock?c(o.locked,i(o.locked?"live_car_unlock":"live_car_lock"),o.locked?"\u{1F512}":"\u{1F513}",()=>{o.locked&&!confirm(i("live_car_unlock_confirm",{name:e.name}))||n("lock",o.locked?"unlock":"lock",l.lock)}):f}
${l.climate?c(o.climateOn,i("live_car_climate"),"\u2744",()=>n(l.climate.split(".")[0],o.climateOn?"turn_off":"turn_on",l.climate)):f}
${l.charge&&o.home?c(o.charging,i("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f}
</div>
</div>
</div>`}function tm(r,e,t,n){let o=e.media,i=l=>R(r,l),s=`rgb(${o.color.join(",")})`,a=(l,u,c)=>m`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),n("media_player",c,o.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 om(r,e,t,n){let o=e.media,i=l=>E(r,l),s=`rgb(${o.color.join(",")})`,a=(l,c,u)=>m`<button class="live-btn" title=${l} aria-label=${l} @click=${h=>(h.stopPropagation(),n("media_player",u,o.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")}>
${o.picture?m`<img class="live-cover" src=${o.picture} alt="" loading="lazy" />`:m`<div class="live-cover live-cover-none">♪</div>`}
<div class="live-rows">
<div class="live-title" title=${o.title}>${o.title||o.name}</div>
@@ -865,9 +865,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
/>`:f}
</div>
</div>
</div>`}function uu(r){let e=[...r.querySelectorAll(".live-card")].filter(i=>i.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,o=e.map(i=>{let[s,a]=[Number(i.dataset.x),i.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return i.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:i,x:l,y:Number(i.dataset.y),w:a,h:i.offsetHeight}}).sort((i,s)=>s.y-i.y);for(let i of o){let s=i.y;for(let l=0;l<12;l++){let u={x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s},c=t.find(d=>u.x0<d.x1+6&&u.x1>d.x0-6&&u.y0<d.y1+6&&u.y1>d.y0-6);if(!c)break;s=c.y0-8}t.push({x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s});let a=i.y-s;i.el.style.transform=`translate(${Math.round(i.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,i.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function nm(r,e,t){let n=e.printer,o=(u,c)=>R(r,u,c),i=n.progress??0,s=u=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(u)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${o("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${o("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return m`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
</div>`}function dc(r){let e=[...r.querySelectorAll(".live-card")].filter(i=>i.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,o=e.map(i=>{let[s,a]=[Number(i.dataset.x),i.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return i.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:i,x:l,y:Number(i.dataset.y),w:a,h:i.offsetHeight}}).sort((i,s)=>s.y-i.y);for(let i of o){let s=i.y;for(let l=0;l<12;l++){let c={x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s},u=t.find(h=>c.x0<h.x1+6&&c.x1>h.x0-6&&c.y0<h.y1+6&&c.y1>h.y0-6);if(!u)break;s=u.y0-8}t.push({x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s});let a=i.y-s;i.el.style.transform=`translate(${Math.round(i.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,i.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function im(r,e,t){let n=e.printer,o=(c,u)=>E(r,c,u),i=n.progress??0,s=c=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${o("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${o("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return m`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
<div class="live-own">
${n.picture?m`<img class="live-print-pic" src=${n.picture} alt="" />`:fn(i/100,n.printing?"#38bdf8":"#8aa0c8")}
${n.picture?m`<img class="live-print-pic" src=${n.picture} alt="" />`:gn(i/100,n.printing?"#38bdf8":"#8aa0c8")}
<div class="live-own-text"><b>${n.progress!==null?`${Math.round(i)} %`:"\u2013"}</b><span>${o(`printer_${n.printing?"printing":/finish|complete|fertig/.test(n.status)?"done":/pause/.test(n.status)?"paused":/error|fail/.test(n.status)?"error":"idle"}`)}</span></div>
</div>
<div class="live-rows">
@@ -876,11 +876,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${n.printing&&(n.endsAt||a)?m`<div class="live-status">⏱ ${[a,n.endsAt?o("printer_done_at",{time:s(n.endsAt)}):null].filter(Boolean).join(" \xB7 ")}</div>`:f}
${n.layer!==null?m`<div class="live-status">▤ ${o("printer_layer")} ${n.layer}${n.layers?` / ${n.layers}`:""}</div>`:f}
${l?m`<div class="live-status">🌡 ${l}</div>`:f}
${n.filaments.length?m`<div class="live-filaments">${n.filaments.map(u=>m`<i style=${`background:${u}`}></i>`)}</div>`:f}
${n.filaments.length?m`<div class="live-filaments">${n.filaments.map(c=>m`<i style=${`background:${c}`}></i>`)}</div>`:f}
</div>
</div>`}function rm(r,e,t){let n=e.pump,o=a=>R(r,a),i=a=>a===null?"\u2013":`${O(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return m`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
</div>`}function sm(r,e,t){let n=e.pump,o=a=>E(r,a),i=a=>a===null?"\u2013":`${O(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return m`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
<div class="live-own">
${fn(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
${gn(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
<div class="live-own-text"><b>${n.cop!==null?O(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
</div>
<div class="live-rows">
@@ -891,9 +891,15 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${n.power!==null?m`<div class="live-row live-house"><span>${o("heatpump_power")}</span><b>${Me(r,n.power)}</b></div>`:f}
${n.outside!==null?m`<div class="live-status">🌡 ${o("heatpump_outside")} ${i(n.outside)}</div>`:f}
</div>
</div>`}function cu(r,e,t,n){return e.length?m`<div class="live-cards">
${e.map((o,i)=>o.kind==="house"?Jp(r,o,i,n):o.kind==="car"?em(r,o,i,t):o.kind==="printer"?nm(r,o,i):o.kind==="heatpump"?rm(r,o,i):tm(r,o,i,t))}
</div>`:f}var du=te`
</div>`}function am(r,e,t){let n=(o,i,s)=>o===null?"\u2013":`${O(r,o,i)} ${s}`;return m`<div class="live-card live-card-roomclimate" data-i=${t} data-room=${e.roomId}>
<div class="live-title">${e.name||E(r,"room")}</div>
<div class="live-row live-climate-temperature"><span>🌡 ${E(r,"climate_temperature")}</span><b>${n(e.temperature===null?null:r?oe(r,e.temperature):e.temperature,1,r?X(r):"\xB0C")}</b></div>
<div class="live-row live-climate-humidity"><span>💧 ${E(r,"climate_humidity")}</span><b>${n(e.humidity,0,"%")}</b></div>
<div class="live-row live-climate-co2"><span>${E(r,"climate_co2")}</span><b>${n(e.co2,0,"ppm")}</b></div>
${e.temperature===null&&e.humidity===null&&e.co2===null?m`<small class="live-status">${E(r,"climate_card_missing")}</small>`:f}
</div>`}function hc(r,e,t,n,o=!1){return e.length?m`<div class="live-cards">
${e.map((i,s)=>i.kind==="roomclimate"?am(r,i,s):o?f:i.kind==="house"?em(r,i,s,n):i.kind==="car"?rm(r,i,s,t):i.kind==="printer"?im(r,i,s):i.kind==="heatpump"?sm(r,i,s):om(r,i,s,t))}
</div>`:f}var pc=ne`
.live-cards {
position: absolute;
inset: 0;
@@ -992,6 +998,21 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
gap: 2px;
min-width: 150px;
}
.live-card-roomclimate {
display: grid;
gap: 4px;
min-width: 190px;
max-width: calc(100vw - 24px);
box-sizing: border-box;
}
.live-card-roomclimate .live-title {
overflow: hidden;
text-overflow: ellipsis;
max-width: 220px;
}
.live-climate-temperature b { color: color-mix(in srgb, #ffca8a 80%, var(--nf-text)); }
.live-climate-humidity b { color: color-mix(in srgb, #7dd3fc 80%, var(--nf-text)); }
.live-climate-co2 b { color: color-mix(in srgb, #c4b5fd 80%, var(--nf-text)); }
.live-row {
display: flex;
justify-content: space-between;
@@ -1199,7 +1220,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
text-transform: uppercase;
letter-spacing: 0.04em;
}
`;function Er(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var ri=r=>r.points.length>=3;function hu(r,e,t){return r.rooms.filter(ri).find(n=>H([e,t],n.points))}function om(r,e,t,n){let o=[];for(let a of e.rooms.filter(ri)){let[l,u]=We(a.points);o.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:u,y:0})}let i=new Set,s=(a,l,u,c)=>{if(i.has(a)||!(a in r.states))return;i.add(a);let d=hu(e,l,u),p=[d?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");o.push({kind:"device",name:L(r,a),where:p,floorId:e.id,roomId:d?.id??null,entity:a,icon:D(a),x:l,z:u,y:c})};for(let a of e.placements){let l=a.y??wt(D(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=hu(e,a.x,a.z),u=[l?.name,n?e.name:void 0].filter(c=>!!c).join(" \xB7 ");o.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 o}function pu(r,e){let t=ot(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>om(r,i,t,n));for(let i of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(p=>i.rooms.includes(p.id)&&ri(p)).map(p=>({f:d,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[u,c]=We(l.points);o.push({kind:"circuit",name:`\u{1F50C} ${i.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 o}function im(r,e){return(Er(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function mu(r,e,t=8){let n=Er(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Er(e.trim());return r.filter(i=>{let s=Er([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:im(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var sm=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],am=[2200,2700,3200,4e3,5e3,6500],lm=["hs","rgb","rgbw","rgbww","xy"],um=4,fu=16,gu=32,cm=128;function ii(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>lm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function si(r){return((r.attributes.supported_features??0)&um)!==0&&typeof r.attributes.current_position=="number"}var oi=class extends re{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 R(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){fe(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,o)=>{let i=o/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(i)*39}%;top:${50+Math.sin(i)*39}%">${n}</div>`})}renderLight(e){let t=ii(e),n=e.state==="on",o=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,i=t.color?sm.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?am.map(s=>m`<button class="qm-swatch" style="background:${dm(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${i.length?"":"qm-ring-small"}">
`;function Er(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var ni=r=>r.points.length>=3;function mc(r,e,t){return r.rooms.filter(ni).find(n=>H([e,t],n.points))}function lm(r,e,t,n){let o=[];for(let a of e.rooms.filter(ni)){let[l,c]=xe(a.points);o.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let i=new Set,s=(a,l,c,u)=>{if(i.has(a)||!(a in r.states))return;i.add(a);let h=mc(e,l,c),p=[h?.name,n?e.name:void 0].filter(d=>!!d).join(" \xB7 ");o.push({kind:"device",name:L(r,a),where:p,floorId:e.id,roomId:h?.id??null,entity:a,icon:D(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??wt(D(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=mc(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");o.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 o}function fc(r,e){let t=ot(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>lm(r,i,t,n));for(let i of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(p=>i.rooms.includes(p.id)&&ni(p)).map(p=>({f:h,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=xe(l.points);o.push({kind:"circuit",name:`\u{1F50C} ${i.name}`,where:s.map(h=>h.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return o}function cm(r,e){return(Er(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function gc(r,e,t=8){let n=Er(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Er(e.trim());return r.filter(i=>{let s=Er([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:cm(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var um=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],dm=[2200,2700,3200,4e3,5e3,6500],hm=["hs","rgb","rgbw","rgbww","xy"],pm=4,_c=16,bc=32,mm=128;function oi(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>hm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function ii(r){return((r.attributes.supported_features??0)&pm)!==0&&typeof r.attributes.current_position=="number"}var ri=class extends re{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 E(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){fe(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,o)=>{let i=o/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(i)*39}%;top:${50+Math.sin(i)*39}%">${n}</div>`})}renderLight(e){let t=oi(e),n=e.state==="on",o=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,i=t.color?um.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?dm.map(s=>m`<button class="qm-swatch" style="background:${fm(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${i.length?"":"qm-ring-small"}">
${this.ring(i)}
<button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @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>
@@ -1214,17 +1235,17 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.value=${String(Math.max(1,o))}
aria-label=${this.t("brightness")}
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
/>`:f}`}renderCover(e){e=Xn(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",o=si(e),i=(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=[i("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...o?[75,50].map(c=>i(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],i("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...o?[25].map(c=>i(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],...Number(e.attributes.supported_features??0)&8?[i("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(o||Number(e.attributes.supported_features??0)&8)?[i("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(o?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||n||e.state==="open"||e.state==="closed";return m`<div class="qm-ring">
/>`:f}`}renderCover(e){e=Xn(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",o=ii(e),i=(u,h,p,d=!1)=>m`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${p}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[i("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...o?[75,50].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],i("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...o?[25].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[i("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(o||Number(e.attributes.supported_features??0)&8)?[i("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(o?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||n||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":""}"
class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
style="--closed:${l}%"
?disabled=${!u}
?disabled=${!c}
aria-label=${n?this.t("cover_stop"):l>50?this.t("cover_open"):this.t("cover_close")}
@click=${()=>n?this.call("cover","stop_cover"):this.ask()&&this.call("cover",l>50?"open_cover":"close_cover")}
>
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 4h16M5 4v15M19 4v15M7 8h10M7 12h10M7 16h10" /></svg>
<b>${t!==null?`${t} %`:ee(this.hass,e)}</b>
<b>${t!==null?`${t} %`:te(this.hass,e)}</b>
</button>
</div>
${o?m`<input
@@ -1234,9 +1255,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
max="100"
.value=${String(t??0)}
aria-label=${this.t("position")}
@change=${c=>this.call("cover","set_cover_position",{position:Number(c.target.value)})}
@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,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&cm&&n!==null?m`<label class="qm-tilt"
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&mm&&n!==null?m`<label class="qm-tilt"
><span>${this.t("cover_tilt")} · ${Math.round(n)} %</span>
<input
class="qm-slider"
@@ -1246,9 +1267,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.value=${String(n)}
aria-label=${this.t("cover_tilt")}
@change=${o=>this.call("cover","set_cover_tilt_position",{entity_id:this.tiltEntity||this.entity,tilt_position:Number(o.target.value)})}
/></label>`:t&(fu|gu)?m`<div class="qm-tilt-buttons">
${t&fu?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&gu?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
/></label>`:t&(_c|bc)?m`<div class="qm-tilt-buttons">
${t&_c?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&bc?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",n=e.entity_id.split(".")[0];return m`<div class="qm-ring qm-ring-small">
<button
class="qm-power ${t?"qm-on":""}"
@@ -1256,25 +1277,25 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@click=${()=>this.ask()&&(n==="lock"?this.call("lock",t?"lock":"unlock"):this.call("homeassistant","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>
<b>${ee(this.hass,e)}</b>
<b>${te(this.hass,e)}</b>
</button>
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",o=e.attributes,i=typeof o.volume_level=="number"?Math.round(o.volume_level*100):null,s=Array.isArray(o.source_list)?o.source_list.slice(0,24):[],a=[o.media_title,o.media_artist].filter(d=>typeof d=="string"&&d).join(" \xB7 "),l=d=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${d} /></svg>`,u=(d,p,h,g=!1)=>m`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${p} title=${p} @click=${h}>${d}</button>`,c=t?[u(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),u(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),u(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return m`<div class="qm-ring ${c.length?"":"qm-ring-small"}">
${this.ring(c)}
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",o=e.attributes,i=typeof o.volume_level=="number"?Math.round(o.volume_level*100):null,s=Array.isArray(o.source_list)?o.source_list.slice(0,24):[],a=[o.media_title,o.media_artist].filter(h=>typeof h=="string"&&h).join(" \xB7 "),l=h=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${h} /></svg>`,c=(h,p,d,g=!1)=>m`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${p} title=${p} @click=${d}>${h}</button>`,u=t?[c(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),c(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),c(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return m`<div class="qm-ring ${u.length?"":"qm-ring-small"}">
${this.ring(u)}
<button class="qm-power ${t?"qm-on":""}" aria-pressed=${t} @click=${()=>this.ask()&&this.call("media_player",t?"turn_off":"turn_on")}>
<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>
<b>${i!==null&&t?`${i} %`:ee(this.hass,e)}</b>
<b>${i!==null&&t?`${i} %`:te(this.hass,e)}</b>
</button>
</div>
${a?m`<div class="qm-media-title">${a}</div>`:f}
${i!==null?m`<input class="qm-slider" type="range" min="0" max="100" .value=${String(i)} aria-label=${this.t("media_volume")} @change=${d=>this.call("media_player","volume_set",{volume_level:Number(d.target.value)/100})} />`:f}
${i!==null?m`<input class="qm-slider" type="range" min="0" max="100" .value=${String(i)} aria-label=${this.t("media_volume")} @change=${h=>this.call("media_player","volume_set",{volume_level:Number(h.target.value)/100})} />`:f}
${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 ${o.source===d?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:d})}>${d}</button>`)}</div>`:f}
<div class="qm-play">${s.map(h=>m`<button class="qm-chip ${o.source===h?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:h})}>${h}</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=D(this.entity),n=I(e)&&!Gt(e)?m`<p class="qm-note">${ee(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-play">${this.presets.map(h=>m`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:h.type,media_content_id:h.content})}>${h.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=D(this.entity),n=I(e)&&!Ut(e)?m`<p class="qm-note">${te(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>
${n}
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
</div>`}static styles=[Se,te`
</div>`}static styles=[$e,ne`
.qm-play-head {
margin: 10px 0 4px;
font-size: 11px;
@@ -1517,43 +1538,43 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.qm-note {
color: var(--nf-muted);
}
`]};function dm(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,o)=>Math.round(n+(o-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",oi);var hm=new URL(import.meta.url),pm=new URL("./nextfloor-3d.js?v=74227cd20cc3",hm).href,_u;function bu(){return _u??=import(pm),_u}function wu(r){if(!r||r.state!=="on")return 0;let e=typeof r.attributes.percentage=="number"?r.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var mm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Rr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||I(n))return!0;let o=String(n.state).toLowerCase(),i=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=i.length?i.includes(o):mm.has(o)||Number.isFinite(Number(o))&&Number(o)>0;return t.invert?!s:s}function ai(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)Rr(r,o)||t.push(o.id);return t.sort()}function vu(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(o=>t.has(o.id))?{...n,furniture:n.furniture.filter(o=>!t.has(o.id))}:n)}}var yu="image:";function li(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(yu))return t(n.slice(yu.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let o=r?.states[n]?.attributes.entity_picture;return typeof o=="string"&&o?o:null}return null}var gn=r=>Number(r);function bn(r){if(Array.isArray(r)){let[i,s]=[gn(r[0]),gn(r[1])];return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,o]=[gn(e),gn(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function xu(r){return r?bn(r.charger)??bn(r.charger_position):null}function ku(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(bn(t.attributes?.vacuum_position)??xu(t.attributes)))return e;return null}var fm=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",_n=(r,e)=>e?[r[0],-r[1]]:r;function gm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=_n(r.ga,e),[o,i]=_n(r.gb,e),[s,a]=r.a,[l,u]=r.b,[c,d]=[o-t,i-n],[p,h]=[l-s,u-a],g=Math.hypot(c,d),b=Math.hypot(p,h);if(!(g>1e-6)||!(b>1e-6))return null;let _=b/g,w=Math.atan2(h,p)-Math.atan2(d,c),[S,$]=[Math.cos(w),Math.sin(w)];return x=>{let y=_n(x,e),[F,T]=[y[0]-t,y[1]-n];return[s+_*(F*S-T*$),a+_*(F*$+T*S)]}}function _m(r){if(!r)return null;let e=r.mirror===!0,[t,n]=_n(r.ga,e),[o,i]=_n(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(i-n,o-t);return Number.isFinite(s)?s:null}function Su(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=gm(t)??(g=>g),i=_m(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=bn(a),u=l?(()=>{let[g,b]=o(l),_=gn(a?.a)*s;if(!Number.isFinite(_))return{x:g,z:b,heading:0};let w=_*Math.PI/180+i;return{x:g,z:b,heading:Math.atan2(Math.cos(w),Math.sin(w))}})():null,c=xu(n),d=Array.isArray(n.path)?n.path:[],p=d.length>0&&fm(d[0])?[d]:d,h=[];for(let g of p){let b=[];for(let _ of Array.isArray(g)?g:[]){let w=bn(_);w&&b.push(o(w))}b.length>1&&h.push(b)}return!u&&!c&&!h.length?null:{pose:u,charger:c?o(c):null,path:h}}var Mu="nextfloor.lock3d",$u=520,ci=class extends re{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},_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},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButto Line truncated
`]};function fm(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,o)=>Math.round(n+(o-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",ri);var gm=new URL(import.meta.url),_m=new URL("./nextfloor-3d.js?v=74227cd20cc3",gm).href,wc;function vc(){return wc??=import(_m),wc}function yc(r){if(!r||r.state!=="on")return 0;let e=typeof r.attributes.percentage=="number"?r.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var bm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Rr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||I(n))return!0;let o=String(n.state).toLowerCase(),i=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=i.length?i.includes(o):bm.has(o)||Number.isFinite(Number(o))&&Number(o)>0;return t.invert?!s:s}function si(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)Rr(r,o)||t.push(o.id);return t.sort()}function xc(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(o=>t.has(o.id))?{...n,furniture:n.furniture.filter(o=>!t.has(o.id))}:n)}}var kc="image:";function ai(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(kc))return t(n.slice(kc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let o=r?.states[n]?.attributes.entity_picture;return typeof o=="string"&&o?o:null}return null}var _n=r=>Number(r);function wn(r){if(Array.isArray(r)){let[i,s]=[_n(r[0]),_n(r[1])];return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,o]=[_n(e),_n(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function Sc(r){return r?wn(r.charger)??wn(r.charger_position):null}function $c(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(wn(t.attributes?.vacuum_position)??Sc(t.attributes)))return e;return null}var wm=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",bn=(r,e)=>e?[r[0],-r[1]]:r;function vm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=bn(r.ga,e),[o,i]=bn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,h]=[o-t,i-n],[p,d]=[l-s,c-a],g=Math.hypot(u,h),b=Math.hypot(p,d);if(!(g>1e-6)||!(b>1e-6))return null;let _=b/g,w=Math.atan2(d,p)-Math.atan2(h,u),[S,M]=[Math.cos(w),Math.sin(w)];return x=>{let y=bn(x,e),[F,T]=[y[0]-t,y[1]-n];return[s+_*(F*S-T*M),a+_*(F*M+T*S)]}}function ym(r){if(!r)return null;let e=r.mirror===!0,[t,n]=bn(r.ga,e),[o,i]=bn(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(i-n,o-t);return Number.isFinite(s)?s:null}function Mc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=vm(t)??(g=>g),i=ym(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=wn(a),c=l?(()=>{let[g,b]=o(l),_=_n(a?.a)*s;if(!Number.isFinite(_))return{x:g,z:b,heading:0};let w=_*Math.PI/180+i;return{x:g,z:b,heading:Math.atan2(Math.cos(w),Math.sin(w))}})():null,u=Sc(n),h=Array.isArray(n.path)?n.path:[],p=h.length>0&&wm(h[0])?[h]:h,d=[];for(let g of p){let b=[];for(let _ of Array.isArray(g)?g:[]){let w=wn(_);w&&b.push(o(w))}b.length>1&&d.push(b)}return!c&&!u&&!d.length?null:{pose:c,charger:u?o(u):null,path:d}}var Ac="nextfloor.lock3d",Ec=520,ci=class extends re{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},_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},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButto 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,n=this.building;if(!t||!n||!this.hass)return;let o=this._travel,i=o&&!o.loading?$t(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=rt(i,n.floors),this.furnitureLinks=ot(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?gl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=kl({hass:i,building:n,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)!==i.states[v])))return;ai(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(v=>[v,i.states[v]])),this.refreshToday(n),this.refreshForecast(n);let a=Xt(i,n),l=ra(i,n.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(i):n);this.placementInfo=new Map(l.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let u=this.furnitureMarkers(i,n,new Set(l.map(v=>v.id)),new Set(a.map(v=>v.powerEntity)));a.push(...u.consumers);let c=en(i,n,a,Fe(n,v=>this.furnitureLinks?.get(v.id)?.power??null)),d=new Map(a.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=it(i,n.floors);let p=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of n.floors)for(let k of v.outdoor??[]){if(!k.area_id&&!k.temp_entity&&!k.pump_entity)continue;let B=k.temp_entity?i.states[k.temp_entity]:void 0,z=k.pump_entity?i.states[k.pump_entity]:void 0,[W,de]=We(k.points),qe=B&&Number.isFinite(Number(B.state))?`${O(i,ce(i,Vn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${ne(i)}`:"",ct=!!z&&Q(z);l.push({id:k.area_id?`outdoor:${k.id}`:k.pump_entity??k.temp_entity,floorId:v.id,roomId:null,x:W,z:de,y:Cn(v,k,W,de)+.7,icon:xe(k.type==="pool"?"pool":k.type==="terrace"?"table-chair":"tree-outline"),name:k.area_id&&i.areas?.[k.area_id]?.name||R(i,`out_${k.type}`),text:[qe,ct?R(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:ct,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let v of n.floors){for(let k of v.placements)k.pin_offset&&h.set(`${v.id}:${k.entity_id}`,k.pin_offset);for(let k of v.furniture)k.pin_offset&&h.set(`f:${k.id}`,k.pin_offset)}let g=v=>{let k=v.lamp?void 0:(v.furnitureId?h.get(`f:${v.furnitureId}`):void 0)??h.get(`${v.floorId}:${v.id}`);return k?{...v,x:v.x+(k.x??0),z:v.z+(k.z??0),y:v.y+(k.y??0)}:v};t.setDevices([...[...l,...u.markers].map(g).map(v=>{let k=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:d.get(v.id)??null,B={...v,power:k,powerText:k===null?void 0:se(i,k),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(i,n,c,v.furnitureId)??v.text},z=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",W=p.has(v.id)||!!v.furnitureId&&p.has(v.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:v.show==="always",caption:z}})]),t.setPickTargets(u.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(u.screens),t.setFridgeDoors(Ns(i,n.floors)),t.setCovers(Zs(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let v of n.floors)for(let k of v.furniture)!q(k.type)?.pet||!k.room_sensor||k.room_sensor==="none"||b.set(k.id,fo(i,v.rooms.filter(B=>B.points.length>=3),null,k.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(dl(i,n)),t.setParked(Lo(i,n)),t.setGateStates(Rl(i,n));let _=new Map(n.floors.flatMap(v=>v.openings.map(k=>[k.id,k.type]))),w=new Map([...this.openingLinks].map(([v,k])=>[v,Ee(i,k,_.get(v))]));t.setOpeningStates(w),this.setAlerts(this.alertSrc?No(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let S=[...l,...u.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(k=>k.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...w].map(([v,k])=>`${v}:${k.open}:${k.cover===null?"-":k.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=S,v||this.scheduleThumbs(1500)}let $=Kl(i,n,a,n.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),x=this.liveCars(i,n);for(let v of x){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let k=n.floors.flatMap(W=>W.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:W.id,x:de.x,z:de.z,y:1}))).sort((W,de)=>Math.hypot(W.x-v.at.x,W.z-v.at.z)-Math.hypot(de.x-v.at.x,de.z-v.at.z))[0],B=k&&k.floorId===v.at.floorId&&Math.hypot(k.x-v.at.x,k.z-v.at.z)<9,z=k??hn(n);!z||!v.car.charging&&!B||$.arcs.push({key:`car:${v.spot}`,from:z,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...z,y:.35},{floorId:v.at.floorId,x:(z.x+v.at.x)/2,z:(z.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let y=hn(n);for(let v of this.liveHeatPumps(n)){let k=v.pump.heat??(v.pump.mode==="heating"||v.puLine truncated
<button class="nf-thumbs-fold" title=${R(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${R(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${o}>${n?"\u25B8":"\u25C2"}</button>
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let o=this._travel,i=o&&!o.loading?At(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=rt(i,n.floors),this.furnitureLinks=ot(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?gl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=Sl({hass:i,building:n,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)!==i.states[v])))return;si(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(v=>[v,i.states[v]])),this.refreshToday(n),this.refreshForecast(n);let a=en(i,n),l=ra(i,n.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(i):n);this.placementInfo=new Map(l.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let c=this.furnitureMarkers(i,n,new Set(l.map(v=>v.id)),new Set(a.map(v=>v.powerEntity)));a.push(...c.consumers);let u=tn(i,n,a,De(n,v=>this.furnitureLinks?.get(v.id)?.power??null)),h=new Map(a.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=it(i,n.floors);let p=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of n.floors)for(let k of v.outdoor??[]){if(!k.area_id&&!k.temp_entity&&!k.pump_entity)continue;let B=k.temp_entity?i.states[k.temp_entity]:void 0,z=k.pump_entity?i.states[k.pump_entity]:void 0,[W,de]=xe(k.points),qe=B&&Number.isFinite(Number(B.state))?`${O(i,oe(i,Kn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${X(i)}`:"",ut=!!z&&Q(z);l.push({id:k.area_id?`outdoor:${k.id}`:k.pump_entity??k.temp_entity,floorId:v.id,roomId:null,x:W,z:de,y:Nn(v,k,W,de)+.7,icon:ke(k.type==="pool"?"pool":k.type==="terrace"?"table-chair":"tree-outline"),name:k.area_id&&i.areas?.[k.area_id]?.name||E(i,`out_${k.type}`),text:[qe,ut?E(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:ut,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let v of n.floors){for(let k of v.placements)k.pin_offset&&d.set(`${v.id}:${k.entity_id}`,k.pin_offset);for(let k of v.furniture)k.pin_offset&&d.set(`f:${k.id}`,k.pin_offset)}let g=v=>{let k=v.lamp?void 0:(v.furnitureId?d.get(`f:${v.furnitureId}`):void 0)??d.get(`${v.floorId}:${v.id}`);return k?{...v,x:v.x+(k.x??0),z:v.z+(k.z??0),y:v.y+(k.y??0)}:v};t.setDevices([...[...l,...c.markers].map(g).map(v=>{let k=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:h.get(v.id)??null,B={...v,power:k,powerText:k===null?void 0:ae(i,k),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(i,n,u,v.furnitureId)??v.text},z=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",W=p.has(v.id)||!!v.furnitureId&&p.has(v.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:v.show==="always",caption:z}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ns(i,n.floors)),t.setCovers(Zs(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let v of n.floors)for(let k of v.furniture)!q(k.type)?.pet||!k.room_sensor||k.room_sensor==="none"||b.set(k.id,fo(i,v.rooms.filter(B=>B.points.length>=3),null,k.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(dl(i,n)),t.setParked(Lo(i,n)),t.setGateStates(zl(i,n));let _=new Map(n.floors.flatMap(v=>v.openings.map(k=>[k.id,k.type]))),w=new Map([...this.openingLinks].map(([v,k])=>[v,Re(i,k,_.get(v))]));t.setOpeningStates(w),this.setAlerts(this.alertSrc?No(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let S=[...l,...c.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(k=>k.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...w].map(([v,k])=>`${v}:${k.open}:${k.cover===null?"-":k.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=S,v||this.scheduleThumbs(1500)}let M=Gl(i,n,a,n.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),x=this.liveCars(i,n);for(let v of x){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let k=n.floors.flatMap(W=>W.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:W.id,x:de.x,z:de.z,y:1}))).sort((W,de)=>Math.hypot(W.x-v.at.x,W.z-v.at.z)-Math.hypot(de.x-v.at.x,de.z-v.at.z))[0],B=k&&k.floorId===v.at.floorId&&Math.hypot(k.x-v.at.x,k.z-v.at.z)<9,z=k??pn(n);!z||!v.car.charging&&!B||M.arcs.push({key:`car:${v.spot}`,from:z,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...z,y:.35},{floorId:v.at.floorId,x:(z.x+v.at.x)/2,z:(z.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let y=pn(n);for(let v of this.liveHeatPumps(n)){let k=v.pump.heat??(v.pump.mode==="heating"||v.pumLine truncated
<button class="nf-thumbs-fold" title=${E(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${E(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${o}>${n?"\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>
<span>${R(this.hass,"all_floors")}</span>
<span>${E(this.hass,"all_floors")}</span>
</button>
${t.map(i=>m`<button class="nf-thumb" aria-pressed=${this.floorId===i.floorId} @click=${()=>this.fire("floor-tap",{floorId:i.floorId})}>
${n?f:m`<img src=${i.url} alt="" />`}
<span>${e.get(i.floorId)??""}</span>
</button>`)}
</nav>`}onDeviceHold(e,t,n){let o=D(e);o==="light"||o==="cover"||o==="switch"||o==="fan"||o==="lock"?this._menu={entity:e,x:t,y:n}:fe(this,e)}onDeviceSwipe(e,t,n,o,i){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=D(e);if(l==="light"&&ii(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:o,y:i},!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:o,y:i},!0}if(l==="cover"&&si(s)){let u=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:u,value:u,x:o,y:i},!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-n/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(){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,ha(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}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()||!la(e,this.screenName)||!ua(e))return;let n=ca(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),da(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${R(this.hass,"close")} @click=${()=>this._announcement=null}>
</nav>`}onDeviceHold(e,t,n){let o=D(e);o==="light"||o==="cover"||o==="switch"||o==="fan"||o==="lock"?this._menu={entity:e,x:t,y:n}:fe(this,e)}onDeviceSwipe(e,t,n,o,i){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=D(e);if(l==="light"&&oi(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:o,y:i},!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:o,y:i},!0}if(l==="cover"&&ii(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:o,y:i},!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-n/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(){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,ha(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}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()||!la(e,this.screenName)||!ca(e))return;let n=ua(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),da(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${E(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(n=>m`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${Oo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Oo(this.hass,e,n)}</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(i=>i.rooms).find(i=>i.id===this.roomId),n=t?K(this.hass,t).filter(i=>D(i)==="scene"||D(i)==="script").slice(0,6):[];if(!n.length)return f;let o=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return m`<div class="nf-scenes">
${n.map(i=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===i} @click=${()=>this.runScene(i)}>${L(this.hass,i,o)}</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=${R(this.hass,"find")} aria-label=${R(this.hass,"find")} @click=${()=>this._find=""}>
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return m`<button class="nf-find-btn" title=${E(this.hass,"find")} aria-label=${E(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=mu(this.findIndex??=pu(this.hass,e),this._find);return m`<div class="nf-find">
</button>`;let t=gc(this.findIndex??=fc(this.hass,e),this._find);return m`<div class="nf-find">
<input
type="search"
placeholder=${R(this.hass,"find_placeholder")}
placeholder=${E(this.hass,"find_placeholder")}
.value=${this._find}
@input=${n=>this._find=n.target.value}
@keydown=${n=>{n.key==="Escape"&&(this._find=null),n.key==="Enter"&&t[0]&&this.goTo(t[0])}}
/>
<button class="nf-find-close" aria-label=${R(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
<button class="nf-find-close" aria-label=${E(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
${this._find.trim()?m`<div class="nf-find-list">
${t.length?t.map(n=>m`<button @click=${()=>this.goTo(n)}>
<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=${n.icon?nr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
<span><b>${n.name}</b>${n.where?m`<small>${n.where}</small>`:f}</span>
</button>`):m`<p>${R(this.hass,"find_none")}</p>`}
</button>`):m`<p>${E(this.hass,"find_none")}</p>`}
</div>`:f}
</div>`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let n=(_,w)=>R(t,_,w),o=m`<button
</div>`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let n=(_,w)=>E(t,_,w),o=m`<button
class="nf-central-btn ${this._central?"nf-central-on":""}"
title=${n("central")}
aria-label=${n("central")}
@@ -1561,13 +1582,13 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@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 o;let i=this.floorId?e.floors.find(_=>_.id===this.floorId):void 0,s=i?[i]:e.floors,a=s.flatMap(_=>go(t,_).lights),l=s.flatMap(_=>go(t,_).covers),u=a.filter(_=>t.states[_]?.state==="on").length,c=!i,d=(_,w,S,$)=>{if($.length){if(c&&this._armed!==_){this._armed=_,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(w,S,{entity_id:$})}},p=(_,w,S,$,x)=>m`<button class="nf-btn ${this._armed===_?"nf-central-armed":""}" ?disabled=${!x.length} @click=${()=>d(_,S,$,x)}>
</button>`;if(!this._central)return o;let i=this.floorId?e.floors.find(_=>_.id===this.floorId):void 0,s=i?[i]:e.floors,a=s.flatMap(_=>go(t,_).lights),l=s.flatMap(_=>go(t,_).covers),c=a.filter(_=>t.states[_]?.state==="on").length,u=!i,h=(_,w,S,M)=>{if(M.length){if(u&&this._armed!==_){this._armed=_,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(w,S,{entity_id:M})}},p=(_,w,S,M,x)=>m`<button class="nf-btn ${this._armed===_?"nf-central-armed":""}" ?disabled=${!x.length} @click=${()=>h(_,S,M,x)}>
${this._armed===_?n("central_sure"):n(w)}
</button>`,h=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(_=>t.states[_]&&(!h[_]||!i||h[_]===i.id)),b=this.buttons??e.settings.buttons??[];return m`${o}
</button>`,d=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(_=>t.states[_]&&(!d[_]||!i||d[_]===i.id)),b=this.buttons??e.settings.buttons??[];return m`${o}
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
<b>${i?i.name:n("central_house")}</b>
<div class="nf-central-row">
<span>${n("central_lights")}${a.length?m` <small>${u}/${a.length}</small>`:f}</span>
<span>${n("central_lights")}${a.length?m` <small>${c}/${a.length}</small>`:f}</span>
${p("lights_on","central_on","light","turn_on",a.filter(_=>t.states[_]?.state==="off"))}
${p("lights_off","central_off","light","turn_off",a.filter(_=>t.states[_]?.state==="on"))}
</div>
@@ -1578,10 +1599,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</div>`:f}
<b>${n("central_favorites")}</b>
${g.length?m`<div class="nf-central-favs">
${g.map(_=>{let[w,S]=Vs(_),$=t.states[_],x=w==="homeassistant"&&$?.state==="on";return m`<button
${g.map(_=>{let[w,S]=Vs(_),M=t.states[_],x=w==="homeassistant"&&M?.state==="on";return m`<button
class="nf-chip"
aria-pressed=${x||this._sceneFired===_}
?disabled=${I($)}
?disabled=${I(M)}
@click=${()=>{t.callService(w,S,{entity_id:_}),this._sceneFired=_,setTimeout(()=>this._sceneFired=null,600)}}
>
${L(t,_)}
@@ -1596,7 +1617,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${_.icon?m`<ha-icon .icon=${_.icon.startsWith("mdi:")?_.icon:`mdi:${_.icon}`}></ha-icon>`:f}${_.label}
</button>`)}
</div>`:f}
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Mu,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(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let o=await rn(this.hass,tl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:nl(o,n,t),loading:!1}}catch{this._travel=null,this._error=R(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 n=this._travel;if(!n)return;let o=n.t+250*n.speed;o>=n.to&&this.playTravel(!1),this.travelTo(o)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>R(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 n=this.hass.language??navigator.language,o=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),i=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(Ac,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(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let o=await on(this.hass,tl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:nl(o,n,t),loading:!1}}catch{this._travel=null,this._error=E(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 n=this._travel;if(!n)return;let o=n.t+250*n.speed;o>=n.to&&this.playTravel(!1),this.travelTo(o)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>E(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 n=this.hass.language??navigator.language,o=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),i=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"):o}</b>
<div class="nf-travel-track">
@@ -1609,18 +1630,18 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<button class="nf-travel-span" aria-pressed=${t.hours===24} @click=${()=>{this.openTravel(24)}}>24 h</button>
<button class="nf-travel-span" aria-pressed=${t.hours===168} @click=${()=>{this.openTravel(168)}}>7 ${e("travel_days")}</button>
<button class="nf-travel-live" @click=${()=>{this.openTravel(null)}}>● ${e("travel_live")}</button>
</div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let o=n.getBoundingClientRect(),i=o.width/2,[s,a]=[(e.clientX-o.left-i)/i,(e.clientY-o.top-i)/i],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>R(this.hass,n),t=this._stick??[0,0];return m`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}>
</div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let o=n.getBoundingClientRect(),i=o.width/2,[s,a]=[(e.clientX-o.left-i)/i,(e.clientY-o.top-i)/i],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>E(this.hass,n),t=this._stick??[0,0];return m`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}>
${this._walking?"\u2715":J`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="13" cy="4" r="2" /><path d="M10 21l2-6 3 3v5M9 12l1-4 4 1 3 3M8 9l-2 4" /></svg>`}
</button>
${this._walking?m`<div class="nf-stick" @pointerdown=${n=>this.stickMove(n,!0)} @pointermove=${n=>this.stickMove(n)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}>
<span style="transform:translate(${t[0]*34}px, ${t[1]*34}px)"></span>
</div>
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=R(this.hass,this._locked?"lock3d_off":"lock3d_on");return m`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}>
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=E(this.hass,this._locked?"lock3d_off":"lock3d_on");return m`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="5" y="11" width="14" height="9" rx="2" />
${this._locked?J`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:J`<path d="M8 11V8a4 4 0 0 1 7.5-2" />`}
</svg>
</button>`}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),o=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),i=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return m`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${o}</b><span>${i}</span></div>`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=R(this.hass,this.clean?"controls_show":"controls_hide");return m`<button
</button>`}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),o=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),i=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return m`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${o}</b><span>${i}</span></div>`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=E(this.hass,this.clean?"controls_show":"controls_hide");return m`<button
class="nf-eye ${this.clean?"nf-eye-clean":""}"
title=${e}
aria-label=${e}
@@ -1630,11 +1651,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${this.clean?J`<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>`:J`<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>${L(this.hass,e.entity)}</span>
<b>${t?R(this.hass,"swipe_off"):`${e.value} %`}</b>
<b>${t?E(this.hass,"swipe_off"):`${e.value} %`}</b>
<i><em style="height:${e.value}%"></em></i>
</div>`}tapPlate(e,t,n){let o=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),i=o?bo(o.gang_entities,q(o.type)?.gangs??0):[];if(i.length===1)return this.onDeviceTap(i[0],t,n);i.length>1&&(this._plate={ids:i,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return m`<div class="nf-menu-backdrop" @click=${n}></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((o,i)=>{let s=t.states[o],a=Q(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(o,e.x,e.y)}}><b>${i+1}</b><span>${L(t,o)}</span><i>${s?ee(t,s):"\u2013"}</i></button>`})}
${e.ids.map((o,i)=>{let s=t.states[o],a=Q(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(o,e.x,e.y)}}><b>${i+1}</b><span>${L(t,o)}</span><i>${s?te(t,s):"\u2013"}</i></button>`})}
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,o=t?.clientHeight??600,i=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(o-360,e.y-170));return m`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
<nf-quick-menu
style="left:${i}px;top:${s}px"
@@ -1647,61 +1668,61 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.myPosition=${this.myPositionOf(e.entity)}
.tiltEntity=${Qn(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 n of t.openings){let o=this.openingLinks?.get(n.id);if(n.my_position!=null&&(o?.cover===e||o?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let o=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(o){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===o);s?.tap&&_o(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,n);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??Fe(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&fe(this,a);return}let i=D(e);if(i==="cover"||i==="media"){this._menu={entity:e,x:t,y:n};return}if(i==="lock"){let s=po(this.hass,e),a=L(this.hass,e);confirm(R(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(i&&bs.has(i)){if(this.confirmSet.has(e)&&!confirm(R(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;ia(this.hass,e)}else fe(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let o=this.building?.floors.find(i=>i.id===n.floorId)?.placements.find(i=>i.entity_id===e);return Qi({hass:this.hass,entityId:e,state:t},n,o?.plugin??void 0,{showWindow:(i,s)=>{i&&"hass"in i&&(i.hass=this.hass),this._pluginWindow=i?{node:i,title:s?.title??""}:null},moreInfo:i=>fe(this,i??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=${R(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let o=this.openingLinks?.get(n.id);if(n.my_position!=null&&(o?.cover===e||o?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let o=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(o){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===o);s?.tap&&_o(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,n);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??De(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&fe(this,a);return}let i=D(e);if(i==="cover"||i==="media"){this._menu={entity:e,x:t,y:n};return}if(i==="lock"){let s=po(this.hass,e),a=L(this.hass,e);confirm(E(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(i&&bs.has(i)){if(this.confirmSet.has(e)&&!confirm(E(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;ia(this.hass,e)}else fe(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let o=this.building?.floors.find(i=>i.id===n.floorId)?.placements.find(i=>i.entity_id===e);return Ji({hass:this.hass,entityId:e,state:t},n,o?.plugin??void 0,{showWindow:(i,s)=>{i&&"hass"in i&&(i.hass=this.hass),this._pluginWindow=i?{node:i,title:s?.title??""}:null},moreInfo:i=>fe(this,i??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=${E(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 n=[];for(let o of e.floors)for(let i of o.furniture){if(!nu(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=tu(t,s?.entity??s?.power??null);a&&n.push({id:i.id,name:i.name||he(t,i.type),floorId:o.id,x:i.x,z:i.z,at:{floorId:o.id,x:i.x,z:i.z,y:le(o,i)+i.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let o of e.floors)for(let i of o.furniture){if(!ei(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=Xo(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:i.id,name:i.name||he(t,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:le(o,i)+i.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let o of t.floors)for(let i of o.furniture){if(i.type!=="parking")continue;let s=au(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Wo(e,i),l=a?xl(i,a):null,u=i.name||(a?he(e,a):he(e,i.type));n.push({spot:i.id,name:u,at:{floorId:o.id,x:i.x,z:i.z,y:le(o,i)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let o of t.floors){for(let i of o.furniture){let s=this.furnitureLinks?.get(i.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:i.name||he(e,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:le(o,i)+i.h+.15},rings:i.sound_rings})}for(let i of o.placements)i.entity_id.startsWith("media_player.")&&n.push({entity:i.entity_id,name:i.name||L(e,i.entity_id),at:{floorId:o.id,x:i.x,z:i.z,y:(i.y??1.1)+.15},rings:i.sound_rings})}return al(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],o=Math.max(1,Math.min(7,e.settings.today_days??1)),i=`${new Date().toDateString()}|${o}`;!t||!n.length||Date.now()-this.todayAt<9e5&&i===this.todayDay||(this.todayAt=Date.now(),this.todayDay=i,Yl(t,n,o).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?Ue(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let o=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&o===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=o,Xl(t,n).then(i=>this._forecast=i))}renderForecast(e){let t=this.building,n=this.hass,o=t?.settings.forecast;if(!t||!n||!o||o.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let i=Ql(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.length)return f;let s=Ue(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),u=String(a?.precipitation_unit??"mm"),c=n.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=${R(n,"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 n=[];for(let o of e.floors)for(let i of o.furniture){if(!oc(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=rc(t,s?.entity??s?.power??null);a&&n.push({id:i.id,name:i.name||he(t,i.type),floorId:o.id,x:i.x,z:i.z,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let o of e.floors)for(let i of o.furniture){if(!Xo(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=Qo(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:i.id,name:i.name||he(t,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let o of t.floors)for(let i of o.furniture){if(i.type!=="parking")continue;let s=cc(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Wo(e,i),l=a?xl(i,a):null,c=i.name||(a?he(e,a):he(e,i.type));n.push({spot:i.id,name:c,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let o of t.floors){for(let i of o.furniture){let s=this.furnitureLinks?.get(i.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:i.name||he(e,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.15},rings:i.sound_rings})}for(let i of o.placements)i.entity_id.startsWith("media_player.")&&n.push({entity:i.entity_id,name:i.name||L(e,i.entity_id),at:{floorId:o.id,x:i.x,z:i.z,y:(i.y??1.1)+.15},rings:i.sound_rings})}return al(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],o=Math.max(1,Math.min(7,e.settings.today_days??1)),i=`${new Date().toDateString()}|${o}`;!t||!n.length||Date.now()-this.todayAt<9e5&&i===this.todayDay||(this.todayAt=Date.now(),this.todayDay=i,Ql(t,n,o).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?Ue(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let o=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&o===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=o,tc(t,n).then(i=>this._forecast=i))}renderForecast(e){let t=this.building,n=this.hass,o=t?.settings.forecast;if(!t||!n||!o||o.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let i=ec(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.length)return f;let s=Ue(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,h=new Intl.DateTimeFormat(u,{weekday:"short"}),p=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return m`<section class="nf-forecast" aria-label=${E(n,"forecast")}>
<ul>
${i.map((h,g)=>m`<li>
<span class="nf-fc-day">${g===0?R(n,"today"):d.format(new Date(h.day))}</span>
<span class="nf-fc-icon" aria-hidden="true">${h.icon}</span>
<span class="nf-fc-temp" title=${l}><b>${p(h.high)}</b> <small>${p(h.low)}</small></span>
<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>
${i.map((d,g)=>m`<li>
<span class="nf-fc-day">${g===0?E(n,"today"):h.format(new Date(d.day))}</span>
<span class="nf-fc-icon" aria-hidden="true">${d.icon}</span>
<span class="nf-fc-temp" title=${l}><b>${p(d.high)}</b> <small>${p(d.low)}</small></span>
<span class="nf-fc-rain">${d.rain!==null&&d.rain>0?`\u{1F4A7}${d.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:d.chance!==null&&d.chance>0?`\u{1F4A7}${Math.round(d.chance)} %`:""}</span>
</li>`)}
</ul>
</section>`}renderToday(){let e=this.building,t=this.hass;if(!e||!t||this.clean||this.roomId||this.panelOpen)return f;let n=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(e,t);return o===f&&n===f?f:m`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${o}${n}</div>`}renderTodayCard(e,t){let n=ql(t,e,Date.now(),{today:R(t,"care_bin_today"),tomorrow:R(t,"care_bin_tomorrow")}),o=Zl([...n,...this._todayItems??[]]);if(!o.length&&!(e.settings.calendars??[]).length)return f;let i=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 R(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=o.flatMap((c,d)=>[(c.day??0)>0&&(o[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 ${i?"":"nf-today-folded"}" aria-label=${R(t,"today")}>
</section>`}renderToday(){let e=this.building,t=this.hass;if(!e||!t||this.clean||this.roomId||this.panelOpen)return f;let n=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(e,t);return o===f&&n===f?f:m`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${o}${n}</div>`}renderTodayCard(e,t){let n=Yl(t,e,Date.now(),{today:E(t,"care_bin_today"),tomorrow:E(t,"care_bin_tomorrow")}),o=Jl([...n,...this._todayItems??[]]);if(!o.length&&!(e.settings.calendars??[]).length)return f;let i=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 E(t,"tomorrow");let h=new Date;return h.setDate(h.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(h)},c=o.flatMap((u,h)=>[(u.day??0)>0&&(o[h-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 ${i?"":"nf-today-folded"}" aria-label=${E(t,"today")}>
<button class="nf-today-head" aria-expanded=${i} @click=${()=>this._todayOpen=!i}>
<b>📅 ${R(t,"today")}</b><span>${s}</span>
<b>📅 ${E(t,"today")}</b><span>${s}</span>
</button>
${i?o.length?m`<ul>
${u}
</ul>`:m`<p class="nf-today-none">${R(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 n=Fe(e,s=>this.furnitureLinks?.get(s.id)?.power??null),o=e.energy,i={solar:o.solar?[o.solar]:n.solar,grid:o.grid??n.grid,gridInvert:!!o.grid_invert,battery:o.battery?[o.battery]:n.battery,batteryInvert:!!o.battery_invert,consumption:o.consumption};Ba(t,i).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,o=[],i=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=i?.power_entity?j(n?.states[i.power_entity]):null;if(i&&s!==null){let a=t&&t>0?` \xB7 ${R(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";o.push({icon:"\u26A1",label:i.name,value:`${at(n,s)}${a}`})}for(let[a,l,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let c=e.energy[a],d=c?n?.states[c]:void 0;d&&!I(d)&&o.push({icon:l,label:R(n,u),value:ee(n,d)})}return o}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>en(a,e,Xt(a,e),Fe(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),o=rl(t,n),i=Date.now(),s=i-24*36e5;rn(t,o,s,i,!0).then(a=>{this.dayCurves=ol(t,a,s,i,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,o,i){let s=[],a=n.summary,l=a.solar!==null||a.grid!==null||a.battery!==null||a.consumption!==null,u=hn(t),c=(this.floorId?t.floors.find(d=>d.id===this.floorId):void 0)??[...t.floors].sort((d,p)=>p.elevation-d.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&l&&u&&c){let d=0,p=0,h=0;for(let g of c.rooms)for(let[b,_]of g.points)d+=b,p+=_,h++;s.push({kind:"house",at:{floorId:c.id,x:h?d/h:u.x,z:h?p/h:u.z,y:c.height+(this.floorId?1.2:3.2)},summary:a,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,a.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let d of o)s.push({kind:"car",at:d.at,spot:d.spot,name:d.name,car:d.car});for(let d of this.livePrinters(t))s.push({kind:"printer",at:d.at,name:d.name,printer:d.printer});for(let d of this.liveHeatPumps(t))s.push({kind:"heatpump",at:d.at,name:d.name,pump:d.pump});for(let d of i)s.push({kind:"media",at:{...d.at,y:d.at.y+.5},media:d})}JSON.stringify(s)!==JSON.stringify(this._liveCards)&&(this._liveCards=s),e.setLiveAnchors(s.map(d=>d.at),s.length?(d,p,h,g)=>this.placeLhCard(d,p,h,g):null)}placeLhCard(e,t,n,o){let i=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);i&&(i.dataset.x=String(t),i.dataset.y=String(n),i.style.visibility=o?"visible":"hidden",e===this._liveCards.length-1&&uu(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>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary;if(!(!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null)))return e.length?m`<div class="nf-energy" aria-live="off">${e}</div>`:f;let o=s=>R(this.hass,s),i=[];if(t.solar!==null&&i.push({cls:"solar",label:o("energy_solar"),value:se(this.hass,t.solar)}),t.consumption!==null&&i.push({cls:"total",label:o("energy_consumption"),value:se(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&i.push({cls:"total",label:o("energy_rest"),value:se(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let s=[t.battery!==null?se(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);i.push({cls:"battery",label:o("energy_battery"),value:s.join(" \xB7 ")})}if(t.grid!==null){let s=t.grid<0;i.push({cls:s?"export":"grid",label:o(s?"energy_grid_export":"energy_grid_import"),value:se(this.hass,Math.abs(t.grid))})}if(t.tariff&&i.push({cls:"tariff",label:o("energy_tariff"),value:`${O(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let s of this.meterRows(this.building))i.push({cls:"meter",label:`${s.icon} ${s.label}`,value:s.value});return m`<div class="nf-energy" aria-live="off">
${this.liveCardsOn&&this._liveCards.some(s=>s.kind==="house")?f:i.map(s=>m`<div class="nf-energy-item nf-energy-${s.cls}"><span>${s.label}</span><b>${s.value}</b></div>`)}
${this.flows!==null?f:m`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${o("flows_hint")} aria-label=${o("flows")} @click=${()=>this.toggleFlows()}>
<span>${o("flows")}</span><b>⚡</b>
</button>`}
${this.holograms!==null?f:m`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._liveCardOn} title=${o("holos_hint")} aria-label=${o("holos")} @click=${()=>this.toggleLhCards()}>
<span>${o("holos")}</span><b>◫</b>
${c}
</ul>`:m`<p class="nf-today-none">${E(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 n=De(e,s=>this.furnitureLinks?.get(s.id)?.power??null),o=e.energy,i={solar:o.solar?[o.solar]:n.solar,grid:o.grid??n.grid,gridInvert:!!o.grid_invert,battery:o.battery?[o.battery]:n.battery,batteryInvert:!!o.battery_invert,consumption:o.consumption};Ba(t,i).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,o=[],i=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=i?.power_entity?j(n?.states[i.power_entity]):null;if(i&&s!==null){let a=t&&t>0?` \xB7 ${E(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";o.push({icon:"\u26A1",label:i.name,value:`${at(n,s)}${a}`})}for(let[a,l,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let u=e.energy[a],h=u?n?.states[u]:void 0;h&&!I(h)&&o.push({icon:l,label:E(n,c),value:te(n,h)})}return o}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>tn(a,e,en(a,e),De(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),o=rl(t,n),i=Date.now(),s=i-24*36e5;on(t,o,s,i,!0).then(a=>{this.dayCurves=ol(t,a,s,i,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,o,i,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=pn(t),h=(this.floorId?t.floors.find(p=>p.id===this.floorId):void 0)??[...t.floors].sort((p,d)=>d.elevation-p.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&h){let p=0,d=0,g=0;for(let b of h.rooms)for(let[_,w]of b.points)p+=_,d+=w,g++;a.push({kind:"house",at:{floorId:h.id,x:g?p/g:u.x,z:g?d/g:u.z,y:h.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.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 o)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 i)a.push({kind:"media",at:{...p.at,y:p.at.y+.5},media:p})}this.liveCardsOn&&!this.dimmed&&a.push(...Ul(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(p=>p.at),a.length?(p,d,g,b)=>this.placeLhCard(p,d,g,b):null)}placeLhCard(e,t,n,o){let i=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);i&&(i.dataset.x=String(t),i.dataset.y=String(n),i.style.visibility=o?"visible":"hidden",e===this._liveCards.length-1&&dc(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>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),i=this.building?.floors.some(l=>l.rooms.some(c=>c.climate_card))?this.renderCardToggle():f;if(!n)return e.length||i!==f?m`<div class="nf-energy" aria-live="off">${e}${i}</div>`:f;let s=l=>E(this.hass,l),a=[];if(t.solar!==null&&a.push({cls:"solar",label:s("energy_solar"),value:ae(this.hass,t.solar)}),t.consumption!==null&&a.push({cls:"total",label:s("energy_consumption"),value:ae(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&a.push({cls:"total",label:s("energy_rest"),value:ae(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let l=[t.battery!==null?ae(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);a.push({cls:"battery",label:s("energy_battery"),value:l.join(" \xB7 ")})}if(t.grid!==null){let l=t.grid<0;a.push({cls:l?"export":"grid",label:s(l?"energy_grid_export":"energy_grid_import"),value:ae(this.hass,Math.abs(t.grid))})}if(t.tariff&&a.push({cls:"tariff",label:s("energy_tariff"),value:`${O(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let l of this.meterRows(this.building))a.push({cls:"meter",label:`${l.icon} ${l.label}`,value:l.value});return m`<div class="nf-energy" aria-live="off">
${this.liveCardsOn&&this._liveCards.some(l=>l.kind==="house")?f:a.map(l=>m`<div class="nf-energy-item nf-energy-${l.cls}"><span>${l.label}</span><b>${l.value}</b></div>`)}
${this.flows!==null?f:m`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${s("flows_hint")} aria-label=${s("flows")} @click=${()=>this.toggleFlows()}>
<span>${s("flows")}</span><b>⚡</b>
</button>`}
${this.renderCardToggle()}
${e}
</div>`}ownSensors(){return(this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[]).filter(t=>this.hass.states[t]).map(t=>m`<button class="nf-energy-item nf-own-sensor" title=${L(this.hass,t)} @click=${()=>fe(this,t)}>
<span>${L(this.hass,t)}</span><b>${ee(this.hass,this.hass.states[t])}</b>
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return El(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=st(new Date,this.hass?.config?.latitude??50),t=ur(this.heatMode,e),n=this.heatMode==="temperature",o=n?ce(this.hass,t.stops[0][0]):t.stops[0][0],i=n?ce(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?ne(this.hass):t.unit,a=l=>R(this.hass,l);return m`<div class="nf-legend">
</div>`}renderCardToggle(){return this.holograms!==null?f:m`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${E(this.hass,"holos_hint")} aria-label=${E(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
<span>${E(this.hass,"holos")}</span><b>◫</b>
</button>`}ownSensors(){return(this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[]).filter(t=>this.hass.states[t]).map(t=>m`<button class="nf-energy-item nf-own-sensor" title=${L(this.hass,t)} @click=${()=>fe(this,t)}>
<span>${L(this.hass,t)}</span><b>${te(this.hass,this.hass.states[t])}</b>
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Rl(e)?m`<a class="nf-map-credit" href=${Bo(e).href} target="_blank" rel="noopener">${Bo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=st(new Date,this.hass?.config?.latitude??50),t=cr(this.heatMode,e),n=this.heatMode==="temperature",o=n?oe(this.hass,t.stops[0][0]):t.stops[0][0],i=n?oe(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?X(this.hass):t.unit,a=l=>E(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:${La(this.heatMode,e)}"></span>
<span class="nf-legend-range"><span>${O(this.hass,o,0)} ${s}</span><span>${O(this.hass,i,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 n=(u,c)=>R(e,u,c),o=t.floors.flatMap(u=>u.furniture.filter(c=>ti(c.type)).map(c=>ni(e,this.furnitureLinks?.get(c.id)?.entity??this.furnitureLinks?.get(c.id)?.power??null))),s=o.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=iu(a);return m`<div class="nf-legend">
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>E(e,c,u),o=t.floors.flatMap(c=>c.furniture.filter(u=>ei(u.type)).map(u=>ti(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=o.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=ac(a);return m`<div class="nf-legend">
<b>📶 ${n("heat_wifi")}</b>
<span>${n("wifi_aps",{n:o.length,clients:s})}</span>
${l.online+l.offline.length?m`<span>${n("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}
${o.length?f:m`<span class="nf-legend-none">${n("wifi_none")}</span>`}
</div>`}skyColor(){let e=sn[this.theme]??sn.neon,t=this._sky;return e.night[0].map((n,o)=>Math.round(n+(e.day[0][o]-n)*t))}render(){let e=this._sky,t=(i,s)=>`rgb(${i.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=sn[this.theme]??sn.neon,o=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+il(this.building?.settings.backdrop);return m`<div
</div>`}skyColor(){let e=an[this.theme]??an.neon,t=this._sky;return e.night[0].map((n,o)=>Math.round(n+(e.day[0][o]-n)*t))}render(){let e=this._sky,t=(i,s)=>`rgb(${i.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=an[this.theme]??an.neon,o=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+il(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":""}"
style=${o}
>
${this._error?m`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${cu(this.hass,this.roomId||this.panelOpen?[]:this._liveCards,(i,s,a,l)=>this.hass?.callService(i,s,{entity_id:a,...l}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()})} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this._error?m`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${hc(this.hass,this._liveCards,(i,s,a,l)=>this.hass?.callService(i,s,{entity_id:a,...l}),{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()} ${this.renderLayers()} ${this.renderPluginWindow()}
${this.showStats&&this._stats?m`<span class="nf-stats"
><b>${this._stats.fps?R(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):R(this.hass,"stats_idle")}</b>
${this._stats.busy.length?m`(${this._stats.busy.map(i=>R(this.hass,`stats_busy_${i}`)).join(", ")})`:f} ·
${R(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${R(this.hass,this._stats.low?"stats_low":"stats_full",{r:O(this.hass,this._stats.pixelRatio,2)})}</span
><b>${this._stats.fps?E(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):E(this.hass,"stats_idle")}</b>
${this._stats.busy.length?m`(${this._stats.busy.map(i=>E(this.hass,`stats_busy_${i}`)).join(", ")})`:f} ·
${E(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${E(this.hass,this._stats.low?"stats_low":"stats_full",{r:O(this.hass,this._stats.pixelRatio,2)})}</span
>`:f}
</div>`}static styles=[Se,Ke,du,te`
</div>`}static styles=[$e,Ke,pc,ne`
:host {
display: block;
position: relative;
@@ -3279,26 +3300,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
inset: auto 16px 16px;
color: var(--nf-danger);
}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",ci);function se(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function ui(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function wm(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:ee(r,e)}var Au;function Eu(){let r=new URL("./nextfloor-editor.js?v=a29c3d0b177c",new URL(import.meta.url)).href;return Au??=import(r),Au}var vm=.25,Ru=r=>Math.round(r*1e3)/1e3,zu=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function hi(r,e,t,n,o){let i=zu(r,e,t);if(!i)return[n,o];let s=(a,l)=>H([a,l],i.points);return s(n,o)?[n,o]:s(n,t)?[n,t]:s(e,o)?[e,o]:[e,t]}function ym(r,e,t,n){return r.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let a=o.points[(s+1)%o.points.length];return Math.abs(oe(Z(i,t),n))<.02&&Math.abs(oe(Z(a,t),n))<.02}))}var di=(r,e)=>Math.abs((r-e+540)%360-180);function Tu(r,e,t,n=vm){let o=zu(r,e.x,e.z);if(!o)return null;let i=o.points,s=tt(i)>=0?1:-1,a=null;return i.forEach((l,u)=>{let c=i[(u+1)%i.length],d=Te(Z(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=oe(Z([e.x,e.z],l),p);if(g<0||g>d)return;let b=ym(r,o,l,h)?t/2:0,_=oe(Z([e.x,e.z],l),h)-b,w=Math.atan2(-h[0],h[1])*180/Math.PI,$=[{rotation:w,extent:e.d/2},{rotation:w+90,extent:e.w/2},{rotation:w-90,extent:e.w/2}].reduce((y,F)=>di(e.rotation,F.rotation)<di(e.rotation,y.rotation)?F:y);if(di(e.rotation,$.rotation)>50)return;let x=_-$.extent;Math.abs(x)>n||a&&Math.abs(x)>=Math.abs(a.gap)||(a={x:Ru(e.x-h[0]*x),z:Ru(e.z-h[1]*x),rotation:(Math.round($.rotation)%360+360)%360,gap:x})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function zr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.furniture.find(s=>s.id===e);i&&t(i,o)}return n}function Tr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.placements.find(s=>s.entity_id===e);i&&t(i,o)}return n}function Fu(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Du(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(o=>o.entity_id!==e);return t}function Pu(r,e,t,n){return Tr(r,e,(o,i)=>{[o.x,o.z]=hi(i,o.x,o.z,t,n)})}function Hu(r,e,t,n){let o=r.settings.wall_interior??.12;return zr(r,e,(i,s)=>{[i.x,i.z]=hi(s,i.x,i.z,t,n);let a=Tu(s,i,o);a&&Object.assign(i,a)})}var pi=(r,e)=>((r+e)%360+360)%360,Iu=r=>Number.parseFloat(r.replace(",",".")),wn=(r,e)=>Math.round(r*10**e)/10**e;function mi(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Iu(i.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${r.title}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",ci);function ae(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function li(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function km(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:te(r,e)}var Rc;function zc(){let r=new URL("./nextfloor-editor.js?v=a47d165ade30",new URL(import.meta.url)).href;return Rc??=import(r),Rc}var Sm=.25,Tc=r=>Math.round(r*1e3)/1e3,Fc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function di(r,e,t,n,o){let i=Fc(r,e,t);if(!i)return[n,o];let s=(a,l)=>H([a,l],i.points);return s(n,o)?[n,o]:s(n,t)?[n,t]:s(e,o)?[e,o]:[e,t]}function $m(r,e,t,n){return r.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let a=o.points[(s+1)%o.points.length];return Math.abs(ie(Y(i,t),n))<.02&&Math.abs(ie(Y(a,t),n))<.02}))}var ui=(r,e)=>Math.abs((r-e+540)%360-180);function Dc(r,e,t,n=Sm){let o=Fc(r,e.x,e.z);if(!o)return null;let i=o.points,s=tt(i)>=0?1:-1,a=null;return i.forEach((l,c)=>{let u=i[(c+1)%i.length],h=Fe(Y(u,l));if(h<.3)return;let p=[(u[0]-l[0])/h,(u[1]-l[1])/h],d=[-p[1]*s,p[0]*s],g=ie(Y([e.x,e.z],l),p);if(g<0||g>h)return;let b=$m(r,o,l,d)?t/2:0,_=ie(Y([e.x,e.z],l),d)-b,w=Math.atan2(-d[0],d[1])*180/Math.PI,M=[{rotation:w,extent:e.d/2},{rotation:w+90,extent:e.w/2},{rotation:w-90,extent:e.w/2}].reduce((y,F)=>ui(e.rotation,F.rotation)<ui(e.rotation,y.rotation)?F:y);if(ui(e.rotation,M.rotation)>50)return;let x=_-M.extent;Math.abs(x)>n||a&&Math.abs(x)>=Math.abs(a.gap)||(a={x:Tc(e.x-d[0]*x),z:Tc(e.z-d[1]*x),rotation:(Math.round(M.rotation)%360+360)%360,gap:x})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function zr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.furniture.find(s=>s.id===e);i&&t(i,o)}return n}function Tr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.placements.find(s=>s.entity_id===e);i&&t(i,o)}return n}function Pc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Hc(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(o=>o.entity_id!==e);return t}function Ic(r,e,t,n){return Tr(r,e,(o,i)=>{[o.x,o.z]=di(i,o.x,o.z,t,n)})}function Cc(r,e,t,n){let o=r.settings.wall_interior??.12;return zr(r,e,(i,s)=>{[i.x,i.z]=di(s,i.x,i.z,t,n);let a=Dc(s,i,o);a&&Object.assign(i,a)})}var hi=(r,e)=>((r+e)%360+360)%360,Nc=r=>Number.parseFloat(r.replace(",",".")),vn=(r,e)=>Math.round(r*10**e)/10**e;function pi(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Nc(i.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${r.title}
>${r.label}
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(wn(r.value,2))} @change=${o} />
</label>`}var Nu=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Cu=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function xm(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let o=(s,a)=>mi({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,u=>u[s]=wn(l,3))}),i=ms(n)?m`${mi({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??le(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=wn(s,3))})}
${n.mount_y!=null?Nu(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${o("w","size_short_w")}${o("d","size_short_d")}${o("h","size_short_h")} ${i}`}function km(r,e){let t=r.building.floors.find(l=>l.placements.some(u=>u.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let o=D(e),i=(l,u,c)=>m`<select class="nf-size-select" title=${r.t(l)} @change=${d=>r.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>`)}
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(vn(r.value,2))} @change=${o} />
</label>`}var Wc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Oc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Mm(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let o=(s,a)=>pi({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,c=>c[s]=vn(l,3))}),i=ps(n)?m`${pi({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??ce(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=vn(s,3))})}
${n.mount_y!=null?Wc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${o("w","size_short_w")}${o("d","size_short_d")}${o("h","size_short_h")} ${i}`}function Am(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let o=D(e),i=(l,c,u)=>m`<select class="nf-size-select" title=${r.t(l)} @change=${h=>r.editDevice(e,p=>Object.assign(p,{mount:h.target.value,y:null}))}>
${c.map(([h,p])=>m`<option value=${h} ?selected=${h===u}>${p}</option>`)}
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=o?wt(o,me(t,n.x,n.z),o==="light"?n.mount??"ceiling":null):1;return m`${o==="light"?i("lamp_mount",s,n.mount??"ceiling"):f}
${mi({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,u=>u.y=wn(l,3))})}
${n.y!==null?Nu(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Ou(r,e,t){let n=r.t,o;if(e){let i=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;o=m`<span>${i?he(r.hass,i):""}</span>
${xm(r,e)} ${Cu(45,s=>r.turnFurniture(e,s))}
${pi({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,c=>c.y=vn(l,3))})}
${n.y!==null?Wc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Lc(r,e,t){let n=r.t,o;if(e){let i=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;o=m`<span>${i?he(r.hass,i):""}</span>
${Mm(r,e)} ${Oc(45,s=>r.turnFurniture(e,s))}
<button class="nf-chip" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button>
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?o=m`<span>${L(r.hass,t)}</span>
${km(r,t)} ${Cu(45,i=>r.turnDevice(t,i))}
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:o=m`<span>${n("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${o}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Wu=J`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
${Am(r,t)} ${Oc(45,i=>r.turnDevice(t,i))}
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:o=m`<span>${n("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${o}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Bc=J`<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 ae=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Dt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(o=>o===n)??t,write:n=>n}),fi={explode:ae("explode",!0),keepRoof:ae("roof",!1),solidWalls:ae("solid_walls",!1),quality:Dt("quality",["auto","low","high"],"auto"),stats:ae("stats",!1),markers:Dt("markers",["none","important","all"],"important"),heat:Dt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Dt("theme",br,"neon"),clock:Dt("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:Dt("floor_stack",["dim","stacked","single"],"dim"),roomNames:ae("room_names",!0),clean:ae("clean",!1),navWrap:ae("nav_wrap",!1),weather:ae("weather",!0),timeSlider:ae("time_slider",!1),menuOpen:ae("menu_open",!1),keepCamera:ae("keep_camera",!1),readable:ae("readable",!1),plain:ae("plain",!1),rightBack:ae("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:ae("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function Lu(r=Dr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Bu(r=Dr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Dr(){try{return localStorage}catch{return null}}var Fr=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 n of Object.keys(fi)){let o=fi[n],i=this.raw(o.name);t[n]=i===null?o.fallback:o.read(i)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=fi[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Vu=te`
</svg>`;var le=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Pt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(o=>o===n)??t,write:n=>n}),mi={explode:le("explode",!0),keepRoof:le("roof",!1),solidWalls:le("solid_walls",!1),quality:Pt("quality",["auto","low","high"],"auto"),stats:le("stats",!1),markers:Pt("markers",["none","important","all"],"important"),heat:Pt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Pt("theme",br,"neon"),clock:Pt("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:Pt("floor_stack",["dim","stacked","single"],"dim"),roomNames:le("room_names",!0),clean:le("clean",!1),navWrap:le("nav_wrap",!1),weather:le("weather",!0),timeSlider:le("time_slider",!1),menuOpen:le("menu_open",!1),keepCamera:le("keep_camera",!1),readable:le("readable",!1),plain:le("plain",!1),rightBack:le("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:le("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function Vc(r=Dr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Kc(r=Dr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Dr(){try{return localStorage}catch{return null}}var Fr=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 n of Object.keys(mi)){let o=mi[n],i=this.raw(o.name);t[n]=i===null?o.fallback:o.read(i)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=mi[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Gc=ne`
.nf-dot {
display: inline-block;
width: 8px;
@@ -3783,11 +3804,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
gap: 12px;
margin: auto;
}
`;var gi=class extends re{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{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 Fr(Dr());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,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:et(pt(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,n=i=>`${String(Math.floor(i)).padStart(2,"0")}:${String(Math.round(i%1*60)).padStart(2,"0")}`,o=()=>{let i=new Date;return Math.round((i.getHours()+i.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?o():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
`;var fi=class extends re{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{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 Fr(Dr());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,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:et(pt(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,n=i=>`${String(Math.floor(i)).padStart(2,"0")}:${String(Math.round(i%1*60)).padStart(2,"0")}`,o=()=>{let i=new Date;return Math.round((i.getHours()+i.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?o():null)}>☀ ${t===null?e("time_of_day"):n(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=${i=>this._timeDrag=Number(i.target.value)}
@change=${i=>(this._timeDrag=null,this._timeOfDay=Number(i.target.value))}
/></label>`:f}`}t=(e,t)=>R(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=pr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let n=qt(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>zr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Tr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>zr(n,e,o=>o.rotation=pi(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Tr(n,e,o=>o.rotation=pi(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Fu(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Du(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(o=>({...o,rooms:o.rooms.map(i=>i.id===e?{...i,moods:t.length?t:void 0}:i)}))}))}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._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&&tr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=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)=>E(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=pr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let n=Zt(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>zr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Tr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>zr(n,e,o=>o.rotation=hi(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Tr(n,e,o=>o.rotation=hi(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Pc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Hc(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(o=>({...o,rooms:o.rooms.map(i=>i.id===e?{...i,moods:t.length?t:void 0}:i)}))}))}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._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&&tr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=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}
@@ -3839,7 +3860,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</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.data.saveState,n=(i,s,a="")=>m`<button role="tab" class=${a} aria-pressed=${this._mode===i} @click=${()=>this.setMode(i)}>${s}</button>`,o=t==="saving"?"saving":t==="saved"?"saved":"save_error";return m`<header class="nf-header">
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
<h1>${Wu}NextFloor</h1>
<h1>${Bc}NextFloor</h1>
${this.isAdmin?m`<div class="nf-seg" role="tablist">${n("view",this.t("view"))}${n("editor",this.t("editor"))}${n("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
<span class="nf-grow"></span>
${this.isAdmin&&this.hass.symconRefresh?m`<button class="nf-btn nf-reload-variables" ?disabled=${this._variablesLoading} aria-busy=${this._variablesLoading} @click=${()=>{this.reloadVariables()}}>↻ ${this.t(this._variablesLoading?"symcon_variables_loading":"symcon_variables_reload")}</button>`:f}
@@ -3853,7 +3874,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<span>${this.t("draft_found",{time:n})}</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():(Eu().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():(zc().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"
@@ -3864,40 +3885,40 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.loadCardEditor=${Mn}
@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(o=>o.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let o=this._floorUndo;return m`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let i of o)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=nn(el(t).map(o=>this.hass.states[o]));return n.count<2?f:m`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let o of n.off)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(u=>!this._floorId||u.id===this._floorId),n=e.floors.length>1,o=this._prefs.navWrap,i=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=n?m`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
${[...e.floors].reverse().map(u=>m`<button class="nf-chip" aria-pressed=${u.id===this._floorId} @click=${()=>this.openFloor(u.id)}>${u.name}</button>`)}
></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(o=>o.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let o=this._floorUndo;return m`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let i of o)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=rn(el(t).map(o=>this.hass.states[o]));return n.count<2?f:m`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let o of n.off)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=e.floors.length>1,o=this._prefs.navWrap,i=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=n?m`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
${[...e.floors].reverse().map(c=>m`<button class="nf-chip" aria-pressed=${c.id===this._floorId} @click=${()=>this.openFloor(c.id)}>${c.name}</button>`)}
${i} ${this.allOffChip(e)}
<span class="nf-sep"></span>`:m`${i} ${this.allOffChip(e)}`,a=t.flatMap(u=>[t.length>1&&u.rooms.length?m`<span class="nf-nav-floor">${u.name}</span>`:f,...u.rooms.map(c=>m`<button
<span class="nf-sep"></span>`:m`${i} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?m`<span class="nf-nav-floor">${c.name}</span>`:f,...c.rooms.map(u=>m`<button
class="nf-chip nf-room-chip"
aria-pressed=${c.id===this._roomId}
@click=${()=>{n&&(this._floorId=u.id),this._roomId=c.id===this._roomId?null:c.id,this._outside=!1}}
aria-pressed=${u.id===this._roomId}
@click=${()=>{n&&(this._floorId=c.id),this._roomId=u.id===this._roomId?null:u.id,this._outside=!1}}
>
${c.name}
${u.name}
</button>`)]),l=this.t(o?"nav_row":"nav_wrap");return m`<nav class="nf-nav ${o?"nf-nav-wrap":""}" @wheel=${this.onNavWheel}>
${s}${a}
<button class="nf-chip nf-nav-toggle" title=${l} aria-label=${l} aria-pressed=${o} @click=${()=>this.setPref("navWrap",!o)}>${o?"\u2194":"\u2261"}</button>
</nav>`}toggleChip(e,t,n){return m`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,o=(c,d)=>m`<div class="nf-seg">${[c,d].map(([p,h,g])=>m`<button aria-pressed=${p} @click=${h}>${g}</button>`)}</div>`,i=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?m`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,u=m`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?m`<div class="nf-overlay">
</nav>`}toggleChip(e,t,n){return m`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,o=(u,h)=>m`<div class="nf-seg">${[u,h].map(([p,d,g])=>m`<button aria-pressed=${p} @click=${d}>${g}</button>`)}</div>`,i=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?m`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,c=m`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?m`<div class="nf-overlay">
<div class="nf-switches-veil" @click=${()=>this._switchesOpen=!1}></div>
<div class="nf-switches" role="group" aria-label=${n("bars_unfold")} @keydown=${c=>c.key==="Escape"&&(this._switchesOpen=!1)}>
<div class="nf-switches" role="group" aria-label=${n("bars_unfold")} @keydown=${u=>u.key==="Escape"&&(this._switchesOpen=!1)}>
<div class="nf-seg">
${["auto","cut","slope"].map(c=>m`<button aria-pressed=${this._wallMode===c} title=${c==="slope"?n("walls_slope_hint"):f} @click=${()=>this._wallMode=c}>${n(`walls_${c}`)}</button>`)}
${["auto","cut","slope"].map(u=>m`<button aria-pressed=${this._wallMode===u} title=${u==="slope"?n("walls_slope_hint"):f} @click=${()=>this._wallMode=u}>${n(`walls_${u}`)}</button>`)}
</div>
<div class="nf-seg"><button aria-pressed=${t.solidWalls} title=${n("walls_solid_hint")} @click=${()=>this.setPref("solidWalls",!t.solidWalls)}>${n("walls_solid")}</button></div>
${a&&!this._floorId?o([t.explode,()=>this.setPref("explode",!0),n("floors_apart")],[!t.explode,()=>this.setPref("explode",!1),n("floors_stacked")]):f}
${!this._floorId&&e.settings.roof.type!=="none"?m`<div class="nf-seg"><button aria-pressed=${t.keepRoof} title=${n("roof_keep_hint")} @click=${()=>this.setPref("keepRoof",!t.keepRoof)}>${n("roof_keep")}</button></div>`:f}
${a&&this._floorId?m`<div class="nf-seg" role="group" aria-label=${n("card_floor_stack")}>
${s.map(c=>m`<button aria-pressed=${t.floorStack===c} @click=${()=>this.setPref("floorStack",c)}>${n(`floor_stack_short_${c}`)}</button>`)}
${s.map(u=>m`<button aria-pressed=${t.floorStack===u} @click=${()=>this.setPref("floorStack",u)}>${n(`floor_stack_short_${u}`)}</button>`)}
</div>`:f}
<div class="nf-seg" role="group" aria-label=${n("heatmap")}>
${i.map(c=>m`<button aria-pressed=${t.heat===c} @click=${()=>this.setPref("heat",c)}>${n(c==="none"?"heat_off":`heat_short_${c}`)}</button>`)}
${i.map(u=>m`<button aria-pressed=${t.heat===u} @click=${()=>this.setPref("heat",u)}>${n(u==="none"?"heat_off":`heat_short_${u}`)}</button>`)}
</div>
${this.toggleChip("roomNames","room_names_short")}
${this.toggleChip("weather","weather_short","weather_hint")}
${t.timeSlider?this.renderTimeOfDay():f}
</div>
${u}${l}
</div>`:m`<div class="nf-overlay">${u}${l}</div>`}renderView(e){if(!e.floors.some(o=>o.rooms.length))return m`<div class="nf-empty">
${c}${l}
</div>`:m`<div class="nf-overlay">${c}${l}</div>`}renderView(e){if(!e.floors.some(o=>o.rooms.length))return m`<div class="nf-empty">
<p>${this.t(this.isAdmin?e.floors.length?"no_rooms_admin":"no_building_admin":"no_building")}</p>
${this.isAdmin?m`<button class="nf-btn nf-primary" @click=${()=>this.setMode("editor")}>${this.t("open_editor")}</button>`:f}
</div>`;let t=this._prefs,n=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this._roomId)??null;return this.furnishHost.hass=this.hass,this.furnishHost.building=e,m`
@@ -3943,9 +3964,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
?furnish=${this._furnish}
.selectedFurniture=${this._selFurniture}
@furniture-select=${o=>this._selFurniture=o.detail.id}
@furniture-move=${o=>this.applyEdit(i=>Hu(i,o.detail.id,o.detail.x,o.detail.z))}
@furniture-move=${o=>this.applyEdit(i=>Cc(i,o.detail.id,o.detail.x,o.detail.z))}
@device-select=${o=>this._selDevice=o.detail.id}
@device-move=${o=>this.applyEdit(i=>Pu(i,o.detail.id,o.detail.x,o.detail.z))}
@device-move=${o=>this.applyEdit(i=>Ic(i,o.detail.id,o.detail.x,o.detail.z))}
.quality=${t.quality}
?showStats=${t.stats}
@room-tap=${this.onRoomTap}
@@ -3974,9 +3995,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@close=${()=>this._outside=!1}
></nf-room-panel>`:f}
${t.clean?f:this.renderOverlay(e)}
${this._furnish?Ou(this.furnishHost,this._selFurniture,this._selDevice):f}
${this._furnish?Lc(this.furnishHost,this._selFurniture,this._selDevice):f}
</div>
`}static styles=[Se,Ke,Vu,hr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",gi);var Sm=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Ku=(r,e)=>Number(r)*60+Number(e);function vn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Sm.exec(r.trim());if(!n)return!1;let o=Ku(n[1],n[2]),i=Ku(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Pr=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(vn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Gu(r,e){return r?r.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(n=>({id:n.id,name:n.name||"\u2013",floorId:t.id}))})):[]}var Uu=te`
`}static styles=[$e,Ke,Gc,hr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",fi);var Em=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Uc=(r,e)=>Number(r)*60+Number(e);function yn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Em.exec(r.trim());if(!n)return!1;let o=Uc(n[1],n[2]),i=Uc(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Pr=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 jc(r,e){return r?r.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(n=>({id:n.id,name:n.name||"\u2013",floorId:t.id}))})):[]}var qc=ne`
ha-card {
overflow: hidden;
background: var(--nf-bg);
@@ -4100,14 +4121,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
justify-content: flex-end;
}
}
`;function _i(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:o,template:i,...s}=n;return{...s,...r}}function ju(r,e){let t=new Set(e),n=[];for(let i of r.floors){let s=i.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));n.push({...i,rooms:s,openings:i.openings.filter(u=>l.has(u.room_id)),furniture:i.furniture.filter(u=>a(u.x,u.z)),placements:i.placements.filter(u=>a(u.x,u.z)),walls:(i.walls??[]).filter(u=>a((u.a[0]+u.b[0])/2,(u.a[1]+u.b[1])/2)),outdoor:[]})}let o={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:o}}}var Pt="nf-outside",bi=class extends re{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{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}};_own=null;templatesSeen;roomApplied=!1;data=new bt(this);kiosk=new Pr({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._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,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 Mn(),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._own=e,this._config=_i(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=vn(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=_i(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=pr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=vn(this._config?.night,this.hass);n!==this._night&&(this._night=n)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null: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 n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:ju(e,t)}),this.roomsMemo.result}t=e=>R(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,o=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,i=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!o&&(e?.floors.length??0)>1;return{floorId:o,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?.controls&&!i)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,o=["temperature","humidity","co2"].filter(s=>this.shows(s)),i=(s,a)=>m`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,u,c])=>m`<button aria-pressed=${l} @click=${u}>${c}</button>`)}</div>`;return m`<div class="nf-card-controls">
`;function gi(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:o,template:i,...s}=n;return{...s,...r}}function Zc(r,e){let t=new Set(e),n=[];for(let i of r.floors){let s=i.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));n.push({...i,rooms:s,openings:i.openings.filter(c=>l.has(c.room_id)),furniture:i.furniture.filter(c=>a(c.x,c.z)),placements:i.placements.filter(c=>a(c.x,c.z)),walls:(i.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let o={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:o}}}var Ht="nf-outside",_i=class extends re{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{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}};_own=null;templatesSeen;roomApplied=!1;data=new bt(this);kiosk=new Pr({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._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,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 Mn(),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._own=e,this._config=gi(e,this.data.building?.settings.card_templates),this._floorId=void 0,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=gi(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=pr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=yn(this._config?.night,this.hass);n!==this._night&&(this._night=n)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null: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 n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:Zc(e,t)}),this.roomsMemo.result}t=e=>E(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,o=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,i=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!o&&(e?.floors.length??0)>1;return{floorId:o,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?.controls&&!i)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,o=["temperature","humidity","co2"].filter(s=>this.shows(s)),i=(s,a)=>m`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>m`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return m`<div class="nf-card-controls">
${e.canGoBack?m`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f}
${this.shows("walls")?i(void 0,[[e.walls==="auto",()=>this._walls="auto",n("walls_auto")],[e.walls==="cut",()=>this._walls="cut",n("walls_cut")],[e.walls==="slope",()=>this._walls="slope",n("walls_slope")]]):f}
${this.shows("floors")&&t.floors.length>1&&!e.floorId?i(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
${o.length>0?i(n("heatmap"),["none",...o].map(s=>[e.heat===s,()=>this._heat=s,n(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;let n=Gu(t,e.floorId);if(!n.length)return f;let o=n.length>1,i=(l,u)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=u===this._roomId?null:u},s=qt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Pt?null:Pt};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")}>
${n.map(l=>m`${o?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=${()=>i(l.floorId,u.id)}>${u.name}</button>`)}`)}
${s?m`<button class="nf-chip" aria-pressed=${this._roomId===Pt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=jc(t,e.floorId);if(!n.length)return f;let o=n.length>1,i=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=Zt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Ht?null:Ht};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")}>
${n.map(l=>m`${o?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=${()=>i(l.floorId,c.id)}>${c.name}</button>`)}`)}
${s?m`<button class="nf-chip" aria-pressed=${this._roomId===Ht} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
</div>`}renderCorners(){let e=this._config,t=this.t,n=this._clean||!!this._roomId&&e?.room_panel!==!1;return m`${e?.fullscreen_button&&!n?m`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
${this._fullscreen?"\u2715":"\u26F6"}
</button>`:f}
@@ -4118,8 +4139,8 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.building=${t}
.packs=${this.data.packs}
.floorId=${e.floorId}
.roomId=${this._roomId===Pt?null:this._roomId}
.outsideOpen=${this._roomId===Pt}
.roomId=${this._roomId===Ht?null:this._roomId}
.outsideOpen=${this._roomId===Ht}
.wallMode=${e.walls}
.solidWalls=${n?.solid_walls===!0}
.explode=${e.explode}
@@ -4158,10 +4179,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.panelOpen=${!!this._roomId&&n?.room_panel!==!1}
.alerts=${n?.alerts!==!1}
.alertJump=${!!n?.alert_jump}
.announcements=${n?.announcements!==!1&&!Bu()}
.announcements=${n?.announcements!==!1&&!Kc()}
.sensorBar=${n?.sensor_bar!==!1}
.glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null}
.screenName=${n?.screen_name??Lu()}
.screenName=${n?.screen_name??Vc()}
.scenes=${n?.scenes!==!1}
.clean=${this._clean}
.cleanButton=${i}
@@ -4182,19 +4203,19 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.hass=${this.hass}
.room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null}
.floor=${e.floors.find(t=>t.rooms.some(n=>n.id===this._roomId))??null}
.outside=${this._roomId===Pt?qt(this.hass,e.floors):null}
.outside=${this._roomId===Ht?Zt(this.hass,e.floors):null}
.confirmEntities=${it(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
@close=${()=>this._roomId=null}
></nf-room-panel>`}render(){if(this.hass&&tr(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 n=this.stage(),o=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,i=/^#[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=${i?`--nf-accent:${i}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
<div class="nf-card-body" style="height:${o}">
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):m`<p class="nf-card-msg">${this.data.error??(e?R(this.hass,"no_building"):R(this.hass,"loading"))}</p>`}
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):m`<p class="nf-card-msg">${this.data.error??(e?E(this.hass,"no_building"):E(this.hass,"loading"))}</p>`}
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
${this.renderRoomButtons(n)}
${n.showBar&&e?this.renderBar(n):f}
${this.renderCorners()}
</div>
</ha-card>`}static styles=[Se,Ke,Uu,hr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",bi);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:R(void 0,"card_name"),description:R(void 0,"card_description"),preview:!1})}Xr();
</ha-card>`}static styles=[$e,Ke,qc,hr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",_i);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:E(void 0,"card_name"),description:E(void 0,"card_description"),preview:!1})}Xr();
/*! Bundled license information:
@lit/reactive-element/css-tag.js:
@@ -5,7 +5,7 @@ import { entityAreaId, entityKind, entityName, groupByDevice, isClimateValueSens
import { iconPath } from "../../../icons.ts";
import { pointInPolygon, type Room } from "../../../model.ts";
import { entityOptions } from "../entities.ts";
import { deviceIcon, entityField, hint } from "../fields.ts";
import { checkField, deviceIcon, entityField, hint } from "../fields.ts";
import type { EditorHost } from "../host.ts";
import { matchesQuery, placedElsewhere, placedInRoom, rankedBy, takeFirst, withToggled } from "../ops/device-list.ts";
import type { SideState } from "../side-state.ts";
@@ -133,10 +133,10 @@ export function renderRoomClimate(host: EditorHost, room: Room, patch: (patch: P
};
const field = (key: ClimateKey, label: string) => {
const found = roomClimateSensors(hass, host.floor ?? null, { ...room, climate: null }, key);
const wanted = entityOptions(hass, (id) => isClimateValueSensor(hass, id, key));
const picked = [room.climate?.[key] ?? null].flat();
const wanted = entityOptions(hass, (id) => isClimateValueSensor(hass, id, key, true) && (!hass.states[id]?.attributes.symcon_source_entity || picked.includes(id)));
// the room's own sensors first, then the others; device temperatures (a printer, a heat pump) come last
const options = rankedBy(wanted, (id) => (entityAreaId(hass, id) === room.area_id ? 0 : 1) + (isRoomClimateSensor(hass, id) ? 0 : 2));
const picked = [room.climate?.[key] ?? null].flat();
// several sensors are averaged: once one is chosen, another can be added; "none" in a slot drops it
const save = (list: (string | null)[]) => {
const ids = list.filter((id): id is string => !!id && id !== "none");
@@ -146,9 +146,11 @@ export function renderRoomClimate(host: EditorHost, room: Room, patch: (patch: P
const slots = real ? [...picked, null] : picked;
return slots.map((id, i) => entityField(host, i ? host.t("climate_more") : label, id, i ? undefined : (found[0] ?? null), options, (v) => save(slots.map((x, j) => (j === i ? v : x)))));
};
return html`<details class="nf-points" ?open=${chosen}>
return html`<details class="nf-points" ?open=${chosen || !!room.climate_card}>
<summary>${host.t("climate")}</summary>
<div class="nf-form">${field("temperature", host.t("climate_temperature"))} ${field("humidity", host.t("climate_humidity"))} ${field("co2", host.t("climate_co2"))}</div>
${checkField(host, host.t("climate_card"), !!room.climate_card, (on) => patch({ climate_card: on || undefined }))}
${hint(host.t("climate_card_hint"))}
${hint(host.t("climate_hint"))}
</details>`;
}
+16 -10
View File
@@ -30,6 +30,7 @@ import { gateStates } from "../entities/gates.ts";
import { weatherEntity } from "../weather.ts";
import { chosenEffects, readSkyWeather, withDensity } from "../live/sky-weather.ts";
import { energyPicture, houseHub, type EnergyPicture } from "../live/energy-flow.ts";
import { roomClimateCards } from "../live/room-climate-card.ts";
import { loadWeek, type WeekBars } from "../live/week-bars.ts";
import { binsDue, loadToday, sortDay, type TodayItem } from "../live/today.ts";
import { forecastDays, loadForecast } from "../live/forecast.ts";
@@ -690,7 +691,7 @@ export class NfView3d extends LitElement {
if (changed.has("building") || changed.has("theme") || changed.has("floorThumbs") || changed.has("packs")) this.scheduleThumbs();
// markers shown by kind outside the opened room change with the room
const byRoom = this.markersOutside ? ["markersOutside", "floorId", "roomId"] : ["markersOutside"];
const forced = this.pluginsDirty || ["building", "markerMode", "heatMode", "flows", "alerts", "dimmed", ...byRoom].some((k) => changed.has(k));
const forced = this.pluginsDirty || ["building", "markerMode", "heatMode", "flows", "alerts", "dimmed", "holograms", "roomLabels", "floorId", "roomId", ...byRoom].some((k) => changed.has(k));
this.pluginsDirty = false;
if (forced || changed.has("hass")) this.syncDevices(forced);
if (changed.has("autoOrbit")) v.setAutoOrbit(this.autoOrbit ? 0.06 : 0);
@@ -969,7 +970,7 @@ export class NfView3d extends LitElement {
playing.filter((m) => m.rings > 0).map((m) => ({ id: m.entity, at: m.at, color: m.color, level: m.volume ?? 0.5, size: m.rings })),
multiroom(playing).map(([a, c]) => [a.at, c.at]),
);
this.syncLhCards(v, b, livePic, liveCars, playing);
this.syncLhCards(v, b, livePic, liveCars, playing, hass);
// TV screens: a TV or monitor linked to a media player that runs shows what runs
v.setLiveScreens(this.dimmed ? [] : liveScreens(hass, b, this.furnitureLinks));
v.setPictures(this.framePictures(hass, b));
@@ -2618,7 +2619,7 @@ export class NfView3d extends LitElement {
.catch(() => (this.dayCurves = null));
}
private syncLhCards(v: NextFloorViewer, b: Building, pic: EnergyPicture, cars: ReturnType<NfView3d["liveCars"]>, media: MediaNow[]): void {
private syncLhCards(v: NextFloorViewer, b: Building, pic: EnergyPicture, cars: ReturnType<NfView3d["liveCars"]>, media: MediaNow[], hass: HomeAssistant): void {
const cards: LiveCard[] = [];
const s = pic.summary;
const hasEnergy = s.solar !== null || s.grid !== null || s.battery !== null || s.consumption !== null;
@@ -2639,6 +2640,7 @@ export class NfView3d extends LitElement {
for (const p of this.liveHeatPumps(b)) cards.push({ kind: "heatpump", at: p.at, name: p.name, pump: p.pump });
for (const m of media) cards.push({ kind: "media", at: { ...m.at, y: m.at.y + 0.5 }, media: m });
}
if (this.liveCardsOn && !this.dimmed) cards.push(...roomClimateCards(hass, b, this.floorId, this.roomId));
if (JSON.stringify(cards) !== JSON.stringify(this._liveCards)) this._liveCards = cards;
v.setLiveAnchors(
cards.map((c) => c.at),
@@ -2689,7 +2691,9 @@ export class NfView3d extends LitElement {
const own = this.ownSensors();
const e = this._liveEnergy?.summary;
const energy = !!e && !this.roomId && this.showEnergy && !!this.hass && !(e.consumption === null && e.grid === null && e.solar === null && e.battery === null);
if (!energy) return own.length ? html`<div class="nf-energy" aria-live="off">${own}</div>` : nothing;
const climate = this.building?.floors.some((f) => f.rooms.some((r) => r.climate_card));
const climateToggle = climate ? this.renderCardToggle() : nothing;
if (!energy) return own.length || climateToggle !== nothing ? html`<div class="nf-energy" aria-live="off">${own}${climateToggle}</div>` : nothing;
const t = (k: Parameters<typeof translate>[1]) => translate(this.hass, k);
const items: { cls: string; label: string; value: string }[] = [];
if (e.solar !== null) items.push({ cls: "solar", label: t("energy_solar"), value: formatPower(this.hass, e.solar) });
@@ -2712,15 +2716,17 @@ export class NfView3d extends LitElement {
: html`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${t("flows_hint")} aria-label=${t("flows")} @click=${() => this.toggleFlows()}>
<span>${t("flows")}</span><b>⚡</b>
</button>`}
${this.holograms !== null
? nothing
: html`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._liveCardOn} title=${t("holos_hint")} aria-label=${t("holos")} @click=${() => this.toggleLhCards()}>
<span>${t("holos")}</span><b>◫</b>
</button>`}
${this.renderCardToggle()}
${own}
</div>`;
}
private renderCardToggle() {
return this.holograms !== null ? nothing : html`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${translate(this.hass, "holos_hint")} aria-label=${translate(this.hass, "holos")} @click=${() => this.toggleLhCards()}>
<span>${translate(this.hass, "holos")}</span><b>◫</b>
</button>`;
}
/** The plan's own sensors at the top (outside temperature, the alarm…): their name and state; a tap opens their details. */
private ownSensors() {
const ids = this.sensorBar && this.hass ? (this.building?.settings.status_entities ?? []) : [];
@@ -2795,7 +2801,7 @@ export class NfView3d extends LitElement {
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" : ""}"
style=${style}
>
${this._error ? html`<p class="nf-error">${this._error}</p>` : nothing} ${this.renderTopLeft()} ${renderLhCards(this.hass, this.roomId || this.panelOpen ? [] : this._liveCards, (domain, service, entity, data) => this.hass?.callService(domain, service, { entity_id: entity, ...data }), { folded: this._houseFolded, toggle: () => this.toggleHouseFold() })} ${this.clean ? nothing : this.renderLegend()} ${this.renderMapCredit()}
${this._error ? html`<p class="nf-error">${this._error}</p>` : nothing} ${this.renderTopLeft()} ${renderLhCards(this.hass, this._liveCards, (domain, service, entity, data) => this.hass?.callService(domain, service, { entity_id: entity, ...data }), { folded: this._houseFolded, toggle: () => this.toggleHouseFold() }, !!this.roomId || this.panelOpen)} ${this.clean ? nothing : this.renderLegend()} ${this.renderMapCredit()}
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean ? nothing : html`${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()} ${this.renderLayers()} ${this.renderPluginWindow()}
${this.showStats && this._stats
@@ -47,3 +47,10 @@ test("a standalone blind's separate slat position is watched", () => {
b.floors[0].placements.push({ entity_id: "cover.blind", cover_tilt: "cover.slats", x: 2, z: 2, y: null });
assert.ok(watchedEntities(inputs({ building: b })).includes("cover.slats"));
});
test("room cards watch explicitly chosen values outside the area, including a source that is temporarily missing", () => {
const b = building();
Object.assign(b.floors[0].rooms[0], { climate_card: true, climate: { humidity: "cover.knx", temperature: "sensor.missing", co2: "sensor.other_room" } });
const ids = watchedEntities(inputs({ building: b, needsRoomSensors: false }));
for (const id of ["cover.knx", "sensor.missing", "sensor.other_room"]) assert.ok(ids.includes(id), id);
});
+4 -2
View File
@@ -2,7 +2,7 @@
// everything it shows: devices and their power sensors, openings and their contacts, energy, presence, heat, weather, and so on.
import { alertEntities, type AlertSources } from "../../alerts.ts";
import { carWatched, deviceSiblings, kindOf, robotRoomSensor, type FurnitureLinks, type OpeningEntities, roomEntities } from "../../devices.ts";
import { carWatched, deviceSiblings, kindOf, robotRoomSensor, roomClimateSensors, type FurnitureLinks, type OpeningEntities, roomEntities } from "../../devices.ts";
import { powerSensorFor } from "../../energy.ts";
import { placedEntities } from "../../markers.ts";
import type { Building } from "../../model.ts";
@@ -59,7 +59,9 @@ export function watchedEntities(inputs: WatchInputs): string[] {
const placed = placedEntities(b);
const energy = b.energy;
const lightsOfRooms = roomsOf(b).flatMap((r) => roomEntities(hass, r).filter((id) => kindOf(id) === "light"));
const sensorsOfRooms = inputs.needsRoomSensors ? roomsOf(b).flatMap((r) => roomEntities(hass, r).filter((id) => id.startsWith("sensor.") || id.startsWith("climate."))) : [];
const sensorsOfRooms = b.floors.flatMap((f) => f.rooms.flatMap((r) => inputs.needsRoomSensors || r.climate_card
? [...roomEntities(hass, r).filter((id) => id.startsWith("sensor.") || id.startsWith("climate.")), ...Object.values(r.climate ?? {}).flat(), ...(["temperature", "humidity", "co2"] as const).flatMap((key) => roomClimateSensors(hass, f, r, key))]
: []));
const ids: MaybeId[] = [
...placed,
...b.floors.flatMap((f) => f.placements.map((p) => p.cover_tilt)),
+14
View File
@@ -21,6 +21,20 @@ test("a KNX numeric temperature remains selectable and readable even with an inf
assert.equal(roomClimateValue(hass, null, { ...room, climate: { temperature: "sensor.fahrenheit" } }, "temperature"), 20);
});
test("manual Symcon climate assignment accepts unclassified numeric values without relaxing automatic detection", () => {
const h = hassOf([
entity("cover.knx", "open", { symcon_id: 12, symcon_variable_type: 2, symcon_numeric_value: 48.5 }),
entity("sensor.percent", "50", { unit_of_measurement: "%" }),
entity("sensor.soil", "50", { device_class: "moisture", unit_of_measurement: "%" }),
entity("sensor.text", "50", { symcon_id: 13, symcon_variable_type: 3, unit_of_measurement: "%" }),
]);
assert.equal(isClimateValueSensor(h, "cover.knx", "humidity", true), true);
assert.equal(isClimateValueSensor(h, "cover.knx", "humidity"), false);
assert.equal(isClimateValueSensor(h, "sensor.percent", "humidity"), true);
assert.equal(isClimateValueSensor(h, "sensor.soil", "humidity"), false);
assert.equal(isClimateValueSensor(h, "sensor.text", "humidity", true), false);
});
const lounge = hassOf(
[
entity("light.ceiling", "on"),
+8 -1
View File
@@ -210,13 +210,18 @@ export const CLIMATE_CLASSES = { temperature: "temperature", humidity: "humidity
export type ClimateKey = keyof typeof CLIMATE_CLASSES;
/** Numeric room values, including Symcon readings whose legacy domain was inferred from a parent name. */
export function isClimateValueSensor(hass: HomeAssistant, id: string, key: ClimateKey): boolean {
export function isClimateValueSensor(hass: HomeAssistant, id: string, key: ClimateKey, manual = false): boolean {
const a = hass.states[id]?.attributes;
if (!a) return false;
const symconNumber = (a.symcon_variable_type === 1 || a.symcon_variable_type === 2) && typeof a.symcon_id === "number";
if (typeof a.symcon_id === "number" && !symconNumber) return false;
if (!symconNumber && !/^(sensor|input_number|number)\./.test(id)) return false;
// An explicit assignment gives an otherwise unclassified Symcon number its meaning.
if (manual && symconNumber) return true;
const unit = String(a.unit_of_measurement ?? "").replace(/\s/g, "").toLowerCase();
if (key === "temperature" && ["°c", "°f", "℃", "℉", "k"].includes(unit)) return true;
if (key === "humidity" && !a.device_class && ["%", "%rh", "%r.h.", "%rf", "%r.f."].includes(unit)) return true;
if (key === "co2" && unit === "ppm" && /co[₂2]/i.test(String(a.friendly_name ?? ""))) return true;
return a.device_class === CLIMATE_CLASSES[key];
}
@@ -264,11 +269,13 @@ export function roomClimateValue(hass: HomeAssistant, floor: Floor | null, room:
const readings = roomClimateSensors(hass, floor, room, key)
.map((id) => {
const state = hass.states[id];
if (!state || isUnavailable(state) || (!state.state.trim() && state.attributes.symcon_numeric_value === undefined)) return NaN;
const reading = Number(state?.attributes.symcon_numeric_value ?? state?.state);
return key === "temperature" ? toCelsius(reading, hass.states[id]?.attributes.unit_of_measurement) : reading;
})
.filter(Number.isFinite);
if (readings.length) return readings.reduce((sum, v) => sum + v, 0) / readings.length;
if (room.climate?.[key]) return null;
// no room sensor: a thermostat of the room's area tells its temperature and humidity (heating curves, the heat map)
if (key === "co2" || room.climate?.[key] === "none") return null;
const attr = key === "temperature" ? "current_temperature" : "current_humidity";
+6
View File
@@ -25,6 +25,9 @@ const DE = {
reload_page: "Neu laden",
symcon_variables_reload: "Variablen neu laden",
symcon_cover_position: "Position (Behang)",
climate_card: "Raumklima als schwebende Karte",
climate_card_hint: "Zeigt Temperatur, Luftfeuchtigkeit und CO₂ über diesem Raum. In der 3D-Ansicht lassen sie sich über „Karten“ ein- und ausblenden.",
climate_card_missing: "Keine aktuellen Messwerte",
cover_tilt_entity: "Lamellenposition",
cover2_tilt_entity: "Lamellenposition (zweiter Behang)",
symcon_variables_loading: "Variablen werden geladen …",
@@ -2051,6 +2054,9 @@ const EN: Record<Key, string> = {
reload_page: "Reload",
symcon_variables_reload: "Reload variables",
symcon_cover_position: "Blind position",
climate_card: "Room climate as a floating card",
climate_card_hint: "Shows temperature, humidity and CO₂ over this room. Toggle them with “Cards” in the 3D view.",
climate_card_missing: "No current readings",
cover_tilt_entity: "Slat position",
cover2_tilt_entity: "Slat position (second blind)",
symcon_variables_loading: "Loading variables …",
+31 -3
View File
@@ -18,6 +18,8 @@ import { curvePath } from "./day-curves.ts";
import type { PrinterInfo } from "./printer.ts";
import type { HeatPumpInfo } from "./heat-pump.ts";
import type { PlanPoint } from "../viewer/live-energy.ts";
import type { RoomClimateCard } from "./room-climate-card.ts";
import { fromCelsius, tempUnit } from "../devices.ts";
export interface HouseCard {
kind: "house";
@@ -60,7 +62,7 @@ export interface HeatPumpCard {
pump: HeatPumpInfo;
}
export type LiveCard = HouseCard | CarCard | MediaCard | PrinterCard | HeatPumpCard;
export type LiveCard = HouseCard | CarCard | MediaCard | PrinterCard | HeatPumpCard | RoomClimateCard;
/** A button on a card was pressed: the 3D view calls the service (with extra data such as the volume). */
export type LiveCardAction = (domain: string, service: string, entity: string, data?: Record<string, unknown>) => void;
@@ -312,10 +314,21 @@ function heatPumpCard(hass: HomeAssistant | undefined, c: HeatPumpCard, i: numbe
</div>`;
}
export function renderLhCards(hass: HomeAssistant | undefined, cards: readonly LiveCard[], act: LiveCardAction, fold?: LiveCardFold): TemplateResult | typeof nothing {
function roomClimateCard(hass: HomeAssistant | undefined, c: RoomClimateCard, i: number): TemplateResult {
const value = (n: number | null, digits: number, unit: string) => n === null ? "–" : `${formatNumber(hass, n, digits)} ${unit}`;
return html`<div class="live-card live-card-roomclimate" data-i=${i} data-room=${c.roomId}>
<div class="live-title">${c.name || translate(hass, "room")}</div>
<div class="live-row live-climate-temperature"><span>🌡 ${translate(hass, "climate_temperature")}</span><b>${value(c.temperature === null ? null : hass ? fromCelsius(hass, c.temperature) : c.temperature, 1, hass ? tempUnit(hass) : "°C")}</b></div>
<div class="live-row live-climate-humidity"><span>💧 ${translate(hass, "climate_humidity")}</span><b>${value(c.humidity, 0, "%")}</b></div>
<div class="live-row live-climate-co2"><span>${translate(hass, "climate_co2")}</span><b>${value(c.co2, 0, "ppm")}</b></div>
${c.temperature === null && c.humidity === null && c.co2 === null ? html`<small class="live-status">${translate(hass, "climate_card_missing")}</small>` : nothing}
</div>`;
}
export function renderLhCards(hass: HomeAssistant | undefined, cards: readonly LiveCard[], act: LiveCardAction, fold?: LiveCardFold, climateOnly = false): TemplateResult | typeof nothing {
if (!cards.length) return nothing;
return html`<div class="live-cards">
${cards.map((c, i) => (c.kind === "house" ? houseCard(hass, c, i, fold) : c.kind === "car" ? carCard(hass, c, i, act) : c.kind === "printer" ? printerCard(hass, c, i) : c.kind === "heatpump" ? heatPumpCard(hass, c, i) : mediaCard(hass, c, i, act)))}
${cards.map((c, i) => (c.kind === "roomclimate" ? roomClimateCard(hass, c, i) : climateOnly ? nothing : c.kind === "house" ? houseCard(hass, c, i, fold) : c.kind === "car" ? carCard(hass, c, i, act) : c.kind === "printer" ? printerCard(hass, c, i) : c.kind === "heatpump" ? heatPumpCard(hass, c, i) : mediaCard(hass, c, i, act)))}
</div>`;
}
@@ -418,6 +431,21 @@ export const liveCardStyles = css`
gap: 2px;
min-width: 150px;
}
.live-card-roomclimate {
display: grid;
gap: 4px;
min-width: 190px;
max-width: calc(100vw - 24px);
box-sizing: border-box;
}
.live-card-roomclimate .live-title {
overflow: hidden;
text-overflow: ellipsis;
max-width: 220px;
}
.live-climate-temperature b { color: color-mix(in srgb, #ffca8a 80%, var(--nf-text)); }
.live-climate-humidity b { color: color-mix(in srgb, #7dd3fc 80%, var(--nf-text)); }
.live-climate-co2 b { color: color-mix(in srgb, #c4b5fd 80%, var(--nf-text)); }
.live-row {
display: flex;
justify-content: space-between;
@@ -0,0 +1,43 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { box, entity, floorWith, hassOf } from "../entities/fixtures.ts";
import { emptyBuilding, normalizeBuilding, pointInPolygon } from "../model.ts";
import { roomClimateCards } from "./room-climate-card.ts";
test("enabled room cards use explicit numeric sensors, averages and temperature conversion", () => {
const b = emptyBuilding();
const room = { ...box("living", 0, 0, 4, 4), name: "Wohnzimmer", climate_card: true, climate: { temperature: ["sensor.c", "sensor.f"], humidity: "cover.knx", co2: "sensor.co2" } };
b.floors = [floorWith([room, box("disabled", 5, 0, 8, 4)])];
const h = hassOf([
entity("sensor.c", "20", { unit_of_measurement: "°C" }), entity("sensor.f", "68", { unit_of_measurement: "°F" }),
entity("cover.knx", "open", { symcon_numeric_value: 48.5 }), entity("sensor.co2", "780"),
]);
const cards = roomClimateCards(h, normalizeBuilding(b), null, null);
assert.equal(cards.length, 1);
assert.deepEqual([cards[0].temperature, cards[0].humidity, cards[0].co2], [20, 48.5, 780]);
assert.equal(cards[0].name, "Wohnzimmer");
assert.ok(pointInPolygon([cards[0].at.x, cards[0].at.z], room.points));
h.states["cover.knx"] = entity("cover.knx", "open", { symcon_numeric_value: 55 });
assert.equal(roomClimateCards(h, b, null, null)[0].humidity, 55, "a fresh state updates the card values");
});
test("floor/room navigation filters cards and concave rooms keep their anchor inside", () => {
const b = emptyBuilding();
const room = { ...box("u", 0, 0, 6, 6), climate_card: true, points: [[0, 0], [6, 0], [6, 6], [4, 6], [4, 2], [2, 2], [2, 6], [0, 6]] as [number, number][] };
const upper = { ...floorWith([{ ...box("upper", 0, 0, 4, 4), climate_card: true }]), id: "upper" };
b.floors = [floorWith([room]), upper];
const h = hassOf([]);
const all = roomClimateCards(h, b, null, null);
assert.equal(all.length, 2);
assert.ok(pointInPolygon([all[0].at.x, all[0].at.z], room.points));
assert.deepEqual(roomClimateCards(h, b, "upper", null).map((c) => c.roomId), ["upper"]);
assert.deepEqual(roomClimateCards(h, b, null, "u").map((c) => c.roomId), ["u"]);
});
test("missing, unavailable and disabled readings stay missing rather than becoming zero or another thermostat", () => {
const b = emptyBuilding();
b.floors = [floorWith([{ ...box("r", 0, 0, 4, 4, "a"), climate_card: true, climate: { temperature: "sensor.offline", humidity: "sensor.empty", co2: "none" } }])];
const h = hassOf([entity("sensor.offline", "unavailable"), entity("sensor.empty", ""), entity("climate.other", "heat", { current_temperature: 30 })], { "climate.other": { area_id: "a" } });
const [card] = roomClimateCards(h, b, null, null);
assert.deepEqual([card.temperature, card.humidity, card.co2], [null, null, null]);
});
+35
View File
@@ -0,0 +1,35 @@
import { roomClimateValue } from "../devices.ts";
import { centroid, pointInPolygon, spotGrid, type Building } from "../model.ts";
import type { HomeAssistant } from "../types.ts";
import type { PlanPoint } from "../viewer/live-energy.ts";
export interface RoomClimateCard {
kind: "roomclimate";
at: PlanPoint;
roomId: string;
name: string;
/** Celsius internally, converted to the display unit when rendered. */
temperature: number | null;
humidity: number | null;
co2: number | null;
}
/** One opt-in card per room, using the exact same sensor assignments and averaging as the room panel. */
export function roomClimateCards(hass: HomeAssistant, building: Building, floorId: string | null, roomId: string | null): RoomClimateCard[] {
const cards: RoomClimateCard[] = [];
for (const floor of building.floors) {
if (floorId && floor.id !== floorId) continue;
for (const room of floor.rooms) {
if (!room.climate_card || room.points.length < 3 || (roomId && room.id !== roomId)) continue;
const middle = centroid(room.points);
const [x, z] = pointInPolygon(middle, room.points) ? middle : spotGrid(room, 9, 9).sort((a, b) => Math.hypot(a[0] - middle[0], a[1] - middle[1]) - Math.hypot(b[0] - middle[0], b[1] - middle[1]))[0] ?? room.points[0];
cards.push({ kind: "roomclimate", roomId: room.id, name: room.name,
at: { floorId: floor.id, x, z, y: (room.ceiling ?? floor.height) + 0.4 },
temperature: roomClimateValue(hass, floor, room, "temperature"),
humidity: roomClimateValue(hass, floor, room, "humidity"),
co2: roomClimateValue(hass, floor, room, "co2"),
});
}
}
return cards;
}
+2
View File
@@ -24,6 +24,8 @@ export type WallHeight = number | null | (number | null)[];
export interface Room {
/** Room temperature, humidity and CO2: chosen sensors instead of the automatic pick. */
climate?: RoomClimate | null;
/** Show temperature, humidity and CO2 in a floating glass card over this room. */
climate_card?: boolean;
id: string;
name: string;
area_id: string | null;
+137
View File
@@ -0,0 +1,137 @@
// Complete climate-card flow against the built UI and an invented Symcon object tree.
import assert from "node:assert/strict";
import { createServer } from "node:http";
import { existsSync, mkdirSync, readFileSync } from "node:fs";
import { extname, join, relative, resolve } from "node:path";
import { build } from "esbuild";
import puppeteer from "puppeteer-core";
const root = resolve(import.meta.dirname, "..");
const types = { ".html": "text/html", ".js": "text/javascript", ".json": "application/json", ".png": "image/png" };
const server = createServer((req, res) => {
const file = resolve(root, `.${decodeURIComponent(new URL(req.url, "http://localhost").pathname)}`);
if (relative(root, file).startsWith("..") || !existsSync(file)) return res.writeHead(404).end();
res.writeHead(200, { "content-type": types[extname(file)] ?? "application/octet-stream" }).end(readFileSync(file));
});
await new Promise((done) => server.listen(0, "127.0.0.1", done));
const executablePath = [process.env.CHROME_PATH, "C:/Program Files/Google/Chrome/Application/chrome.exe", "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"].find((p) => p && existsSync(p));
let browser;
try {
browser = await puppeteer.launch({ executablePath, headless: true, args: ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"] });
const page = await browser.newPage();
const errors = [];
page.on("pageerror", (e) => errors.push(String(e)));
await page.evaluateOnNewDocument(() => localStorage.setItem("nextfloor.cards", "0"));
await page.setViewport({ width: 1440, height: 1000 });
await page.goto(`http://127.0.0.1:${server.address().port}/preview/index.html`, { waitUntil: "networkidle0" });
await page.waitForFunction(() => window.nfPanel?.data.building?.floors.length);
const adapter = await build({ entryPoints: [join(root, "frontend/src/symcon-bridge.ts")], bundle: true, write: false, format: "iife", globalName: "SymconAdapter", logLevel: "silent" });
await page.addScriptTag({ content: adapter.outputFiles[0].text });
await page.evaluate(async () => {
window.humidityValue = 51.6;
window.bootstrapCalls = 0;
const raw = (id, name, type, value, unit, domain = "sensor") => ({ entity_id: `${domain}.${id}`, name, path: `Haus / Messwerte / ${name}`, state: domain === "cover" ? "open" : String(value), attributes: { symcon_id: id, symcon_variable_type: type, symcon_numeric_value: value, unit_of_measurement: unit } });
const originalFetch = window.fetch;
window.fetch = async (url, init) => {
if (!String(url).includes("/hook/climate-fixture/")) return originalFetch(url, init);
window.bootstrapCalls++;
const variables = [raw(201, "Raumtemperatur", 2, 21.5, "°C"), raw(202, "Messwert Raumfeuchtigkeit", 2, window.humidityValue, "%", "cover"), raw(203, "CO₂", 1, 780, "ppm")];
const objects = [{ object_id: 100, parent_id: 0, name: "Haus", path: "Haus", object_type: 0, position: 0, hidden: true, icon: "" },
...variables.map((v) => ({ object_id: v.attributes.symcon_id, parent_id: 100, entity_id: v.entity_id, name: v.name, path: v.path, object_type: 2, position: 0, hidden: false, icon: "" }))];
return new Response(JSON.stringify({ state_revision: window.bootstrapCalls, building_revision: 1, variables, objects, areas: [] }));
};
window.__NEXTFLOOR_SYMCON__ = { endpoint: "/hook/climate-fixture", token: "fixture-only" };
const bridge = new window.SymconAdapter.SymconBridge();
await bridge.start();
bridge.stop();
const p = window.nfPanel;
const apply = () => {
const h = bridge.snapshot();
p.hass = { ...p.hass, language: "de", states: h.states, entities: h.entities, symconObjects: h.symconObjects, symconRefresh: h.symconRefresh };
};
apply();
bridge.onChange(apply);
await p.updateComplete;
[...p.shadowRoot.querySelectorAll("[role=tab]")].find((b) => b.textContent.includes("Editor")).click();
});
await page.waitForFunction(() => window.nfPanel.shadowRoot.querySelector("nf-editor")?.shadowRoot);
await page.evaluate(async () => {
const e = window.nfPanel.shadowRoot.querySelector("nf-editor");
window.climateEditor = e;
e._floorId = e._doc.floors[0].id;
window.climateRoomId = e._doc.floors[0].rooms[0].id;
window.climateFloorId = e._floorId;
e.selectItem("room", window.climateRoomId);
await e.updateComplete;
const section = [...e.shadowRoot.querySelectorAll("details.nf-points")].find((d) => d.querySelector("summary").textContent === "Raumklima");
section.open = true;
window.climateSection = section;
window.pickClimate = async (label, id, name) => {
const field = [...window.climateSection.querySelectorAll("label.nf-field")].find((el) => el.textContent.trim().startsWith(label));
const picker = field.querySelector("nf-entity-picker");
await picker.updateComplete;
const native = picker.shadowRoot.querySelector("nf-symcon-object-picker");
await native.updateComplete;
native.shadowRoot.querySelector(".trigger").click();
await native.updateComplete;
const input = native.shadowRoot.querySelector(".search");
input.value = name;
input.dispatchEvent(new Event("input", { bubbles: true }));
await native.updateComplete;
const row = native.shadowRoot.querySelector(`#object-${id}`);
if (!row?.classList.contains("selectable")) throw new Error(`${name} must be selectable despite its inferred domain`);
row.click();
await native.updateComplete;
native.shadowRoot.querySelector(".apply").click();
await e.updateComplete;
};
await window.pickClimate("Temperatur", 201, "Raumtemperatur");
await window.pickClimate("Luftfeuchte", 202, "Messwert Raumfeuchtigkeit");
await window.pickClimate("CO₂", 203, "CO₂");
const label = [...window.climateSection.querySelectorAll("label.nf-check")].find((el) => el.textContent.includes("schwebende Karte"));
label.querySelector("input").click();
await e.updateComplete;
const second = e._doc.floors[0].rooms[1];
second.climate = { temperature: "none", humidity: "none", co2: "none" };
e.selectItem("room", second.id);
await e.updateComplete;
const section2 = [...e.shadowRoot.querySelectorAll("details.nf-points")].find((d) => d.querySelector("summary").textContent === "Raumklima");
section2.open = true;
[...section2.querySelectorAll("label.nf-check")].find((el) => el.textContent.includes("schwebende Karte")).querySelector("input").click();
await e.updateComplete;
[...window.nfPanel.shadowRoot.querySelectorAll("[role=tab]")].find((b) => b.textContent.trim() === "3D").click();
});
await page.waitForFunction(() => window.nfPanel.shadowRoot.querySelector("nf-view3d")?.viewer);
await page.evaluate(() => { window.climateView = window.nfPanel.shadowRoot.querySelector("nf-view3d"); });
await page.waitForFunction(() => window.climateView.shadowRoot.querySelector(".nf-card-toggle"));
assert.equal(await page.evaluate(() => window.climateView.shadowRoot.querySelector(".nf-card-toggle").getAttribute("aria-pressed")), "false");
await page.evaluate(() => window.climateView.shadowRoot.querySelector(".nf-card-toggle").click());
await page.waitForFunction(() => window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate").length === 2);
const text = () => page.evaluate(() => window.climateView.shadowRoot.querySelector(`.live-card[data-room="${window.climateRoomId}"]`).textContent);
assert.match(await text(), /21,5\s*°C/);
assert.match(await text(), /52\s*%/);
assert.match(await text(), /780\s*ppm/);
assert.equal(await page.evaluate(() => !!window.climateView.shadowRoot.querySelector(".live-card-house")), false, "climate cards do not require an energy meter");
assert.equal(await page.evaluate(() => window.nfPanel.data.building.floors[0].rooms[0].climate.humidity), "cover.202");
assert.equal(await page.evaluate(() => [...window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate")].some((c) => c.textContent.includes("Keine aktuellen Messwerte"))), true);
await page.evaluate(() => { window.humidityValue = 62.4; window.nfPanel.shadowRoot.querySelector(".nf-reload-variables").click(); });
await page.waitForFunction(() => window.climateView.shadowRoot.querySelector(`.live-card[data-room="${window.climateRoomId}"]`).textContent.includes("62 %"));
const out = join(root, "preview/screenshots");
mkdirSync(out, { recursive: true });
await page.waitForFunction(() => [...window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate")].every((c) => c.style.visibility === "visible"));
await page.screenshot({ path: join(out, "symcon-climate-desktop.png") });
await page.setViewport({ width: 390, height: 844 });
await page.evaluate(() => { window.nfPanel.narrow = true; });
await page.waitForFunction(() => [...window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate")].every((c) => { const r = c.getBoundingClientRect(); return r.left >= 0 && r.right <= innerWidth; }));
await page.screenshot({ path: join(out, "symcon-climate-mobile.png") });
await page.evaluate(() => { const p = window.nfPanel; p._floorId = window.climateFloorId; p._roomId = window.climateRoomId; });
await page.waitForFunction(() => window.climateView.panelOpen && window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate").length === 1);
assert.match(await text(), /62\s*%/);
await page.evaluate(() => window.climateView.shadowRoot.querySelector(".nf-card-toggle").click());
await page.waitForFunction(() => !window.climateView.shadowRoot.querySelector(".live-card-roomclimate"));
assert.deepEqual(errors, []);
console.log("OK: native float humidity picker, saved per-room card setting, temperature/humidity/CO2 values, missing data, live reload, no-energy toggle, desktop/mobile and opened-room cards");
} finally {
await browser?.close();
await new Promise((done) => server.close(done));
}
+185 -164
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 S={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=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var xn=globalThis,kn=xn.ShadowRoot&&(xn.ShadyCSS===void 0||xn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Cr=Symbol(),xi=new WeakMap,It=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Cr)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(kn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=xi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&xi.set(t,e))}return e}toString(){return this.cssText}},ki=r=>new It(typeof r=="string"?r:r+"",void 0,Cr),te=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,o,i)=>n+(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.")})(o)+r[i+1],r[0]);return new It(t,r,Cr)},Si=(r,e)=>{if(kn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=xn.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Nr=kn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return ki(t)})(r):r;var{is:Xc,defineProperty:eu,getOwnPropertyDescriptor:tu,getOwnPropertyNames:nu,getOwnPropertySymbols:ru,getPrototypeOf:ou}=Object,Sn=globalThis,Mi=Sn.trustedTypes,iu=Mi?Mi.emptyScript:"",su=Sn.reactiveElementPolyfillSupport,Ct=(r,e)=>r,Or={toAttribute(r,e){switch(e){case Boolean:r=r?iu:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Ai=(r,e)=>!Xc(r,e),$i={attribute:!0,type:String,converter:Or,reflect:!1,useDefault:!1,hasChanged:Ai};Symbol.metadata??=Symbol("metadata"),Sn.litPropertyMetadata??=new WeakMap;var $e=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=$i){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 n=Symbol(),o=this.getPropertyDescriptor(e,n,t);o!==void 0&&eu(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=tu(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:o,set(s){let a=o?.call(this);i?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??$i}static _$Ei(){if(this.hasOwnProperty(Ct("elementProperties")))return;let e=ou(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ct("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ct("properties"))){let t=this.properties,n=[...nu(t),...ru(t)];for(let o of n)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,o]of t)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let o=this._$Eu(t,n);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let o of n)t.unshift(Nr(o))}else e!==void 0&&t.push(Nr(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shaLine truncated
\f\r]`,Nt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zi=/-->/g,Ti=/>/g,Ze=RegExp(`>|${Wr}(?:([^\\s"'>=/]+)(${Wr}*=${Wr}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Fi=/'/g,Di=/"/g,Ci=/^(?:script|style|textarea|title)$/i,qr=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=qr(1),J=qr(2),Bm=qr(3),Qe=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Pi=new WeakMap,Ye=Je.createTreeWalker(Je,129);function Ni(r,e){if(!jr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ri!==void 0?Ri.createHTML(e):e}var cu=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=Nt;for(let a=0;a<t;a++){let l=r[a],c,u,d=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===Nt?u[1]==="!--"?s=zi:u[1]!==void 0?s=Ti:u[2]!==void 0?(Ci.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=Ze):u[3]!==void 0&&(s=Ze):s===Ze?u[0]===">"?(s=o??Nt,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Ze:u[3]==='"'?Di:Fi):s===Di||s===Fi?s=Ze:s===zi||s===Ti?s=Nt:(s=Ze,o=void 0);let h=s===Ze&&r[a+1].startsWith("/>")?" ":"";i+=s===Nt?l+au:d>=0?(n.push(c),l.slice(0,d)+Hi+l.slice(d)+Oe+h):l+Oe+(d===-2?a:h)}return[Ni(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Lt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[c,u]=cu(e,t);if(this.el=r.createElement(c,n),Ye.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(o=Ye.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let d of o.getAttributeNames())if(d.endsWith(Hi)){let p=u[s++],h=o.getAttribute(d).split(Oe),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:i,name:g[2],strings:h,ctor:g[1]==="."?Br:g[1]==="?"?Vr:g[1]==="@"?Kr:ht}),o.removeAttribute(d)}else d.startsWith(Oe)&&(l.push({type:6,index:i}),o.removeAttribute(d));if(Ci.test(o.tagName)){let d=o.textContent.split(Oe),p=d.length-1;if(p>0){o.textContent=Mn?Mn.emptyScript:"";for(let h=0;h<p;h++)o.append(d[h],Ot()),Ye.nextNode(),l.push({type:2,index:++i});o.append(d[p],Ot())}}}else if(o.nodeType===8)if(o.data===Ii)l.push({type:2,index:i});else{let d=-1;for(;(d=o.data.indexOf(Oe,d+1))!==-1;)l.push({type:7,index:i}),d+=Oe.length-1}i++}}static createElement(e,t){let n=Je.createElement("template");return n.innerHTML=e,n}};function dt(r,e,t=r,n){if(e===Qe)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Wt(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(r),o._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=o:t._$Cl=o),o!==void 0&&(e=dt(r,o._$AS(r,e.values),o,n)),e}var Lr=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:n}=this._$AD,o=(e?.creationScope??Je).importNode(t,!0);Ye.currentNode=o;let i=Ye.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Bt(i,i.nextSibling,this,e):l.type===1?c=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(c=new Gr(i,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=Ye.nextNode(),s++)}return Ye.currentNode=Je,o}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Bt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,o){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cv=o?.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=dt(this,e,t),Wt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==Qe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):lu(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&&Wt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Je.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,o=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Lt.createElement(Ni(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Lr(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=Pi.get(e.strings);return t===void 0&&Pi.set(e.strings,t=new Lt(e)),t}k(e){jr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(Ot()),this.O(Ot()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Ei(e).nextSibling;Ei(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ht=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,o,i){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._Line truncated
var S={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=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var kn=globalThis,Sn=kn.ShadowRoot&&(kn.ShadyCSS===void 0||kn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Cr=Symbol(),yi=new WeakMap,Ct=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Cr)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(Sn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=yi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&yi.set(t,e))}return e}toString(){return this.cssText}},xi=r=>new Ct(typeof r=="string"?r:r+"",void 0,Cr),ne=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,o,i)=>n+(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.")})(o)+r[i+1],r[0]);return new Ct(t,r,Cr)},ki=(r,e)=>{if(Sn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=kn.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Nr=Sn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return xi(t)})(r):r;var{is:tu,defineProperty:nu,getOwnPropertyDescriptor:ru,getOwnPropertyNames:ou,getOwnPropertySymbols:iu,getPrototypeOf:su}=Object,Mn=globalThis,Si=Mn.trustedTypes,au=Si?Si.emptyScript:"",lu=Mn.reactiveElementPolyfillSupport,Nt=(r,e)=>r,Or={toAttribute(r,e){switch(e){case Boolean:r=r?au:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},$i=(r,e)=>!tu(r,e),Mi={attribute:!0,type:String,converter:Or,reflect:!1,useDefault:!1,hasChanged:$i};Symbol.metadata??=Symbol("metadata"),Mn.litPropertyMetadata??=new WeakMap;var Ae=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=Mi){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 n=Symbol(),o=this.getPropertyDescriptor(e,n,t);o!==void 0&&nu(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=ru(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:o,set(s){let a=o?.call(this);i?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Mi}static _$Ei(){if(this.hasOwnProperty(Nt("elementProperties")))return;let e=su(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Nt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Nt("properties"))){let t=this.properties,n=[...ou(t),...iu(t)];for(let o of n)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,o]of t)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let o=this._$Eu(t,n);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let o of n)t.unshift(Nr(o))}else e!==void 0&&t.push(Nr(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shaLine truncated
\f\r]`,Ot=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ri=/-->/g,zi=/>/g,Ze=RegExp(`>|${Wr}(?:([^\\s"'>=/]+)(${Wr}*=${Wr}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ti=/'/g,Fi=/"/g,Ii=/^(?:script|style|textarea|title)$/i,qr=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=qr(1),J=qr(2),Um=qr(3),Qe=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Di=new WeakMap,Ye=Je.createTreeWalker(Je,129);function Ci(r,e){if(!jr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ei!==void 0?Ei.createHTML(e):e}var du=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=Ot;for(let a=0;a<t;a++){let l=r[a],c,u,h=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===Ot?u[1]==="!--"?s=Ri:u[1]!==void 0?s=zi:u[2]!==void 0?(Ii.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=Ze):u[3]!==void 0&&(s=Ze):s===Ze?u[0]===">"?(s=o??Ot,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Ze:u[3]==='"'?Fi:Ti):s===Fi||s===Ti?s=Ze:s===Ri||s===zi?s=Ot:(s=Ze,o=void 0);let d=s===Ze&&r[a+1].startsWith("/>")?" ":"";i+=s===Ot?l+cu:h>=0?(n.push(c),l.slice(0,h)+Pi+l.slice(h)+We+d):l+We+(h===-2?a:d)}return[Ci(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Bt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[c,u]=du(e,t);if(this.el=r.createElement(c,n),Ye.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=Ye.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(Pi)){let p=u[s++],d=o.getAttribute(h).split(We),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:i,name:g[2],strings:d,ctor:g[1]==="."?Br:g[1]==="?"?Vr:g[1]==="@"?Kr:ht}),o.removeAttribute(h)}else h.startsWith(We)&&(l.push({type:6,index:i}),o.removeAttribute(h));if(Ii.test(o.tagName)){let h=o.textContent.split(We),p=h.length-1;if(p>0){o.textContent=$n?$n.emptyScript:"";for(let d=0;d<p;d++)o.append(h[d],Wt()),Ye.nextNode(),l.push({type:2,index:++i});o.append(h[p],Wt())}}}else if(o.nodeType===8)if(o.data===Hi)l.push({type:2,index:i});else{let h=-1;for(;(h=o.data.indexOf(We,h+1))!==-1;)l.push({type:7,index:i}),h+=We.length-1}i++}}static createElement(e,t){let n=Je.createElement("template");return n.innerHTML=e,n}};function dt(r,e,t=r,n){if(e===Qe)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Lt(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(r),o._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=o:t._$Cl=o),o!==void 0&&(e=dt(r,o._$AS(r,e.values),o,n)),e}var Lr=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:n}=this._$AD,o=(e?.creationScope??Je).importNode(t,!0);Ye.currentNode=o;let i=Ye.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Vt(i,i.nextSibling,this,e):l.type===1?c=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(c=new Gr(i,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=Ye.nextNode(),s++)}return Ye.currentNode=Je,o}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Vt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,o){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cv=o?.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=dt(this,e,t),Lt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==Qe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):uu(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&&Lt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Je.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,o=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Bt.createElement(Ci(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Lr(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=Di.get(e.strings);return t===void 0&&Di.set(e.strings,t=new Bt(e)),t}k(e){jr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(Wt()),this.O(Wt()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Ai(e).nextSibling;Ai(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ht=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,o,i){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[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);
}
`,pr=te`
`,pr=ne`
:host([readable]) {
--secondary-text-color: var(--primary-text-color, #e1e1e1);
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
@@ -46,7 +46,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
:host([readable]) .nf-overlay {
zoom: 1.2;
}
`,Ke=te`
`,Ke=ne`
/* a group of switches: one rounded pill, the active one tinted with the accent */
.nf-seg {
display: inline-flex;
@@ -209,12 +209,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
min-height: 40px;
}
}
`;function mr(r){return r?.themes?.darkMode===!1?"light":"dark"}var Dh=4,Ph=8,Hh=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],At=r=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
`;function mr(r){return r?.themes?.darkMode===!1?"light":"dark"}var Ih=4,Ch=8,Nh=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],Et=r=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d=${rr(r)} />
</svg>`,fr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Ho=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Ih=24,Ch=10,Io=class extends re{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 hr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],o=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!o)return f;let i=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>K(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(dr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
</svg>`,fr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Ho=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Oh=24,Wh=10,Io=class extends re{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 hr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],o=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!o)return f;let i=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>K(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(dr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
${n.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>
${i.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=i.find(p=>p.id===u.value);u.value="",d&&this.runMood(nl(l,s(d)))}}>
${i.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,h=i.find(p=>p.id===u.value);u.value="",h&&this.runMood(nl(l,s(h)))}}>
<option value="">→</option>
${i.map(c=>m`<option value=${c.id}>${c.name}</option>`)}
</select>`:f}
@@ -224,38 +224,38 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
><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=Zn(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let o=Date.now(),i=o-24*36e5;try{let s=await on(this.hass,n,i,o,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=$t(this.hass,s,i+(o-i)*l/96),u=n.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;let t=Do(this.hass,this.building,this.floor,e);try{let n=await ja(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=K(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(!n.length||n.some(s=>s.state!=="off"))return f;let o=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),i=Math.floor((Date.now()-o)/6e4);return!o||i<Ch?f:m`<div class="nf-rp-shade">
</div>`}async loadCurve(e){let t=vt(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let o=Date.now(),i=o-24*36e5;try{let s=await sn(this.hass,n,i,o,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=At(this.hass,s,i+(o-i)*l/96),u=n.map(h=>h.startsWith("climate.")?Number(c.states[h]?.attributes.current_temperature):Number(c.states[h]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((h,p)=>h+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;let t=Do(this.hass,this.building,this.floor,e);try{let n=await ja(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=K(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(!n.length||n.some(s=>s.state!=="off"))return f;let o=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),i=Math.floor((Date.now()-o)/6e4);return!o||i<Wh?f:m`<div class="nf-rp-shade">
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:i})}</span>
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.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 n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.length)return f;let o=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",i=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(o));if(!i.length)return f;let s=()=>{for(let a of n)(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:i.length})}</span>
<button class="nf-btn nf-rp-small" @click=${s}>${this.t("open_heating_off")}</button>
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o=Y(this.hass,this.floor,e,"temperature");if(o===null||o<Ih)return f;let i=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(Wa(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(i)))];return s.length?m`<div class="nf-rp-shade">
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${O(this.hass,ue(this.hass,o),1)} ${ne(this.hass)}`})}</span>
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o=Z(this.hass,this.floor,e,"temperature");if(o===null||o<Oh)return f;let i=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(Wa(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(i)))];return s.length?m`<div class="nf-rp-shade">
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${O(this.hass,oe(this.hass,o),1)} ${X(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:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o={latitude:t,longitude:n};if(!St(this.building,this.floor,e,{...o,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:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o={latitude:t,longitude:n};if(!Mt(this.building,this.floor,e,{...o,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=Oa(this.building,this.floor,e,o),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]} ${O(this.hass,u,1)} h`).join(", ")}>
${a.map((u,d)=>m`<span title=${`${O(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[d]}</b></span>`)}
</button>`;if(!this._sunYear)return s;let a=Oa(this.building,this.floor,e,o),l=Math.max(1,...a),c=Array.from({length:12},(u,h)=>new Date(2026,h,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return m`${s}
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,h)=>`${c[h]} ${O(this.hass,u,1)} h`).join(", ")}>
${a.map((u,h)=>m`<span title=${`${O(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[h]}</b></span>`)}
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,o=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,i=qa(e.month,o),s=a=>`${O(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)})}${i?` \xB7 ${O(this.hass,i.value,2)} ${i.currency}`:""}
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),o=Math.max(...t),i=Math.max(1,o-n),s=e.map(c=>c===null?null:c-n+i*.1),a=sn(s,220,36,i*1.2),l=c=>`${O(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),n=Math.min(...t),o=Math.max(...t),i=Math.max(1,o-n),s=e.map(c=>c===null?null:c-n+i*.1),a=an(s,220,36,i*1.2),l=c=>`${O(this.hass,oe(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">${J`<path d=${a}></path>`}</svg>
<span>24 h · ${l(n)} – ${l(o)}</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 R(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let o=t.slice(0,t.indexOf(".")),i=()=>o==="script"?this.call("script","turn_on",{entity_id:t}):this.call(o,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(n)} title=${this.t("room_clean_run_hint")} @click=${i}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=rn(e);for(let n of t.off)this.call(n.domain,n.service,n.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}=rn(e);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 n of t.placements)if(n.entity_id===e)return n}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=${()=>fe(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,n){let o=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};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 E(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let o=t.slice(0,t.indexOf(".")),i=()=>o==="script"?this.call("script","turn_on",{entity_id:t}):this.call(o,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(n)} title=${this.t("room_clean_run_hint")} @click=${i}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=on(e);for(let n of t.off)this.call(n.domain,n.service,n.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}=on(e);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 n of t.placements)if(n.entity_id===e)return n}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=${()=>fe(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,n){let o=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return m`<button
class="nf-switch"
role="switch"
aria-checked=${t?"true":"false"}
aria-label=${this.name(e.entity_id)}
?disabled=${I(e)}
@click=${o}
></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 n=e??K(this.hass,t),o=this.memo,{shown:i,more:s}=e?{shown:e,more:[]}:o&&o.entities===this.hass.entities&&o.floor===this.floor&&o.room===t?o:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Bs(this.hass,this.floor,t):{shown:n,more:[]}},a=mo(this.hass,s).map(x=>x.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=x=>c.filter(y=>x.includes(D(y))).map(y=>this.hass.states[y]),d=u(["light"]),p=u(["cover"]),h=u(["climate"]),g=u(["media"]),b=u(["switch","fan","lock"]),_=u(["sensor","binary"]),w=u(["scene","script"]),M=this.facts(h),$=d.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 n=e??K(this.hass,t),o=this.memo,{shown:i,more:s}=e?{shown:e,more:[]}:o&&o.entities===this.hass.entities&&o.floor===this.floor&&o.room===t?o:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Bs(this.hass,this.floor,t):{shown:n,more:[]}},a=mo(this.hass,s).map(x=>x.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=x=>c.filter(y=>x.includes(D(y))).map(y=>this.hass.states[y]),h=u(["light"]),p=u(["cover"]),d=u(["climate"]),g=u(["media"]),b=u(["switch","fan","lock"]),_=u(["sensor","binary"]),w=u(["scene","script"]),M=this.facts(d),$=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>
${M.length?m`<p class="nf-rp-facts">${M.join(" \xB7 ")}</p>`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()}
${this.renderOpenWhileHeating(h)} ${this.renderEmptyLights(t,$)}
${this.renderOpenWhileHeating(d)} ${this.renderEmptyLights(t,$)}
${this.renderCurve()}
</div>
<button class="nf-rp-close" aria-label=${this.t(this._folded?"panel_unfold":"panel_fold")} title=${this.t(this._folded?"panel_unfold":"panel_fold")} aria-expanded=${this._folded?"false":"true"} @click=${()=>this._folded=!this._folded}>
@@ -266,7 +266,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</button>
</header>
<div class="nf-rp-body" ?hidden=${this._folded}>
${this.renderAllOff([...d,...g,...b])}
${this.renderAllOff([...h,...g,...b])}
${this.renderClean(t)}
${!t.area_id&&!e?m`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:c.length?f:m`<p class="nf-rp-note">${this.t("panel_empty")}</p>`}
${w.length?this.section("panel_scenes",[m`<div class="nf-rp-scenes">
@@ -278,17 +278,17 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${this.name(x.entity_id)}
</button>`)}
</div>`]):f}
${d.length?this.section("panel_lights",[...d.map(x=>this.lightRow(x)),...t?[this.renderMoods(t,d)]:[]],m`${$.length<d.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_on",{entity_id:d.filter(x=>!I(x)).map(x=>x.entity_id)})}>
${h.length?this.section("panel_lights",[...h.map(x=>this.lightRow(x)),...t?[this.renderMoods(t,h)]:[]],m`${$.length<h.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_on",{entity_id:h.filter(x=>!I(x)).map(x=>x.entity_id)})}>
${this.t("panel_all_on")}
</button>`:f}${$.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:$.map(x=>x.entity_id)})}>
${this.t("panel_all_off")}
</button>`:f}`):f}
${p.length?this.section("panel_covers",p.map(x=>this.coverRow(x)),p.length>1&&Bn(p,this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Bn(p,this.confirmEntities)})}>
${p.length?this.section("panel_covers",p.map(x=>this.coverRow(x)),p.length>1&&Vn(p,this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Vn(p,this.confirmEntities)})}>
${this.t("panel_all_open")}</button
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Bn(p,this.confirmEntities)})}>
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Vn(p,this.confirmEntities)})}>
${this.t("panel_all_close")}
</button>`:f):f}
${h.length?this.section("panel_climate",h.map(x=>this.climateRow(x))):f}
${d.length?this.section("panel_climate",d.map(x=>this.climateRow(x))):f}
${g.length?this.section("panel_media",g.map(x=>this.mediaRow(x))):f}
${b.length?this.section("panel_switches",b.map(x=>this.switchRow(x))):f}
${_.length?this.section("panel_sensors",_.map(x=>this.sensorRow(x))):f}
@@ -298,22 +298,22 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
</button>`:f}
</div>
</section>`}facts(e){let t=[],n=this.room;if(!n)return t;let o=(y,F)=>{let T=Y(this.hass,this.floor,n,y);if(T===null)return null;if(y==="temperature")return`${O(this.hass,ue(this.hass,T),1)} ${ne(this.hass)}`;let C=Zn(this.hass,this.floor,n,y)[0],E=this.hass.states[C]?.attributes.unit_of_measurement??F;return`${O(this.hass,T,1)} ${E}`},i=e.find(y=>typeof y.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${O(this.hass,i.attributes.current_temperature,1)} ${ne(this.hass)}`);let a=o("humidity","%");a&&t.push(a);let l=this.floor&&this.building?Fo(this.hass,this.building,this.floor,n):null;l!==null&&t.push(`\u26A1 ${at(this.hass,l)}`);let c=this.floor?this.floor.openings.filter(y=>y.room_id===n.id).flatMap(y=>[y.contact,y.contact2,y.tilt,y.tilt2]).map(y=>y&&y!=="none"?this.hass.states[y]:void 0).filter(y=>y?.state==="on").map(y=>Date.parse(String(y.last_changed??""))).filter(Number.isFinite):[];c.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Po(Date.now()-Math.min(...c))})}`);let u=K(this.hass,n).map(y=>this.hass.states[y]).filter(y=>!!y&&y.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(y.attributes.device_class)));if(u.length)if(u.some(y=>y.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let y=Math.max(...u.map(F=>Date.parse(String(F.last_changed??""))||0));y>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Po(Date.now()-y)})}`)}let d=this.building?Ja(this.hass,this.building).filter(y=>y.roomId===n.id&&y.level<Ya):[];d.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:d.length,names:d.map(y=>`${this.name(y.entity)} ${Math.round(y.level)} %`).join(", ")})}`);let p=(this.building?.settings.circuits??[]).filter(y=>y.rooms.includes(n.id)).map(y=>y.name),h=this.building?.settings.room_facts_off??[];p.length&&!h.includes("circuits")&&t.push(`\u{1F50C} ${p.join(", ")}`);let{latitude:g,longitude:b,time_zone:_}=this.hass.config??{};if(this.floor&&g!==void 0&&b!==void 0&&this.building&&!h.includes("sun")){let y=St(this.building,this.floor,n,{latitude:g,longitude:b,zone:_});y.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:O(this.hass,y.hours,1),facing:y.facing.join(", ")})}`)}let w=Y(this.hass,this.floor,n,"temperature"),M=Y(this.hass,this.floor,n,"humidity"),$=lr(Y(this.hass,this.floor,n,"co2"),M,Mt(w,M));$&&!h.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${$}`)}`);let x=cr(w,M,Y(this.hass,this.floor,n,"co2"),st(new Date,this.hass.config?.latitude));return x!==null&&(w!==null||M!==null)&&!h.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(i=>this.t(`announce_phrase_${i}`)),n=i=>{let s=i.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))},o=i=>{i.preventDefault();let s=i.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(i=>m`<button class="nf-btn" @click=${()=>n(i)}>${i}</button>`)}</div>
</section>`}facts(e){let t=[],n=this.room;if(!n)return t;let o=(y,F)=>{let T=Z(this.hass,this.floor,n,y);if(T===null)return null;if(y==="temperature")return`${O(this.hass,oe(this.hass,T),1)} ${X(this.hass)}`;let C=vt(this.hass,this.floor,n,y)[0],R=this.hass.states[C]?.attributes.unit_of_measurement??F;return`${O(this.hass,T,1)} ${R}`},i=e.find(y=>typeof y.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${O(this.hass,i.attributes.current_temperature,1)} ${X(this.hass)}`);let a=o("humidity","%");a&&t.push(a);let l=this.floor&&this.building?Fo(this.hass,this.building,this.floor,n):null;l!==null&&t.push(`\u26A1 ${at(this.hass,l)}`);let c=this.floor?this.floor.openings.filter(y=>y.room_id===n.id).flatMap(y=>[y.contact,y.contact2,y.tilt,y.tilt2]).map(y=>y&&y!=="none"?this.hass.states[y]:void 0).filter(y=>y?.state==="on").map(y=>Date.parse(String(y.last_changed??""))).filter(Number.isFinite):[];c.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Po(Date.now()-Math.min(...c))})}`);let u=K(this.hass,n).map(y=>this.hass.states[y]).filter(y=>!!y&&y.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(y.attributes.device_class)));if(u.length)if(u.some(y=>y.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let y=Math.max(...u.map(F=>Date.parse(String(F.last_changed??""))||0));y>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Po(Date.now()-y)})}`)}let h=this.building?Ja(this.hass,this.building).filter(y=>y.roomId===n.id&&y.level<Ya):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(y=>`${this.name(y.entity)} ${Math.round(y.level)} %`).join(", ")})}`);let p=(this.building?.settings.circuits??[]).filter(y=>y.rooms.includes(n.id)).map(y=>y.name),d=this.building?.settings.room_facts_off??[];p.length&&!d.includes("circuits")&&t.push(`\u{1F50C} ${p.join(", ")}`);let{latitude:g,longitude:b,time_zone:_}=this.hass.config??{};if(this.floor&&g!==void 0&&b!==void 0&&this.building&&!d.includes("sun")){let y=Mt(this.building,this.floor,n,{latitude:g,longitude:b,zone:_});y.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:O(this.hass,y.hours,1),facing:y.facing.join(", ")})}`)}let w=Z(this.hass,this.floor,n,"temperature"),M=Z(this.hass,this.floor,n,"humidity"),$=lr(Z(this.hass,this.floor,n,"co2"),M,$t(w,M));$&&!d.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${$}`)}`);let x=cr(w,M,Z(this.hass,this.floor,n,"co2"),st(new Date,this.hass.config?.latitude));return x!==null&&(w!==null||M!==null)&&!d.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(i=>this.t(`announce_phrase_${i}`)),n=i=>{let s=i.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))},o=i=>{i.preventDefault();let s=i.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(i=>m`<button class="nf-btn" @click=${()=>n(i)}>${i}</button>`)}</div>
<form class="nf-rp-say" @submit=${o}>
<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 ns({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(o=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${o.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 ts({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(o=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${o.key}>
<div class="nf-rp-sec-head"><h3>${o.title}</h3></div>
${typeof o.content=="string"?m`<p class="nf-rp-note">${o.content}</p>`:o.content}
</div>`)}section(e,t,n=f){return m`<div class="nf-rp-sec">
<div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${n}</div>
${t}
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",o=t.supported_color_modes??[],i=o.some(h=>h!=="onoff"),s=o.includes("color_temp"),a=o.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 ${n?"nf-rp-on":""}">${At("light")}</span>
${this.nameButton(d)}
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",o=t.supported_color_modes??[],i=o.some(d=>d!=="onoff"),s=o.includes("color_temp"),a=o.some(d=>["hs","rgb","rgbw","rgbww","xy"].includes(d)),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,h=e.entity_id,p=!!this.placedAs(h)?.simple;return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Et("light")}</span>
${this.nameButton(h)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:d}))}
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:h}))}
${i&&!p?m`<label class="nf-rp-slider"
><span>${this.t("brightness")}</span>
<input
@@ -321,7 +321,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
min="1"
max="100"
.value=${String(l)}
@change=${h=>this.call("light","turn_on",{entity_id:d,brightness_pct:Number(h.target.value)})}
@change=${d=>this.call("light","turn_on",{entity_id:h,brightness_pct:Number(d.target.value)})}
/></label>`:f}
${n&&s&&!p?m`<label class="nf-rp-slider nf-rp-ct"
><span>${this.t("color_temp")}</span>
@@ -331,26 +331,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
max=${u}
step="50"
.value=${String(t.color_temp_kelvin??c)}
@change=${h=>this.call("light","turn_on",{entity_id:d,color_temp_kelvin:Number(h.target.value)})}
@change=${d=>this.call("light","turn_on",{entity_id:h,color_temp_kelvin:Number(d.target.value)})}
/></label>`:f}
${n&&a&&!p?m`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
${Hh.map(h=>m`<button
${Nh.map(d=>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})}
style="--c: rgb(${d.join(",")})"
aria-label="rgb(${d.join(", ")})"
@click=${()=>this.call("light","turn_on",{entity_id:h,rgb_color:d})}
></button>`)}
</div>`:f}
</div>`}coverRow(e){let t=Xn(this.hass,this.building?.floors??[],e.entity_id);e=er(this.hass,e,t);let n=e.attributes,o=n.supported_features??0,i=e.entity_id,s=I(e)&&!Ut(e);return m`<div class="nf-rp-row">
<span class="nf-rp-icon">${At("cover")}</span>
</div>`}coverRow(e){let t=Xn(this.hass,this.building?.floors??[],e.entity_id);e=er(this.hass,e,t);let n=e.attributes,o=n.supported_features??0,i=e.entity_id,s=I(e)&&!jt(e);return m`<div class="nf-rp-row">
<span class="nf-rp-icon">${Et("cover")}</span>
${this.nameButton(i)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
<div class="nf-rp-buttons">
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(i)&&this.call("cover","open_cover",{entity_id:i})}>${this.t("cover_open")}</button>
${o&Ph?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:i})}>${this.t("cover_stop")}</button>`:f}
${o&Ch?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:i})}>${this.t("cover_stop")}</button>`:f}
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(i)&&this.call("cover","close_cover",{entity_id:i})}>${this.t("cover_close")}</button>
</div>
${o&Dh&&typeof n.current_position=="number"?m`<label class="nf-rp-slider"
${o&Ih&&typeof n.current_position=="number"?m`<label class="nf-rp-slider"
><span>${this.t("position")}</span>
<input
type="range"
@@ -374,12 +374,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${o&32?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:i})}>${this.t("cover_tilt_close")}</button>`:f}
</div>`:f}
</div>`}climateRow(e){let t=e.attributes,n=e.entity_id,o=typeof t.temperature=="number"?t.temperature:null,i=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:n,temperature:Math.min(a,Math.max(s,Math.round(u/i)*i))});return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${At("climate")}</span>
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Et("climate")}</span>
${this.nameButton(n)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
${o!==null?m`<div class="nf-rp-stepper nf-rp-wide">
<button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>c(o-i)}>−</button>
<span><small>${this.t("target_temp")}</small> ${O(this.hass,o,1)} ${ne(this.hass)}</span>
<span><small>${this.t("target_temp")}</small> ${O(this.hass,o,1)} ${X(this.hass)}</span>
<button class="nf-btn" aria-label=${this.t("temp_up")} @click=${()=>c(o+i)}>+</button>
</div>`:f}
${l.length>1?m`<div class="nf-rp-chips">
@@ -391,8 +391,8 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${this.stateLabel(u)}
</button>`)}
</div>`:f}
</div>`}stateOf(e,t=ee(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=D(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,o=I(e)||e.state==="off",i=[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":""}">${At("media")}</span>
</div>`}stateOf(e,t=te(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=D(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,o=I(e)||e.state==="off",i=[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":""}">${Et("media")}</span>
${this.nameButton(n)}
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}</span>
${i?m`<p class="nf-rp-media nf-rp-wide">${i}</p>`:f}
@@ -417,15 +417,15 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})}
/></label>`:f}
</div>`}switchRow(e){let t=e.entity_id,n=D(t),o=t.slice(0,t.indexOf(".")),i=n==="lock"?e.state==="unlocked"||e.state==="open":Q(e),s=()=>n==="lock"?this.call("lock",i?"lock":"unlock",{entity_id:t}):this.call(o,"toggle",{entity_id:t});return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${i?"nf-rp-on":""}">${At(n)}</span>
<span class="nf-rp-icon ${i?"nf-rp-on":""}">${Et(n)}</span>
${this.nameButton(t)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
${this.toggle(e,i,s)}
</div>`}sensorRow(e){let t=D(e.entity_id),n=t==="binary"&&e.state==="on";return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${At(t)}</span>
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Et(t)}</span>
${this.nameButton(e.entity_id)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[Se,Ke,te`
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[Me,Ke,ne`
:host {
display: block;
}
@@ -806,32 +806,32 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
outline: 2px solid var(--nf-accent);
outline-offset: 2px;
}
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Io);function ll(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var Nh=[[/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]]],cl=[34,211,238];function Co(r){return r?Nh.find(([e])=>e.test(r))?.[1]??cl:cl}function No(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Oo=r=>r.state==="playing"||r.state==="on"&&No(r);function ul(r,e){let t=[],n=new Set;for(let o of e){if(!o.entity.startsWith("media_player.")||n.has(o.entity))continue;n.add(o.entity);let i=r.states[o.entity];if(!i)continue;let s=i.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:o.entity,name:o.name,at:o.at,playing:Oo(i),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:Co(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==o.entity):[],rings:o.rings??1})}return t}function dl(r){let e=new Map(r.filter(o=>o.playing).map(o=>[o.entity,o])),t=[],n=new Set;for(let o of e.values())for(let i of o.group){let s=e.get(i),a=[o.entity,i].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([o,s]))}return t}var Oh=3;function hl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!i.type.endsWith(":sprinkler"))continue;let s=t?.get(i.id)?.entity??null;!s||!Q(r.states[s])||n.push({id:i.id,at:{floorId:o.id,x:i.x,y:le(o,i)+i.h,z:i.z},reach:Math.min(15,Math.max(.5,i.spray??Oh))})}return n}var gr=r=>r&&r!=="none"?r:null,pl=r=>Math.min(1,Math.max(0,r));function ml(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=Ee(r,{cover:gr(n.cover),contact:gr(n.contact),tilt:gr(n.tilt)},"window"),i=gr(n.window),s=i?r.states[i]:void 0,a=o.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?pl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:o.tilt,cover:o.cover??0})}return t}function Wh(r,e){let t=o=>Math.hypot(o.x-e.x,o.z-e.z);return r.placements.filter(o=>o.entity_id.startsWith("media_player.")&&t(o)<Math.max(2,e.w)).sort((o,i)=>t(o)-t(i))[0]?.entity_id??null}var Ge=(r,e)=>typeof r[e]=="string"?r[e]:"";function fl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Yn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:Wh(o,i),l=a?r.states[a]:void 0;if(!l||!No(l))continue;let c=l.attributes,u=Ge(c,"app_name")||Ge(c,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Co(u),title:Ge(c,"media_title")||Ge(c,"media_channel")||u||"",subtitle:Ge(c,"media_artist")||Ge(c,"media_series_title")||Ge(c,"media_album_name"),app:u,picture:Ge(c,"entity_picture")||null,playing:Oo(l),ambilight:i.ambilight??1})}return n}function gl(r){let e=r.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function _l(r,e){return(r===null?0:pl((r+4)/16))*(1-.45*e)}function Ue(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var _r=new Set(["contact_lost","unlocked_night","own"]);function Lh(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),o=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(o){let i=Number(t.state),s=Number(o[2].replace(",","."));return Number.isFinite(i)&&(o[1]==="<"?i<s:i>s)}return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Bh=600*1e3,Vh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Kh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),bl=(r,e)=>{if(e.startsWith("binary_sensor."))return Kh.get(String(r.states[e]?.attributes.device_class))};function Gh(r,e){let t=new Set,n=[];for(let o of r.floors)for(let i of o.openings){let s=e.get(i.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:o.id,roomId:i.room_id,entity:a}))}return n}function wl(r,e,t,n){let o=[];for(let a of e.floors)for(let l of a.rooms){let c=K(r,l).filter(u=>bl(r,u)); Line truncated
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Io);function ll(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var Lh=[[/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]]],cl=[34,211,238];function Co(r){return r?Lh.find(([e])=>e.test(r))?.[1]??cl:cl}function No(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Oo=r=>r.state==="playing"||r.state==="on"&&No(r);function ul(r,e){let t=[],n=new Set;for(let o of e){if(!o.entity.startsWith("media_player.")||n.has(o.entity))continue;n.add(o.entity);let i=r.states[o.entity];if(!i)continue;let s=i.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:o.entity,name:o.name,at:o.at,playing:Oo(i),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:Co(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==o.entity):[],rings:o.rings??1})}return t}function dl(r){let e=new Map(r.filter(o=>o.playing).map(o=>[o.entity,o])),t=[],n=new Set;for(let o of e.values())for(let i of o.group){let s=e.get(i),a=[o.entity,i].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([o,s]))}return t}var Bh=3;function hl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!i.type.endsWith(":sprinkler"))continue;let s=t?.get(i.id)?.entity??null;!s||!Q(r.states[s])||n.push({id:i.id,at:{floorId:o.id,x:i.x,y:ce(o,i)+i.h,z:i.z},reach:Math.min(15,Math.max(.5,i.spray??Bh))})}return n}var gr=r=>r&&r!=="none"?r:null,pl=r=>Math.min(1,Math.max(0,r));function ml(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=Re(r,{cover:gr(n.cover),contact:gr(n.contact),tilt:gr(n.tilt)},"window"),i=gr(n.window),s=i?r.states[i]:void 0,a=o.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?pl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:o.tilt,cover:o.cover??0})}return t}function Vh(r,e){let t=o=>Math.hypot(o.x-e.x,o.z-e.z);return r.placements.filter(o=>o.entity_id.startsWith("media_player.")&&t(o)<Math.max(2,e.w)).sort((o,i)=>t(o)-t(i))[0]?.entity_id??null}var Ge=(r,e)=>typeof r[e]=="string"?r[e]:"";function fl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Yn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:Vh(o,i),l=a?r.states[a]:void 0;if(!l||!No(l))continue;let c=l.attributes,u=Ge(c,"app_name")||Ge(c,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Co(u),title:Ge(c,"media_title")||Ge(c,"media_channel")||u||"",subtitle:Ge(c,"media_artist")||Ge(c,"media_series_title")||Ge(c,"media_album_name"),app:u,picture:Ge(c,"entity_picture")||null,playing:Oo(l),ambilight:i.ambilight??1})}return n}function gl(r){let e=r.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function _l(r,e){return(r===null?0:pl((r+4)/16))*(1-.45*e)}function Ue(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var _r=new Set(["contact_lost","unlocked_night","own"]);function Kh(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),o=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(o){let i=Number(t.state),s=Number(o[2].replace(",","."));return Number.isFinite(i)&&(o[1]==="<"?i<s:i>s)}return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Gh=600*1e3,Uh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),jh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),bl=(r,e)=>{if(e.startsWith("binary_sensor."))return jh.get(String(r.states[e]?.attributes.device_class))};function qh(r,e){let t=new Set,n=[];for(let o of r.floors)for(let i of o.openings){let s=e.get(i.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:o.id,roomId:i.room_id,entity:a}))}return n}function wl(r,e,t,n){let o=[];for(let a of e.floors)for(let l of a.rooms){let c=K(r,l).filter(u=>bl(r,u)); Line truncated
${J`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
</svg>`}function tm(r,e,t,n){let o=e.summary,i=c=>R(r,c),s=e.autarky,a=n?m`<button class="live-fold" title=${i(n.folded?"live_unfold":"live_fold")} aria-label=${i(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=o.solar!==null?`\u2600 ${Me(r,o.solar)}`:o.consumption!==null?`\u2302 ${Me(r,o.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 om(r,e,t,n){let o=e.summary,i=c=>E(r,c),s=e.autarky,a=n?m`<button class="live-fold" title=${i(n.folded?"live_unfold":"live_fold")} aria-label=${i(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=o.solar!==null?`\u2600 ${$e(r,o.solar)}`:o.consumption!==null?`\u2302 ${$e(r,o.consumption)}`:null;return m`<div class="live-card live-card-house live-folded" data-i=${t}>
${s!==null?m`<div class="live-own">${_n(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(o.solar!==null&&l.push(m`<div class="live-row live-solar"><span>☀ ${i("energy_solar")}</span><b>${Me(r,o.solar)}</b></div>`),o.consumption!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${i("energy_consumption")}</span><b>${Me(r,o.consumption)}</b></div>`),o.rest!==void 0&&o.rest!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${i("energy_rest")}</span><b>${Me(r,o.rest)}</b></div>`),o.battery!==null||o.soc!==null){let c=o.battery===null||Math.abs(o.battery)<15?"":o.battery>0?" \u2193":" \u2191";l.push(m`<div class="live-row live-battery"><span>▮ ${i("energy_battery")}${c}</span><b>${o.soc!==null?`${Math.round(o.soc)} %`:""}${o.battery!==null&&Math.abs(o.battery)>=15?` \xB7 ${Me(r,o.battery)}`:""}</b></div>`)}if(o.grid!==null){let c=o.grid<-15;l.push(m`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${i(c?"energy_grid_export":"energy_grid_import")}</span><b>${Me(r,o.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}>
</div>`}let l=[];if(o.solar!==null&&l.push(m`<div class="live-row live-solar"><span>☀ ${i("energy_solar")}</span><b>${$e(r,o.solar)}</b></div>`),o.consumption!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${i("energy_consumption")}</span><b>${$e(r,o.consumption)}</b></div>`),o.rest!==void 0&&o.rest!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${i("energy_rest")}</span><b>${$e(r,o.rest)}</b></div>`),o.battery!==null||o.soc!==null){let c=o.battery===null||Math.abs(o.battery)<15?"":o.battery>0?" \u2193":" \u2191";l.push(m`<div class="live-row live-battery"><span>▮ ${i("energy_battery")}${c}</span><b>${o.soc!==null?`${Math.round(o.soc)} %`:""}${o.battery!==null&&Math.abs(o.battery)>=15?` \xB7 ${$e(r,o.battery)}`:""}</b></div>`)}if(o.grid!==null){let c=o.grid<-15;l.push(m`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${i(c?"energy_grid_export":"energy_grid_import")}</span><b>${$e(r,o.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">${gn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${i("live_autarky")}</span></div></div>`:f}
${s!==null?m`<div class="live-own">${_n(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${i("live_autarky")}</span></div></div>`:f}
<div class="live-rows">${l}</div>
${rm(r,e.curves)} ${nm(r,e.week)}
</div>`}function nm(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[o,i]=[150,30],s=o/7,a=(c,u,d)=>c===null||c<=0?f:J`<rect x=${u.toFixed(1)} y=${(i-c/n*i).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*i).toFixed(1)} class=${d}></rect>`,l=c=>c.reduce((u,d)=>u+(d??0),0);return m`<div class="live-day live-week" title=${R(r,"live_week_hint",{solar:O(r,l(e.solar),0),use:O(r,l(e.use),0)})}>
${sm(r,e.curves)} ${im(r,e.week)}
</div>`}function im(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[o,i]=[150,30],s=o/7,a=(c,u,h)=>c===null||c<=0?f:J`<rect x=${u.toFixed(1)} y=${(i-c/n*i).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*i).toFixed(1)} class=${h}></rect>`,l=c=>c.reduce((u,h)=>u+(h??0),0);return m`<div class="live-day live-week" title=${E(r,"live_week_hint",{solar:O(r,l(e.solar),0),use:O(r,l(e.use),0)})}>
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
${e.days.map((c,u)=>J`${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 ${R(r,"live_days")}</span>
</div>`}function rm(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[o,i]=[150,34],s=sn(e.solar,o,i,n),a=sn(e.use,o,i,n);return m`<div class="live-day" title=${R(r,"live_day_hint")}>
<span>7 ${E(r,"live_days")}</span>
</div>`}function sm(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[o,i]=[150,34],s=an(e.solar,o,i,n),a=an(e.use,o,i,n);return m`<div class="live-day" title=${E(r,"live_day_hint")}>
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
${s?J`<path d=${`${s}L${o},${i}L0,${i}Z`} class="live-day-solar"></path>`:f}
${a?J`<path d=${a} class="live-day-use"></path>`:f}
</svg>
<span>24 h</span>
</div>`}function om(r,e,t,n){let o=e.car,i=(u,d)=>R(r,u,d),s=dc(o.soc),a=o.home?o.charging?`\u26A1 ${i("live_car_charging")}${o.chargingW?` \xB7 ${Me(r,o.chargingW)}`:""}`:o.plugged?`\u{1F50C} ${i("live_car_plugged")}`:"":`${i("live_car_away")}${o.where?` \xB7 ${o.where}`:""}${o.distance!==null?` \xB7 ${O(r,o.distance,o.distance<10?1:0)} km`:""}`,l=o.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 ${o.charging?"live-charging":""} ${o.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
</div>`}function am(r,e,t,n){let o=e.car,i=(u,h)=>E(r,u,h),s=pc(o.soc),a=o.home?o.charging?`\u26A1 ${i("live_car_charging")}${o.chargingW?` \xB7 ${$e(r,o.chargingW)}`:""}`:o.plugged?`\u{1F50C} ${i("live_car_plugged")}`:"":`${i("live_car_away")}${o.where?` \xB7 ${o.where}`:""}${o.distance!==null?` \xB7 ${O(r,o.distance,o.distance<10?1:0)} km`:""}`,l=o.entities,c=(u,h,p,d)=>m`<button class="live-btn ${u?"live-on":""}" title=${h} aria-label=${h} aria-pressed=${u??!1} @click=${g=>(g.stopPropagation(),d())}>${p}</button>`;return m`<div class="live-card live-card-car ${o.charging?"live-charging":""} ${o.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
<div class="live-own">
${gn((o.soc??0)/100,s)}
${_n((o.soc??0)/100,s)}
<div class="live-own-text"><b>${o.soc!==null?`${Math.round(o.soc)} %`:"\u2013"}</b><span>${o.range!==null?`${Math.round(o.range)} ${o.rangeUnit}`:""}</span></div>
</div>
<div class="live-rows">
@@ -846,7 +846,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${l.charge&&o.home?c(o.charging,i("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f}
</div>
</div>
</div>`}function im(r,e,t,n){let o=e.media,i=l=>R(r,l),s=`rgb(${o.color.join(",")})`,a=(l,c,u)=>m`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),n("media_player",u,o.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 lm(r,e,t,n){let o=e.media,i=l=>E(r,l),s=`rgb(${o.color.join(",")})`,a=(l,c,u)=>m`<button class="live-btn" title=${l} aria-label=${l} @click=${h=>(h.stopPropagation(),n("media_player",u,o.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")}>
${o.picture?m`<img class="live-cover" src=${o.picture} alt="" loading="lazy" />`:m`<div class="live-cover live-cover-none">♪</div>`}
<div class="live-rows">
<div class="live-title" title=${o.title}>${o.title||o.name}</div>
@@ -865,9 +865,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
/>`:f}
</div>
</div>
</div>`}function hc(r){let e=[...r.querySelectorAll(".live-card")].filter(i=>i.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,o=e.map(i=>{let[s,a]=[Number(i.dataset.x),i.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return i.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:i,x:l,y:Number(i.dataset.y),w:a,h:i.offsetHeight}}).sort((i,s)=>s.y-i.y);for(let i of o){let s=i.y;for(let l=0;l<12;l++){let c={x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s},u=t.find(d=>c.x0<d.x1+6&&c.x1>d.x0-6&&c.y0<d.y1+6&&c.y1>d.y0-6);if(!u)break;s=u.y0-8}t.push({x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s});let a=i.y-s;i.el.style.transform=`translate(${Math.round(i.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,i.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function sm(r,e,t){let n=e.printer,o=(c,u)=>R(r,c,u),i=n.progress??0,s=c=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${o("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${o("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return m`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
</div>`}function mc(r){let e=[...r.querySelectorAll(".live-card")].filter(i=>i.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,o=e.map(i=>{let[s,a]=[Number(i.dataset.x),i.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return i.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:i,x:l,y:Number(i.dataset.y),w:a,h:i.offsetHeight}}).sort((i,s)=>s.y-i.y);for(let i of o){let s=i.y;for(let l=0;l<12;l++){let c={x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s},u=t.find(h=>c.x0<h.x1+6&&c.x1>h.x0-6&&c.y0<h.y1+6&&c.y1>h.y0-6);if(!u)break;s=u.y0-8}t.push({x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s});let a=i.y-s;i.el.style.transform=`translate(${Math.round(i.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,i.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function cm(r,e,t){let n=e.printer,o=(c,u)=>E(r,c,u),i=n.progress??0,s=c=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${o("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${o("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return m`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
<div class="live-own">
${n.picture?m`<img class="live-print-pic" src=${n.picture} alt="" />`:gn(i/100,n.printing?"#38bdf8":"#8aa0c8")}
${n.picture?m`<img class="live-print-pic" src=${n.picture} alt="" />`:_n(i/100,n.printing?"#38bdf8":"#8aa0c8")}
<div class="live-own-text"><b>${n.progress!==null?`${Math.round(i)} %`:"\u2013"}</b><span>${o(`printer_${n.printing?"printing":/finish|complete|fertig/.test(n.status)?"done":/pause/.test(n.status)?"paused":/error|fail/.test(n.status)?"error":"idle"}`)}</span></div>
</div>
<div class="live-rows">
@@ -878,22 +878,28 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${l?m`<div class="live-status">🌡 ${l}</div>`:f}
${n.filaments.length?m`<div class="live-filaments">${n.filaments.map(c=>m`<i style=${`background:${c}`}></i>`)}</div>`:f}
</div>
</div>`}function am(r,e,t){let n=e.pump,o=a=>R(r,a),i=a=>a===null?"\u2013":`${O(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return m`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
</div>`}function um(r,e,t){let n=e.pump,o=a=>E(r,a),i=a=>a===null?"\u2013":`${O(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return m`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
<div class="live-own">
${gn(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
${_n(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
<div class="live-own-text"><b>${n.cop!==null?O(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
</div>
<div class="live-rows">
<div class="live-title">${e.name}</div>
<div class="live-status">${s} ${o(`heatpump_${n.mode}`)}</div>
${n.flow!==null||n.return!==null?m`<div class="live-row live-heat"><span>${o("heatpump_flow_return")}</span><b>${i(n.flow)} → ${i(n.return)}</b></div>`:f}
${n.heat!==null?m`<div class="live-row live-heat"><span>${o("heatpump_heat")}</span><b>${Me(r,n.heat)}</b></div>`:f}
${n.power!==null?m`<div class="live-row live-house"><span>${o("heatpump_power")}</span><b>${Me(r,n.power)}</b></div>`:f}
${n.heat!==null?m`<div class="live-row live-heat"><span>${o("heatpump_heat")}</span><b>${$e(r,n.heat)}</b></div>`:f}
${n.power!==null?m`<div class="live-row live-house"><span>${o("heatpump_power")}</span><b>${$e(r,n.power)}</b></div>`:f}
${n.outside!==null?m`<div class="live-status">🌡 ${o("heatpump_outside")} ${i(n.outside)}</div>`:f}
</div>
</div>`}function pc(r,e,t,n){return e.length?m`<div class="live-cards">
${e.map((o,i)=>o.kind==="house"?tm(r,o,i,n):o.kind==="car"?om(r,o,i,t):o.kind==="printer"?sm(r,o,i):o.kind==="heatpump"?am(r,o,i):im(r,o,i,t))}
</div>`:f}var mc=te`
</div>`}function dm(r,e,t){let n=(o,i,s)=>o===null?"\u2013":`${O(r,o,i)} ${s}`;return m`<div class="live-card live-card-roomclimate" data-i=${t} data-room=${e.roomId}>
<div class="live-title">${e.name||E(r,"room")}</div>
<div class="live-row live-climate-temperature"><span>🌡 ${E(r,"climate_temperature")}</span><b>${n(e.temperature===null?null:r?oe(r,e.temperature):e.temperature,1,r?X(r):"\xB0C")}</b></div>
<div class="live-row live-climate-humidity"><span>💧 ${E(r,"climate_humidity")}</span><b>${n(e.humidity,0,"%")}</b></div>
<div class="live-row live-climate-co2"><span>${E(r,"climate_co2")}</span><b>${n(e.co2,0,"ppm")}</b></div>
${e.temperature===null&&e.humidity===null&&e.co2===null?m`<small class="live-status">${E(r,"climate_card_missing")}</small>`:f}
</div>`}function fc(r,e,t,n,o=!1){return e.length?m`<div class="live-cards">
${e.map((i,s)=>i.kind==="roomclimate"?dm(r,i,s):o?f:i.kind==="house"?om(r,i,s,n):i.kind==="car"?am(r,i,s,t):i.kind==="printer"?cm(r,i,s):i.kind==="heatpump"?um(r,i,s):lm(r,i,s,t))}
</div>`:f}var gc=ne`
.live-cards {
position: absolute;
inset: 0;
@@ -992,6 +998,21 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
gap: 2px;
min-width: 150px;
}
.live-card-roomclimate {
display: grid;
gap: 4px;
min-width: 190px;
max-width: calc(100vw - 24px);
box-sizing: border-box;
}
.live-card-roomclimate .live-title {
overflow: hidden;
text-overflow: ellipsis;
max-width: 220px;
}
.live-climate-temperature b { color: color-mix(in srgb, #ffca8a 80%, var(--nf-text)); }
.live-climate-humidity b { color: color-mix(in srgb, #7dd3fc 80%, var(--nf-text)); }
.live-climate-co2 b { color: color-mix(in srgb, #c4b5fd 80%, var(--nf-text)); }
.live-row {
display: flex;
justify-content: space-between;
@@ -1199,7 +1220,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
text-transform: uppercase;
letter-spacing: 0.04em;
}
`;function Rr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var ii=r=>r.points.length>=3;function fc(r,e,t){return r.rooms.filter(ii).find(n=>H([e,t],n.points))}function lm(r,e,t,n){let o=[];for(let a of e.rooms.filter(ii)){let[l,c]=We(a.points);o.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let i=new Set,s=(a,l,c,u)=>{if(i.has(a)||!(a in r.states))return;i.add(a);let d=fc(e,l,c),p=[d?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");o.push({kind:"device",name:L(r,a),where:p,floorId:e.id,roomId:d?.id??null,entity:a,icon:D(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??wt(D(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=fc(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");o.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 o}function gc(r,e){let t=ot(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>lm(r,i,t,n));for(let i of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(p=>i.rooms.includes(p.id)&&ii(p)).map(p=>({f:d,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=We(l.points);o.push({kind:"circuit",name:`\u{1F50C} ${i.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 o}function cm(r,e){return(Rr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function _c(r,e,t=8){let n=Rr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Rr(e.trim());return r.filter(i=>{let s=Rr([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:cm(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var um=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],dm=[2200,2700,3200,4e3,5e3,6500],hm=["hs","rgb","rgbw","rgbww","xy"],pm=4,bc=16,wc=32,mm=128;function ai(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>hm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function li(r){return((r.attributes.supported_features??0)&pm)!==0&&typeof r.attributes.current_position=="number"}var si=class extends re{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 R(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){fe(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,o)=>{let i=o/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(i)*39}%;top:${50+Math.sin(i)*39}%">${n}</div>`})}renderLight(e){let t=ai(e),n=e.state==="on",o=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,i=t.color?um.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?dm.map(s=>m`<button class="qm-swatch" style="background:${fm(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${i.length?"":"qm-ring-small"}">
`;function Rr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var oi=r=>r.points.length>=3;function _c(r,e,t){return r.rooms.filter(oi).find(n=>H([e,t],n.points))}function hm(r,e,t,n){let o=[];for(let a of e.rooms.filter(oi)){let[l,c]=xe(a.points);o.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let i=new Set,s=(a,l,c,u)=>{if(i.has(a)||!(a in r.states))return;i.add(a);let h=_c(e,l,c),p=[h?.name,n?e.name:void 0].filter(d=>!!d).join(" \xB7 ");o.push({kind:"device",name:L(r,a),where:p,floorId:e.id,roomId:h?.id??null,entity:a,icon:D(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??wt(D(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=_c(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");o.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 o}function bc(r,e){let t=ot(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>hm(r,i,t,n));for(let i of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(p=>i.rooms.includes(p.id)&&oi(p)).map(p=>({f:h,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=xe(l.points);o.push({kind:"circuit",name:`\u{1F50C} ${i.name}`,where:s.map(h=>h.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return o}function pm(r,e){return(Rr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function wc(r,e,t=8){let n=Rr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Rr(e.trim());return r.filter(i=>{let s=Rr([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:pm(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var mm=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],fm=[2200,2700,3200,4e3,5e3,6500],gm=["hs","rgb","rgbw","rgbww","xy"],_m=4,vc=16,yc=32,bm=128;function si(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>gm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function ai(r){return((r.attributes.supported_features??0)&_m)!==0&&typeof r.attributes.current_position=="number"}var ii=class extends re{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 E(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){fe(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,o)=>{let i=o/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(i)*39}%;top:${50+Math.sin(i)*39}%">${n}</div>`})}renderLight(e){let t=si(e),n=e.state==="on",o=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,i=t.color?mm.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?fm.map(s=>m`<button class="qm-swatch" style="background:${wm(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${i.length?"":"qm-ring-small"}">
${this.ring(i)}
<button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @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>
@@ -1214,7 +1235,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.value=${String(Math.max(1,o))}
aria-label=${this.t("brightness")}
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
/>`:f}`}renderCover(e){e=er(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",o=li(e),i=(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=[i("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...o?[75,50].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],i("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...o?[25].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[i("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(o||Number(e.attributes.supported_features??0)&8)?[i("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(o?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||n||e.state==="open"||e.state==="closed";return m`<div class="qm-ring">
/>`:f}`}renderCover(e){e=er(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",o=ai(e),i=(u,h,p,d=!1)=>m`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${p}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[i("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...o?[75,50].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],i("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...o?[25].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[i("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(o||Number(e.attributes.supported_features??0)&8)?[i("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(o?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||n||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":""}"
@@ -1224,7 +1245,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@click=${()=>n?this.call("cover","stop_cover"):this.ask()&&this.call("cover",l>50?"open_cover":"close_cover")}
>
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 4h16M5 4v15M19 4v15M7 8h10M7 12h10M7 16h10" /></svg>
<b>${t!==null?`${t} %`:ee(this.hass,e)}</b>
<b>${t!==null?`${t} %`:te(this.hass,e)}</b>
</button>
</div>
${o?m`<input
@@ -1236,7 +1257,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
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,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&mm&&n!==null?m`<label class="qm-tilt"
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&bm&&n!==null?m`<label class="qm-tilt"
><span>${this.t("cover_tilt")} · ${Math.round(n)} %</span>
<input
class="qm-slider"
@@ -1246,9 +1267,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.value=${String(n)}
aria-label=${this.t("cover_tilt")}
@change=${o=>this.call("cover","set_cover_tilt_position",{entity_id:this.tiltEntity||this.entity,tilt_position:Number(o.target.value)})}
/></label>`:t&(bc|wc)?m`<div class="qm-tilt-buttons">
${t&bc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&wc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
/></label>`:t&(vc|yc)?m`<div class="qm-tilt-buttons">
${t&vc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&yc?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",n=e.entity_id.split(".")[0];return m`<div class="qm-ring qm-ring-small">
<button
class="qm-power ${t?"qm-on":""}"
@@ -1256,25 +1277,25 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@click=${()=>this.ask()&&(n==="lock"?this.call("lock",t?"lock":"unlock"):this.call("homeassistant","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>
<b>${ee(this.hass,e)}</b>
<b>${te(this.hass,e)}</b>
</button>
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",o=e.attributes,i=typeof o.volume_level=="number"?Math.round(o.volume_level*100):null,s=Array.isArray(o.source_list)?o.source_list.slice(0,24):[],a=[o.media_title,o.media_artist].filter(d=>typeof d=="string"&&d).join(" \xB7 "),l=d=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${d} /></svg>`,c=(d,p,h,g=!1)=>m`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${p} title=${p} @click=${h}>${d}</button>`,u=t?[c(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),c(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),c(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return m`<div class="qm-ring ${u.length?"":"qm-ring-small"}">
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",o=e.attributes,i=typeof o.volume_level=="number"?Math.round(o.volume_level*100):null,s=Array.isArray(o.source_list)?o.source_list.slice(0,24):[],a=[o.media_title,o.media_artist].filter(h=>typeof h=="string"&&h).join(" \xB7 "),l=h=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${h} /></svg>`,c=(h,p,d,g=!1)=>m`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${p} title=${p} @click=${d}>${h}</button>`,u=t?[c(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),c(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),c(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return m`<div class="qm-ring ${u.length?"":"qm-ring-small"}">
${this.ring(u)}
<button class="qm-power ${t?"qm-on":""}" aria-pressed=${t} @click=${()=>this.ask()&&this.call("media_player",t?"turn_off":"turn_on")}>
<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>
<b>${i!==null&&t?`${i} %`:ee(this.hass,e)}</b>
<b>${i!==null&&t?`${i} %`:te(this.hass,e)}</b>
</button>
</div>
${a?m`<div class="qm-media-title">${a}</div>`:f}
${i!==null?m`<input class="qm-slider" type="range" min="0" max="100" .value=${String(i)} aria-label=${this.t("media_volume")} @change=${d=>this.call("media_player","volume_set",{volume_level:Number(d.target.value)/100})} />`:f}
${i!==null?m`<input class="qm-slider" type="range" min="0" max="100" .value=${String(i)} aria-label=${this.t("media_volume")} @change=${h=>this.call("media_player","volume_set",{volume_level:Number(h.target.value)/100})} />`:f}
${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 ${o.source===d?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:d})}>${d}</button>`)}</div>`:f}
<div class="qm-play">${s.map(h=>m`<button class="qm-chip ${o.source===h?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:h})}>${h}</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=D(this.entity),n=I(e)&&!Ut(e)?m`<p class="qm-note">${ee(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-play">${this.presets.map(h=>m`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:h.type,media_content_id:h.content})}>${h.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=D(this.entity),n=I(e)&&!jt(e)?m`<p class="qm-note">${te(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>
${n}
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
</div>`}static styles=[Se,te`
</div>`}static styles=[Me,ne`
.qm-play-head {
margin: 10px 0 4px;
font-size: 11px;
@@ -1517,43 +1538,43 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.qm-note {
color: var(--nf-muted);
}
`]};function fm(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,o)=>Math.round(n+(o-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",si);var gm=new URL(import.meta.url),_m=new URL("./nextfloor-3d.js?v=74227cd20cc3",gm).href,vc;function yc(){return vc??=import(_m),vc}function xc(r){if(!r||r.state!=="on")return 0;let e=typeof r.attributes.percentage=="number"?r.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var bm=new Set(["on","home","open","true","active","playing","heat","heating"]);function zr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||I(n))return!0;let o=String(n.state).toLowerCase(),i=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=i.length?i.includes(o):bm.has(o)||Number.isFinite(Number(o))&&Number(o)>0;return t.invert?!s:s}function ci(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)zr(r,o)||t.push(o.id);return t.sort()}function kc(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(o=>t.has(o.id))?{...n,furniture:n.furniture.filter(o=>!t.has(o.id))}:n)}}var Sc="image:";function ui(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(Sc))return t(n.slice(Sc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let o=r?.states[n]?.attributes.entity_picture;return typeof o=="string"&&o?o:null}return null}var _n=r=>Number(r);function wn(r){if(Array.isArray(r)){let[i,s]=[_n(r[0]),_n(r[1])];return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,o]=[_n(e),_n(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function Mc(r){return r?wn(r.charger)??wn(r.charger_position):null}function $c(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(wn(t.attributes?.vacuum_position)??Mc(t.attributes)))return e;return null}var wm=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",bn=(r,e)=>e?[r[0],-r[1]]:r;function vm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=bn(r.ga,e),[o,i]=bn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,d]=[o-t,i-n],[p,h]=[l-s,c-a],g=Math.hypot(u,d),b=Math.hypot(p,h);if(!(g>1e-6)||!(b>1e-6))return null;let _=b/g,w=Math.atan2(h,p)-Math.atan2(d,u),[M,$]=[Math.cos(w),Math.sin(w)];return x=>{let y=bn(x,e),[F,T]=[y[0]-t,y[1]-n];return[s+_*(F*M-T*$),a+_*(F*$+T*M)]}}function ym(r){if(!r)return null;let e=r.mirror===!0,[t,n]=bn(r.ga,e),[o,i]=bn(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(i-n,o-t);return Number.isFinite(s)?s:null}function Ac(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=vm(t)??(g=>g),i=ym(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=wn(a),c=l?(()=>{let[g,b]=o(l),_=_n(a?.a)*s;if(!Number.isFinite(_))return{x:g,z:b,heading:0};let w=_*Math.PI/180+i;return{x:g,z:b,heading:Math.atan2(Math.cos(w),Math.sin(w))}})():null,u=Mc(n),d=Array.isArray(n.path)?n.path:[],p=d.length>0&&wm(d[0])?[d]:d,h=[];for(let g of p){let b=[];for(let _ of Array.isArray(g)?g:[]){let w=wn(_);w&&b.push(o(w))}b.length>1&&h.push(b)}return!c&&!u&&!h.length?null:{pose:c,charger:u?o(u):null,path:h}}var Ec="nextfloor.lock3d",Rc=520,hi=class extends re{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},_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},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButto Line truncated
`]};function wm(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,o)=>Math.round(n+(o-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",ii);var vm=new URL(import.meta.url),ym=new URL("./nextfloor-3d.js?v=74227cd20cc3",vm).href,xc;function kc(){return xc??=import(ym),xc}function Sc(r){if(!r||r.state!=="on")return 0;let e=typeof r.attributes.percentage=="number"?r.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var xm=new Set(["on","home","open","true","active","playing","heat","heating"]);function zr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||I(n))return!0;let o=String(n.state).toLowerCase(),i=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=i.length?i.includes(o):xm.has(o)||Number.isFinite(Number(o))&&Number(o)>0;return t.invert?!s:s}function li(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)zr(r,o)||t.push(o.id);return t.sort()}function Mc(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(o=>t.has(o.id))?{...n,furniture:n.furniture.filter(o=>!t.has(o.id))}:n)}}var $c="image:";function ci(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith($c))return t(n.slice($c.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let o=r?.states[n]?.attributes.entity_picture;return typeof o=="string"&&o?o:null}return null}var bn=r=>Number(r);function vn(r){if(Array.isArray(r)){let[i,s]=[bn(r[0]),bn(r[1])];return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,o]=[bn(e),bn(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function Ac(r){return r?vn(r.charger)??vn(r.charger_position):null}function Ec(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(vn(t.attributes?.vacuum_position)??Ac(t.attributes)))return e;return null}var km=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",wn=(r,e)=>e?[r[0],-r[1]]:r;function Sm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=wn(r.ga,e),[o,i]=wn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,h]=[o-t,i-n],[p,d]=[l-s,c-a],g=Math.hypot(u,h),b=Math.hypot(p,d);if(!(g>1e-6)||!(b>1e-6))return null;let _=b/g,w=Math.atan2(d,p)-Math.atan2(h,u),[M,$]=[Math.cos(w),Math.sin(w)];return x=>{let y=wn(x,e),[F,T]=[y[0]-t,y[1]-n];return[s+_*(F*M-T*$),a+_*(F*$+T*M)]}}function Mm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=wn(r.ga,e),[o,i]=wn(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(i-n,o-t);return Number.isFinite(s)?s:null}function Rc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=Sm(t)??(g=>g),i=Mm(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=vn(a),c=l?(()=>{let[g,b]=o(l),_=bn(a?.a)*s;if(!Number.isFinite(_))return{x:g,z:b,heading:0};let w=_*Math.PI/180+i;return{x:g,z:b,heading:Math.atan2(Math.cos(w),Math.sin(w))}})():null,u=Ac(n),h=Array.isArray(n.path)?n.path:[],p=h.length>0&&km(h[0])?[h]:h,d=[];for(let g of p){let b=[];for(let _ of Array.isArray(g)?g:[]){let w=vn(_);w&&b.push(o(w))}b.length>1&&d.push(b)}return!c&&!u&&!d.length?null:{pose:c,charger:u?o(u):null,path:d}}var zc="nextfloor.lock3d",Tc=520,di=class extends re{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},_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},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButto 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,n=this.building;if(!t||!n||!this.hass)return;let o=this._travel,i=o&&!o.loading?$t(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=rt(i,n.floors),this.furnitureLinks=ot(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?wl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=$l({hass:i,building:n,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)!==i.states[v])))return;ci(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(v=>[v,i.states[v]])),this.refreshToday(n),this.refreshForecast(n);let a=en(i,n),l=sa(i,n.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(i):n);this.placementInfo=new Map(l.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let c=this.furnitureMarkers(i,n,new Set(l.map(v=>v.id)),new Set(a.map(v=>v.powerEntity)));a.push(...c.consumers);let u=tn(i,n,a,Fe(n,v=>this.furnitureLinks?.get(v.id)?.power??null)),d=new Map(a.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=it(i,n.floors);let p=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of n.floors)for(let k of v.outdoor??[]){if(!k.area_id&&!k.temp_entity&&!k.pump_entity)continue;let B=k.temp_entity?i.states[k.temp_entity]:void 0,z=k.pump_entity?i.states[k.pump_entity]:void 0,[W,de]=We(k.points),qe=B&&Number.isFinite(Number(B.state))?`${O(i,ue(i,Kn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${ne(i)}`:"",ut=!!z&&Q(z);l.push({id:k.area_id?`outdoor:${k.id}`:k.pump_entity??k.temp_entity,floorId:v.id,roomId:null,x:W,z:de,y:Nn(v,k,W,de)+.7,icon:xe(k.type==="pool"?"pool":k.type==="terrace"?"table-chair":"tree-outline"),name:k.area_id&&i.areas?.[k.area_id]?.name||R(i,`out_${k.type}`),text:[qe,ut?R(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:ut,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let v of n.floors){for(let k of v.placements)k.pin_offset&&h.set(`${v.id}:${k.entity_id}`,k.pin_offset);for(let k of v.furniture)k.pin_offset&&h.set(`f:${k.id}`,k.pin_offset)}let g=v=>{let k=v.lamp?void 0:(v.furnitureId?h.get(`f:${v.furnitureId}`):void 0)??h.get(`${v.floorId}:${v.id}`);return k?{...v,x:v.x+(k.x??0),z:v.z+(k.z??0),y:v.y+(k.y??0)}:v};t.setDevices([...[...l,...c.markers].map(g).map(v=>{let k=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:d.get(v.id)??null,B={...v,power:k,powerText:k===null?void 0:se(i,k),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(i,n,u,v.furnitureId)??v.text},z=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",W=p.has(v.id)||!!v.furnitureId&&p.has(v.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:v.show==="always",caption:z}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ls(i,n.floors)),t.setCovers(Qs(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let v of n.floors)for(let k of v.furniture)!q(k.type)?.pet||!k.room_sensor||k.room_sensor==="none"||b.set(k.id,_o(i,v.rooms.filter(B=>B.points.length>=3),null,k.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(ml(i,n)),t.setParked(Vo(i,n)),t.setGateStates(Fl(i,n));let _=new Map(n.floors.flatMap(v=>v.openings.map(k=>[k.id,k.type]))),w=new Map([...this.openingLinks].map(([v,k])=>[v,Ee(i,k,_.get(v))]));t.setOpeningStates(w),this.setAlerts(this.alertSrc?Wo(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let M=[...l,...c.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(k=>k.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...w].map(([v,k])=>`${v}:${k.open}:${k.cover===null?"-":k.cover.toFixed(1)}`).join(";");if(M!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=M,v||this.scheduleThumbs(1500)}let $=jl(i,n,a,n.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),x=this.liveCars(i,n);for(let v of x){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let k=n.floors.flatMap(W=>W.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:W.id,x:de.x,z:de.z,y:1}))).sort((W,de)=>Math.hypot(W.x-v.at.x,W.z-v.at.z)-Math.hypot(de.x-v.at.x,de.z-v.at.z))[0],B=k&&k.floorId===v.at.floorId&&Math.hypot(k.x-v.at.x,k.z-v.at.z)<9,z=k??pn(n);!z||!v.car.charging&&!B||$.arcs.push({key:`car:${v.spot}`,from:z,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...z,y:.35},{floorId:v.at.floorId,x:(z.x+v.at.x)/2,z:(z.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let y=pn(n);for(let v of this.liveHeatPumps(n)){let k=v.pump.heat??(v.pump.mode==="heating"||v.puLine truncated
<button class="nf-thumbs-fold" title=${R(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${R(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${o}>${n?"\u25B8":"\u25C2"}</button>
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let o=this._travel,i=o&&!o.loading?At(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=rt(i,n.floors),this.furnitureLinks=ot(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?wl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=Al({hass:i,building:n,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)!==i.states[v])))return;li(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(v=>[v,i.states[v]])),this.refreshToday(n),this.refreshForecast(n);let a=tn(i,n),l=sa(i,n.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(i):n);this.placementInfo=new Map(l.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let c=this.furnitureMarkers(i,n,new Set(l.map(v=>v.id)),new Set(a.map(v=>v.powerEntity)));a.push(...c.consumers);let u=nn(i,n,a,De(n,v=>this.furnitureLinks?.get(v.id)?.power??null)),h=new Map(a.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=it(i,n.floors);let p=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of n.floors)for(let k of v.outdoor??[]){if(!k.area_id&&!k.temp_entity&&!k.pump_entity)continue;let B=k.temp_entity?i.states[k.temp_entity]:void 0,z=k.pump_entity?i.states[k.pump_entity]:void 0,[W,de]=xe(k.points),qe=B&&Number.isFinite(Number(B.state))?`${O(i,oe(i,Gn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${X(i)}`:"",ut=!!z&&Q(z);l.push({id:k.area_id?`outdoor:${k.id}`:k.pump_entity??k.temp_entity,floorId:v.id,roomId:null,x:W,z:de,y:On(v,k,W,de)+.7,icon:ke(k.type==="pool"?"pool":k.type==="terrace"?"table-chair":"tree-outline"),name:k.area_id&&i.areas?.[k.area_id]?.name||E(i,`out_${k.type}`),text:[qe,ut?E(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:ut,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let v of n.floors){for(let k of v.placements)k.pin_offset&&d.set(`${v.id}:${k.entity_id}`,k.pin_offset);for(let k of v.furniture)k.pin_offset&&d.set(`f:${k.id}`,k.pin_offset)}let g=v=>{let k=v.lamp?void 0:(v.furnitureId?d.get(`f:${v.furnitureId}`):void 0)??d.get(`${v.floorId}:${v.id}`);return k?{...v,x:v.x+(k.x??0),z:v.z+(k.z??0),y:v.y+(k.y??0)}:v};t.setDevices([...[...l,...c.markers].map(g).map(v=>{let k=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:h.get(v.id)??null,B={...v,power:k,powerText:k===null?void 0:ae(i,k),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(i,n,u,v.furnitureId)??v.text},z=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",W=p.has(v.id)||!!v.furnitureId&&p.has(v.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:v.show==="always",caption:z}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ls(i,n.floors)),t.setCovers(Qs(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let v of n.floors)for(let k of v.furniture)!q(k.type)?.pet||!k.room_sensor||k.room_sensor==="none"||b.set(k.id,_o(i,v.rooms.filter(B=>B.points.length>=3),null,k.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(ml(i,n)),t.setParked(Vo(i,n)),t.setGateStates(Dl(i,n));let _=new Map(n.floors.flatMap(v=>v.openings.map(k=>[k.id,k.type]))),w=new Map([...this.openingLinks].map(([v,k])=>[v,Re(i,k,_.get(v))]));t.setOpeningStates(w),this.setAlerts(this.alertSrc?Wo(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let M=[...l,...c.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(k=>k.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...w].map(([v,k])=>`${v}:${k.open}:${k.cover===null?"-":k.cover.toFixed(1)}`).join(";");if(M!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=M,v||this.scheduleThumbs(1500)}let $=ql(i,n,a,n.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),x=this.liveCars(i,n);for(let v of x){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let k=n.floors.flatMap(W=>W.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:W.id,x:de.x,z:de.z,y:1}))).sort((W,de)=>Math.hypot(W.x-v.at.x,W.z-v.at.z)-Math.hypot(de.x-v.at.x,de.z-v.at.z))[0],B=k&&k.floorId===v.at.floorId&&Math.hypot(k.x-v.at.x,k.z-v.at.z)<9,z=k??mn(n);!z||!v.car.charging&&!B||$.arcs.push({key:`car:${v.spot}`,from:z,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...z,y:.35},{floorId:v.at.floorId,x:(z.x+v.at.x)/2,z:(z.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let y=mn(n);for(let v of this.liveHeatPumps(n)){let k=v.pump.heat??(v.pump.mode==="heating"||v.pumLine truncated
<button class="nf-thumbs-fold" title=${E(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${E(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${o}>${n?"\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>
<span>${R(this.hass,"all_floors")}</span>
<span>${E(this.hass,"all_floors")}</span>
</button>
${t.map(i=>m`<button class="nf-thumb" aria-pressed=${this.floorId===i.floorId} @click=${()=>this.fire("floor-tap",{floorId:i.floorId})}>
${n?f:m`<img src=${i.url} alt="" />`}
<span>${e.get(i.floorId)??""}</span>
</button>`)}
</nav>`}onDeviceHold(e,t,n){let o=D(e);o==="light"||o==="cover"||o==="switch"||o==="fan"||o==="lock"?this._menu={entity:e,x:t,y:n}:fe(this,e)}onDeviceSwipe(e,t,n,o,i){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=D(e);if(l==="light"&&ai(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:o,y:i},!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:o,y:i},!0}if(l==="cover"&&li(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:o,y:i},!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-n/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(){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,fa(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}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()||!da(e,this.screenName)||!ha(e))return;let n=pa(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),ma(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${R(this.hass,"close")} @click=${()=>this._announcement=null}>
</nav>`}onDeviceHold(e,t,n){let o=D(e);o==="light"||o==="cover"||o==="switch"||o==="fan"||o==="lock"?this._menu={entity:e,x:t,y:n}:fe(this,e)}onDeviceSwipe(e,t,n,o,i){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=D(e);if(l==="light"&&si(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:o,y:i},!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:o,y:i},!0}if(l==="cover"&&ai(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:o,y:i},!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-n/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(){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,fa(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}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()||!da(e,this.screenName)||!ha(e))return;let n=pa(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),ma(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${E(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(n=>m`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${Lo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Lo(this.hass,e,n)}</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(i=>i.rooms).find(i=>i.id===this.roomId),n=t?K(this.hass,t).filter(i=>D(i)==="scene"||D(i)==="script").slice(0,6):[];if(!n.length)return f;let o=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return m`<div class="nf-scenes">
${n.map(i=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===i} @click=${()=>this.runScene(i)}>${L(this.hass,i,o)}</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=${R(this.hass,"find")} aria-label=${R(this.hass,"find")} @click=${()=>this._find=""}>
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return m`<button class="nf-find-btn" title=${E(this.hass,"find")} aria-label=${E(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=_c(this.findIndex??=gc(this.hass,e),this._find);return m`<div class="nf-find">
</button>`;let t=wc(this.findIndex??=bc(this.hass,e),this._find);return m`<div class="nf-find">
<input
type="search"
placeholder=${R(this.hass,"find_placeholder")}
placeholder=${E(this.hass,"find_placeholder")}
.value=${this._find}
@input=${n=>this._find=n.target.value}
@keydown=${n=>{n.key==="Escape"&&(this._find=null),n.key==="Enter"&&t[0]&&this.goTo(t[0])}}
/>
<button class="nf-find-close" aria-label=${R(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
<button class="nf-find-close" aria-label=${E(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
${this._find.trim()?m`<div class="nf-find-list">
${t.length?t.map(n=>m`<button @click=${()=>this.goTo(n)}>
<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=${n.icon?rr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
<span><b>${n.name}</b>${n.where?m`<small>${n.where}</small>`:f}</span>
</button>`):m`<p>${R(this.hass,"find_none")}</p>`}
</button>`):m`<p>${E(this.hass,"find_none")}</p>`}
</div>`:f}
</div>`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let n=(_,w)=>R(t,_,w),o=m`<button
</div>`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let n=(_,w)=>E(t,_,w),o=m`<button
class="nf-central-btn ${this._central?"nf-central-on":""}"
title=${n("central")}
aria-label=${n("central")}
@@ -1561,9 +1582,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@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 o;let i=this.floorId?e.floors.find(_=>_.id===this.floorId):void 0,s=i?[i]:e.floors,a=s.flatMap(_=>bo(t,_).lights),l=s.flatMap(_=>bo(t,_).covers),c=a.filter(_=>t.states[_]?.state==="on").length,u=!i,d=(_,w,M,$)=>{if($.length){if(u&&this._armed!==_){this._armed=_,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(w,M,{entity_id:$})}},p=(_,w,M,$,x)=>m`<button class="nf-btn ${this._armed===_?"nf-central-armed":""}" ?disabled=${!x.length} @click=${()=>d(_,M,$,x)}>
</button>`;if(!this._central)return o;let i=this.floorId?e.floors.find(_=>_.id===this.floorId):void 0,s=i?[i]:e.floors,a=s.flatMap(_=>bo(t,_).lights),l=s.flatMap(_=>bo(t,_).covers),c=a.filter(_=>t.states[_]?.state==="on").length,u=!i,h=(_,w,M,$)=>{if($.length){if(u&&this._armed!==_){this._armed=_,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(w,M,{entity_id:$})}},p=(_,w,M,$,x)=>m`<button class="nf-btn ${this._armed===_?"nf-central-armed":""}" ?disabled=${!x.length} @click=${()=>h(_,M,$,x)}>
${this._armed===_?n("central_sure"):n(w)}
</button>`,h=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(_=>t.states[_]&&(!h[_]||!i||h[_]===i.id)),b=this.buttons??e.settings.buttons??[];return m`${o}
</button>`,d=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(_=>t.states[_]&&(!d[_]||!i||d[_]===i.id)),b=this.buttons??e.settings.buttons??[];return m`${o}
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
<b>${i?i.name:n("central_house")}</b>
<div class="nf-central-row">
@@ -1596,7 +1617,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${_.icon?m`<ha-icon .icon=${_.icon.startsWith("mdi:")?_.icon:`mdi:${_.icon}`}></ha-icon>`:f}${_.label}
</button>`)}
</div>`:f}
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Ec,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(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let o=await on(this.hass,ol(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:il(o,n,t),loading:!1}}catch{this._travel=null,this._error=R(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 n=this._travel;if(!n)return;let o=n.t+250*n.speed;o>=n.to&&this.playTravel(!1),this.travelTo(o)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>R(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 n=this.hass.language??navigator.language,o=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),i=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(zc,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(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let o=await sn(this.hass,ol(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:il(o,n,t),loading:!1}}catch{this._travel=null,this._error=E(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 n=this._travel;if(!n)return;let o=n.t+250*n.speed;o>=n.to&&this.playTravel(!1),this.travelTo(o)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>E(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 n=this.hass.language??navigator.language,o=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),i=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"):o}</b>
<div class="nf-travel-track">
@@ -1609,18 +1630,18 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<button class="nf-travel-span" aria-pressed=${t.hours===24} @click=${()=>{this.openTravel(24)}}>24 h</button>
<button class="nf-travel-span" aria-pressed=${t.hours===168} @click=${()=>{this.openTravel(168)}}>7 ${e("travel_days")}</button>
<button class="nf-travel-live" @click=${()=>{this.openTravel(null)}}>● ${e("travel_live")}</button>
</div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let o=n.getBoundingClientRect(),i=o.width/2,[s,a]=[(e.clientX-o.left-i)/i,(e.clientY-o.top-i)/i],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>R(this.hass,n),t=this._stick??[0,0];return m`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}>
</div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let o=n.getBoundingClientRect(),i=o.width/2,[s,a]=[(e.clientX-o.left-i)/i,(e.clientY-o.top-i)/i],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>E(this.hass,n),t=this._stick??[0,0];return m`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}>
${this._walking?"\u2715":J`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="13" cy="4" r="2" /><path d="M10 21l2-6 3 3v5M9 12l1-4 4 1 3 3M8 9l-2 4" /></svg>`}
</button>
${this._walking?m`<div class="nf-stick" @pointerdown=${n=>this.stickMove(n,!0)} @pointermove=${n=>this.stickMove(n)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}>
<span style="transform:translate(${t[0]*34}px, ${t[1]*34}px)"></span>
</div>
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=R(this.hass,this._locked?"lock3d_off":"lock3d_on");return m`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}>
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=E(this.hass,this._locked?"lock3d_off":"lock3d_on");return m`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="5" y="11" width="14" height="9" rx="2" />
${this._locked?J`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:J`<path d="M8 11V8a4 4 0 0 1 7.5-2" />`}
</svg>
</button>`}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),o=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),i=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return m`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${o}</b><span>${i}</span></div>`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=R(this.hass,this.clean?"controls_show":"controls_hide");return m`<button
</button>`}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),o=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),i=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return m`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${o}</b><span>${i}</span></div>`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=E(this.hass,this.clean?"controls_show":"controls_hide");return m`<button
class="nf-eye ${this.clean?"nf-eye-clean":""}"
title=${e}
aria-label=${e}
@@ -1630,11 +1651,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${this.clean?J`<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>`:J`<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>${L(this.hass,e.entity)}</span>
<b>${t?R(this.hass,"swipe_off"):`${e.value} %`}</b>
<b>${t?E(this.hass,"swipe_off"):`${e.value} %`}</b>
<i><em style="height:${e.value}%"></em></i>
</div>`}tapPlate(e,t,n){let o=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),i=o?vo(o.gang_entities,q(o.type)?.gangs??0):[];if(i.length===1)return this.onDeviceTap(i[0],t,n);i.length>1&&(this._plate={ids:i,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return m`<div class="nf-menu-backdrop" @click=${n}></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((o,i)=>{let s=t.states[o],a=Q(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(o,e.x,e.y)}}><b>${i+1}</b><span>${L(t,o)}</span><i>${s?ee(t,s):"\u2013"}</i></button>`})}
${e.ids.map((o,i)=>{let s=t.states[o],a=Q(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(o,e.x,e.y)}}><b>${i+1}</b><span>${L(t,o)}</span><i>${s?te(t,s):"\u2013"}</i></button>`})}
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,o=t?.clientHeight??600,i=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(o-360,e.y-170));return m`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
<nf-quick-menu
style="left:${i}px;top:${s}px"
@@ -1647,61 +1668,61 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.myPosition=${this.myPositionOf(e.entity)}
.tiltEntity=${Xn(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 n of t.openings){let o=this.openingLinks?.get(n.id);if(n.my_position!=null&&(o?.cover===e||o?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let o=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(o){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===o);s?.tap&&wo(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,n);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??Fe(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&fe(this,a);return}let i=D(e);if(i==="cover"||i==="media"){this._menu={entity:e,x:t,y:n};return}if(i==="lock"){let s=fo(this.hass,e),a=L(this.hass,e);confirm(R(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(i&&ys.has(i)){if(this.confirmSet.has(e)&&!confirm(R(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;la(this.hass,e)}else fe(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let o=this.building?.floors.find(i=>i.id===n.floorId)?.placements.find(i=>i.entity_id===e);return ts({hass:this.hass,entityId:e,state:t},n,o?.plugin??void 0,{showWindow:(i,s)=>{i&&"hass"in i&&(i.hass=this.hass),this._pluginWindow=i?{node:i,title:s?.title??""}:null},moreInfo:i=>fe(this,i??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=${R(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let o=this.openingLinks?.get(n.id);if(n.my_position!=null&&(o?.cover===e||o?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let o=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(o){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===o);s?.tap&&wo(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,n);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??De(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&fe(this,a);return}let i=D(e);if(i==="cover"||i==="media"){this._menu={entity:e,x:t,y:n};return}if(i==="lock"){let s=fo(this.hass,e),a=L(this.hass,e);confirm(E(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(i&&ys.has(i)){if(this.confirmSet.has(e)&&!confirm(E(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;la(this.hass,e)}else fe(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let o=this.building?.floors.find(i=>i.id===n.floorId)?.placements.find(i=>i.entity_id===e);return es({hass:this.hass,entityId:e,state:t},n,o?.plugin??void 0,{showWindow:(i,s)=>{i&&"hass"in i&&(i.hass=this.hass),this._pluginWindow=i?{node:i,title:s?.title??""}:null},moreInfo:i=>fe(this,i??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=${E(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 n=[];for(let o of e.floors)for(let i of o.furniture){if(!ic(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=oc(t,s?.entity??s?.power??null);a&&n.push({id:i.id,name:i.name||he(t,i.type),floorId:o.id,x:i.x,z:i.z,at:{floorId:o.id,x:i.x,z:i.z,y:le(o,i)+i.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let o of e.floors)for(let i of o.furniture){if(!ni(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=ti(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:i.id,name:i.name||he(t,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:le(o,i)+i.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let o of t.floors)for(let i of o.furniture){if(i.type!=="parking")continue;let s=uc(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Bo(e,i),l=a?Ml(i,a):null,c=i.name||(a?he(e,a):he(e,i.type));n.push({spot:i.id,name:c,at:{floorId:o.id,x:i.x,z:i.z,y:le(o,i)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let o of t.floors){for(let i of o.furniture){let s=this.furnitureLinks?.get(i.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:i.name||he(e,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:le(o,i)+i.h+.15},rings:i.sound_rings})}for(let i of o.placements)i.entity_id.startsWith("media_player.")&&n.push({entity:i.entity_id,name:i.name||L(e,i.entity_id),at:{floorId:o.id,x:i.x,z:i.z,y:(i.y??1.1)+.15},rings:i.sound_rings})}return ul(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],o=Math.max(1,Math.min(7,e.settings.today_days??1)),i=`${new Date().toDateString()}|${o}`;!t||!n.length||Date.now()-this.todayAt<9e5&&i===this.todayDay||(this.todayAt=Date.now(),this.todayDay=i,Xl(t,n,o).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?Ue(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let o=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&o===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=o,nc(t,n).then(i=>this._forecast=i))}renderForecast(e){let t=this.building,n=this.hass,o=t?.settings.forecast;if(!t||!n||!o||o.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let i=tc(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.length)return f;let s=Ue(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.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=${R(n,"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 n=[];for(let o of e.floors)for(let i of o.furniture){if(!ac(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=sc(t,s?.entity??s?.power??null);a&&n.push({id:i.id,name:i.name||he(t,i.type),floorId:o.id,x:i.x,z:i.z,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let o of e.floors)for(let i of o.furniture){if(!ti(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=ei(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:i.id,name:i.name||he(t,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let o of t.floors)for(let i of o.furniture){if(i.type!=="parking")continue;let s=hc(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Bo(e,i),l=a?Ml(i,a):null,c=i.name||(a?he(e,a):he(e,i.type));n.push({spot:i.id,name:c,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let o of t.floors){for(let i of o.furniture){let s=this.furnitureLinks?.get(i.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:i.name||he(e,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.15},rings:i.sound_rings})}for(let i of o.placements)i.entity_id.startsWith("media_player.")&&n.push({entity:i.entity_id,name:i.name||L(e,i.entity_id),at:{floorId:o.id,x:i.x,z:i.z,y:(i.y??1.1)+.15},rings:i.sound_rings})}return ul(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],o=Math.max(1,Math.min(7,e.settings.today_days??1)),i=`${new Date().toDateString()}|${o}`;!t||!n.length||Date.now()-this.todayAt<9e5&&i===this.todayDay||(this.todayAt=Date.now(),this.todayDay=i,tc(t,n,o).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?Ue(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let o=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&o===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=o,oc(t,n).then(i=>this._forecast=i))}renderForecast(e){let t=this.building,n=this.hass,o=t?.settings.forecast;if(!t||!n||!o||o.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let i=rc(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.length)return f;let s=Ue(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,h=new Intl.DateTimeFormat(u,{weekday:"short"}),p=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return m`<section class="nf-forecast" aria-label=${E(n,"forecast")}>
<ul>
${i.map((h,g)=>m`<li>
<span class="nf-fc-day">${g===0?R(n,"today"):d.format(new Date(h.day))}</span>
<span class="nf-fc-icon" aria-hidden="true">${h.icon}</span>
<span class="nf-fc-temp" title=${l}><b>${p(h.high)}</b> <small>${p(h.low)}</small></span>
<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>
${i.map((d,g)=>m`<li>
<span class="nf-fc-day">${g===0?E(n,"today"):h.format(new Date(d.day))}</span>
<span class="nf-fc-icon" aria-hidden="true">${d.icon}</span>
<span class="nf-fc-temp" title=${l}><b>${p(d.high)}</b> <small>${p(d.low)}</small></span>
<span class="nf-fc-rain">${d.rain!==null&&d.rain>0?`\u{1F4A7}${d.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:d.chance!==null&&d.chance>0?`\u{1F4A7}${Math.round(d.chance)} %`:""}</span>
</li>`)}
</ul>
</section>`}renderToday(){let e=this.building,t=this.hass;if(!e||!t||this.clean||this.roomId||this.panelOpen)return f;let n=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(e,t);return o===f&&n===f?f:m`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${o}${n}</div>`}renderTodayCard(e,t){let n=Jl(t,e,Date.now(),{today:R(t,"care_bin_today"),tomorrow:R(t,"care_bin_tomorrow")}),o=Ql([...n,...this._todayItems??[]]);if(!o.length&&!(e.settings.calendars??[]).length)return f;let i=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 R(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=o.flatMap((u,d)=>[(u.day??0)>0&&(o[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 ${i?"":"nf-today-folded"}" aria-label=${R(t,"today")}>
</section>`}renderToday(){let e=this.building,t=this.hass;if(!e||!t||this.clean||this.roomId||this.panelOpen)return f;let n=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(e,t);return o===f&&n===f?f:m`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${o}${n}</div>`}renderTodayCard(e,t){let n=Xl(t,e,Date.now(),{today:E(t,"care_bin_today"),tomorrow:E(t,"care_bin_tomorrow")}),o=ec([...n,...this._todayItems??[]]);if(!o.length&&!(e.settings.calendars??[]).length)return f;let i=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 E(t,"tomorrow");let h=new Date;return h.setDate(h.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(h)},c=o.flatMap((u,h)=>[(u.day??0)>0&&(o[h-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 ${i?"":"nf-today-folded"}" aria-label=${E(t,"today")}>
<button class="nf-today-head" aria-expanded=${i} @click=${()=>this._todayOpen=!i}>
<b>📅 ${R(t,"today")}</b><span>${s}</span>
<b>📅 ${E(t,"today")}</b><span>${s}</span>
</button>
${i?o.length?m`<ul>
${c}
</ul>`:m`<p class="nf-today-none">${R(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 n=Fe(e,s=>this.furnitureLinks?.get(s.id)?.power??null),o=e.energy,i={solar:o.solar?[o.solar]:n.solar,grid:o.grid??n.grid,gridInvert:!!o.grid_invert,battery:o.battery?[o.battery]:n.battery,batteryInvert:!!o.battery_invert,consumption:o.consumption};Ga(t,i).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,o=[],i=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=i?.power_entity?j(n?.states[i.power_entity]):null;if(i&&s!==null){let a=t&&t>0?` \xB7 ${R(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";o.push({icon:"\u26A1",label:i.name,value:`${at(n,s)}${a}`})}for(let[a,l,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let u=e.energy[a],d=u?n?.states[u]:void 0;d&&!I(d)&&o.push({icon:l,label:R(n,c),value:ee(n,d)})}return o}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>tn(a,e,en(a,e),Fe(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),o=sl(t,n),i=Date.now(),s=i-24*36e5;on(t,o,s,i,!0).then(a=>{this.dayCurves=al(t,a,s,i,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,o,i){let s=[],a=n.summary,l=a.solar!==null||a.grid!==null||a.battery!==null||a.consumption!==null,c=pn(t),u=(this.floorId?t.floors.find(d=>d.id===this.floorId):void 0)??[...t.floors].sort((d,p)=>p.elevation-d.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&l&&c&&u){let d=0,p=0,h=0;for(let g of u.rooms)for(let[b,_]of g.points)d+=b,p+=_,h++;s.push({kind:"house",at:{floorId:u.id,x:h?d/h:c.x,z:h?p/h:c.z,y:u.height+(this.floorId?1.2:3.2)},summary:a,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,a.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let d of o)s.push({kind:"car",at:d.at,spot:d.spot,name:d.name,car:d.car});for(let d of this.livePrinters(t))s.push({kind:"printer",at:d.at,name:d.name,printer:d.printer});for(let d of this.liveHeatPumps(t))s.push({kind:"heatpump",at:d.at,name:d.name,pump:d.pump});for(let d of i)s.push({kind:"media",at:{...d.at,y:d.at.y+.5},media:d})}JSON.stringify(s)!==JSON.stringify(this._liveCards)&&(this._liveCards=s),e.setLiveAnchors(s.map(d=>d.at),s.length?(d,p,h,g)=>this.placeLhCard(d,p,h,g):null)}placeLhCard(e,t,n,o){let i=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);i&&(i.dataset.x=String(t),i.dataset.y=String(n),i.style.visibility=o?"visible":"hidden",e===this._liveCards.length-1&&hc(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>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary;if(!(!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null)))return e.length?m`<div class="nf-energy" aria-live="off">${e}</div>`:f;let o=s=>R(this.hass,s),i=[];if(t.solar!==null&&i.push({cls:"solar",label:o("energy_solar"),value:se(this.hass,t.solar)}),t.consumption!==null&&i.push({cls:"total",label:o("energy_consumption"),value:se(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&i.push({cls:"total",label:o("energy_rest"),value:se(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let s=[t.battery!==null?se(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);i.push({cls:"battery",label:o("energy_battery"),value:s.join(" \xB7 ")})}if(t.grid!==null){let s=t.grid<0;i.push({cls:s?"export":"grid",label:o(s?"energy_grid_export":"energy_grid_import"),value:se(this.hass,Math.abs(t.grid))})}if(t.tariff&&i.push({cls:"tariff",label:o("energy_tariff"),value:`${O(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let s of this.meterRows(this.building))i.push({cls:"meter",label:`${s.icon} ${s.label}`,value:s.value});return m`<div class="nf-energy" aria-live="off">
${this.liveCardsOn&&this._liveCards.some(s=>s.kind==="house")?f:i.map(s=>m`<div class="nf-energy-item nf-energy-${s.cls}"><span>${s.label}</span><b>${s.value}</b></div>`)}
${this.flows!==null?f:m`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${o("flows_hint")} aria-label=${o("flows")} @click=${()=>this.toggleFlows()}>
<span>${o("flows")}</span><b>⚡</b>
</button>`}
${this.holograms!==null?f:m`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._liveCardOn} title=${o("holos_hint")} aria-label=${o("holos")} @click=${()=>this.toggleLhCards()}>
<span>${o("holos")}</span><b>◫</b>
</ul>`:m`<p class="nf-today-none">${E(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 n=De(e,s=>this.furnitureLinks?.get(s.id)?.power??null),o=e.energy,i={solar:o.solar?[o.solar]:n.solar,grid:o.grid??n.grid,gridInvert:!!o.grid_invert,battery:o.battery?[o.battery]:n.battery,batteryInvert:!!o.battery_invert,consumption:o.consumption};Ga(t,i).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,o=[],i=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=i?.power_entity?j(n?.states[i.power_entity]):null;if(i&&s!==null){let a=t&&t>0?` \xB7 ${E(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";o.push({icon:"\u26A1",label:i.name,value:`${at(n,s)}${a}`})}for(let[a,l,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let u=e.energy[a],h=u?n?.states[u]:void 0;h&&!I(h)&&o.push({icon:l,label:E(n,c),value:te(n,h)})}return o}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>nn(a,e,tn(a,e),De(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),o=sl(t,n),i=Date.now(),s=i-24*36e5;sn(t,o,s,i,!0).then(a=>{this.dayCurves=al(t,a,s,i,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,o,i,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=mn(t),h=(this.floorId?t.floors.find(p=>p.id===this.floorId):void 0)??[...t.floors].sort((p,d)=>d.elevation-p.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&h){let p=0,d=0,g=0;for(let b of h.rooms)for(let[_,w]of b.points)p+=_,d+=w,g++;a.push({kind:"house",at:{floorId:h.id,x:g?p/g:u.x,z:g?d/g:u.z,y:h.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.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 o)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 i)a.push({kind:"media",at:{...p.at,y:p.at.y+.5},media:p})}this.liveCardsOn&&!this.dimmed&&a.push(...Zl(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(p=>p.at),a.length?(p,d,g,b)=>this.placeLhCard(p,d,g,b):null)}placeLhCard(e,t,n,o){let i=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);i&&(i.dataset.x=String(t),i.dataset.y=String(n),i.style.visibility=o?"visible":"hidden",e===this._liveCards.length-1&&mc(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>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),i=this.building?.floors.some(l=>l.rooms.some(c=>c.climate_card))?this.renderCardToggle():f;if(!n)return e.length||i!==f?m`<div class="nf-energy" aria-live="off">${e}${i}</div>`:f;let s=l=>E(this.hass,l),a=[];if(t.solar!==null&&a.push({cls:"solar",label:s("energy_solar"),value:ae(this.hass,t.solar)}),t.consumption!==null&&a.push({cls:"total",label:s("energy_consumption"),value:ae(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&a.push({cls:"total",label:s("energy_rest"),value:ae(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let l=[t.battery!==null?ae(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);a.push({cls:"battery",label:s("energy_battery"),value:l.join(" \xB7 ")})}if(t.grid!==null){let l=t.grid<0;a.push({cls:l?"export":"grid",label:s(l?"energy_grid_export":"energy_grid_import"),value:ae(this.hass,Math.abs(t.grid))})}if(t.tariff&&a.push({cls:"tariff",label:s("energy_tariff"),value:`${O(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let l of this.meterRows(this.building))a.push({cls:"meter",label:`${l.icon} ${l.label}`,value:l.value});return m`<div class="nf-energy" aria-live="off">
${this.liveCardsOn&&this._liveCards.some(l=>l.kind==="house")?f:a.map(l=>m`<div class="nf-energy-item nf-energy-${l.cls}"><span>${l.label}</span><b>${l.value}</b></div>`)}
${this.flows!==null?f:m`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${s("flows_hint")} aria-label=${s("flows")} @click=${()=>this.toggleFlows()}>
<span>${s("flows")}</span><b>⚡</b>
</button>`}
${this.renderCardToggle()}
${e}
</div>`}ownSensors(){return(this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[]).filter(t=>this.hass.states[t]).map(t=>m`<button class="nf-energy-item nf-own-sensor" title=${L(this.hass,t)} @click=${()=>fe(this,t)}>
<span>${L(this.hass,t)}</span><b>${ee(this.hass,this.hass.states[t])}</b>
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Tl(e)?m`<a class="nf-map-credit" href=${Go(e).href} target="_blank" rel="noopener">${Go(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=st(new Date,this.hass?.config?.latitude??50),t=ur(this.heatMode,e),n=this.heatMode==="temperature",o=n?ue(this.hass,t.stops[0][0]):t.stops[0][0],i=n?ue(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?ne(this.hass):t.unit,a=l=>R(this.hass,l);return m`<div class="nf-legend">
</div>`}renderCardToggle(){return this.holograms!==null?f:m`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${E(this.hass,"holos_hint")} aria-label=${E(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
<span>${E(this.hass,"holos")}</span><b>◫</b>
</button>`}ownSensors(){return(this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[]).filter(t=>this.hass.states[t]).map(t=>m`<button class="nf-energy-item nf-own-sensor" title=${L(this.hass,t)} @click=${()=>fe(this,t)}>
<span>${L(this.hass,t)}</span><b>${te(this.hass,this.hass.states[t])}</b>
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Fl(e)?m`<a class="nf-map-credit" href=${Ko(e).href} target="_blank" rel="noopener">${Ko(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=st(new Date,this.hass?.config?.latitude??50),t=ur(this.heatMode,e),n=this.heatMode==="temperature",o=n?oe(this.hass,t.stops[0][0]):t.stops[0][0],i=n?oe(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?X(this.hass):t.unit,a=l=>E(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:${Ka(this.heatMode,e)}"></span>
<span class="nf-legend-range"><span>${O(this.hass,o,0)} ${s}</span><span>${O(this.hass,i,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 n=(c,u)=>R(e,c,u),o=t.floors.flatMap(c=>c.furniture.filter(u=>ri(u.type)).map(u=>oi(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=o.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=lc(a);return m`<div class="nf-legend">
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>E(e,c,u),o=t.floors.flatMap(c=>c.furniture.filter(u=>ni(u.type)).map(u=>ri(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=o.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=uc(a);return m`<div class="nf-legend">
<b>📶 ${n("heat_wifi")}</b>
<span>${n("wifi_aps",{n:o.length,clients:s})}</span>
${l.online+l.offline.length?m`<span>${n("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}
${o.length?f:m`<span class="nf-legend-none">${n("wifi_none")}</span>`}
</div>`}skyColor(){let e=an[this.theme]??an.neon,t=this._sky;return e.night[0].map((n,o)=>Math.round(n+(e.day[0][o]-n)*t))}render(){let e=this._sky,t=(i,s)=>`rgb(${i.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=an[this.theme]??an.neon,o=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+ll(this.building?.settings.backdrop);return m`<div
</div>`}skyColor(){let e=ln[this.theme]??ln.neon,t=this._sky;return e.night[0].map((n,o)=>Math.round(n+(e.day[0][o]-n)*t))}render(){let e=this._sky,t=(i,s)=>`rgb(${i.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=ln[this.theme]??ln.neon,o=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+ll(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":""}"
style=${o}
>
${this._error?m`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${pc(this.hass,this.roomId||this.panelOpen?[]:this._liveCards,(i,s,a,l)=>this.hass?.callService(i,s,{entity_id:a,...l}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()})} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this._error?m`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${fc(this.hass,this._liveCards,(i,s,a,l)=>this.hass?.callService(i,s,{entity_id:a,...l}),{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()} ${this.renderLayers()} ${this.renderPluginWindow()}
${this.showStats&&this._stats?m`<span class="nf-stats"
><b>${this._stats.fps?R(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):R(this.hass,"stats_idle")}</b>
${this._stats.busy.length?m`(${this._stats.busy.map(i=>R(this.hass,`stats_busy_${i}`)).join(", ")})`:f} ·
${R(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${R(this.hass,this._stats.low?"stats_low":"stats_full",{r:O(this.hass,this._stats.pixelRatio,2)})}</span
><b>${this._stats.fps?E(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):E(this.hass,"stats_idle")}</b>
${this._stats.busy.length?m`(${this._stats.busy.map(i=>E(this.hass,`stats_busy_${i}`)).join(", ")})`:f} ·
${E(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${E(this.hass,this._stats.low?"stats_low":"stats_full",{r:O(this.hass,this._stats.pixelRatio,2)})}</span
>`:f}
</div>`}static styles=[Se,Ke,mc,te`
</div>`}static styles=[Me,Ke,gc,ne`
:host {
display: block;
position: relative;
@@ -3279,26 +3300,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
inset: auto 16px 16px;
color: var(--nf-danger);
}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",hi);function se(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function di(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function km(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:ee(r,e)}var zc;function Tc(){let r=new URL("./nextfloor-editor.js?v=a29c3d0b177c",new URL(import.meta.url)).href;return zc??=import(r),zc}var Sm=.25,Fc=r=>Math.round(r*1e3)/1e3,Dc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function mi(r,e,t,n,o){let i=Dc(r,e,t);if(!i)return[n,o];let s=(a,l)=>H([a,l],i.points);return s(n,o)?[n,o]:s(n,t)?[n,t]:s(e,o)?[e,o]:[e,t]}function Mm(r,e,t,n){return r.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let a=o.points[(s+1)%o.points.length];return Math.abs(oe(Z(i,t),n))<.02&&Math.abs(oe(Z(a,t),n))<.02}))}var pi=(r,e)=>Math.abs((r-e+540)%360-180);function Pc(r,e,t,n=Sm){let o=Dc(r,e.x,e.z);if(!o)return null;let i=o.points,s=tt(i)>=0?1:-1,a=null;return i.forEach((l,c)=>{let u=i[(c+1)%i.length],d=Te(Z(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=oe(Z([e.x,e.z],l),p);if(g<0||g>d)return;let b=Mm(r,o,l,h)?t/2:0,_=oe(Z([e.x,e.z],l),h)-b,w=Math.atan2(-h[0],h[1])*180/Math.PI,$=[{rotation:w,extent:e.d/2},{rotation:w+90,extent:e.w/2},{rotation:w-90,extent:e.w/2}].reduce((y,F)=>pi(e.rotation,F.rotation)<pi(e.rotation,y.rotation)?F:y);if(pi(e.rotation,$.rotation)>50)return;let x=_-$.extent;Math.abs(x)>n||a&&Math.abs(x)>=Math.abs(a.gap)||(a={x:Fc(e.x-h[0]*x),z:Fc(e.z-h[1]*x),rotation:(Math.round($.rotation)%360+360)%360,gap:x})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Tr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.furniture.find(s=>s.id===e);i&&t(i,o)}return n}function Fr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.placements.find(s=>s.entity_id===e);i&&t(i,o)}return n}function Hc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Ic(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(o=>o.entity_id!==e);return t}function Cc(r,e,t,n){return Fr(r,e,(o,i)=>{[o.x,o.z]=mi(i,o.x,o.z,t,n)})}function Nc(r,e,t,n){let o=r.settings.wall_interior??.12;return Tr(r,e,(i,s)=>{[i.x,i.z]=mi(s,i.x,i.z,t,n);let a=Pc(s,i,o);a&&Object.assign(i,a)})}var fi=(r,e)=>((r+e)%360+360)%360,Oc=r=>Number.parseFloat(r.replace(",",".")),vn=(r,e)=>Math.round(r*10**e)/10**e;function gi(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Oc(i.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${r.title}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",di);function ae(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function ui(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function Am(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:te(r,e)}var Fc;function Dc(){let r=new URL("./nextfloor-editor.js?v=a47d165ade30",new URL(import.meta.url)).href;return Fc??=import(r),Fc}var Em=.25,Pc=r=>Math.round(r*1e3)/1e3,Hc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function pi(r,e,t,n,o){let i=Hc(r,e,t);if(!i)return[n,o];let s=(a,l)=>H([a,l],i.points);return s(n,o)?[n,o]:s(n,t)?[n,t]:s(e,o)?[e,o]:[e,t]}function Rm(r,e,t,n){return r.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let a=o.points[(s+1)%o.points.length];return Math.abs(ie(Y(i,t),n))<.02&&Math.abs(ie(Y(a,t),n))<.02}))}var hi=(r,e)=>Math.abs((r-e+540)%360-180);function Ic(r,e,t,n=Em){let o=Hc(r,e.x,e.z);if(!o)return null;let i=o.points,s=tt(i)>=0?1:-1,a=null;return i.forEach((l,c)=>{let u=i[(c+1)%i.length],h=Fe(Y(u,l));if(h<.3)return;let p=[(u[0]-l[0])/h,(u[1]-l[1])/h],d=[-p[1]*s,p[0]*s],g=ie(Y([e.x,e.z],l),p);if(g<0||g>h)return;let b=Rm(r,o,l,d)?t/2:0,_=ie(Y([e.x,e.z],l),d)-b,w=Math.atan2(-d[0],d[1])*180/Math.PI,$=[{rotation:w,extent:e.d/2},{rotation:w+90,extent:e.w/2},{rotation:w-90,extent:e.w/2}].reduce((y,F)=>hi(e.rotation,F.rotation)<hi(e.rotation,y.rotation)?F:y);if(hi(e.rotation,$.rotation)>50)return;let x=_-$.extent;Math.abs(x)>n||a&&Math.abs(x)>=Math.abs(a.gap)||(a={x:Pc(e.x-d[0]*x),z:Pc(e.z-d[1]*x),rotation:(Math.round($.rotation)%360+360)%360,gap:x})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Tr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.furniture.find(s=>s.id===e);i&&t(i,o)}return n}function Fr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.placements.find(s=>s.entity_id===e);i&&t(i,o)}return n}function Cc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Nc(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(o=>o.entity_id!==e);return t}function Oc(r,e,t,n){return Fr(r,e,(o,i)=>{[o.x,o.z]=pi(i,o.x,o.z,t,n)})}function Wc(r,e,t,n){let o=r.settings.wall_interior??.12;return Tr(r,e,(i,s)=>{[i.x,i.z]=pi(s,i.x,i.z,t,n);let a=Ic(s,i,o);a&&Object.assign(i,a)})}var mi=(r,e)=>((r+e)%360+360)%360,Lc=r=>Number.parseFloat(r.replace(",",".")),yn=(r,e)=>Math.round(r*10**e)/10**e;function fi(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Lc(i.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${r.title}
>${r.label}
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(vn(r.value,2))} @change=${o} />
</label>`}var Lc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Wc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function $m(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let o=(s,a)=>gi({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,c=>c[s]=vn(l,3))}),i=_s(n)?m`${gi({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??le(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=vn(s,3))})}
${n.mount_y!=null?Lc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${o("w","size_short_w")}${o("d","size_short_d")}${o("h","size_short_h")} ${i}`}function Am(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let o=D(e),i=(l,c,u)=>m`<select class="nf-size-select" title=${r.t(l)} @change=${d=>r.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>`)}
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(yn(r.value,2))} @change=${o} />
</label>`}var Vc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Bc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function zm(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let o=(s,a)=>fi({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,c=>c[s]=yn(l,3))}),i=gs(n)?m`${fi({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??ce(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=yn(s,3))})}
${n.mount_y!=null?Vc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${o("w","size_short_w")}${o("d","size_short_d")}${o("h","size_short_h")} ${i}`}function Tm(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let o=D(e),i=(l,c,u)=>m`<select class="nf-size-select" title=${r.t(l)} @change=${h=>r.editDevice(e,p=>Object.assign(p,{mount:h.target.value,y:null}))}>
${c.map(([h,p])=>m`<option value=${h} ?selected=${h===u}>${p}</option>`)}
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=o?wt(o,me(t,n.x,n.z),o==="light"?n.mount??"ceiling":null):1;return m`${o==="light"?i("lamp_mount",s,n.mount??"ceiling"):f}
${gi({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,c=>c.y=vn(l,3))})}
${n.y!==null?Lc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Bc(r,e,t){let n=r.t,o;if(e){let i=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;o=m`<span>${i?he(r.hass,i):""}</span>
${$m(r,e)} ${Wc(45,s=>r.turnFurniture(e,s))}
${fi({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,c=>c.y=yn(l,3))})}
${n.y!==null?Vc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Kc(r,e,t){let n=r.t,o;if(e){let i=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;o=m`<span>${i?he(r.hass,i):""}</span>
${zm(r,e)} ${Bc(45,s=>r.turnFurniture(e,s))}
<button class="nf-chip" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button>
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?o=m`<span>${L(r.hass,t)}</span>
${Am(r,t)} ${Wc(45,i=>r.turnDevice(t,i))}
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:o=m`<span>${n("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${o}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Vc=J`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
${Tm(r,t)} ${Bc(45,i=>r.turnDevice(t,i))}
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:o=m`<span>${n("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${o}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Gc=J`<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 ae=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Dt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(o=>o===n)??t,write:n=>n}),_i={explode:ae("explode",!0),keepRoof:ae("roof",!1),solidWalls:ae("solid_walls",!1),quality:Dt("quality",["auto","low","high"],"auto"),stats:ae("stats",!1),markers:Dt("markers",["none","important","all"],"important"),heat:Dt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Dt("theme",wr,"neon"),clock:Dt("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:Dt("floor_stack",["dim","stacked","single"],"dim"),roomNames:ae("room_names",!0),clean:ae("clean",!1),navWrap:ae("nav_wrap",!1),weather:ae("weather",!0),timeSlider:ae("time_slider",!1),menuOpen:ae("menu_open",!1),keepCamera:ae("keep_camera",!1),readable:ae("readable",!1),plain:ae("plain",!1),rightBack:ae("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:ae("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function Kc(r=Pr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Gc(r=Pr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Pr(){try{return localStorage}catch{return null}}var Dr=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 n of Object.keys(_i)){let o=_i[n],i=this.raw(o.name);t[n]=i===null?o.fallback:o.read(i)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=_i[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Uc=te`
</svg>`;var le=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Pt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(o=>o===n)??t,write:n=>n}),gi={explode:le("explode",!0),keepRoof:le("roof",!1),solidWalls:le("solid_walls",!1),quality:Pt("quality",["auto","low","high"],"auto"),stats:le("stats",!1),markers:Pt("markers",["none","important","all"],"important"),heat:Pt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Pt("theme",wr,"neon"),clock:Pt("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:Pt("floor_stack",["dim","stacked","single"],"dim"),roomNames:le("room_names",!0),clean:le("clean",!1),navWrap:le("nav_wrap",!1),weather:le("weather",!0),timeSlider:le("time_slider",!1),menuOpen:le("menu_open",!1),keepCamera:le("keep_camera",!1),readable:le("readable",!1),plain:le("plain",!1),rightBack:le("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:le("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function Uc(r=Pr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function jc(r=Pr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Pr(){try{return localStorage}catch{return null}}var Dr=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 n of Object.keys(gi)){let o=gi[n],i=this.raw(o.name);t[n]=i===null?o.fallback:o.read(i)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=gi[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var qc=ne`
.nf-dot {
display: inline-block;
width: 8px;
@@ -3783,11 +3804,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
gap: 12px;
margin: auto;
}
`;var bi=class extends re{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{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 Dr(Pr());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,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:et(pt(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,n=i=>`${String(Math.floor(i)).padStart(2,"0")}:${String(Math.round(i%1*60)).padStart(2,"0")}`,o=()=>{let i=new Date;return Math.round((i.getHours()+i.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?o():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
`;var _i=class extends re{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{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 Dr(Pr());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,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:et(pt(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,n=i=>`${String(Math.floor(i)).padStart(2,"0")}:${String(Math.round(i%1*60)).padStart(2,"0")}`,o=()=>{let i=new Date;return Math.round((i.getHours()+i.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?o():null)}>☀ ${t===null?e("time_of_day"):n(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=${i=>this._timeDrag=Number(i.target.value)}
@change=${i=>(this._timeDrag=null,this._timeOfDay=Number(i.target.value))}
/></label>`:f}`}t=(e,t)=>R(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=mr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let n=Zt(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>Tr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Fr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Tr(n,e,o=>o.rotation=fi(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Fr(n,e,o=>o.rotation=fi(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Hc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Ic(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(o=>({...o,rooms:o.rooms.map(i=>i.id===e?{...i,moods:t.length?t:void 0}:i)}))}))}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._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&&nr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=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)=>E(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=mr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let n=Yt(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>Tr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Fr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Tr(n,e,o=>o.rotation=mi(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Fr(n,e,o=>o.rotation=mi(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Cc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Nc(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(o=>({...o,rooms:o.rooms.map(i=>i.id===e?{...i,moods:t.length?t:void 0}:i)}))}))}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._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&&nr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=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}
@@ -3839,7 +3860,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</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.data.saveState,n=(i,s,a="")=>m`<button role="tab" class=${a} aria-pressed=${this._mode===i} @click=${()=>this.setMode(i)}>${s}</button>`,o=t==="saving"?"saving":t==="saved"?"saved":"save_error";return m`<header class="nf-header">
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
<h1>${Vc}NextFloor</h1>
<h1>${Gc}NextFloor</h1>
${this.isAdmin?m`<div class="nf-seg" role="tablist">${n("view",this.t("view"))}${n("editor",this.t("editor"))}${n("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
<span class="nf-grow"></span>
${this.isAdmin&&this.hass.symconRefresh?m`<button class="nf-btn nf-reload-variables" ?disabled=${this._variablesLoading} aria-busy=${this._variablesLoading} @click=${()=>{this.reloadVariables()}}>↻ ${this.t(this._variablesLoading?"symcon_variables_loading":"symcon_variables_reload")}</button>`:f}
@@ -3853,7 +3874,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<span>${this.t("draft_found",{time:n})}</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():(Tc().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():(Dc().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"
@@ -3861,10 +3882,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.building=${e}
.narrow=${this.narrow}
.packs=${this.data.packs}
.loadCardEditor=${$n}
.loadCardEditor=${An}
@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(o=>o.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let o=this._floorUndo;return m`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let i of o)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=rn(rl(t).map(o=>this.hass.states[o]));return n.count<2?f:m`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let o of n.off)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=e.floors.length>1,o=this._prefs.navWrap,i=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=n?m`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
></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(o=>o.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let o=this._floorUndo;return m`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let i of o)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=on(rl(t).map(o=>this.hass.states[o]));return n.count<2?f:m`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let o of n.off)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=e.floors.length>1,o=this._prefs.navWrap,i=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=n?m`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
${[...e.floors].reverse().map(c=>m`<button class="nf-chip" aria-pressed=${c.id===this._floorId} @click=${()=>this.openFloor(c.id)}>${c.name}</button>`)}
${i} ${this.allOffChip(e)}
<span class="nf-sep"></span>`:m`${i} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?m`<span class="nf-nav-floor">${c.name}</span>`:f,...c.rooms.map(u=>m`<button
@@ -3876,7 +3897,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</button>`)]),l=this.t(o?"nav_row":"nav_wrap");return m`<nav class="nf-nav ${o?"nf-nav-wrap":""}" @wheel=${this.onNavWheel}>
${s}${a}
<button class="nf-chip nf-nav-toggle" title=${l} aria-label=${l} aria-pressed=${o} @click=${()=>this.setPref("navWrap",!o)}>${o?"\u2194":"\u2261"}</button>
</nav>`}toggleChip(e,t,n){return m`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,o=(u,d)=>m`<div class="nf-seg">${[u,d].map(([p,h,g])=>m`<button aria-pressed=${p} @click=${h}>${g}</button>`)}</div>`,i=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?m`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,c=m`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?m`<div class="nf-overlay">
</nav>`}toggleChip(e,t,n){return m`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,o=(u,h)=>m`<div class="nf-seg">${[u,h].map(([p,d,g])=>m`<button aria-pressed=${p} @click=${d}>${g}</button>`)}</div>`,i=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?m`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,c=m`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?m`<div class="nf-overlay">
<div class="nf-switches-veil" @click=${()=>this._switchesOpen=!1}></div>
<div class="nf-switches" role="group" aria-label=${n("bars_unfold")} @keydown=${u=>u.key==="Escape"&&(this._switchesOpen=!1)}>
<div class="nf-seg">
@@ -3943,9 +3964,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
?furnish=${this._furnish}
.selectedFurniture=${this._selFurniture}
@furniture-select=${o=>this._selFurniture=o.detail.id}
@furniture-move=${o=>this.applyEdit(i=>Nc(i,o.detail.id,o.detail.x,o.detail.z))}
@furniture-move=${o=>this.applyEdit(i=>Wc(i,o.detail.id,o.detail.x,o.detail.z))}
@device-select=${o=>this._selDevice=o.detail.id}
@device-move=${o=>this.applyEdit(i=>Cc(i,o.detail.id,o.detail.x,o.detail.z))}
@device-move=${o=>this.applyEdit(i=>Oc(i,o.detail.id,o.detail.x,o.detail.z))}
.quality=${t.quality}
?showStats=${t.stats}
@room-tap=${this.onRoomTap}
@@ -3974,9 +3995,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@close=${()=>this._outside=!1}
></nf-room-panel>`:f}
${t.clean?f:this.renderOverlay(e)}
${this._furnish?Bc(this.furnishHost,this._selFurniture,this._selDevice):f}
${this._furnish?Kc(this.furnishHost,this._selFurniture,this._selDevice):f}
</div>
`}static styles=[Se,Ke,Uc,pr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",bi);var Em=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,jc=(r,e)=>Number(r)*60+Number(e);function yn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Em.exec(r.trim());if(!n)return!1;let o=jc(n[1],n[2]),i=jc(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Hr=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 qc(r,e){return r?r.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(n=>({id:n.id,name:n.name||"\u2013",floorId:t.id}))})):[]}var Zc=te`
`}static styles=[Me,Ke,qc,pr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",_i);var Fm=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Zc=(r,e)=>Number(r)*60+Number(e);function xn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Fm.exec(r.trim());if(!n)return!1;let o=Zc(n[1],n[2]),i=Zc(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Hr=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(xn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Yc(r,e){return r?r.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(n=>({id:n.id,name:n.name||"\u2013",floorId:t.id}))})):[]}var Jc=ne`
ha-card {
overflow: hidden;
background: var(--nf-bg);
@@ -4100,14 +4121,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
justify-content: flex-end;
}
}
`;function wi(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:o,template:i,...s}=n;return{...s,...r}}function Yc(r,e){let t=new Set(e),n=[];for(let i of r.floors){let s=i.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));n.push({...i,rooms:s,openings:i.openings.filter(c=>l.has(c.room_id)),furniture:i.furniture.filter(c=>a(c.x,c.z)),placements:i.placements.filter(c=>a(c.x,c.z)),walls:(i.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let o={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:o}}}var Pt="nf-outside",vi=class extends re{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{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}};_own=null;templatesSeen;roomApplied=!1;data=new bt(this);kiosk=new Hr({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._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,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 $n(),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._own=e,this._config=wi(e,this.data.building?.settings.card_templates),this._floorId=void 0,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=wi(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=mr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=yn(this._config?.night,this.hass);n!==this._night&&(this._night=n)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null: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 n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:Yc(e,t)}),this.roomsMemo.result}t=e=>R(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,o=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,i=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!o&&(e?.floors.length??0)>1;return{floorId:o,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?.controls&&!i)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,o=["temperature","humidity","co2"].filter(s=>this.shows(s)),i=(s,a)=>m`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>m`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return m`<div class="nf-card-controls">
`;function bi(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:o,template:i,...s}=n;return{...s,...r}}function Qc(r,e){let t=new Set(e),n=[];for(let i of r.floors){let s=i.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));n.push({...i,rooms:s,openings:i.openings.filter(c=>l.has(c.room_id)),furniture:i.furniture.filter(c=>a(c.x,c.z)),placements:i.placements.filter(c=>a(c.x,c.z)),walls:(i.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let o={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:o}}}var Ht="nf-outside",wi=class extends re{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{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}};_own=null;templatesSeen;roomApplied=!1;data=new bt(this);kiosk=new Hr({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._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,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 An(),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._own=e,this._config=bi(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=xn(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=bi(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=mr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=xn(this._config?.night,this.hass);n!==this._night&&(this._night=n)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null: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 n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:Qc(e,t)}),this.roomsMemo.result}t=e=>E(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,o=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,i=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!o&&(e?.floors.length??0)>1;return{floorId:o,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?.controls&&!i)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,o=["temperature","humidity","co2"].filter(s=>this.shows(s)),i=(s,a)=>m`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>m`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return m`<div class="nf-card-controls">
${e.canGoBack?m`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f}
${this.shows("walls")?i(void 0,[[e.walls==="auto",()=>this._walls="auto",n("walls_auto")],[e.walls==="cut",()=>this._walls="cut",n("walls_cut")],[e.walls==="slope",()=>this._walls="slope",n("walls_slope")]]):f}
${this.shows("floors")&&t.floors.length>1&&!e.floorId?i(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
${o.length>0?i(n("heatmap"),["none",...o].map(s=>[e.heat===s,()=>this._heat=s,n(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;let n=qc(t,e.floorId);if(!n.length)return f;let o=n.length>1,i=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=Zt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Pt?null:Pt};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;let n=Yc(t,e.floorId);if(!n.length)return f;let o=n.length>1,i=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=Yt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Ht?null:Ht};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")}>
${n.map(l=>m`${o?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=${()=>i(l.floorId,c.id)}>${c.name}</button>`)}`)}
${s?m`<button class="nf-chip" aria-pressed=${this._roomId===Pt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
${s?m`<button class="nf-chip" aria-pressed=${this._roomId===Ht} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
</div>`}renderCorners(){let e=this._config,t=this.t,n=this._clean||!!this._roomId&&e?.room_panel!==!1;return m`${e?.fullscreen_button&&!n?m`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
${this._fullscreen?"\u2715":"\u26F6"}
</button>`:f}
@@ -4118,8 +4139,8 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.building=${t}
.packs=${this.data.packs}
.floorId=${e.floorId}
.roomId=${this._roomId===Pt?null:this._roomId}
.outsideOpen=${this._roomId===Pt}
.roomId=${this._roomId===Ht?null:this._roomId}
.outsideOpen=${this._roomId===Ht}
.wallMode=${e.walls}
.solidWalls=${n?.solid_walls===!0}
.explode=${e.explode}
@@ -4158,10 +4179,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.panelOpen=${!!this._roomId&&n?.room_panel!==!1}
.alerts=${n?.alerts!==!1}
.alertJump=${!!n?.alert_jump}
.announcements=${n?.announcements!==!1&&!Gc()}
.announcements=${n?.announcements!==!1&&!jc()}
.sensorBar=${n?.sensor_bar!==!1}
.glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null}
.screenName=${n?.screen_name??Kc()}
.screenName=${n?.screen_name??Uc()}
.scenes=${n?.scenes!==!1}
.clean=${this._clean}
.cleanButton=${i}
@@ -4182,19 +4203,19 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.hass=${this.hass}
.room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null}
.floor=${e.floors.find(t=>t.rooms.some(n=>n.id===this._roomId))??null}
.outside=${this._roomId===Pt?Zt(this.hass,e.floors):null}
.outside=${this._roomId===Ht?Yt(this.hass,e.floors):null}
.confirmEntities=${it(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
@close=${()=>this._roomId=null}
></nf-room-panel>`}render(){if(this.hass&&nr(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 n=this.stage(),o=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,i=/^#[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=${i?`--nf-accent:${i}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
<div class="nf-card-body" style="height:${o}">
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):m`<p class="nf-card-msg">${this.data.error??(e?R(this.hass,"no_building"):R(this.hass,"loading"))}</p>`}
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):m`<p class="nf-card-msg">${this.data.error??(e?E(this.hass,"no_building"):E(this.hass,"loading"))}</p>`}
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
${this.renderRoomButtons(n)}
${n.showBar&&e?this.renderBar(n):f}
${this.renderCorners()}
</div>
</ha-card>`}static styles=[Se,Ke,Zc,pr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",vi);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:R(void 0,"card_name"),description:R(void 0,"card_description"),preview:!1})}to();var Rm="nextfloor-chunks-v1";async function yi(r,e,t){let n=await fetch(`${r.endpoint}/api?token=${encodeURIComponent(r.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:Rm})}),o=await n.text(),i;try{i=JSON.parse(o)}catch{throw/Output-Buffer exceeds Limit/i.test(o)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${o.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${n.status}).`)}if(!n.ok||!i||typeof i!="object"||"error"in i){let s=i&&typeof i=="object"&&"error"in i?i.error:`HTTP ${n.status}`;throw new Error(String(s))}return i}async function Ht(r,e,t={}){let n=await yi(r,e,t);if(!("_nextfloor_transfer"in n))return n;let o=n._nextfloor_transfer;if(!o||!/^[a-f0-9]{32}$/.test(o.id)||!Number.isSafeInteger(o.bytes)||o.bytes<=0||o.bytes>67108864||!Number.isSafeInteger(o.chunk_bytes)||o.chunk_bytes<=0||o.chunk_bytes>128*1024||o.chunks!==Math.ceil(o.bytes/o.chunk_bytes)||o.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let i=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<o.chunks;a++){let l=await yi(r,"transport/read",{transfer_id:o.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(o.chunk_bytes,o.bytes-a*o.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(i.decode(c,{stream:!0}))}return s.push(i.decode()),JSON.parse(s.join(""))}finally{await yi(r,"transport/release",{transfer_id:o.id}).catch(()=>{})}}function zm(r){let e=r.attributes;if(typeof e.symcon_numeric_value!="number")return null;let t=typeof e.symcon_min=="number"?e.symcon_min:0,n=typeof e.symcon_max=="number"&&e.symcon_max>t?e.symcon_max:100;return Math.max(0,Math.min(100,(e.symcon_numeric_value-t)/(n-t)*100))}function Jc(r,e){let t=zm(r),n=r.attributes.symcon_id;return t===null||typeof n!="number"?null:{...r,entity_id:`${e}.${n}`,state:e==="light"?t>0?"on":"off":t>0?"open":"closed",attributes:{...r.attributes,...e==="light"?{brightness:Math.round(t*2.55),color_mode:"brightness",supported_color_modes:["brightness"]}:{current_position:t,supported_features:4},...r.entity_id!==`${e}.${n}`?{symcon_source_entity:r.entity_id}:{}}}}function Tm(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}var Ir=class{settings=Tm();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:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],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 n=o=>e({revision:o});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await Ht(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(()=>{})},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 Ht(this.settings,"bootstrap"):await Ht(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 n of this.changeListenerLine truncated
</ha-card>`}static styles=[Me,Ke,Jc,pr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",wi);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:E(void 0,"card_name"),description:E(void 0,"card_description"),preview:!1})}to();var Dm="nextfloor-chunks-v1";async function vi(r,e,t){let n=await fetch(`${r.endpoint}/api?token=${encodeURIComponent(r.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:Dm})}),o=await n.text(),i;try{i=JSON.parse(o)}catch{throw/Output-Buffer exceeds Limit/i.test(o)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${o.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${n.status}).`)}if(!n.ok||!i||typeof i!="object"||"error"in i){let s=i&&typeof i=="object"&&"error"in i?i.error:`HTTP ${n.status}`;throw new Error(String(s))}return i}async function It(r,e,t={}){let n=await vi(r,e,t);if(!("_nextfloor_transfer"in n))return n;let o=n._nextfloor_transfer;if(!o||!/^[a-f0-9]{32}$/.test(o.id)||!Number.isSafeInteger(o.bytes)||o.bytes<=0||o.bytes>67108864||!Number.isSafeInteger(o.chunk_bytes)||o.chunk_bytes<=0||o.chunk_bytes>128*1024||o.chunks!==Math.ceil(o.bytes/o.chunk_bytes)||o.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let i=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<o.chunks;a++){let l=await vi(r,"transport/read",{transfer_id:o.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(o.chunk_bytes,o.bytes-a*o.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(i.decode(c,{stream:!0}))}return s.push(i.decode()),JSON.parse(s.join(""))}finally{await vi(r,"transport/release",{transfer_id:o.id}).catch(()=>{})}}function Pm(r){let e=r.attributes;if(typeof e.symcon_numeric_value!="number")return null;let t=typeof e.symcon_min=="number"?e.symcon_min:0,n=typeof e.symcon_max=="number"&&e.symcon_max>t?e.symcon_max:100;return Math.max(0,Math.min(100,(e.symcon_numeric_value-t)/(n-t)*100))}function Xc(r,e){let t=Pm(r),n=r.attributes.symcon_id;return t===null||typeof n!="number"?null:{...r,entity_id:`${e}.${n}`,state:e==="light"?t>0?"on":"off":t>0?"open":"closed",attributes:{...r.attributes,...e==="light"?{brightness:Math.round(t*2.55),color_mode:"brightness",supported_color_modes:["brightness"]}:{current_position:t,supported_features:4},...r.entity_id!==`${e}.${n}`?{symcon_source_entity:r.entity_id}:{}}}}function Hm(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}var Ir=class{settings=Hm();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:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],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 n=o=>e({revision:o});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await It(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(()=>{})},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 It(this.settings,"bootstrap"):await It(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 n of this.changeListenerLine truncated
/*! Bundled license information:
@lit/reactive-element/css-tag.js:
+4 -2
View File
@@ -1,7 +1,7 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var S={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"};var bo=globalThis,yo=bo.ShadowRoot&&(bo.ShadyCSS===void 0||bo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qi=Symbol(),Ll=new WeakMap,cr=class{constructor(e,n,r){if(this._$cssResult$=!0,r!==qi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o,n=this.t;if(yo&&e===void 0){let r=n!==void 0&&n.length===1;r&&(e=Ll.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Ll.set(n,e))}return e}toString(){return this.cssText}},Cl=t=>new cr(typeof t=="string"?t:t+"",void 0,qi),se=(t,...e)=>{let n=t.length===1?t[0]:e.reduce((r,o,i)=>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.")})(o)+t[i+1],t[0]);return new cr(n,t,qi)},Nl=(t,e)=>{if(yo)t.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of e){let r=document.createElement("style"),o=bo.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=n.cssText,t.appendChild(r)}},Yi=yo?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(let r of e.cssRules)n+=r.cssText;return Cl(n)})(t):t;var{is:Xg,defineProperty:Qg,getOwnPropertyDescriptor:Jg,getOwnPropertyNames:e_,getOwnPropertySymbols:t_,getPrototypeOf:n_}=Object,wo=globalThis,Bl=wo.trustedTypes,r_=Bl?Bl.emptyScript:"",o_=wo.reactiveElementPolyfillSupport,dr=(t,e)=>t,Xi={toAttribute(t,e){switch(e){case Boolean:t=t?r_:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},Vl=(t,e)=>!Xg(t,e),Wl={attribute:!0,type:String,converter:Xi,reflect:!1,useDefault:!1,hasChanged:Vl};Symbol.metadata??=Symbol("metadata"),wo.litPropertyMetadata??=new WeakMap;var mt=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,n=Wl){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(e,r,n);o!==void 0&&Qg(this.prototype,e,o)}}static getPropertyDescriptor(e,n,r){let{get:o,set:i}=Jg(this.prototype,e)??{get(){return this[n]},set(s){this[n]=s}};return{get:o,set(s){let l=o?.call(this);i?.call(this,s),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Wl}static _$Ei(){if(this.hasOwnProperty(dr("elementProperties")))return;let e=n_(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(dr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(dr("properties"))){let n=this.properties,r=[...e_(n),...t_(n)];for(let o of r)this.createProperty(o,n[o])}let e=this[Symbol.metadata];if(e!==null){let n=litPropertyMetadata.get(e);if(n!==void 0)for(let[r,o]of n)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[n,r]of this.elementProperties){let o=this._$Eu(n,r);o!==void 0&&this._$Eh.set(o,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let n=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let o of r)n.unshift(Yi(o))}else e!==void 0&&n.push(Yi(e));return n}static _$Eu(e,n){let r=n.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,n=this.constructor.elementProperties;for(let r of n.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Nl(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.Line truncated
\f\r]`,ur=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,jl=/-->/g,Ul=/>/g,Gt=RegExp(`>|${Qi}(?:([^\\s"'>=/]+)(${Qi}*=${Qi}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Zl=/'/g,ql=/"/g,Ql=/^(?:script|style|textarea|title)$/i,rs=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),m=rs(1),R=rs(2),Ak=rs(3),Qe=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Yl=new WeakMap,jt=Ut.createTreeWalker(Ut,129);function Jl(t,e){if(!ns(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gl!==void 0?Gl.createHTML(e):e}var ec=(t,e)=>{let n=t.length-1,r=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=ur;for(let l=0;l<n;l++){let a=t[l],c,d,u=-1,p=0;for(;p<a.length&&(s.lastIndex=p,d=s.exec(a),d!==null);)p=s.lastIndex,s===ur?d[1]==="!--"?s=jl:d[1]!==void 0?s=Ul:d[2]!==void 0?(Ql.test(d[2])&&(o=RegExp("</"+d[2],"g")),s=Gt):d[3]!==void 0&&(s=Gt):s===Gt?d[0]===">"?(s=o??ur,u=-1):d[1]===void 0?u=-2:(u=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Gt:d[3]==='"'?ql:Zl):s===ql||s===Zl?s=Gt:s===jl||s===Ul?s=ur:(s=Gt,o=void 0);let h=s===Gt&&t[l+1].startsWith("/>")?" ":"";i+=s===ur?a+i_:u>=0?(r.push(c),a.slice(0,u)+es+a.slice(u)+gt+h):a+gt+(u===-2?l:h)}return[Jl(t,i+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},fr=class t{constructor({strings:e,_$litType$:n},r){let o;this.parts=[];let i=0,s=0,l=e.length-1,a=this.parts,[c,d]=ec(e,n);if(this.el=t.createElement(c,r),jt.currentNode=this.el.content,n===2||n===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(o=jt.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let u of o.getAttributeNames())if(u.endsWith(es)){let p=d[s++],h=o.getAttribute(u).split(gt),f=/([.?@])?(.*)/.exec(p);a.push({type:1,index:i,name:f[2],strings:h,ctor:f[1]==="."?xo:f[1]==="?"?$o:f[1]==="@"?So:qt}),o.removeAttribute(u)}else u.startsWith(gt)&&(a.push({type:6,index:i}),o.removeAttribute(u));if(Ql.test(o.tagName)){let u=o.textContent.split(gt),p=u.length-1;if(p>0){o.textContent=vo?vo.emptyScript:"";for(let h=0;h<p;h++)o.append(u[h],hr()),jt.nextNode(),a.push({type:2,index:++i});o.append(u[p],hr())}}}else if(o.nodeType===8)if(o.data===ts)a.push({type:2,index:i});else{let u=-1;for(;(u=o.data.indexOf(gt,u+1))!==-1;)a.push({type:7,index:i}),u+=gt.length-1}i++}}static createElement(e,n){let r=Ut.createElement("template");return r.innerHTML=e,r}};function Zt(t,e,n=t,r){if(e===Qe)return e;let o=r!==void 0?n._$Co?.[r]:n._$Cl,i=pr(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(t),o._$AT(t,n,r)),r!==void 0?(n._$Co??=[])[r]=o:n._$Cl=o),o!==void 0&&(e=Zt(t,o._$AS(t,e.values),o,r)),e}var ko=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:n},parts:r}=this._$AD,o=(e?.creationScope??Ut).importNode(n,!0);jt.currentNode=o;let i=jt.nextNode(),s=0,l=0,a=r[0];for(;a!==void 0;){if(s===a.index){let c;a.type===2?c=new yn(i,i.nextSibling,this,e):a.type===1?c=new a.ctor(i,a.name,a.strings,this,e):a.type===6&&(c=new Mo(i,this,e)),this._$AV.push(c),a=r[++l]}s!==a?.index&&(i=jt.nextNode(),s++)}return jt.currentNode=Ut,o}p(e){let n=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,n),n+=r.strings.length-2):r._$AI(e[n])),n++}},yn=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,r,o){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=Zt(this,e,n),pr(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==Qe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xl(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!==_&&pr(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ut.createTextNode(e)),this._$AH=e}$(e){let{values:n,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=fr.createElement(Jl(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(n);else{let i=new ko(o,this),s=i.u(this.options);i.p(n),this.T(s),this._$AH=i}}_$AC(e){let n=Yl.get(e.strings);return n===void 0&&Yl.set(e.strings,n=new fr(e)),n}k(e){ns(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,o=0;for(let i of e)o===n.length?n.push(r=new t(this.O(hr()),this.O(hr()),this,this.options)):r=n[o],r._$AI(i),o++;o<n.length&&(this._$AR(r&&r._$AB.nextSibling,o),n.length=o)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){let r=Kl(e).nextSibling;Kl(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},qt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,r,o,i){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=n,this._$AM=o,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._Line truncated
\f\r"'\`<>=]|("|')|))|$)`,"g"),Zl=/'/g,ql=/"/g,Ql=/^(?:script|style|textarea|title)$/i,rs=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),m=rs(1),R=rs(2),Ak=rs(3),Qe=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Yl=new WeakMap,jt=Ut.createTreeWalker(Ut,129);function Jl(t,e){if(!ns(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gl!==void 0?Gl.createHTML(e):e}var ec=(t,e)=>{let n=t.length-1,r=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=ur;for(let l=0;l<n;l++){let a=t[l],c,d,u=-1,p=0;for(;p<a.length&&(s.lastIndex=p,d=s.exec(a),d!==null);)p=s.lastIndex,s===ur?d[1]==="!--"?s=jl:d[1]!==void 0?s=Ul:d[2]!==void 0?(Ql.test(d[2])&&(o=RegExp("</"+d[2],"g")),s=Gt):d[3]!==void 0&&(s=Gt):s===Gt?d[0]===">"?(s=o??ur,u=-1):d[1]===void 0?u=-2:(u=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Gt:d[3]==='"'?ql:Zl):s===ql||s===Zl?s=Gt:s===jl||s===Ul?s=ur:(s=Gt,o=void 0);let h=s===Gt&&t[l+1].startsWith("/>")?" ":"";i+=s===ur?a+i_:u>=0?(r.push(c),a.slice(0,u)+es+a.slice(u)+gt+h):a+gt+(u===-2?l:h)}return[Jl(t,i+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},fr=class t{constructor({strings:e,_$litType$:n},r){let o;this.parts=[];let i=0,s=0,l=e.length-1,a=this.parts,[c,d]=ec(e,n);if(this.el=t.createElement(c,r),jt.currentNode=this.el.content,n===2||n===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(o=jt.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let u of o.getAttributeNames())if(u.endsWith(es)){let p=d[s++],h=o.getAttribute(u).split(gt),f=/([.?@])?(.*)/.exec(p);a.push({type:1,index:i,name:f[2],strings:h,ctor:f[1]==="."?xo:f[1]==="?"?$o:f[1]==="@"?So:qt}),o.removeAttribute(u)}else u.startsWith(gt)&&(a.push({type:6,index:i}),o.removeAttribute(u));if(Ql.test(o.tagName)){let u=o.textContent.split(gt),p=u.length-1;if(p>0){o.textContent=vo?vo.emptyScript:"";for(let h=0;h<p;h++)o.append(u[h],hr()),jt.nextNode(),a.push({type:2,index:++i});o.append(u[p],hr())}}}else if(o.nodeType===8)if(o.data===ts)a.push({type:2,index:i});else{let u=-1;for(;(u=o.data.indexOf(gt,u+1))!==-1;)a.push({type:7,index:i}),u+=gt.length-1}i++}}static createElement(e,n){let r=Ut.createElement("template");return r.innerHTML=e,r}};function Zt(t,e,n=t,r){if(e===Qe)return e;let o=r!==void 0?n._$Co?.[r]:n._$Cl,i=pr(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(t),o._$AT(t,n,r)),r!==void 0?(n._$Co??=[])[r]=o:n._$Cl=o),o!==void 0&&(e=Zt(t,o._$AS(t,e.values),o,r)),e}var ko=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:n},parts:r}=this._$AD,o=(e?.creationScope??Ut).importNode(n,!0);jt.currentNode=o;let i=jt.nextNode(),s=0,l=0,a=r[0];for(;a!==void 0;){if(s===a.index){let c;a.type===2?c=new yn(i,i.nextSibling,this,e):a.type===1?c=new a.ctor(i,a.name,a.strings,this,e):a.type===6&&(c=new Mo(i,this,e)),this._$AV.push(c),a=r[++l]}s!==a?.index&&(i=jt.nextNode(),s++)}return jt.currentNode=Ut,o}p(e){let n=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,n),n+=r.strings.length-2):r._$AI(e[n])),n++}},yn=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,r,o){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=Zt(this,e,n),pr(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==Qe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xl(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!==_&&pr(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ut.createTextNode(e)),this._$AH=e}$(e){let{values:n,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=fr.createElement(Jl(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(n);else{let i=new ko(o,this),s=i.u(this.options);i.p(n),this.T(s),this._$AH=i}}_$AC(e){let n=Yl.get(e.strings);return n===void 0&&Yl.set(e.strings,n=new fr(e)),n}k(e){ns(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,o=0;for(let i of e)o===n.length?n.push(r=new t(this.O(hr()),this.O(hr()),this,this.options)):r=n[o],r._$AI(i),o++;o<n.length&&(this._$AR(r&&r._$AB.nextSibling,o),n.length=o)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){let r=Kl(e).nextSibling;Kl(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},qt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,r,o,i){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=n,this._$AM=o,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._Line truncated
:host {
--nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b);
@@ -971,9 +971,11 @@ ${i}`}else o=ju(s)}}catch(s){let l=s.message,a={not_json:"import_error_not_json"
${M(t.t("devices_panel_hint"))}
${t.admin?m`<div class="nf-seg nf-dev-source">${d.map(([p,h])=>m`<button aria-pressed=${a===p} @click=${()=>e.deviceSource=p}>${h}</button>`)}</div>`:_}
${a!=="area"?m`${u}${M0(t,e,n,l,a)}`:R0(t,e,n,l,s,i,r)}
</section>`}function zp(t,e,n){let{hass:r}=t;if(!r)return _;let o=!!e.climate&&Object.values(e.climate).some(l=>l!=null),i=(l,a)=>{let c={...e.climate??{},[l]:a};n({climate:Object.values(c).every(d=>d==null)?null:c})},s=(l,a)=>{let c=pd(r,t.floor??null,{...e,climate:null},l),d=L(r,y=>Ms(r,y,l)),u=Fp(d,y=>(Tt(r,y)===e.area_id?0:1)+(Rs(r,y)?0:2)),p=[e.climate?.[l]??null].flat(),h=y=>{let b=y.filter(v=>!!v&&v!=="none");i(l,y[0]==="none"?"none":b.length>1?b:b[0]??null)},g=p[0]&&p[0]!=="none"?[...p,null]:p;return g.map((y,b)=>P(t,b?t.t("climate_more"):a,y,b?void 0:c[0]??null,u,v=>h(g.map((w,x)=>x===b?v:w))))};return m`<details class="nf-points" ?open=${o}>
</section>`}function zp(t,e,n){let{hass:r}=t;if(!r)return _;let o=!!e.climate&&Object.values(e.climate).some(l=>l!=null),i=(l,a)=>{let c={...e.climate??{},[l]:a};n({climate:Object.values(c).every(d=>d==null)?null:c})},s=(l,a)=>{let c=pd(r,t.floor??null,{...e,climate:null},l),d=[e.climate?.[l]??null].flat(),u=L(r,y=>Ms(r,y,l,!0)&&(!r.states[y]?.attributes.symcon_source_entity||d.includes(y))),p=Fp(u,y=>(Tt(r,y)===e.area_id?0:1)+(Rs(r,y)?0:2)),h=y=>{let b=y.filter(v=>!!v&&v!=="none");i(l,y[0]==="none"?"none":b.length>1?b:b[0]??null)},g=d[0]&&d[0]!=="none"?[...d,null]:d;return g.map((y,b)=>P(t,b?t.t("climate_more"):a,y,b?void 0:c[0]??null,p,v=>h(g.map((w,x)=>x===b?v:w))))};return m`<details class="nf-points" ?open=${o||!!e.climate_card}>
<summary>${t.t("climate")}</summary>
<div class="nf-form">${s("temperature",t.t("climate_temperature"))} ${s("humidity",t.t("climate_humidity"))} ${s("co2",t.t("climate_co2"))}</div>
${H(t,t.t("climate_card"),!!e.climate_card,l=>n({climate_card:l||void 0}))}
${M(t.t("climate_card_hint"))}
${M(t.t("climate_hint"))}
</details>`}var Na="metric",Ip=t=>{Na=t==="imperial"?"imperial":"metric"};var Pp=.3048;function he(t,e,n=2,r=Na){if(r==="metric")return`${j(t,e,n)} m`;let o=e<0?"\u2212":"",i=Math.round(Math.abs(e)/.0254*2),s=Math.floor(i/24),l=i-s*24,a=`${Math.floor(l/2)}${l%2?"\xBD":""}`;return s?`${o}${s}\u2032 ${a}\u2033`:`${o}${a}\u2033`}function Ae(t,e,n=Na){return n==="metric"?`${j(t,e,1)} m\xB2`:`${j(t,e/(Pp*Pp),0)} ft\xB2`}var E0=.15,A0=(t,e)=>Math.abs((t-e+540)%360-180);function F0(t,e,n,r){return t.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let l=o.points[(s+1)%o.points.length];return Math.abs(Q(K(i,n),r))<.02&&Math.abs(Q(K(l,n),r))<.02}))}function Wa(t,e,n,r){let o=e.points,[i,s]=[o[n],o[(n+1)%o.length]],l=fe(K(s,i)),a=ge(o)>=0?1:-1,c=[(s[0]-i[0])/l,(s[1]-i[1])/l],d=[-c[1]*a||0,c[0]*a||0],u=c[0]*d[1]-c[1]*d[0]>0,p=e.wall_heights?.[n],h=e.ceiling??t.height,f=typeof p=="number"?p:Array.isArray(p)?Math.max(...p.map(b=>b??h)):h,g=e.wall_slopes?.[n],y=typeof g=="number"&&typeof p=="number"?g:f;return{origin:u?i:s,along:u?c:[-c[0],-c[1]],normal:d,length:l,face:F0(t,e,i,d)?r/2:0,heightLeft:u?f:y,heightRight:u?y:f}}function Ba(t,e){let n=K(e,t.origin);return{u:Q(n,t.along),depth:Q(n,t.normal)-t.face}}function T0(t,e){let n=t.rooms.find(s=>s.id===e.room_id);if(!n||e.wall)return null;let[r,o]=[n.points[e.edge],n.points[(e.edge+1)%n.points.length]];if(!r||!o)return null;let i=fe(K(o,r))||1;return[r[0]+(o[0]-r[0])*e.offset/i,r[1]+(o[1]-r[1])*e.offset/i]}var Dp=t=>G(t.type)?.mount==="wall"||t.type==="lamp_wall"||t.mount_y!=null;function Op(t,e,n){let r=[];for(let i of t.openings){let s=T0(t,i);if(!s)continue;let{u:l,depth:a}=Ba(n,s);Math.abs(a+n.face)>.3||l<-.01||l>n.length+.01||r.push({id:i.id,kind:"opening",type:i.type,x0:l-i.width/2,x1:l+i.width/2,y0:i.sill,y1:i.sill+i.height,lifts:i.type==="window"})}let o=Math.atan2(-n.normal[0],n.normal[1])*180/Math.PI;for(let i of t.furniture){if(!N([i.x,i.z],e.points)||A0(i.rotation,o)>20)continue;let{u:s,depth:l}=Ba(n,[i.x,i.z]);if(l-i.d/2>E0||s<0||s>n.length)continue;let a=At(t,i);r.push({id:i.id,kind:"furniture",type:i.type,x0:s-i.w/2,x1:s+i.w/2,y0:a,y1:a+i.h,lifts:Dp(i)})}return r.sort((i,s)=>+(i.kind==="furniture")-+(s.kind==="furniture")||i.x0-s.x0)}var ao=t=>Math.round(t*1e3)/1e3;function Hp(t,e,n,r){let o=Ba(t,[e.x,e.z]).depth,i=Math.min(t.length-e.w/2,Math.max(e.w/2,n+e.w/2)),s=[t.origin[0]+t.along[0]*i+t.normal[0]*(o+t.face),t.origin[1]+t.along[1]*i+t.normal[1]*(o+t.face)];return{x:ao(s[0]),z:ao(s[1]),...r!==null&&Dp(e)?{mount_y:ao(Math.max(0,r))}:{}}}function Lp(t,e,n,r,o){let[i]=[e.points[n.edge]],s=Math.min(t.length-n.width/2,Math.max(n.width/2,r+n.width/2)),l=fe(K(i,t.origin))<1e-6?s:t.length-s;return{offset:ao(l),...o!==null&&n.type==="window"?{sill:ao(Math.max(0,o))}:{}}}var Cp=.01,Np=t=>Math.round(t/Cp)*Cp,Va=class extends ne{static properties={host:{attribute:!1},doc:{attribute:!1},roomId:{},edge:{type:Number},_sel:{state:!0},_drag:{state:!0}};constructor(){super(),this._sel=null,this._drag=null}get room(){return this.host.floor?.rooms.find(e=>e.id===this.roomId)}frame(){let e=this.room;return e&&this.host.floor?Wa(this.host.floor,e,this.edge,this.host.doc.settings.wall_interior):null}boxes(){let e=this.room,n=this.frame();return e&&n&&this.host.floor?Op(this.host.floor,e,n):[]}place(e,n,r){let o=this.room,i=this.frame();!o||!i||this.host.change((s,l)=>{if(e.kind==="furniture"){let a=l.furniture.find(c=>c.id===e.id);a&&Object.assign(a,Hp(i,a,n,e.lifts?r:null))}else{let a=l.openings.find(d=>d.id===e.id),c=l.rooms.find(d=>d.id===a?.room_id);a&&c&&Object.assign(a,Lp(c.id===o.id?i:Wa(l,c,a.edge,this.host.doc.settings.wall_interior),c,a,n,e.lifts?r:null))}})}toWall(e){let r=this.renderRoot.querySelector("svg").getScreenCTM()?.inverse();if(!r)return[0,0];let o=new DOMPoint(e.clientX,e.clientY).matrixTransform(r);return[o.x,-o.y]}down(e,n){if(this._sel=n.id,!this.host.admin)return;e.currentTarget.setPointerCapture(e.pointerId);let[r,o]=this.toWall(e);this._drag={id:n.id,x0:n.x0,y0:n.y0,startU:r,startY:o,fromX:n.x0,fromY:n.y0}}move(e,n){let r=this._drag;if(!r||r.id!==n.id)return;let[o,i]=this.toWall(e),s=this.frame(),l=n.x1-n.x0,a=Math.min((s?.length??0)-l,Math.max(0,Np(r.fromX+o-r.startU))),c=n.lifts?Math.max(0,Np(r.fromY+i-r.startY)):r.fromY;this._drag={...r,x0:a,y0:c}}up(e){let n=this._drag;this._drag=null,!(!n||n.id!==e.id||Math.abs(n.x0-n.fromX)<1e-6&&Math.abs(n.y0-n.fromY)<1e-6)&&this.place(e,n.x0,n.y0)}nameOf(e){if(e.kind==="furniture")return this.host.floor?.furniture.find(o=>o.id===e.id)?.name||qe(this.host.hass,e.type);let n=this.host.floor?.openings.find(r=>r.id===e.id);return n?this.host.t(`preset_${xn(n)}`):e.type}updated(e){(e.has("edge")||e.has("roomId"))&&(this._sel=null)}render(){let e=this.host.t,n=this.room,r=this.frame();if(!n||!r)return _;let o=n.points.length,i=h=>he(this.host.hass,h),s=this.boxes().map(h=>this._drag?.id===h.id?{...h,x1:this._drag.x0+(h.x1-h.x0),y1:this._drag.y0+(h.y1-h.y0),x0:this._drag.x0,y0:this._drag.y0}:h),l=Math.max(r.heLine truncated
<line x1="0" x2=${d.x0} y1=${-(d.y0+d.y1)/2} y2=${-(d.y0+d.y1)/2} />
+3 -3
View File
@@ -429,7 +429,7 @@ class NextFloor extends IPSModuleStrict
'symcon_variable_type' => (int) $variable['VariableType'],
'symcon_has_action' => ((int) ($variable['VariableCustomAction'] ?: $variable['VariableAction'])) !== 0,
'symcon_formatted' => GetValueFormatted($variableID),
'device_class' => $this->deviceClassFor($profile, $name . ' ' . $path, $unit)
'device_class' => $this->deviceClassFor($profile, $name, $unit)
];
if ($unit !== '') {
$attributes['unit_of_measurement'] = $unit;
@@ -539,7 +539,7 @@ class NextFloor extends IPSModuleStrict
private function deviceClassFor(string $profile, string $haystack, string $unit = ''): string
{
$text = mb_strtolower($profile . ' ' . $haystack);
$text = str_replace('co₂', 'co2', mb_strtolower($profile . ' ' . $haystack));
$unitClass = match (preg_replace('/[\s\x{00A0}]+/u', '', mb_strtolower($unit))) {
'°c', '°f', '℃', '℉', 'k' => 'temperature',
'ppm' => str_contains($text, 'co2') || str_contains($text, 'co₂') ? 'carbon_dioxide' : '',
@@ -551,7 +551,7 @@ class NextFloor extends IPSModuleStrict
}
return match (true) {
str_contains($text, 'temperature') || str_contains($text, 'temperatur') => 'temperature',
str_contains($text, 'humidity') || str_contains($text, 'feuchte') => 'humidity',
str_contains($text, 'humidity') || str_contains($text, 'feucht') => 'humidity',
str_contains($text, 'co2') => 'carbon_dioxide',
str_contains($text, 'watt') || str_contains($text, 'power') || str_contains($text, 'leistung') => 'power',
preg_match('/kontakt|fenster|tür|tuer|motion|bewegung|presence|anwesen/', $text) === 1 => 'opening',
+19 -1
View File
@@ -16,7 +16,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.2.5 / Build 8** die Konsole neu laden. Unter
Nach der Aktualisierung auf **0.2.6 / Build 9** die Konsole neu laden. Unter
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
### Für die Entwicklung
@@ -46,6 +46,24 @@ Die Dateien unter `NextFloor/assets/` und `NextFloor/packs/` werden durch
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
## Änderungen in 0.2.6
- Pro Raum lässt sich unter **Raumklima → Raumklima als schwebende Karte** eine Glaskarte
mit Temperatur, Luftfeuchtigkeit und CO₂ einschalten. Sie hängt über dem jeweiligen Raum
und verwendet die dort ausgewählten Variablen, einschließlich mehrerer gemittelter Sensoren.
- Die Karte zeigt Celsius/Fahrenheit entsprechend der Anzeigeeinstellung, Feuchte in Prozent
und CO₂ in ppm. Fehlende Werte stehen als „–“ statt einer erfundenen Null dort.
- Der Schalter **Karten** bleibt auch ohne Energiezähler verfügbar. Karten funktionieren
in der Gesamtansicht, auf einzelnen Etagen und beim geöffneten Raum sowie in der HTML-SDK-Kachel.
- Die Variablenauswahl für Raumklima akzeptiert manuell jeden passenden numerischen
Symcon-Datenpunkt (Integer/Float), auch ohne erkannten Profilnamen oder vermuteten Gerätetyp.
„Feuchtigkeit“ und „CO₂“ werden erkannt; Namen übergeordneter Kategorien überschreiben
die Bedeutung des Messwerts nicht mehr.
Nach dem Update den Designer neu laden, den Raum auswählen und unter **Raumklima** die
Messwerte über den Objektbaum zuweisen. Dort **Raumklima als schwebende Karte** aktivieren.
In der 3D-Ansicht bei Bedarf **Karten** einschalten.
## Änderungen in 0.2.5
- Numerische Variablen lassen sich im Objektbaum ausdrücklich als Licht-Dimmer oder
+2 -2
View File
@@ -6,7 +6,7 @@
"compatibility": {
"version": "9.0"
},
"version": "0.2.5",
"build": 8,
"version": "0.2.6",
"build": 9,
"date": 1794211200
}
+11 -2
View File
@@ -13,17 +13,21 @@ $variables = [
6 => ['VariableType' => 1, 'VariableAction' => 99],
7 => ['VariableType' => 2, 'VariableProfile' => '~Intensity.1', 'VariableAction' => 99],
8 => ['VariableType' => 1, 'VariableAction' => 99],
9 => ['VariableType' => 1, 'VariableAction' => 99]
9 => ['VariableType' => 1, 'VariableAction' => 99],
10 => ['VariableType' => 2, 'VariableAction' => 0],
11 => ['VariableType' => 1, 'VariableAction' => 0]
];
$presentations = [1 => ['SUFFIX' => ' °C'], 2 => ['SUFFIX' => "\u{00A0}°C"], 3 => ['PROFILE' => '~Temperature'], 4 => ['SUFFIX' => ' W']];
$presentations[6] = ['MIN' => 0, 'MAX' => 255, 'STEP_SIZE' => 1, 'USAGE_TYPE' => 2, 'SUFFIX' => '%'];
$presentations[8] = ['MIN' => 0, 'MAX' => 100, 'STEP_SIZE' => 1];
$presentations[9] = ['MIN' => 0, 'MAX' => 255, 'STEP_SIZE' => 1];
$presentations[10] = ['SUFFIX' => ' %'];
$presentations[11] = ['SUFFIX' => ' ppm'];
function IPS_GetVariable(int $id): array { global $variables; return $variables[$id] + ['VariableProfile' => '', 'VariableCustomProfile' => '', 'VariableAction' => 0, 'VariableCustomAction' => 0]; }
function IPS_GetVariablePresentation(int $id): array { global $presentations; return $presentations[$id] ?? []; }
function IPS_VariableProfileExists(string $profile): bool { return in_array($profile, ['~Temperature', '~Intensity.1'], true); }
function IPS_GetVariableProfile(string $profile): array { return $profile === '~Intensity.1' ? ['MinValue' => 0, 'MaxValue' => 1, 'StepSize' => 0.01, 'Suffix' => ' %'] : ['Suffix' => ' °C']; }
function GetValue(int $id): float|int|bool { return match ($id) { 5 => true, 6, 9 => 128, 7 => 0.4, 8 => 40, default => 21.75 }; }
function GetValue(int $id): float|int|bool { return match ($id) { 5 => true, 6, 9 => 128, 7 => 0.4, 8 => 40, 10 => 51.6, 11 => 780, default => 21.75 }; }
function GetValueFormatted(int $id): string { return $id === 5 ? 'An' : '21,75'; }
$writes = [];
function RequestAction(int $id, mixed $value): void { global $writes; $writes[] = [$id, $value]; }
@@ -46,6 +50,11 @@ $override = $describe->invoke($module, 4, 'Temperatur', 'Haus / Temperatur', 10)
check($override['attributes']['unit_of_measurement'] === 'W' && $override['attributes']['device_class'] === 'power', 'The effective presentation overrides a stale legacy profile and ancestor names');
$boolean = $describe->invoke($module, 5, 'Kontakt', 'Haus / Kontakt', 10);
check(!isset($boolean['attributes']['symcon_numeric_value']), 'Boolean values are not advertised as numeric readings');
$humidity = $describe->invoke($module, 10, 'Raumfeuchtigkeit', 'Haus / Temperaturen / KNX / Raumfeuchtigkeit', 10);
check($humidity['attributes']['device_class'] === 'humidity', 'Feuchtigkeit is recognized without an ancestor category overriding its meaning');
check($humidity['attributes']['symcon_numeric_value'] === 51.6 && $humidity['attributes']['unit_of_measurement'] === '%', 'Float humidity values keep their raw value and effective percent unit');
$co2 = $describe->invoke($module, 11, 'CO₂', 'Haus / Temperaturen / CO₂', 10);
check($co2['attributes']['device_class'] === 'carbon_dioxide', 'CO2 with a subscript 2 is recognized for integer ppm variables');
$dimmer = $describe->invoke($module, 6, 'Dimmer', 'Haus / Dimmer', 10);
check($dimmer['attributes']['brightness'] === 128, 'An integer dimmer uses its real 0-255 range');
$floatDimmer = $describe->invoke($module, 7, 'Wert', 'Haus / Wert', 10);