@@ -1616,7 +1616,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
${this._find.trim()?p`
${t.length?t.map(n=>p`
`):p`
${A(this.hass,"find_none")}
`}
`:f}
@@ -1628,7 +1628,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
@click=${()=>{this._central=!this._central,this._armed=null}}
>
- `;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Di(t,b).lights),l=s.flatMap(b=>Di(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,d=(b,v,k,S)=>{if(S.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,k,{entity_id:S})}},m=(b,v,k,S,M)=>p`
`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Fi(t,b).lights),l=s.flatMap(b=>Fi(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,d=(b,v,k,S)=>{if(S.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,k,{entity_id:S})}},m=(b,v,k,S,$)=>p`
`,h=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!h[b]||!o||h[b]===o.id)),_=this.buttons??e.settings.buttons??[];return p`${i}
@@ -1645,25 +1645,25 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
`:f}
${n("central_favorites")}
${g.length?p`
- ${g.map(b=>{let[v,k]=_a(b),S=t.states[b],M=v==="homeassistant"&&S?.state==="on";return p`
`:_.length?f:p`
${n("central_no_favorites")}
`}
${_.length?p`
${_.map(b=>p`{Fi(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
+ aria-pressed=${va(t,b)}
+ @click=${v=>{Hi(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
>
${b.icon?p``:f}${b.label}
`)}
`:f}
-
`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(pu,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 i=await _n(this.hass,Ll(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:Bl(i,n,t),loading:!1}}catch{this._travel=null,this._error=A(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 i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>A(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`
this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}
${t.loading?e("travel_loading"):i}
@@ -1696,12 +1696,12 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
>
${this.clean?te`
`:te`
`}
`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return p`
- ${O(this.hass,e.entity)}
+ ${L(this.hass,e.entity)}
${t?A(this.hass,"swipe_off"):`${e.value} %`}
-
`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Hi(i.gang_entities,Y(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`
+
`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Pi(i.gang_entities,Y(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`
`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return p`
this.hass.states[n]?.attributes.symcon_path||this.hass.states
.presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))}
?confirmSwitch=${this.confirmSet.has(e.entity)}
.myPosition=${this.myPositionOf(e.entity)}
- .tiltEntity=${ur(this.hass,this.building?.floors??[],e.entity)}
+ .tiltEntity=${dr(this.hass,this.building?.floors??[],e.entity)}
@close=${()=>this._menu=null}
- >`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Fi(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??Ne(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&be(this,a);return}let o=F(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=Ri(this.hass,e),a=O(this.hass,e);confirm(A(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Ks.has(o)){if(this.confirmSet.has(e)&&!confirm(A(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;Fa(this.hass,e)}else be(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return ks({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>be(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`
t.stopPropagation()}>
+ >`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Hi(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??Ne(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&be(this,a);return}let o=H(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=zi(this.hass,e),a=L(this.hass,e);confirm(A(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Gs.has(o)){if(this.confirmSet.has(e)&&!confirm(A(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;Ha(this.hass,e)}else be(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return Ss({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>be(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`
t.stopPropagation()}>
${e.title}this._pluginWindow=null}>✕
${e.node}
-
`: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 i of e.floors)for(let o of i.furniture){if(!Bc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Lc(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||fe(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let i of e.floors)for(let o of i.furniture){if(!So(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=ko(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||fe(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=jc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=co(e,o),l=a?lc(o,a):null,c=o.name||(a?fe(e,a):fe(e,o.type));n.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:o.name||fe(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||O(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return jl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Ic(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?Xe(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let i=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Wc(t,n).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,n=this.hass,i=t?.settings.forecast;if(!t||!n||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=Nc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=Xe(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"}),m=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`
`: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 i of e.floors)for(let o of i.furniture){if(!Bc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Oc(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||fe(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let i of e.floors)for(let o of i.furniture){if(!$o(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=So(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||fe(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=jc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=uo(e,o),l=a?lc(o,a):null,c=o.name||(a?fe(e,a):fe(e,o.type));n.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:o.name||fe(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||L(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return jl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Ic(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?et(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let i=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Wc(t,n).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,n=this.hass,i=t?.settings.forecast;if(!t||!n||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=Nc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=et(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"}),m=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`
${o.map((h,g)=>p`-
${g===0?A(n,"today"):d.format(new Date(h.day))}
@@ -1733,7 +1733,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
${o?i.length?p``:p`
${A(t,"today_none")}
`:f}
-
`}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=Ne(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};El(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=o&&U(n)?cn(n,o,e.floors.flatMap(a=>a.rooms)).find(a=>a.kind==="electricity"&&a.metric==="power"&&a.unit==="W")?.value??null:o?.power_entity?Z(n?.states[o.power_entity]):null;if(o&&s!==null){let a=t&&t>0?` \xB7 ${A(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${mt(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)&&i.push({icon:l,label:A(n,c),value:ie(n,d)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>pn(a,e,mn(a,e),Ne(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Vl(t,n),o=Date.now(),s=o-24*36e5;_n(t,i,s,o,!0).then(a=>{this.dayCurves=Kl(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=$n(t),d=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,h)=>h.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&d){let m=0,h=0,g=0;for(let _ of d.rooms)for(let[b,v]of _.points)m+=b,h+=v,g++;a.push({kind:"house",at:{floorId:d.id,x:g?m/g:u.x,z:g?h/g:u.z,y:d.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 m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}this.liveCardsOn&&!this.dimmed&&a.push(...zc(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,h,g,_)=>this.placeLhCard(m,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&Zc(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:p`
${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}
`}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),o=this.building?.floors.some(c=>c.rooms.some(u=>u.climate_card))?this.renderCardToggle():f,s=this.roomNamesButton?p`
{this.roomLabels=!this.roomLabels,this.dispatchEvent(new CustomEvent("room-names-change",{detail:{value:this.roomLabels},bubbles:!0,composed:!0}))}}>${A(this.hass,"room_names_short")}Aa`:f;if(!n)return e.length||o!==f||s!==f?p`
${s}${e}${o}
`:f;let a=c=>A(this.hass,c),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:ce(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:ce(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:ce(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let c=[t.battery!==null?ce(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:c.join(" \xB7 ")})}if(t.grid!==null){let c=t.grid<0;l.push({cls:c?"export":"grid",label:a(c?"energy_grid_export":"energy_grid_import"),value:ce(this.hass,Math.abs(t.grid))})}if(t.tariff&&l.push({cls:"tariff",label:a("energy_tariff"),value:`${W(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let c of this.meterRows(this.building))l.push({cls:"meter",label:`${c.icon} ${c.label}`,value:c.value});return p`
+ `}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=Ne(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};El(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&G(n)?un(n,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=G(n)?s?.value??null:o?.power_entity?Z(n?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${A(n,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Qe(n,s):pt(n,a)}${l}`})}for(let[l,c,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],m=d?n?.states[d]:void 0;m&&!C(m)&&i.push({icon:c,label:A(n,u),value:ie(n,m)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>fn(a,e,pn(a,e),Ne(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Vl(t,n),o=Date.now(),s=o-24*36e5;bn(t,i,s,o,!0).then(a=>{this.dayCurves=Kl(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=Mn(t),d=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,h)=>h.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&d){let m=0,h=0,g=0;for(let _ of d.rooms)for(let[b,v]of _.points)m+=b,h+=v,g++;a.push({kind:"house",at:{floorId:d.id,x:g?m/g:u.x,z:g?h/g:u.z,y:d.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 m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}this.liveCardsOn&&!this.dimmed&&a.push(...zc(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,h,g,_)=>this.placeLhCard(m,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&Zc(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:p`
${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}
`}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),o=this.building?.floors.some(c=>c.rooms.some(u=>u.climate_card))?this.renderCardToggle():f,s=this.roomNamesButton?p`
{this.roomLabels=!this.roomLabels,this.dispatchEvent(new CustomEvent("room-names-change",{detail:{value:this.roomLabels},bubbles:!0,composed:!0}))}}>${A(this.hass,"room_names_short")}Aa`:f;if(!n)return e.length||o!==f||s!==f?p`
${s}${e}${o}
`:f;let a=c=>A(this.hass,c),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:ce(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:ce(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:ce(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let c=[t.battery!==null?ce(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:c.join(" \xB7 ")})}if(t.grid!==null){let c=t.grid<0;l.push({cls:c?"export":"grid",label:a(c?"energy_grid_export":"energy_grid_import"),value:ce(this.hass,Math.abs(t.grid))})}if(t.tariff&&l.push({cls:"tariff",label:a("energy_tariff"),value:`${W(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let c of this.meterRows(this.building))l.push({cls:"meter",label:`${c.icon} ${c.label}`,value:c.value});return p`
${s}
${this.liveCardsOn&&this._liveCards.some(c=>c.kind==="house")?f:l.map(c=>p`
${c.label}${c.value}
`)}
${this.flows!==null?f:p`
this.toggleFlows()}>
@@ -1743,22 +1743,22 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
${e}
`}renderCardToggle(){return this.holograms!==null?f:p`
this.toggleLhCards()}>
${A(this.hass,"holos")}◫
- `}ownSensors(){let e=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],t=U(this.hass)?(this.building?.presence??[]).filter(a=>Va(this.hass,a.person,[0])).map(a=>p`
${a.name||O(this.hass,a.person)}${oe(this.hass.states[a.person])===null?"\u2013":oe(this.hass.states[a.person])?"Anwesend":"Abwesend"}
`):[],n=U(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(a=>!!a[1]&&a[1]!=="none").map(([a,l])=>[lu[a]||a,l]):[];U(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&n.push(["Regensensor",this.building.settings.rain_sensor]);let i=n.length?p`
this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}>Wetter⛅
-
`:f,o=U(this.hass)?(this.building?.floors??[]).filter(a=>!this.floorId||a.id===this.floorId).map(a=>({floor:a,readings:cn(this.hass,a,this.building?.floors.flatMap(l=>l.rooms))})).filter(a=>a.readings.length):[],s=o.length?p`
this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}>Stockwerkszähler⚡ 💧
-
`:f;return[...t,i,s,...e.filter(a=>this.hass.states[a]).map(a=>p`
be(this,a)}>
- ${O(this.hass,a)}${ie(this.hass,this.hass.states[a])}
- `)]}renderMapCredit(){let e=this.building?.settings.map;return pc(e)?p`
${mo(e).text}`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=ht(new Date,this.hass?.config?.latitude??50),t=Sr(this.heatMode,e),n=this.heatMode==="temperature",i=n?se(this.hass,t.stops[0][0]):t.stops[0][0],o=n?se(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=>A(this.hass,l);return p`
+ `}ownSensors(){let e=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],t=G(this.hass)?(this.building?.presence??[]).filter(a=>Ka(this.hass,a.person,[0])).map(a=>p`
${a.name||L(this.hass,a.person)}${oe(this.hass.states[a.person])===null?"\u2013":oe(this.hass.states[a.person])?"Anwesend":"Abwesend"}
`):[],n=G(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(a=>!!a[1]&&a[1]!=="none").map(([a,l])=>[lu[a]||a,l]):[];G(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&n.push(["Regensensor",this.building.settings.rain_sensor]);let i=n.length?p`
this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}>Wetter⛅
+
`:f,o=G(this.hass)?(this.building?.floors??[]).filter(a=>!this.floorId||a.id===this.floorId).map(a=>({floor:a,readings:un(this.hass,a,this.building?.floors.flatMap(l=>l.rooms))})).filter(a=>a.readings.length):[],s=o.length?p`
this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}>Stockwerkszähler⚡ 💧
+
`:f;return[...t,i,s,...e.filter(a=>this.hass.states[a]).map(a=>p`
be(this,a)}>
+ ${L(this.hass,a)}${ie(this.hass,this.hass.states[a])}
+ `)]}renderMapCredit(){let e=this.building?.settings.map;return pc(e)?p`
${po(e).text}`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=mt(new Date,this.hass?.config?.latitude??50),t=$r(this.heatMode,e),n=this.heatMode==="temperature",i=n?se(this.hass,t.stops[0][0]):t.stops[0][0],o=n?se(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=>A(this.hass,l);return p`
${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?p` ${a(e?"heat_summer":"heat_winter")}`:f}
${W(this.hass,i,0)} ${s}${W(this.hass,o,0)} ${s}
${this.heatValues.size?f:p`${a("heat_none_found")}`}
-
`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>A(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>$o(u.type)).map(u=>Mo(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Gc(a);return p`
+
`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>A(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>Mo(u.type)).map(u=>Ao(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Gc(a);return p`
📶 ${n("heat_wifi")}
${n("wifi_aps",{n:i.length,clients:s})}
${l.online+l.offline.length?p`${n("wifi_network",{online:l.online,offline:l.offline.length})}`:f}
${l.offline.length?p`${l.offline.slice(0,4).join(", ")}`:f}
${i.length?f:p`${n("wifi_none")}`}
-
`}skyColor(){let e=vn[this.theme]??vn.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this._sky,t=(o,s)=>`rgb(${o.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=vn[this.theme]??vn.neon,i=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+Gl(this.building?.settings.backdrop);return p`
`}skyColor(){let e=yn[this.theme]??yn.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this._sky,t=(o,s)=>`rgb(${o.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=yn[this.theme]??yn.neon,i=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+Gl(this.building?.settings.backdrop);return p`
@@ -3354,18 +3354,18 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
inset: auto 16px 16px;
color: var(--nf-danger);
}
- `]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Ho);function ce(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function Fo(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function bf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:ie(r,e)}var gu;function _u(){let r=new URL("./nextfloor-editor.js?v=4fd9c94342a9",new URL(import.meta.url)).href;return gu??=import(r),gu}var vf=.25,bu=r=>Math.round(r*1e3)/1e3,vu=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&P([e,t],n.points));function Io(r,e,t,n,i){let o=vu(r,e,t);if(!o)return[n,i];let s=(a,l)=>P([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function yf(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(ae(J(o,t),n))<.02&&Math.abs(ae(J(a,t),n))<.02}))}var Po=(r,e)=>Math.abs((r-e+540)%360-180);function yu(r,e,t,n=vf){let i=vu(r,e.x,e.z);if(!i)return null;let o=i.points,s=lt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=Ce(J(u,l));if(d<.3)return;let m=[(u[0]-l[0])/d,(u[1]-l[1])/d],h=[-m[1]*s,m[0]*s],g=ae(J([e.x,e.z],l),m);if(g<0||g>d)return;let _=yf(r,i,l,h)?t/2:0,b=ae(J([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,S=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((T,z)=>Po(e.rotation,z.rotation)
50)return;let M=b-S.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:bu(e.x-h[0]*M),z:bu(e.z-h[1]*M),rotation:(Math.round(S.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Gr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Ur(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function wu(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function xu(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function ku(r,e,t,n){return Ur(r,e,(i,o)=>{[i.x,i.z]=Io(o,i.x,i.z,t,n)})}function Su(r,e,t,n){let i=r.settings.wall_interior??.12;return Gr(r,e,(o,s)=>{[o.x,o.z]=Io(s,o.x,o.z,t,n);let a=yu(s,o,i);a&&Object.assign(o,a)})}var Co=(r,e)=>((r+e)%360+360)%360,$u=r=>Number.parseFloat(r.replace(",",".")),Dn=(r,e)=>Math.round(r*10**e)/10**e;function No(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=$u(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p``}var Au=(r,e)=>p`${r.t("height_auto")}`,Mu=(r,e)=>p`e(-r)}>↺ ${r}°e(r)}>↻ ${r}°`;function wf(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 i=(s,a)=>Wo({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]=Fn(l,3))}),o=Ls(n)?p`${Wo({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??de(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Fn(s,3))})}
+ ${n.mount_y!=null?Au(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function xf(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 i=H(e),o=(l,c,u)=>p``,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?Mt(i,_e(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
- ${No({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=Dn(l,3))})}
+ `,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?At(i,_e(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
+ ${Wo({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=Fn(l,3))})}
${n.y!==null?Au(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Eu(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`${o?fe(r.hass,o):""}
${wf(r,e)} ${Mu(45,s=>r.turnFurniture(e,s))}
r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}
- r.removeFurniture(e)}>${n("delete")}`}else t?i=p`${O(r.hass,t)}
+ r.removeFurniture(e)}>${n("delete")}`}else t?i=p`${L(r.hass,t)}
${xf(r,t)} ${Mu(45,o=>r.turnDevice(t,o))}
r.removeDevice(t)}>${n("delete")}`:i=p`${n("furnish_hint")}`;return p`${i}r.finish()}>${n("done")}
`}var Ru=te``;var ue=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Lt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),Wo={explode:ue("explode",!0),keepRoof:ue("roof",!1),solidWalls:ue("solid_walls",!1),quality:Lt("quality",["auto","low","high"],"auto"),stats:ue("stats",!1),markers:Lt("markers",["none","important","all"],"important"),heat:Lt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Lt("theme",Tr,"neon"),clock:Lt("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:Lt("floor_stack",["dim","stacked","single"],"dim"),roomNames:ue("room_names",!0),clean:ue("clean",!1),navWrap:ue("nav_wrap",!1),weather:ue("weather",!0),timeSlider:ue("time_slider",!1),menuOpen:ue("menu_open",!1),keepCamera:ue("keep_camera",!1),readable:ue("readable",!1),plain:ue("plain",!1),rightBack:ue("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:ue("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 zu(r=qr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Tu(r=qr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function qr(){try{return localStorage}catch{return null}}var jr=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(Wo)){let i=Wo[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=Wo[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Du=Q`
+`;var ue=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Vt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),Lo={explode:ue("explode",!0),keepRoof:ue("roof",!1),solidWalls:ue("solid_walls",!1),quality:Vt("quality",["auto","low","high"],"auto"),stats:ue("stats",!1),markers:Vt("markers",["none","important","all"],"important"),heat:Vt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Vt("theme",Dr,"neon"),clock:Vt("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:Vt("floor_stack",["dim","stacked","single"],"dim"),roomNames:ue("room_names",!0),clean:ue("clean",!1),navWrap:ue("nav_wrap",!1),weather:ue("weather",!0),timeSlider:ue("time_slider",!1),menuOpen:ue("menu_open",!1),keepCamera:ue("keep_camera",!1),readable:ue("readable",!1),plain:ue("plain",!1),rightBack:ue("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:ue("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 zu(r=Zr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Tu(r=Zr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Zr(){try{return localStorage}catch{return null}}var qr=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(Lo)){let i=Lo[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=Lo[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Du=Q`
.nf-dot {
display: inline-block;
width: 8px;
@@ -3865,11 +3865,11 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
gap: 12px;
margin: auto;
}
-`;var Fu=new WeakMap,Hu=new WeakMap;function gt(r,e){let t=Hu.get(r)??r,n=Fu.get(t)??new WeakMap;Fu.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of De(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let d={...u.attributes,nf_cover_control:!0},m=At(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(d.current_position=m);let h=c.tilt?t.states[c.tilt]:u,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?At(t,c.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=u.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:d}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let d=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,c,{...u,entity_id:h});let _={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let k=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!k?.attributes.symcon_id&&typeof k?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(d.map(m)):m(d[0])}};return Hu.set(a,t),n.set(e,a),a}var Oo=class extends X{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 $t(this);store=new jr(qr());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:at(yt(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=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}
+`;var Fu=new WeakMap,Hu=new WeakMap;function _t(r,e){let t=Hu.get(r)??r,n=Fu.get(t)??new WeakMap;Fu.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of De(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let d={...u.attributes,nf_cover_control:!0},m=Et(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(d.current_position=m);let h=c.tilt?t.states[c.tilt]:u,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?Et(t,c.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=u.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:d}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let d=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,c,{...u,entity_id:h});let _={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let k=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!k?.attributes.symcon_id&&typeof k?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(d.map(m)):m(d[0])}};return Hu.set(a,t),n.set(e,a),a}var Oo=class extends X{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 Mt(this);store=new qr(Zr());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:lt(wt(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=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}
${t!==null?p`this._timeDrag=Number(o.target.value)}
@change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
- />`:f}`}t=(e,t)=>A(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=vr(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=on(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=>Gr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Ur(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Gr(n,e,i=>i.rotation=Co(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Ur(n,e,i=>i.rotation=Co(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>wu(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>xu(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(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._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&&mr(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)),p`
+ />`:f}`}t=(e,t)=>A(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=yr(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=an(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=>Ur(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>jr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Ur(n,e,i=>i.rotation=No(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>jr(n,e,i=>i.rotation=No(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>wu(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>xu(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(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._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&&pr(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)),p`
${t?f:p`${this.renderHeader(e)}${this.renderNotices()}`}
${this.data.error&&!e?p`
${this.t("load_error")}: ${this.data.error}
`:f}
${!e&&!this.data.error?p`
${this.t("loading")}
`:f}
@@ -3882,7 +3882,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
`}renderViewOptions(){let e=this._prefs;return p`
this._optsOpen=!this._optsOpen}>⚙
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
- ${this.choiceRow("theme",Tr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
+ ${this.choiceRow("theme",Dr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
🕒
@@ -3898,7 +3898,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
>${this.t("glass_walls")}
this.setPref("glassWalls",Number(t.target.value))} />
- ${U(this.hass)?f:p`
+ ${G(this.hass)?f:p`
${e.announceMuted?"\u{1F507}":"\u{1F4E2}"}