`${a}:${l.map(u=>u.toFixed(2)).join(",")}`).join(";"):"";s!==this.tintSig&&(this.tintSig=s,e.setRoomTint(i))}furnitureMarkers(e,t,r,i){let o=[],s=[],a=new Map,l=new Map,u=wn(t);for(let d of t.floors)if(!(d.layer&&this.hiddenLayers.has(d.id)))for(let h of d.furniture){if(!Ke(e,h))continue;let g=this.furnitureLinks.get(h.id),_=this.stateFaces(e,h);_.length&&a.set(h.id,{color:_[0].color,level:_[0].level,faces:_});let b=nr(h.type);if(b&&h.care_entity){let x=this.careMarker(e,d,h,b,h.care_entity);x&&(o.push(x.marker),x.glow&&a.set(h.id,{color:x.glow,level:.9,faces:[{part:"all",color:x.glow,level:.9}]}),l.set(h.id,h.care_entity));continue}let v=X(h.type);if(h.cover_entity&&tr(v)&&l.set(h.id,h.cover_entity),v?.gangs){for(let B of(h.gang_entities??[]).slice(0,v.gangs)){let D=B&&B!=="none"?be(e,B):null,W=D?q(e.states[D]):null;D&&W!==null&&!i.has(D)&&(i.add(D),s.push({id:B,powerEntity:D,floorId:d.id,x:h.x,z:h.z,power:Math.max(0,W)}))}let x=Ia(e,(h.gang_entities??[]).slice(0,v.gangs),/socket/.test(h.type));x.length&&a.set(h.id,{color:x[0].color,level:x[0].level,gangs:x}),qi(h.gang_entities,v.gangs).length&&l.set(h.id,`gang:${h.id}`);continue}if(lr(h.type)){let x=this.lampMarker(e,d,h,g?.entity??null),B=g?.power?q(e.states[g.power]):null;if(g?.power&&B!==null&&(B>=1&&(x.text=x.text?`${x.text} \xB7 ${wt(e,B)}`:wt(e,B)),i.has(g.power)||(i.add(g.power),s.push({id:x.id,powerEntity:g.power,floorId:d.id,x:h.x,z:h.z,power:Math.max(0,B)}))),o.push(x),h.type==="ceiling_fan"){let D=g?.fan?e.states[g.fan]:void 0;x.spin=Sc(D),D&&!r.has(D.entity_id)&&(r.add(D.entity_id),o.push({...x,id:D.entity_id,y:Math.max(.5,x.y-.3),icon:h.icon?ze(h.icon):Ct("fan"),name:h.name||L(e,D.entity_id),text:Of(e,D),active:te(D),unavailable:C(D),glow:null,lamp:null,spin:void 0,pickable:void 0,effect:void 0}))}continue}let S=Ki(h.type)?Ma(e,h,x=>`${O(e,ue(e,x),1)} ${re(e)}`):null,k=Ki(h.type)?null:Ea(e,h.temp_entity),M=k===null?"":`\u{1F321} ${O(e,ue(e,k),1)} ${re(e)}`,z=h.type==="home_battery"?h.soc:h.type==="wallbox"?h.status:S?h.temp_entity&&h.temp_entity!=="none"?h.temp_entity:h.temp_entity2:k!==null?h.temp_entity:null,R=z&&z!=="none"?z:(h.values??[]).find(x=>x.entity&&x.entity!=="none")?.entity??null,F=g??(R?{entity:null,power:null}:void 0);if(!F)continue;let T=h.type==="home_battery"?R??F.entity??F.power:F.entity??F.power??R;l.set(h.id,T);let E=F.entity?e.states[F.entity]:void 0,A=u.has(h.id),I=A?!!h.meter_invert:h.type==="meter"?t.energy.grid_invert&&!h.export:h.type==="home_battery"?t.energy.battery_invert&&!h.charge:!1,N=F.power?q(e.states[F.power],I):null,K=h.type==="home_battery"&&h.charge&&h.charge!=="none"?h.charge:h.type==="meter"&&!A&&h.export&&h.export!=="none"?h.export:null,j=K?q(e.states[K]):null;j!==null&&(N=Math.max(0,N??0)-Math.max(0,j)),F.power&&N!==null&&!i.has(F.power)&&(i.add(F.power),s.push({id:T,powerEntity:F.power,floorId:d.id,x:h.x,z:h.z,power:Math.max(0,N),wallbox:h.type==="wallbox"||void 0}));let Y=(N??0)>10||E?.state==="on"||E?.state==="running"||dr(E)&&te(E);if((h.type==="radiator"||v)&&E&&P(E.entity_id)==="climate"){let x=E.attributes;if(x.hvac_action==="heating"){let B=typeof x.temperature=="number"&&typeof x.current_temperature=="number"?x.temperature-x.current_temperature:1,D=!!v&&!v.parts.some(W=>W.screen);a.set(h.id,{color:[1,.42,.1],level:Math.min(1,.45+.25*Math.max(0,B)),heat:D||void 0})}}else(h.type==="washer"||h.type==="dryer"||h.type==="dishwasher")&&Y?a.set(h.id,{color:[.3,.85,1],level:.8}):v&&Y&&!v.light&&v.parts.some(x=>x.glow||x.screen)&&a.set(h.id,{color:[.3,.85,1],level:.8,leds:!0});if(Bo(h.type)){let x=Wo(e,F.entity??F.power);if(x&&x.progress!==null&&(x.printing||/pause/.test(x.status))){let B=x.filaments[0]??"#38bdf8",D=[1,3,5].map(W=>parseInt(B.slice(W,W+2),16)/255);a.set(h.id,{color:D,level:.9,print:Math.max(.02,x.progress/100)})}}if(h.type==="home_battery"&&R){let x=Number(e.states[R]?.state);Number.isFinite(x)&&a.set(h.id,{color:x>60?[.29,.87,.5]:x>25?[.98,.8,.08]:[.97,.44,.44],level:.95,fill:x/100})}if(E&&_r(h.type)){let x=P(E.entity_id)==="light"?Ne(E):null,B=P(E.entity_id)==="media"&&["playing","on","paused","idle"].includes(E.state),D=x?x.color:te(E)||B?[.22,.88,1]:null;D&&a.set(h.id,{color:D,level:E.state==="playing"?1:.6,halo:h.ambilight??1})}if(r.has(T))continue;r.add(T);let ie=F.entity?P(F.entity):null,y=d.rooms.find(x=>x.points.length>=3&&H([h.x,h.z],x.points));o.push({id:T,floorId:d.id,roomId:y?.id??null,x:h.x,z:h.z,y:Jo(h)+oe(d,h),icon:h.icon?ze(h.icon):Ct(ie??"switch"),name:h.name||(F.entity?L(e,F.entity):le(e,h.type)),ownName:h.name||void 0,showName:!!h.show_name,text:[S?S.text:h.type==="home_battery"?this.batteryText(e,R,N):h.type==="wallbox"?this.wallboxText(e,R,N):h.type==="meter"?A?N===null?"":he(e,N):this.meterText(e,N):E&&(h.type==="washer"||h.type==="dryer"||h.type==="dishwasher")&&Y&&Yi(e,gn(e,F.entity??F.power))!==null?$(e,"care_time_left",{time:La(Yi(e,gn(e,F.entity??F.power)))}):E?[se(e,E),N!==null&&N>5&&!dr(E)?he(e,N):""].filter(Boolean).join(" \xB7 "):N!==null?he(e,Math.max(0,N)):"",M,_n(e,h.values)].filter(Boolean).join(" \xB7 "),active:S?.warm||k!==null&&k>=Aa||(E?te(E):(N??0)>5),unavailable:E?C(E):!1,glow:null,furnitureId:h.id,energyDevice:h.type==="inverter"||h.type==="home_battery"||h.type==="wallbox"||h.type==="meter",readout:!!S||!!h.values?.some(x=>x.entity&&x.entity!=="none")||void 0,show:h.marker??void 0,fromFurniture:!0})}let c=this.heatMode==="wifi";for(let d of o){let h=d.furnitureId?t.floors.flatMap(_=>_.furniture).find(_=>_.id===d.furnitureId):void 0;if(!h||!Vo(h.type))continue;let g=Ko(e,this.furnitureLinks.get(h.id)?.entity??this.furnitureLinks.get(h.id)?.power??null);g&&(g.clients!==null&&(d.text=$(e,"wifi_clients",{n:g.clients})),c&&(d.wedge={angle:360,reach:9,near:0,color:uc(g),opacity:.4,through:!0,walls:!1},d.show="always"))}let m=Ru(t,o);for(let d of t.floors.flatMap(h=>h.furniture))ot(d.type)&&l.set(d.id,`hydronic:${d.id}`);this.tapPins=m.pins;for(let d of t.floors.flatMap(h=>h.furniture))d.tap?.action&&l.set(d.id,`tap:${d.id}`);for(let{floor:d,item:h}of m.bare){let g=d.rooms.find(b=>b.points.length>=3&&H([h.x,h.z],b.points)),_=h.name||le(e,h.type);o.push({id:`tap:${h.id}`,floorId:d.id,roomId:g?.id??null,x:h.x,z:h.z,y:Jo(h)+oe(d,h),icon:ze(h.icon||"gesture-tap-button"),name:_,ownName:h.name||void 0,showName:!!h.show_name,text:"",active:!1,unavailable:!1,glow:null,furnitureId:h.id,show:h.marker??void 0,fromFurniture:!0})}return{markers:o,consumers:s,screens:a,targets:l}}robotObstacles(e,t){let r=new Set(["rug","worktop","table","table_round","coffee_table","chair","office_chair","stool","bar_stool","bench","desk","robot_vacuum","parking","stairwell","radiator","tv_wall","kitchen_wall","led_strip"]);return e.furniture.filter(i=>{if(r.has(i.type)||i.type.startsWith("lamp_")&&i.type!=="lamp_floor"&&i.type!=="lamp_uplight"||i.h<.04||oe(e,i)>.12)return!1;let o=X(i.type);return o&&(o.hole||/table|desk|chair|stool|bench|rug|carpet|mat$/.test(i.type))?!1:H([i.x,i.z],t)||ur(i).some(s=>H(s,t))}).map(i=>ur(i))}robotInfos(e,t){let r=[],i=zc(e),o=Tc(e,i,t.settings.vacuum_map??null),s=!1;for(let a of t.floors){for(let l of a.furniture){if(l.type!=="robot_vacuum")continue;let u=this.furnitureLinks.get(l.id)?.entity??null,c=u?e.states[u]?.state:void 0,m=c==="cleaning"?"cleaning":c==="returning"?"returning":c==="error"?"error":c==="docked"||!c?"docked":"idle",d=l.rotation*Math.PI/180,h=l.d*.14,g=[l.x-Math.sin(d)*h,l.z+Math.cos(d)*h],_=a.rooms.filter(T=>T.points.length>=3),v=(m==="cleaning"?Gi(e,_,u,br(e,u,l.room_sensor)):null)??_.find(T=>H(g,T.points)),S=m==="cleaning"&&v?this.robotObstacles(a,v.points):[],k=i?Date.parse(e.states[i]?.last_updated??""):Number.NaN,M=!Number.isFinite(k)||Date.now()-k<120*1e3,z=u?.startsWith("vacuum.")&&o&&!s&&(M||m!=="cleaning"&&m!=="returning")?o:null;z&&(s=!0);let R=u?Date.parse(e.states[u]?.last_changed??""):Number.NaN,F=m==="cleaning"||m==="returning"?null:Number.isFinite(R)?R:null;r.push({id:l.id,floorId:a.id,rest:g,restHeading:-d,mode:m,room:v?.points??null,roomId:v?.id??null,obstacles:S,track:z?.path??null,pose:z?.pose??null,settledAt:F})}for(let l of a.furniture){if(!/:(robot_mower|mower_dock)$/.test(l.type))continue;let u=this.furnitureLinks.get(l.id)?.entity??null;if(!u?.startsWith("lawn_mower."))continue;let c=e.states[u]?.state,m=c==="mowing"?"cleaning":c==="returning"?"returning":c==="error"?"error":c==="docked"||!c?"docked":"idle",d=[l.x,l.z],h=(a.outdoor??[]).filter(b=>b.type==="lawn"&&b.points.length>=3),g=h.find(b=>H(d,b.points))??[...h].sort((b,v)=>dn(v.points)-dn(b.points))[0],_=g?(a.outdoor??[]).filter(b=>b!==g&&b.type!=="lawn"&&b.points.some(v=>H(v,g.points))).map(b=>b.points):[];r.push({id:l.id,floorId:a.id,rest:d,restHeading:-l.rotation*Math.PI/180,mode:m,room:g?.points??null,roomId:g?.id??null,obstacles:_,y:g?sr(a,g,d[0],d[1]):ar(a),mower:!0})}}return r}batteryText(e,t,r){let i=t?Number(e.states[t]?.state):Number.NaN,o=[];return Number.isFinite(i)&&o.push(`${O(e,i,0)} %`),r!==null&&Math.abs(r)>=10&&o.push(`${r<0?"\u25B2":"\u25BC"} ${he(e,Math.abs(r))}`),o.join(" \xB7 ")}subMeterText(e,t,r,i){let o=i?xl(t,r,i):null;return o?he(e,o.use)+(o.unmetered===null?"":` \xB7 ${$(e,"meter_unmetered",{w:he(e,o.unmetered)})}`):null}meterText(e,t){return t===null?"":Math.abs(t)<5?he(e,0):`${$(e,t<0?"energy_grid_export":"energy_grid_import")} ${he(e,Math.abs(t))}`}wallboxText(e,t,r){let i=t?e.states[t]:void 0,o=String(i?.state??"").toLowerCase(),s=(r??0)>50||/charg|laden|lädt/.test(o),a=i?.entity_id.startsWith("binary_sensor.")?o==="on":/connect|plug|ready|angesteckt|verbunden|wait|paused|suspend/.test(o),l=s?$(e,"wallbox_charging"):a?$(e,"wallbox_plugged"):i&&!C(i)&&!i.entity_id.startsWith("binary_sensor.")?se(e,i):"",u=r!==null&&r>50?he(e,r):"";return[l,u].filter(Boolean).join(" \xB7 ")}stateFaces(e,t){let r=[],i=t.state_entity2&&t.state_entity2!=="none"?[[t.state_entity,t.state_split==="top_bottom"?"bottom":"left"],[t.state_entity2,t.state_split==="top_bottom"?"top":"right"]]:[[t.state_entity,"all"]];for(let[o,s]of i){if(!o||o==="none")continue;let a=e.states[o];if(!a||C(a)||!(te(a)||a.state==="home"||a.state==="occupied"||a.state==="on"))continue;let u=P(o)==="light"?Ne(a):null;r.push({part:s,color:u?u.color:[1,.71,.28],level:u?u.level:.85})}return r}careMarker(e,t,r,i,o){let s=e.states[o];if(!s)return null;let a="",l=!1,u=null;if(i==="bin"){let d=vr(s);a=d===null?se(e,s):d===0?$(e,"care_bin_today"):d===1?$(e,"care_bin_tomorrow"):$(e,"care_bin_days",{n:d}),l=d!==null&&d<=1,l&&(u=[1,.72,.28])}else if(i==="mail")l=Ca(s),a=$(e,l?"care_mail_yes":"care_mail_no"),l&&(u=[1,.85,.3]);else{let d=Na(s,r.thirsty_below??20);l=!!d?.thirsty,a=d?Number.isFinite(d.moisture)?`${$(e,l?"care_plant_thirsty":"care_plant_ok")} \xB7 ${Math.round(d.moisture)} %`:$(e,l?"care_plant_thirsty":"care_plant_ok"):se(e,s),l&&(u=[1,.45,.3])}let c=t.rooms.find(d=>d.points.length>=3&&H([r.x,r.z],d.points)),m={bin:"mdi:trash-can-outline",mail:"mdi:mailbox-outline",plant:"mdi:sprout-outline"}[i];return{glow:u,marker:{id:o,floorId:t.id,roomId:c?.id??null,x:r.x,z:r.z,y:Jo(r)+oe(t,r),icon:r.icon?ze(r.icon):ze(m),name:r.name||le(e,r.type),ownName:r.name||void 0,showName:!!r.show_name,text:a,active:l,unavailable:C(s),glow:null,furnitureId:r.id,show:r.marker??void 0,fromFurniture:!0,care:!0}}}lampMarker(e,t,r,i){let o=i?e.states[i]:void 0,s=(r.extra_lights??[]).map(b=>e.states[b]).filter(b=>!!b),a=s.find(b=>te(b)),l=X(r.type),u=ia[r.type]??l?.light??"floor",c=t.rooms.some(b=>b.points.length>=3&&H([r.x,r.z],b.points)),m=u==="strip"&&!c?cn(t,r.x,r.z)+(r.mount_y??0):r.mount_y!=null&&!l?r.mount_y:l||u==="wall"||u==="strip"?oe(t,r):u==="table"?or(t,r.x,r.z):u==="bollard"||u==="garden"?cn(t,r.x,r.z):0,d=t.rooms.find(b=>b.points.length>=3&&H([r.x,r.z],b.points)),h=ir(t,r),g=l?l.mount==="ceiling"?Math.max(.5,m-.15):m+r.h+.2:{ceiling:h-.3,downlight:h-.25,spot:h-.35,panel:h-.25,pendant:Math.max(.6,h-r.h-.25),fan:Math.max(.6,h-r.h-.2),floor:m+r.h+.25,uplight:m+r.h+.25,table:m+r.h+.2,wall:m+r.h+.2,strip:r.upright?m+r.w+.15:Math.max(.3,m-.2),bollard:m+r.h+.25,garden:m+r.h+.25}[u],_={id:i??`lamp:${r.id}`,floorId:t.id,roomId:d?.id??null,x:r.x,z:r.z,y:g,icon:Ct("light"),name:r.name||(i?L(e,i):le(e,r.type)),text:[o&&(te(o)||!a)?se(e,o):a?L(e,a.entity_id):"",_n(e,r.values)].filter(Boolean).join(" \xB7 "),readout:!!r.values?.some(b=>b.entity&&b.entity!=="none"),active:(o?te(o):!1)||!!a,unavailable:o?C(o):!1,glow:o||s.length?eo(da(o,s,r.color_entity&&r.color_entity!=="none"?e.states[r.color_entity]:void 0),r.glow_scale):null,lamp:u,rotation:r.rotation,mirror:!!r.mirror,roll:r.tilt??0,upright:!!r.upright,rise:r.rise??0,size:[r.w,r.d,r.h],base:m,pickable:!!i,furnitureId:r.id,pack:l?r.type:null,lightY:l?l.mount==="ceiling"?m:m+r.h*.85:void 0,ceiling:h,effect:o?.state==="on"?Mr(r,Ua(e,r,i)):void 0,variant:r.variant,show:r.marker??void 0,fromFurniture:!0};return o&&i?to(e,_,o,!1):_}showPin(e){if(this.furnish&&!e.fromFurniture)return!0;if(e.show==="never"||this.markerMode==="none")return!1;if(e.show==="always")return!0;if(e.show==="active"||this.building?.settings.motion_markers_active&&ua(this.hass,e.id)){if(!e.active)return!1;if(e.show==="active")return!0}if(this.markersOutside&&!(this.roomId&&e.roomId===this.roomId))return this.markersOutside.includes(sa(e.id,!!e.lamp));if(this.markerMode==="all")return!0;if(e.lamp)return!1;let t=P(e.id);return t==="light"?!1:e.fromFurniture&&t==="fan"?!0:e.care?e.active:e.id.startsWith("tap:")||e.readout?!0:e.fromFurniture?(e.power??0)>=1||t==="media"&&e.active||!!e.energyDevice&&!!e.text:!0}openingTargets(){let e=new Map;for(let[t,r]of this.openingLinks??[]){let i=r.lock??r.cover??r.contact??r.tilt;i&&e.set(t,i)}return e}downloadStl(){let e=this.viewer?.exportStl(10);if(!e)return;let t=URL.createObjectURL(new Blob([e],{type:"model/stl"})),r=document.createElement("a");r.href=t,r.download=`nextfloor-${new Date().toISOString().slice(0,10)}.stl`,r.click(),setTimeout(()=>URL.revokeObjectURL(t),5e3)}secondBlinds(){let e=new Map;for(let[t,r]of this.openingLinks??[])r.cover2&&!r.lock&&r.cover&&e.set(t,r.cover2);return e}scheduleThumbs(e=600){clearTimeout(this.thumbTimer);let t=this.building?.floors.filter(i=>i.rooms.length).length??0;if(!this.floorThumbs||t<2){this._thumbs=[];return}let r=Math.max(e,this.thumbsAt+(this._low?8e3:4e3)-Date.now());this.thumbTimer=setTimeout(()=>{if(!(!this.viewer||this.dimmed&&this._thumbs.length)){if(document.hidden){this.scheduleThumbs(3e3);return}this.thumbsAt=Date.now(),this._thumbs=this.viewer.floorThumbnails(this.narrowThumbs?104:150,this.narrowThumbs?78:112)}},r)}get narrowThumbs(){return this._narrowStage}renderThumbs(){if(!this._thumbs.length||!this.building||this._phoneStage)return f;let e=new Map(this.building.floors.map(o=>[o.id,o.name])),t=[...this._thumbs].sort((o,s)=>(this.building.floors.find(a=>a.id===s.floorId)?.elevation??0)-(this.building.floors.find(a=>a.id===o.floorId)?.elevation??0)),r=this._thumbsCompact,i=()=>{this._thumbsCompact=!r;try{localStorage.setItem("nextfloor.thumbs_compact",this._thumbsCompact?"1":"0")}catch{}};return p``}onDeviceHold(e,t,r){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:r}:we(this,e)}onDeviceSwipe(e,t,r,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||C(s)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&jo(s).dim){let u=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:u,value:u,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let u=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:u,value:u,x:i,y:o},!0}if(l==="cover"&&qo(s)){let u=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:u,value:u,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-r/220*100)));l!==a.value&&(this._swipe={...a,value:l});let u=performance.now();u-this.swipeSent>350&&(this.swipeSent=u,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){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,rl(this.hass,r=>this.announce(r)).then(r=>{t?r():this.stopAnnouncements=r})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!Xa(e,this.screenName)||!el(e))return;let r=tl(e.message);this._announcement={message:e.message,until:Date.now()+r},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,r),nl(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p``:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return p`
${t.map(r=>p``)}
${this._alerts.length>3?p`+${this._alerts.length-3}`:f}
`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),r=t?U(this.hass,t).filter(o=>P(o)==="scene"||P(o)==="script").slice(0,6):[];if(!r.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`
${r.map(o=>p``)}
`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return p``;let t=vc(this.findIndex??=bc(this.hass,e),this._find);return p`
this._find=r.target.value}
@keydown=${r=>{r.key==="Escape"&&(this._find=null),r.key==="Enter"&&t[0]&&this.goTo(t[0])}}
/>
${this._find.trim()?p`
${t.length?t.map(r=>p`
`):p`
${$(this.hass,"find_none")}
`}
`:f}
`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let r=(b,v)=>$(t,b,v),i=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=>Ui(t,b).lights),l=s.flatMap(b=>Ui(t,b).covers),u=a.filter(b=>t.states[b]?.state==="on").length,c=!o,m=(b,v,S,k)=>{if(k.length){if(c&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},d=(b,v,S,k,M)=>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}
${o?o.name:r("central_house")}
${r("central_lights")}${a.length?p` ${u}/${a.length}`:f}
${d("lights_on","central_on","light","turn_on",a.filter(b=>t.states[b]?.state==="off"))}
${d("lights_off","central_off","light","turn_off",a.filter(b=>t.states[b]?.state==="on"))}
${l.length?p`
${r("central_covers")} ${l.length}
${d("covers_open","central_open","cover","open_cover",l)}
${d("covers_close","central_close","cover","close_cover",l)}
`:f}
${r("central_favorites")}
${g.length?p`
${g.map(b=>{let[v,S]=Ha(b),k=t.states[b],M=v==="homeassistant"&&k?.state==="on";return p``})}
`:_.length?f:p`
${r("central_no_favorites")}
`}
${_.length?p`
${_.map(b=>p``)}
`:f}
`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Dc,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),r=t-e*36e5;this._travel={history:new Map,from:r,to:t,t:r,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await An(this.hass,iu(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:ou(i,r,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let r=this._travel;if(!r)return;let i=r.t+250*r.speed;i>=r.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p``:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p``}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 r=e.currentTarget;if(t)r.setPointerCapture(e.pointerId);else if(!this._stick)return;let i=r.getBoundingClientRect(),o=i.width/2,[s,a]=[(e.clientX-i.left-o)/o,(e.clientY-i.top-o)/o],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=r=>$(this.hass,r),t=this._stick??[0,0];return p`
${this._walking?p`this.stickMove(r,!0)} @pointermove=${r=>this.stickMove(r)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}>
${e("walk_hint")}
`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=$(this.hass,this._locked?"lock3d_off":"lock3d_on");return p``}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,r=new Date(this._now),i=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(r),o=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(r);return p`${i}${o}
`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=$(this.hass,this.clean?"controls_show":"controls_hide");return p``}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return p`
${L(this.hass,e.entity)}
${t?$(this.hass,"swipe_off"):`${e.value} %`}
`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?qi(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,r);o.length>1&&(this._plate={ids:o,x:t,y:r})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,r=()=>this._plate=null;return p`
`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),r=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(r-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return p`
!a.speakers?.length||a.speakers.includes(e.entity))}
?confirmSwitch=${this.confirmSet.has(e.entity)}
.myPosition=${this.myPositionOf(e.entity)}
.tiltEntity=${yr(this.hass,this.building?.floors??[],e.entity)}
@close=${()=>this._menu=null}
>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&Oo().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});return}let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&ji(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,r);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??je(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&we(this,a);return}let o=P(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:r};return}if(o==="lock"){let s=Vi(this.hass,e),a=L(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&aa.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;Ya(this.hass,e)}else we(this,e)}pluginTapped(e){let t=this.hass?.states[e],r=this.placementInfo.get(e);if(!t||!r)return!1;let i=this.building?.floors.find(o=>o.id===r.floorId)?.placements.find(o=>o.entity_id===e);return Os({hass:this.hass,entityId:e,state:t},r,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>we(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`t.stopPropagation()}>
${e.title}
${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 r=[];for(let i of e.floors)for(let o of i.furniture){if(!ac(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=sc(t,s?.entity??s?.power??null);a&&r.push({id:o.id,name:o.name||le(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},pump:a})}return r}livePrinters(e){let t=this.hass,r=[];if(!t)return r;for(let i of e.floors)for(let o of i.furniture){if(!Bo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Wo(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||r.push({id:o.id,name:o.name||le(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},printer:a})}return r}liveCars(e,t){let r=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=hc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Ao(e,o),l=a?$u(o,a):null,u=o.name||(a?le(e,a):le(e,o.type));r.push({spot:o.id,name:u,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+(l?.h??.2)+.6},car:s})}return r}liveMedia(e,t){let r=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&r.push({entity:s,name:o.name||le(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.push({entity:o.entity_id,name:o.name||L(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return cu(e,r)}refreshToday(e){let t=this.hass,r=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!r.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,tc(t,r,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,r=e.settings.forecast&&t?at(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!r)return;let i=`${r}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,ic(t,r).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,r=this.hass,i=t?.settings.forecast;if(!t||!r||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=rc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=at(r,this.weatherEntityId??t.settings.weather_entity),a=s?r.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),u=String(a?.precipitation_unit??"mm"),c=r.language??navigator.language,m=new Intl.DateTimeFormat(c,{weekday:"short"}),d=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`
${o.map((h,g)=>p`-
${g===0?$(r,"today"):m.format(new Date(h.day))}
${h.icon}
${d(h.high)} ${d(h.low)}
${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)} %`:""}
`)}
`}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:p`${e}${o}${i}
`}renderTodayCard(e,t){let r=Xu(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=ec([...r,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=c=>{if(c===1)return $(t,"tomorrow");let m=new Date;return m.setDate(m.getDate()+c),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(m)},u=i.flatMap((c,m)=>[(c.day??0)>0&&(i[m-1]?.day??0)!==c.day?p`${l(c.day??0)}`:f,p`${c.title}${c.source}`]);return p`
${o?i.length?p``:p`${$(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 r=je(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:r.solar,grid:i.grid??r.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:r.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};Gl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let r=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&V(r)?He(r,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=V(r)?s?.value??null:o?.power_entity?q(r?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(r,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Pe(r,s):wt(r,a)}${l}`})}for(let[l,u,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let m=e.energy[l],d=m?r?.states[m]:void 0;d&&!C(d)&&i.push({icon:u,label:$(r,c),value:se(r,d)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let r=a=>kn(a,e,xn(a,e),je(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=su(t,r),o=Date.now(),s=o-24*36e5;An(t,i,s,o,!0).then(a=>{this.dayCurves=au(t,a,s,o,r),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,r){let i=++this.hydronicGeneration,o=this.shownBuilding(r).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>ot(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(r,t,!!this._travel);return}Oo().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(r,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,u=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,c=Pn(t),m=(this.floorId?t.floors.find(d=>d.id===this.floorId):void 0)??[...t.floors].sort((d,h)=>h.elevation-d.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&u&&c&&m){let d=0,h=0,g=0;for(let _ of m.rooms)for(let[b,v]of _.points)d+=b,h+=v,g++;a.push({kind:"house",at:{floorId:m.id,x:g?d/g:c.x,z:g?h/g:c.z,y:m.height+(this.floorId?1.2:3.2)},summary:l,autarky:r.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let d of i)a.push({kind:"car",at:d.at,spot:d.spot,name:d.name,car:d.car});for(let d of this.livePrinters(t))a.push({kind:"printer",at:d.at,name:d.name,printer:d.printer});for(let d of this.liveHeatPumps(t))a.push({kind:"heatpump",at:d.at,name:d.name,pump:d.pump});for(let d of o)a.push({kind:"media",at:{...d.at,y:d.at.y+.5},media:d})}if(this.liveCardsOn&&!this.dimmed){a.push(...ju(s,t,this.floorId,this.roomId)),a.push(...qu(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let d of t.floors)for(let h of d.furniture){if(!ot(h.type)||h.hydronic?.card===!1||this.floorId&&d.id!==this.floorId||!Ke(s,h))continue;let g=this.roomId?d.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([h.x,h.z],g.points))||a.push({kind:"hydronic",item:h,readOnly:!!this._travel,at:{floorId:d.id,x:h.x+(h.pin_offset?.x??0),z:h.z+(h.pin_offset?.z??0),y:oe(d,h)+h.h+.3+(h.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(d=>d.at),a.length?(d,h,g,_)=>this.placeLhCard(d,h,g,_):null)}placeLhCard(e,t,r,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(r),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&pc(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,r=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(u=>u.rooms.some(c=>c.climate_card)||u.furniture.some(c=>c.power_card||ot(c.type)&&c.hydronic?.card!==!1))?this.renderCardToggle():f,s=this.roomNamesButton?p``:f;if(!r)return e.length||o!==f||s!==f?p`${s}${e}${o}
`:f;let a=u=>$(this.hass,u),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:he(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:he(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:he(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let u=[t.battery!==null?he(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:u.join(" \xB7 ")})}if(t.grid!==null){let u=t.grid<0;l.push({cls:u?"export":"grid",label:a(u?"energy_grid_export":"energy_grid_import"),value:he(this.hass,Math.abs(t.grid))})}if(t.tariff&&l.push({cls:"tariff",label:a("energy_tariff"),value:`${O(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let u of this.meterRows(this.building))l.push({cls:"meter",label:`${u.icon} ${u.label}`,value:u.value});return p`
${s}
${this.liveCardsOn&&this._liveCards.some(u=>u.kind==="house")?f:l.map(u=>p`
${u.label}${u.value}
`)}
${this.flows!==null?f:p`
`}
${this.renderCardToggle()}
${e}
`}renderCardToggle(){return this.holograms!==null?f:p``}utilityOverview(e){let t=this.building;if(!t||!V(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen||!e&&!this._utilityOverviewVisible)return f;let r=t.floors.flatMap(o=>o.rooms);return(this.floorId?t.floors.filter(o=>o.id===this.floorId):t.floors).some(o=>He(this.hass,o,r).length||Bt(this.hass,o,r,!0).length)?p`{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:p``,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=V(this.hass)?(this.building?.presence??[]).filter(u=>sl(this.hass,u.person,[0])).map(u=>p`${u.name||L(this.hass,u.person)}${ae(this.hass.states[u.person])===null?"\u2013":ae(this.hass.states[u.person])?"Anwesend":"Abwesend"}${G(this.hass,[u.person],u.name||"Anwesenheit")}
`):[],o=V(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(u=>!!u[1]&&u[1]!=="none").map(([u,c])=>[Ac[u]||u,c]):[];V(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?p`
`:f,a=V(this.hass)?(this.building?.floors??[]).filter(u=>!this.floorId||u.id===this.floorId).map(u=>({floor:u,readings:He(this.hass,u,this.building?.floors.flatMap(c=>c.rooms))})).filter(u=>u.readings.length):[],l=a.length?p`
`:f;return[t,e,...i,s,l,...r.filter(u=>this.hass.states[u]).map(u=>p`${G(this.hass,[u],L(this.hass,u))}`)]}renderMapCredit(){let e=this.building?.settings.map;return Tu(e)?p`${zo(e).text}`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=yt(new Date,this.hass?.config?.latitude??50),t=Wr(this.heatMode,e),r=this.heatMode==="temperature",i=r?ue(this.hass,t.stops[0][0]):t.stops[0][0],o=r?ue(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=r?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`
${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?p` ${a(e?"heat_summer":"heat_winter")}`:f}
${O(this.hass,i,0)} ${s}${O(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 r=(u,c)=>$(e,u,c),i=t.floors.flatMap(u=>u.furniture.filter(c=>Vo(c.type)).map(c=>Ko(e,this.furnitureLinks?.get(c.id)?.entity??this.furnitureLinks?.get(c.id)?.power??null))),s=i.filter(u=>!!u).reduce((u,c)=>u+(c.clients??0),0),a=t.floors.flatMap(u=>u.placements.map(c=>e.states[c.entity_id])),l=cc(a);return p`
📶 ${r("heat_wifi")}
${r("wifi_aps",{n:i.length,clients:s})}
${l.online+l.offline.length?p`${r("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`${r("wifi_none")}`}
`}skyColor(){let e=Rn[this.theme]??Rn.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,u)=>Math.round(l+(a[u]-l)*t)).join(",")})`,i=Rn[this.theme]??Rn.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+lu(this.building?.settings.backdrop);return p`
${this._error?p`
${this._error}
`:f} ${this.renderTopLeft()} ${fc(this.hass,this._liveCards,(s,a,l,u)=>this.hass?.callService(s,a,{entity_id:l,...u}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:p`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday(e)} ${this.renderLayers()} ${this.renderPluginWindow()}
${this.showStats&&this._stats?p`
${this._stats.fps?$(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):$(this.hass,"stats_idle")}
${this._stats.busy.length?p`(${this._stats.busy.map(s=>$(this.hass,`stats_busy_${s}`)).join(", ")})`:f} ·
${$(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${$(this.hass,this._stats.low?"stats_low":"stats_full",{r:O(this.hass,this._stats.pixelRatio,2)})}`:f}
`}static styles=[_e,Te,gc,J`
:host {
display: block;
position: relative;
min-height: 200px;
}
.nf-alert-banner {
position: absolute;
left: 50%;
top: 10px;
transform: translateX(-50%);
display: flex;
justify-content: center;
gap: 6px;
max-width: calc(100% - 24px);
z-index: 4;
}
.nf-alert {
flex: 0 1 auto;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 7px 14px 7px 12px;
border: 0;
border-left: 4px solid #ff3b4f;
border-radius: 12px;
background: var(--nf-chrome-solid);
color: var(--nf-text);
font: 600 13.5px var(--nf-font);
box-shadow: 0 0 18px rgba(255, 59, 79, 0.35);
cursor: pointer;
animation: nf-alert-pulse 1.2s ease-in-out infinite;
}
.nf-alert-water,
.nf-alert-window_rain {
border-left-color: #4fb3ff;
box-shadow: 0 0 18px rgba(79, 179, 255, 0.35);
}
.nf-alert-alarm_pending {
border-left-color: #ffb547;
box-shadow: 0 0 18px rgba(255, 181, 71, 0.35);
}
.nf-announcement {
position: absolute;
inset: 18% 8% auto;
z-index: 30;
display: flex;
align-items: center;
gap: 18px;
margin: 0 auto;
max-width: 860px;
padding: 22px 28px;
border: 1px solid color-mix(in srgb, var(--nf-accent) 55%, transparent);
border-radius: 22px;
background: var(--nf-chrome-solid);
color: var(--nf-text);
box-shadow: 0 0 40px color-mix(in srgb, var(--nf-accent) 35%, transparent), 0 18px 50px rgba(0, 0, 0, 0.45);
font: 700 clamp(22px, 3.6vw, 40px) / 1.25 var(--nf-font);
text-align: left;
cursor: pointer;
animation: nf-announce-in 0.35s ease-out;
}
.nf-announcement-icon {
font-size: 1.3em;
}
@keyframes nf-announce-in {
from {
opacity: 0;
transform: translateY(-12px) scale(0.98);
}
}
@media (prefers-reduced-motion: reduce) {
.nf-announcement {
animation: none;
}
}
/* a contact that stopped answering is a chore, not an emergency: no glow, no pulse */
.nf-alert-contact_lost,
.nf-alert-own {
border-left-color: #ffb547;
box-shadow: none;
animation: none;
}
.nf-alert-more {
align-self: center;
color: var(--nf-muted);
font-size: 13px;
}
@keyframes nf-alert-pulse {
50% {
box-shadow: 0 0 4px transparent;
}
}
.nf-has-alerts .nf-energy,
.nf-has-alerts .nf-topleft {
top: 58px;
}
/* the clock top left stacks above the sensor and energy bar rather than covering it */
.nf-topleft {
position: absolute;
left: 12px;
top: 10px;
z-index: 3;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 8px;
max-width: calc(100% - 24px);
pointer-events: none;
}
.nf-topleft > .nf-clock,
.nf-topleft > .nf-energy {
position: static;
max-width: 100%;
}
.nf-scenes {
position: absolute;
left: 60px;
right: 60px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 6px;
z-index: 2;
pointer-events: none;
}
.nf-scenes .nf-chip {
pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
.nf-alert,
.nf-dev-found {
animation: none;
}
}
.nf-stage {
position: absolute;
inset: 0;
overflow: hidden;
container-type: size;
container-name: nf;
background: radial-gradient(ellipse at 50% 35%, var(--nf-sky, var(--nf-bg2)), var(--nf-ground, var(--nf-bg)) 72%);
transition: background 2s ease;
}
.nf-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
cursor: grab;
}
.nf-canvas:active {
cursor: grabbing;
}
:host([readable]) .nf-pin {
font-size: 15px;
padding: 6px 12px;
}
:host([readable]) .nf-pin-info small,
:host([readable]) .nf-pin-floor span {
font-size: 14px;
opacity: 1;
}
:host([readable]) .nf-pin-floor b {
font-size: 18px;
}
:host([readable]) .nf-dev {
font-size: 14px;
color: var(--nf-text);
}
.nf-note-pin {
background: #ffe58a;
color: #3a2e00;
border-color: #c9a400;
max-width: 260px;
overflow: hidden;
text-overflow: ellipsis;
}
.nf-note-pin.nf-note-due {
background: #ffa726;
color: #2a1600;
}
.nf-note-pin.nf-note-open {
white-space: normal;
text-align: left;
}
.nf-note-photo {
display: block;
width: 100%;
max-height: 200px;
object-fit: cover;
margin-top: 6px;
border-radius: 6px;
}
.nf-labels {
position: absolute;
inset: 0;
pointer-events: none;
}
.nf-pin-info {
display: grid;
gap: 1px;
text-align: center;
}
.nf-pin-info small {
font-size: 11px;
font-weight: 500;
opacity: 0.9;
font-variant-numeric: tabular-nums;
}
.nf-pin {
position: absolute;
left: 0;
top: 0;
pointer-events: auto;
font: 600 12.5px var(--nf-title-font);
color: var(--nf-text);
background: var(--nf-chrome);
border: 1px solid var(--nf-line);
border-radius: 10px;
padding: 5px 10px;
cursor: pointer;
white-space: nowrap;
backdrop-filter: blur(6px);
box-shadow: var(--nf-shadow);
}
.nf-pin-floor {
display: grid;
justify-items: start;
gap: 1px;
padding: 8px 14px;
border-radius: 12px;
background: var(--nf-accent);
color: var(--nf-accent-text);
border-color: transparent;
box-shadow: var(--nf-shadow);
}
.nf-pin-floor b {
font: 700 15px var(--nf-title-font);
letter-spacing: -0.01em;
}
.nf-pin-floor span {
font: 500 12px var(--nf-font);
opacity: 0.78;
}
.nf-dev {
position: absolute;
left: 0;
top: 0;
pointer-events: auto;
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px;
border-radius: 999px;
border: 1px solid var(--nf-line);
background: var(--nf-chrome);
color: var(--nf-muted);
font: 600 12px var(--nf-font);
cursor: pointer;
white-space: nowrap;
backdrop-filter: blur(6px);
touch-action: manipulation;
-webkit-user-select: none;
user-select: none;
transition: opacity 0.2s ease;
}
.nf-dev-icon {
display: grid;
place-items: center;
width: 24px;
height: 24px;
border-radius: 50%;
background: color-mix(in srgb, var(--nf-soft) 14%, transparent);
}
.nf-dev-text {
display: none;
padding-right: 6px;
color: var(--nf-text);
font-variant-numeric: tabular-nums;
max-width: 160px;
overflow: hidden;
text-overflow: ellipsis;
}
.nf-dev-watt:empty {
display: none;
}
.nf-dev-watt {
padding: 1px 6px 1px 0;
color: var(--nf-accent);
font-variant-numeric: tabular-nums;
font-weight: 700;
}
.nf-dev-on .nf-dev-watt {
color: #2a1a00;
}
.nf-person {
position: absolute;
left: 0;
top: 0;
display: grid;
place-items: center;
width: 30px;
height: 30px;
border-radius: 50%;
overflow: hidden;
background: #ff5fd2;
color: #fff;
font: 700 12px var(--nf-font);
box-shadow:
0 0 0 2px rgba(255, 95, 210, 0.45),
0 0 18px #ff5fd2;
pointer-events: auto;
}
.nf-person img {
width: 100%;
height: 100%;
object-fit: cover;
}
.nf-person[hidden] {
display: none;
}
.nf-no-room-names .nf-pin[data-room] {
display: none !important;
}
/* tablet level: blur over the canvas and glowing shadows are expensive on weak GPUs */
.nf-stage.nf-low {
transition: none;
}
.nf-low .nf-pin,
.nf-low .nf-dev,
.nf-low .nf-dev-on,
.nf-low .nf-energy-item,
.nf-low .nf-find input,
.nf-low .nf-find-list,
.nf-low .nf-find-btn,
.nf-low .nf-swipe,
.nf-low .nf-thumb {
backdrop-filter: none;
box-shadow: none;
transition: none;
}
.nf-thumbs {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
display: flex;
flex-direction: column;
gap: 8px;
max-height: calc(100% - 140px);
overflow-y: auto;
scrollbar-width: none;
z-index: 2;
}
.nf-thumb {
position: relative;
display: grid;
padding: 0;
width: 150px;
border: 1px solid var(--nf-line);
border-radius: 14px;
background: color-mix(in srgb, var(--nf-chrome) 70%, transparent);
color: var(--nf-text);
cursor: pointer;
overflow: hidden;
font: inherit;
box-shadow: var(--nf-shadow);
opacity: 0.72;
transition: opacity 0.15s, border-color 0.15s;
}
.nf-thumb:hover,
.nf-thumb[aria-pressed="true"] {
opacity: 1;
}
.nf-thumb[aria-pressed="true"] {
border-color: var(--nf-accent);
box-shadow: var(--nf-shadow), 0 0 0 2px var(--nf-accent);
}
.nf-thumb img {
display: block;
width: 100%;
aspect-ratio: 4 / 3;
}
.nf-thumb span {
position: absolute;
left: 8px;
bottom: 6px;
font-size: 12px;
font-weight: 600;
}
.nf-thumb img + span {
inset: auto 0 0 0;
padding: 18px 10px 6px;
color: #fff;
background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
}
.nf-thumbs-fold {
align-self: flex-start;
width: 26px;
height: 22px;
padding: 0;
border: 1px solid var(--nf-line);
border-radius: 8px;
background: var(--nf-chrome);
color: var(--nf-text);
font-size: 11px;
cursor: pointer;
}
/* folded: plain floor buttons with their names, no pictures (D177) */
.nf-thumbs-compact .nf-thumb {
padding: 6px 10px;
min-width: 0;
}
.nf-thumbs-compact .nf-thumb span {
position: static;
background: none;
padding: 0;
}
.nf-thumb-house {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
}
.nf-thumb-house span {
position: static;
text-shadow: none;
}
/* a low stage (a card of 420 px): the pictures start under the top bar and stop above the buttons at the bottom left */
.nf-thumbs.nf-thumbs-short {
top: 52px;
transform: none;
max-height: calc(100% - 52px - 150px);
}
.nf-thumbs-small .nf-thumb {
width: 104px;
}
.nf-find-btn {
position: absolute;
left: 12px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: 40px;
height: 40px;
display: grid;
place-items: center;
border: 0;
border-radius: 13px;
background: var(--nf-chrome);
color: var(--nf-text);
box-shadow: var(--nf-shadow);
cursor: pointer;
}
/* the star sits above the search button, its menu opens above it */
.nf-central-btn {
position: absolute;
left: 12px;
bottom: calc(56px + var(--nf-bottom-inset, 0px));
width: 40px;
height: 40px;
display: grid;
place-items: center;
border: 0;
border-radius: 13px;
background: var(--nf-chrome);
color: var(--nf-text);
box-shadow: var(--nf-shadow);
cursor: pointer;
z-index: 3;
}
.nf-central-on {
color: var(--nf-accent);
}
.nf-central {
position: absolute;
left: 12px;
bottom: calc(104px + var(--nf-bottom-inset, 0px));
width: min(320px, calc(100% - 24px));
max-height: calc(100% - 140px);
overflow-y: auto;
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 8px;
padding: 12px 14px;
border: 1px solid var(--nf-line);
border-radius: 16px;
background: var(--nf-chrome);
color: var(--nf-text);
box-shadow: var(--nf-shadow);
backdrop-filter: blur(10px);
z-index: 4;
}
.nf-central > b {
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
opacity: 0.7;
}
.nf-central-row {
display: grid;
grid-template-columns: 1fr auto auto;
gap: 6px;
align-items: center;
}
.nf-central-row small {
opacity: 0.6;
}
.nf-central .nf-btn {
min-width: 64px;
}
.nf-central-armed {
background: #ff8a3d !important;
color: #1a0d00 !important;
}
.nf-central-favs {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.nf-own-btn {
display: inline-flex;
align-items: center;
gap: 6px;
}
.nf-own-btn ha-icon {
--mdc-icon-size: 18px;
}
.nf-central-hint {
margin: 0;
font-size: 13px;
opacity: 0.7;
}
.nf-layers {
position: absolute;
top: 12px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 6px;
z-index: 3;
}
.nf-has-alerts .nf-layers {
top: 58px;
}
/* top right: "Today" and the forecast below it, one column */
.nf-right-col {
position: absolute;
top: 12px;
right: 12px;
width: min(280px, calc(100% - 24px));
max-height: calc(100% - 140px);
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 8px;
z-index: 3;
pointer-events: none;
}
.nf-right-col > * {
pointer-events: auto;
}
.nf-utility-right {
height: calc(100% - 140px);
}
.nf-has-utility-overview:not(.nf-narrow) > .nf-energy,
.nf-has-utility-overview:not(.nf-narrow) > .nf-topleft {
max-width: calc(100% - 316px);
}
.nf-has-utility-overview .nf-energy {
align-items: flex-start;
}
.nf-narrow .nf-utility-right {
top: auto !important;
bottom: 64px;
height: 42%;
max-height: 42%;
justify-content: flex-end;
width: min(280px, calc(100% - 24px));
}
.nf-has-alerts .nf-right-col {
top: 58px;
}
/* "Today": the day's appointments and bins, folds to its title */
.nf-today {
width: 100%;
min-height: 0;
overflow-y: auto;
box-sizing: border-box;
padding: 8px 12px 10px;
border-radius: 16px;
border: 1px solid var(--nf-line);
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
backdrop-filter: blur(10px);
color: var(--nf-text);
z-index: 3;
}
.nf-low :is(.nf-today, .nf-forecast) {
backdrop-filter: none;
}
.nf-today-day {
display: block !important;
margin-top: 4px;
font-size: 12px;
font-weight: 600;
color: var(--nf-muted);
}
/* the forecast: a row per day */
.nf-forecast {
box-sizing: border-box;
flex: none;
padding: 6px 12px;
border-radius: 16px;
border: 1px solid var(--nf-line);
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
backdrop-filter: blur(10px);
color: var(--nf-text);
pointer-events: auto;
}
.nf-forecast ul {
list-style: none;
margin: 0;
padding: 0;
display: grid;
grid-template-columns: auto auto auto auto;
column-gap: 10px;
row-gap: 2px;
align-items: baseline;
font-size: 13px;
}
.nf-forecast li {
display: contents;
}
.nf-fc-day {
color: var(--nf-muted);
}
.nf-fc-temp {
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.nf-fc-temp small {
color: var(--nf-muted);
}
.nf-fc-rain {
font-size: 12px;
color: var(--nf-soft);
white-space: nowrap;
}
.nf-today-folded {
width: auto;
align-self: flex-end;
padding-bottom: 8px;
}
.nf-today-head {
display: flex;
gap: 8px;
align-items: baseline;
width: 100%;
padding: 0;
border: 0;
background: none;
color: inherit;
font: inherit;
cursor: pointer;
text-align: left;
}
.nf-today-head span {
font-size: 12px;
color: var(--nf-muted);
}
.nf-today ul {
list-style: none;
margin: 8px 0 0;
padding: 0;
display: grid;
gap: 6px;
}
.nf-today li {
display: grid;
grid-template-columns: 44px 1fr;
gap: 8px;
align-items: baseline;
font-size: 14px;
}
.nf-today time {
font-variant-numeric: tabular-nums;
color: var(--nf-accent);
font-weight: 600;
}
.nf-today small {
display: block;
font-size: 11px;
color: var(--nf-muted);
}
.nf-today-past {
opacity: 0.45;
}
.nf-today-none {
margin: 6px 0 0;
font-size: 13px;
color: var(--nf-muted);
}
/* opened from the start on a wall tablet: a size larger, easy to hit */
.nf-central-big {
width: min(420px, calc(100% - 24px));
font-size: 16px;
}
.nf-central-big .nf-chip,
.nf-central-big .nf-btn {
min-height: 44px;
padding: 8px 16px;
font-size: 15px;
}
.nf-own-btn[aria-pressed="true"] {
border-color: var(--nf-accent);
color: var(--nf-accent);
box-shadow: 0 0 12px color-mix(in srgb, var(--nf-accent) 45%, transparent);
}
.nf-low .nf-central {
backdrop-filter: none;
}
/* the eye sits beside the search button; alone in the corner once the view is clean */
.nf-travel-btn {
position: absolute;
left: 188px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: 36px;
height: 36px;
padding: 0;
border-radius: 50%;
border: 1px solid rgba(160, 240, 255, 0.35);
background: rgba(8, 16, 34, 0.7);
color: var(--nf-text);
font-size: 14px;
cursor: pointer;
z-index: 4;
}
.nf-travel {
position: absolute;
left: 50%;
bottom: calc(62px + var(--nf-bottom-inset, 0px));
transform: translateX(-50%);
width: min(860px, calc(100% - 24px));
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
border-radius: 18px;
background: rgba(8, 16, 34, 0.82);
box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
color: var(--nf-text);
z-index: 5;
flex-wrap: wrap;
}
.nf-travel button,
.nf-travel select {
min-height: 32px;
border: 0;
border-radius: 999px;
padding: 0 10px;
background: rgba(127, 127, 127, 0.16);
color: inherit;
font: inherit;
font-size: 13px;
cursor: pointer;
}
.nf-travel select option {
color: #111;
}
.nf-travel .nf-travel-play {
width: 36px;
padding: 0;
background: var(--nf-accent);
color: #041018;
}
.nf-travel-span[aria-pressed="true"] {
box-shadow: inset 0 0 0 1px var(--nf-accent);
color: var(--nf-accent);
}
.nf-travel-live {
color: #ff5a6b !important;
}
.nf-travel-when {
min-width: 92px;
font-variant-numeric: tabular-nums;
font-size: 14px;
}
.nf-travel-track {
position: relative;
flex: 1 1 220px;
height: 28px;
}
.nf-travel-track svg {
position: absolute;
inset: 9px 0;
width: 100%;
height: 10px;
fill: var(--nf-accent);
opacity: 0.55;
pointer-events: none;
}
.nf-travel-track input {
position: absolute;
inset: 0;
width: 100%;
margin: 0;
background: transparent;
accent-color: var(--nf-accent);
}
.nf-walk-btn {
position: absolute;
left: 144px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: 36px;
height: 36px;
display: grid;
place-items: center;
padding: 0;
border-radius: 50%;
border: 1px solid rgba(160, 240, 255, 0.35);
background: rgba(8, 16, 34, 0.7);
color: var(--nf-text);
font-size: 16px;
cursor: pointer;
z-index: 4;
}
.nf-walk-on {
color: #041018;
background: var(--nf-accent);
border-color: var(--nf-accent);
}
.nf-stick {
position: absolute;
right: 28px;
bottom: calc(70px + var(--nf-bottom-inset, 0px));
width: 120px;
height: 120px;
border-radius: 50%;
background: rgba(8, 16, 34, 0.45);
border: 1px solid rgba(160, 240, 255, 0.35);
display: grid;
place-items: center;
touch-action: none;
z-index: 4;
}
.nf-stick span {
width: 52px;
height: 52px;
border-radius: 50%;
background: var(--nf-accent);
opacity: 0.85;
pointer-events: none;
}
.nf-walk-hint {
position: absolute;
left: 50%;
top: 12px;
transform: translateX(-50%);
margin: 0;
padding: 6px 12px;
border-radius: 999px;
background: rgba(8, 16, 34, 0.6);
color: var(--nf-muted);
font-size: 12px;
pointer-events: none;
z-index: 3;
}
.nf-lock3d {
position: absolute;
left: 100px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: 36px;
height: 36px;
display: grid;
place-items: center;
padding: 0;
border-radius: 50%;
border: 1px solid rgba(160, 240, 255, 0.35);
background: rgba(8, 16, 34, 0.7);
color: var(--nf-text);
cursor: pointer;
z-index: 4;
}
.nf-lock3d-on {
color: #041018;
background: var(--nf-accent);
border-color: var(--nf-accent);
}
.nf-plugin-window {
position: absolute;
right: 12px;
bottom: 12px;
z-index: 6;
width: min(420px, calc(100% - 24px));
border-radius: 12px;
overflow: hidden;
background: rgba(10, 16, 22, 0.92);
border: 1px solid rgba(127, 208, 255, 0.35);
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
color: #e6f4fb;
}
.nf-pw-head {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 8px 6px 12px;
font-size: 13px;
}
.nf-pw-head span {
flex: 1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.nf-pw-close {
border: 0;
background: transparent;
color: inherit;
font-size: 16px;
cursor: pointer;
padding: 2px 6px;
}
.nf-pw-body {
line-height: 0;
}
.nf-clock {
position: absolute;
z-index: 3;
display: flex;
flex-direction: column;
padding: 8px 14px;
border-radius: 16px;
background: rgba(8, 16, 34, 0.55);
color: var(--nf-text);
pointer-events: none;
line-height: 1.1;
}
.nf-clock b {
font-size: clamp(28px, 6cqmin, 64px);
font-weight: 600;
font-variant-numeric: tabular-nums;
letter-spacing: -0.02em;
}
.nf-clock span {
font-size: clamp(12px, 1.8cqmin, 18px);
color: var(--nf-muted);
}
.nf-clock-top_left {
left: 16px;
top: 16px;
}
.nf-clock-top_right {
right: 16px;
top: 16px;
align-items: flex-end;
}
.nf-clock-bottom_left {
left: 16px;
bottom: calc(60px + var(--nf-bottom-inset, 0px));
}
.nf-clock-bottom_right {
right: 16px;
bottom: calc(60px + var(--nf-bottom-inset, 0px));
align-items: flex-end;
}
.nf-eye {
position: absolute;
left: 56px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: 36px;
height: 36px;
display: grid;
place-items: center;
padding: 0;
border-radius: 50%;
border: 1px solid rgba(160, 240, 255, 0.35);
background: rgba(8, 16, 34, 0.7);
color: var(--nf-text);
cursor: pointer;
z-index: 4;
}
/* in the clean view the button sits at the top: a tablet's taskbar or gesture bar covers the bottom edge and the button was lost there (#75) */
.nf-eye-clean {
left: auto;
bottom: auto;
right: calc(12px + env(safe-area-inset-right, 0px));
top: calc(12px + env(safe-area-inset-top, 0px));
opacity: 0.55;
}
.nf-eye:hover,
.nf-eye-clean:hover {
opacity: 1;
}
.nf-find {
position: absolute;
left: 12px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: min(340px, calc(100% - 24px));
display: flex;
flex-direction: column-reverse;
gap: 6px;
z-index: 3;
}
.nf-find input {
box-sizing: border-box;
width: 100%;
height: 42px;
padding: 0 42px 0 14px;
border: 1px solid var(--nf-line);
border-radius: 14px;
background: var(--nf-chrome);
color: var(--nf-text);
font: inherit;
font-size: 15px;
box-shadow: var(--nf-shadow);
backdrop-filter: blur(8px);
}
.nf-find-close {
position: absolute;
right: 6px;
bottom: 6px;
width: 30px;
height: 30px;
border: 0;
border-radius: 10px;
background: none;
color: var(--nf-muted);
cursor: pointer;
}
.nf-find-list {
display: grid;
padding: 6px;
border-radius: 14px;
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
backdrop-filter: blur(8px);
}
.nf-find-list button {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 10px;
border: 0;
border-radius: 10px;
background: none;
color: var(--nf-text);
text-align: left;
font: inherit;
cursor: pointer;
}
.nf-find-list button:hover,
.nf-find-list button:focus-visible {
background: rgba(127, 127, 127, 0.14);
}
.nf-find-list b {
display: block;
font-weight: 600;
}
.nf-find-list small,
.nf-find-list p {
color: var(--nf-muted);
font-size: 12px;
margin: 0;
}
.nf-find-list p {
padding: 8px 10px;
}
.nf-find-icon {
display: grid;
place-items: center;
width: 30px;
height: 30px;
border-radius: 10px;
background: rgba(127, 127, 127, 0.15);
flex: none;
}
.nf-find-icon svg {
width: 16px;
height: 16px;
}
.nf-swipe {
position: absolute;
transform: translate(-50%, calc(-100% - 28px));
display: grid;
grid-template-columns: auto auto;
align-items: center;
gap: 2px 12px;
padding: 8px 12px;
border-radius: 14px;
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
pointer-events: none;
white-space: nowrap;
z-index: 4;
}
.nf-swipe span {
font-size: 12px;
color: var(--nf-muted);
}
.nf-swipe b {
grid-row: 2;
font: 700 22px var(--nf-title-font);
}
.nf-swipe i {
grid-row: 1 / 3;
grid-column: 2;
position: relative;
width: 10px;
height: 44px;
border-radius: 5px;
background: rgba(127, 127, 127, 0.25);
overflow: hidden;
}
.nf-swipe em {
position: absolute;
left: 0;
right: 0;
bottom: 0;
background: var(--nf-warm);
}
.nf-plate-menu {
position: absolute;
z-index: 6;
display: flex;
flex-direction: column;
gap: 4px;
min-width: 220px;
padding: 6px;
border-radius: 16px;
background: var(--nf-bg2, #1c2233);
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.nf-plate-menu button {
display: grid;
grid-template-columns: 24px 1fr auto;
align-items: center;
gap: 8px;
min-height: 42px;
padding: 0 10px;
border: 0;
border-radius: 12px;
background: none;
color: var(--nf-text, #e8eeff);
font: inherit;
text-align: left;
cursor: pointer;
}
.nf-plate-menu button:hover {
background: rgba(127, 127, 127, 0.14);
}
.nf-plate-menu button.on b {
background: var(--nf-accent, #37e0ff);
color: #041018;
}
.nf-plate-menu b {
display: grid;
place-items: center;
width: 24px;
height: 24px;
border-radius: 50%;
background: rgba(127, 127, 127, 0.2);
font-size: 12px;
}
.nf-plate-menu i {
font-style: normal;
color: var(--nf-muted, #9aa5bd);
font-size: 13px;
}
.nf-menu-backdrop {
position: absolute;
inset: 0;
z-index: 5;
}
.nf-through {
position: absolute;
inset: 0;
z-index: 4;
pointer-events: none;
}
/* the camera wall: a glass sheet over the scene with every camera's picture */
.nf-wall {
position: absolute;
inset: 56px 12px calc(var(--nf-bottom-inset, 0px) + 12px);
z-index: 5;
display: flex;
flex-direction: column;
gap: 8px;
padding: 10px 12px;
border-radius: 16px;
background: rgba(8, 16, 34, 0.86);
border: 1px solid rgba(160, 240, 255, 0.4);
box-shadow: var(--nf-shadow);
overflow: auto;
}
.nf-wall-head {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 600;
color: var(--nf-text);
}
.nf-wall-head .nf-wall-title {
flex: 1;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 0 8px;
}
.nf-wall-title b {
color: #ff6b6b;
font-weight: 600;
}
.nf-wall-tools {
display: flex;
gap: 6px;
}
.nf-wall-big {
flex: 1;
min-height: 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12px;
overflow: hidden;
background: #0a1426;
}
.nf-wall-big img {
width: 100%;
height: 100%;
object-fit: contain;
}
/* the stream player: a bare card, as wide as the sheet allows for a 16:9 picture */
.nf-wall-big > hui-picture-entity-card,
.nf-wall-big > hui-error-card {
width: min(100%, calc((100vh - 200px) * 16 / 9));
--ha-card-background: transparent;
--ha-card-border-width: 0;
--ha-card-box-shadow: none;
}
.nf-wall-grid {
flex: 1;
display: grid;
align-content: safe center;
justify-content: center;
gap: 12px;
min-height: 0;
overflow-y: auto;
}
.nf-wall-cam {
position: relative;
padding: 0;
border: 1px solid rgba(160, 240, 255, 0.3);
border-radius: 12px;
overflow: hidden;
background: #0a1426;
cursor: pointer;
width: 100%;
height: 100%;
}
.nf-wall-cam img,
.nf-wall-none {
width: 100%;
height: 100%;
object-fit: cover;
display: flex;
align-items: center;
justify-content: center;
color: #8aa;
}
.nf-wall-seen {
border-color: rgba(255, 80, 90, 0.9);
box-shadow: 0 0 14px rgba(255, 60, 70, 0.5);
}
.nf-wall-name {
position: absolute;
left: 0;
right: 0;
bottom: 0;
padding: 4px 8px;
font-size: 12px;
text-align: left;
color: var(--nf-text);
background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}
.nf-wall-name b {
color: #ff6b6b;
font-weight: 600;
}
/* a lightning bolt of the weather layer lights up the whole stage for a moment */
.live-flash::after {
content: "";
position: absolute;
inset: 0;
z-index: 3;
background: radial-gradient(circle at 50% 20%, rgba(235, 242, 255, 0.55), rgba(200, 215, 255, 0.18) 70%);
pointer-events: none;
}
.nf-through-img {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
opacity: var(--nf-blend);
}
.nf-through-bar {
position: absolute;
left: 50%;
bottom: calc(var(--nf-bottom-inset, 0px) + 14px);
transform: translateX(-50%);
display: flex;
align-items: center;
gap: 12px;
max-width: calc(100% - 32px);
padding: 8px 10px 8px 16px;
border-radius: 999px;
background: var(--nf-chrome);
backdrop-filter: blur(12px);
border: 1px solid var(--nf-line);
pointer-events: auto;
}
.nf-through-name {
font-weight: 600;
white-space: nowrap;
}
/* a small note that the picture is a still, so nobody wonders why it does not move */
.nf-still {
font-size: 11px;
font-weight: 400;
opacity: 0.65;
white-space: nowrap;
margin-left: 6px;
}
.nf-through-bar input[type="range"] {
width: 140px;
accent-color: var(--nf-accent);
}
.nf-through-on :is(.nf-pin, .nf-dev, .nf-energy, .nf-legend, .nf-thumbs, .nf-scenes, .nf-find-btn, .nf-stats) {
display: none;
}
nf-quick-menu {
position: absolute;
z-index: 6;
}
.nf-dev-found {
animation: nf-found 0.6s ease-in-out 4;
}
@keyframes nf-found {
50% {
scale: 1.35;
filter: drop-shadow(0 0 12px var(--nf-accent));
}
}
.nf-map-credit {
position: absolute;
right: 8px;
bottom: 4px;
z-index: 2;
padding: 1px 6px;
border-radius: 6px;
background: color-mix(in srgb, var(--nf-chrome) 80%, transparent);
color: var(--nf-soft);
font-size: 10px;
text-decoration: none;
}
.nf-legend {
position: absolute;
left: 12px;
/* above the star button */
bottom: calc(104px + var(--nf-bottom-inset, 0px));
display: grid;
gap: 4px;
min-width: 180px;
padding: 8px 11px;
border-radius: 12px;
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
font-size: 12px;
pointer-events: none;
}
.nf-legend-bar {
height: 8px;
border-radius: 4px;
}
.nf-legend-range {
display: flex;
justify-content: space-between;
color: var(--nf-muted);
font-variant-numeric: tabular-nums;
}
.nf-legend-none {
color: var(--nf-warm);
}
.nf-energy {
position: absolute;
left: 12px;
top: 10px;
display: flex;
flex-wrap: wrap;
gap: 6px;
max-width: calc(100% - 24px);
pointer-events: none;
}
.nf-energy-item {
display: grid;
padding: 5px 11px 6px;
border-radius: 12px;
background: var(--nf-chrome);
border-left: 3px solid var(--nf-line);
box-shadow: var(--nf-shadow);
backdrop-filter: blur(6px);
font-variant-numeric: tabular-nums;
}
.nf-energy-item span {
font-size: 11px;
color: var(--nf-muted);
}
.nf-energy-item b {
font: 700 15px var(--nf-title-font);
}
.nf-energy-total {
border-left-color: #6fd8ff;
}
.nf-energy-grid {
border-left-color: var(--nf-accent);
}
.nf-energy-export,
.nf-energy-solar {
border-left-color: #ffc633;
}
.nf-energy-battery {
border-left-color: #59ff8c;
}
.nf-flow-toggle {
pointer-events: auto;
cursor: pointer;
border: 0;
border-left: 3px solid var(--nf-line);
color: inherit;
text-align: left;
font: inherit;
}
.nf-weather-dialog { pointer-events:auto; width:min(380px,calc(100vw - 32px)); max-height:75dvh; overflow:auto; box-sizing:border-box; padding:16px; background:var(--nf-chrome-solid); color:var(--nf-text); font:14px/1.5 system-ui,sans-serif; border:1px solid var(--nf-line); border-radius:12px; box-shadow:var(--nf-shadow); }
.nf-weather-dialog::backdrop { background:#0008; }
.nf-weather-dialog header,.nf-weather-dialog p { display:flex; justify-content:space-between; gap:16px; margin:8px 0; }
.nf-weather-dialog p span { color:var(--nf-muted); }
.nf-weather-dialog p b { font-size:13px; white-space:nowrap; }
.nf-own-sensor {
pointer-events: auto;
cursor: pointer;
border: 0;
border-left: 3px solid var(--nf-accent);
color: inherit;
text-align: left;
font: inherit;
max-width: 220px;
}
.nf-own-sensor span,
.nf-own-sensor b {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.nf-flow-toggle[aria-pressed="true"] {
border-left-color: var(--nf-accent);
}
.nf-flow-toggle span {
display: none;
}
.nf-flow-toggle b {
opacity: 0.4;
filter: grayscale(1);
}
.nf-flow-toggle[aria-pressed="true"] b {
opacity: 1;
filter: none;
}
.nf-energy-tariff {
border-left-color: #b98cff;
}
/* narrow stages (portrait tablets, phones): the energy values scroll in one row */
@container nf (max-width: 900px) {
.nf-energy {
flex-wrap: nowrap;
overflow-x: auto;
scrollbar-width: none;
pointer-events: auto;
}
.nf-legend {
bottom: auto;
top: 62px;
}
.nf-has-alerts .nf-legend {
top: 110px;
}
}
/* a room sheet covers the lower half: the view's own controls step aside */
@container nf ((max-width: 700px) or ((orientation: portrait) and (max-width: 1000px))) {
.nf-panel-open :is(.nf-find-btn, .nf-find, .nf-thumbs, .nf-legend, .nf-stats, .nf-scenes) {
display: none;
}
}
@media (pointer: coarse) {
.nf-find-close {
width: 40px;
height: 40px;
right: 1px;
bottom: 1px;
}
.nf-dev {
padding: 6px;
}
.nf-pin {
padding: 8px 12px;
}
}
.nf-dev-full .nf-dev-text {
display: inline;
}
.nf-dev-name:empty {
display: none;
}
.nf-dev-name {
position: absolute;
top: calc(100% + 3px);
left: 50%;
transform: translateX(-50%);
max-width: 140px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 1px 6px;
border-radius: 6px;
font-size: 10.5px;
font-weight: 600;
line-height: 1.35;
/* a fixed dark plate, so a fixed light text: the theme text colour can be dark (day themes, pins that are on) */
color: #f2f5fb;
background: rgba(10, 16, 32, 0.72);
pointer-events: none;
}
.nf-dev-sel {
outline: 2px solid var(--nf-accent);
outline-offset: 2px;
}
.nf-dev-on {
color: #2a1a00;
border-color: transparent;
background: var(--nf-glow, var(--nf-warm));
box-shadow: 0 0 16px var(--nf-glow, var(--nf-warm));
}
.nf-dev-on .nf-dev-icon {
background: color-mix(in srgb, var(--nf-text) 28%, transparent);
}
.nf-dev-on .nf-dev-text {
color: #2a1a00;
}
.nf-dev-na {
opacity: 0.45;
}
.nf-dev-dim {
opacity: 0.35;
}
.nf-dev[hidden],
.nf-pin[hidden] {
display: none;
}
.nf-pin-active {
background: var(--nf-accent);
color: var(--nf-accent-text);
border-color: transparent;
box-shadow: var(--nf-shadow);
}
.nf-stats b {
color: var(--nf-accent);
font-weight: 700;
}
.nf-stats {
padding: 4px 9px;
border-radius: 8px;
background: var(--nf-chrome);
position: absolute;
right: 10px;
bottom: calc(8px + var(--nf-bottom-inset, 0px));
font-size: 11.5px;
color: var(--nf-muted);
font-variant-numeric: tabular-nums;
pointer-events: none;
}
.nf-error {
position: absolute;
inset: auto 16px 16px;
color: var(--nf-danger);
}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Qo);function he(n,e){return Math.abs(e)>=1e3?`${O(n,e/1e3,1)} kW`:`${Math.round(e)} W`}function Jo(n){return n.type==="tv_board"?n.h+.9:n.type==="tv_wall"||n.type==="kitchen_wall"?n.h+.25:n.h+.35}function Of(n,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(n,e)}var Hc;function Pc(){let n=new URL("./nextfloor-editor.js?v=325f76d7dc13",new URL(import.meta.url)).href;return Hc??=import(n),Hc}var Wf=.25,Ic=n=>Math.round(n*1e3)/1e3,Cc=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function es(n,e,t,r,i){let o=Cc(n,e,t);if(!o)return[r,i];let s=(a,l)=>H([a,l],o.points);return s(r,i)?[r,i]:s(r,t)?[r,t]:s(e,i)?[e,i]:[e,t]}function Bf(n,e,t,r){return n.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(ce(ee(o,t),r))<.02&&Math.abs(ce(ee(a,t),r))<.02}))}var Xo=(n,e)=>Math.abs((n-e+540)%360-180);function Nc(n,e,t,r=Wf){let i=Cc(n,e.x,e.z);if(!i)return null;let o=i.points,s=gt(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],m=Ue(ee(c,l));if(m<.3)return;let d=[(c[0]-l[0])/m,(c[1]-l[1])/m],h=[-d[1]*s,d[0]*s],g=ce(ee([e.x,e.z],l),d);if(g<0||g>m)return;let _=Bf(n,i,l,h)?t/2:0,b=ce(ee([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>Xo(e.rotation,R.rotation)50)return;let M=b-k.extent;Math.abs(M)>r||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:Ic(e.x-h[0]*M),z:Ic(e.z-h[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function ai(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return r}function li(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return r}function Lc(n,e){let t=structuredClone(n);for(let r of t.floors)r.furniture=r.furniture.filter(i=>i.id!==e);return t}function Oc(n,e){let t=structuredClone(n);for(let r of t.floors)r.placements=r.placements.filter(i=>i.entity_id!==e);return t}function Wc(n,e,t,r){return li(n,e,(i,o)=>{[i.x,i.z]=es(o,i.x,i.z,t,r)})}function Bc(n,e,t,r){let i=n.settings.wall_interior??.12;return ai(n,e,(o,s)=>{[o.x,o.z]=es(s,o.x,o.z,t,r);let a=Nc(s,o,i);a&&Object.assign(o,a)})}var ts=(n,e)=>((n+e)%360+360)%360,Vc=n=>Number.parseFloat(n.replace(",",".")),Bn=(n,e)=>Math.round(n*10**e)/10**e;function ns(n){let{min:e,max:t,accepts:r=()=>!0}=n,i=o=>{let s=Vc(o.target.value);!Number.isFinite(s)||!r(s)||n.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p``}var Gc=(n,e)=>p``,Kc=(n,e)=>p``;function Vf(n,e){let t=n.building.floors.find(s=>s.furniture.some(a=>a.id===e)),r=t?.furniture.find(s=>s.id===e);if(!t||!r)return f;let i=(s,a)=>ns({label:n.t(a),title:n.t(`size_${s}`),value:r[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>n.editFurniture(e,u=>u[s]=Bn(l,3))}),o=na(r)?p`${ns({label:"\u2195",title:n.t("mount_height"),value:r.mount_y??oe(t,r),step:.05,min:0,accepts:s=>s>=0,apply:s=>n.editFurniture(e,a=>a.mount_y=Bn(s,3))})}
${r.mount_y!=null?Gc(n,()=>n.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 Kf(n,e){let t=n.building.floors.find(l=>l.placements.some(u=>u.entity_id===e)),r=t?.placements.find(l=>l.entity_id===e);if(!t||!r)return f;let i=P(e),o=(l,u,c)=>p``,s=["ceiling","floor","table","wall"].map(l=>[l,n.t(`lamp_${l}`)]),a=i?Ht(i,ye(t,r.x,r.z),i==="light"?r.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,r.mount??"ceiling"):f}
${ns({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,u=>u.y=Bn(l,3))})}
${r.y!==null?Gc(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function Uc(n,e,t){let r=n.t,i;if(e){let o=n.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`${o?le(n.hass,o):""}
${Vf(n,e)} ${Kc(45,s=>n.turnFurniture(e,s))}
`}else t?i=p`${L(n.hass,t)}
${Kf(n,t)} ${Kc(45,o=>n.turnDevice(t,o))}
`:i=p`${r("furnish_hint")}`;return p`${i}
`}var jc=ne``;var me=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Xt=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),rs={explode:me("explode",!0),keepRoof:me("roof",!1),solidWalls:me("solid_walls",!1),quality:Xt("quality",["auto","low","high"],"auto"),stats:me("stats",!1),markers:Xt("markers",["none","important","all"],"important"),heat:Xt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Xt("theme",qr,"neon"),clock:Xt("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:n=>/^#[0-9a-f]{6}$/i.test(n)?n:null,write:n=>n??""},floorStack:Xt("floor_stack",["dim","stacked","single"],"dim"),roomNames:me("room_names",!0),clean:me("clean",!1),navWrap:me("nav_wrap",!1),weather:me("weather",!0),timeSlider:me("time_slider",!1),menuOpen:me("menu_open",!1),keepCamera:me("keep_camera",!1),readable:me("readable",!1),plain:me("plain",!1),rightBack:me("right_back",!1),zoom:{name:"zoom",fallback:100,read:n=>/^\d{2,3}$/.test(n)?Math.min(250,Math.max(60,Number(n))):100,write:n=>String(Math.round(Math.min(250,Math.max(60,n))))},screenName:{name:"screen_name",fallback:"",read:n=>n.slice(0,60),write:n=>n.trim().slice(0,60)},announceMuted:me("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:n=>/^\d{1,3}$/.test(n)?Math.min(100,Number(n)):20,write:n=>String(Math.round(Math.min(100,Math.max(0,n))))}};function qc(n=ci()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Zc(n=ci()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function ci(){try{return localStorage}catch{return null}}var ui=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let r of Object.keys(rs)){let i=rs[r],o=this.raw(i.name);t[r]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let r=rs[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var Yc=J`
.nf-dot {
display: inline-block;
width: 8px;
height: 8px;
margin-left: 6px;
border-radius: 50%;
background: #ffb547;
box-shadow: 0 0 8px #ffb547;
vertical-align: middle;
}
:host {
display: block;
/* HA gives the custom panel's parent no explicit height, so 100% collapses. */
height: 100vh;
height: 100dvh;
background: var(--nf-bg);
}
.nf-app {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
}
.nf-header {
display: flex;
align-items: center;
gap: 12px;
padding: 6px 14px 6px 4px;
min-height: 56px;
border-bottom: var(--app-header-border-bottom, 1px solid var(--nf-line));
background: var(--app-header-background-color, var(--nf-chrome-solid));
color: var(--app-header-text-color, var(--nf-text));
flex-wrap: wrap;
/* above the room bar, so a menu opened from the header (the screen's announcements) is not covered */
position: relative;
z-index: 30;
}
ha-menu-button {
color: var(--app-header-text-color, var(--nf-text));
}
h1 {
display: flex;
align-items: center;
gap: 10px;
font-weight: 400;
font-size: 20px;
margin: 0 4px 0 8px;
white-space: nowrap;
}
.nf-mark {
flex: none;
width: 26px;
height: 28px;
color: var(--nf-accent);
}
.nf-view-title {
min-width: 0;
max-width: min(340px, 45vw);
overflow: hidden;
text-overflow: ellipsis;
}
.nf-notices {
display: grid;
gap: 6px;
padding: 8px 14px 0;
}
.nf-notice {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 12px;
padding: 9px 12px;
border-radius: 10px;
border: 1px solid var(--nf-line);
background: var(--nf-chrome-solid);
font-size: 13.5px;
}
.nf-notice span {
flex: 1;
min-width: 200px;
}
.nf-notice-warn {
border-color: color-mix(in srgb, var(--nf-warm) 60%, transparent);
color: var(--nf-warm);
}
.nf-notice-error {
border-color: color-mix(in srgb, var(--nf-danger) 60%, transparent);
color: var(--nf-danger);
word-break: break-word;
}
.nf-chip-on {
background: var(--nf-accent);
color: var(--nf-accent-text);
}
.nf-furnish-bar {
position: absolute;
left: 50%;
bottom: 16px;
transform: translateX(-50%);
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 8px;
max-width: calc(100% - 24px);
padding: 8px 10px 8px 16px;
border-radius: 999px;
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
font-size: 13.5px;
}
.nf-size-select {
font: inherit;
color: var(--nf-text);
background: var(--nf-chrome-solid);
border: 1px solid var(--nf-line);
border-radius: 999px;
padding: 4px 10px;
}
.nf-size {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 12px;
color: var(--nf-muted);
}
.nf-size input {
width: 58px;
padding: 5px 6px;
border: 1px solid rgba(127, 127, 127, 0.35);
border-radius: 8px;
background: transparent;
color: inherit;
font: inherit;
font-size: 13px;
}
.nf-danger-chip {
color: var(--nf-danger);
}
.nf-grow {
flex: 1;
}
.nf-save {
font-size: 12.5px;
color: var(--nf-muted);
}
.nf-view-opts {
display: contents;
}
.nf-opts-btn {
display: none;
}
/* phones: the view options fold behind ⚙ (one header row instead of three) */
@media (max-width: 700px) {
.nf-opts-btn {
display: grid;
place-items: center;
order: 3;
width: 36px;
height: 36px;
border: 1px solid var(--nf-line);
border-radius: 10px;
background: transparent;
color: var(--nf-text);
font-size: 17px;
cursor: pointer;
}
.nf-opts-btn[aria-expanded="true"] {
color: var(--nf-accent);
border-color: var(--nf-accent);
}
.nf-view-opts {
display: none;
}
.nf-view-opts.nf-opts-open {
display: flex;
flex-wrap: wrap;
gap: 8px;
order: 5;
width: 100%;
}
.nf-version {
order: 4;
}
.nf-header .nf-grow {
display: none;
}
}
/* the installed version, at the far right of the header */
.nf-version {
margin-left: auto;
font-size: 11.5px;
color: var(--nf-muted);
white-space: nowrap;
opacity: 0.8;
}
.nf-save-error {
color: var(--nf-danger);
}
.nf-body {
flex: 1;
min-height: 0;
}
/* the colour well beside the look: a small round swatch, the reset arrow next to it */
.nf-accent-pick {
display: inline-flex;
align-items: center;
gap: 2px;
padding: 0 4px;
}
.nf-clock-pick {
display: inline-flex;
align-items: center;
gap: 2px;
padding: 0 4px 0 10px;
font-size: 14px;
}
.nf-clock-pick select {
border: 0;
background: none;
color: var(--nf-text);
font: inherit;
font-size: 13px;
padding: 6px 2px;
cursor: pointer;
}
.nf-clock-pick option {
color: #111;
}
.nf-glass-pick {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 0 10px;
font-size: 13px;
}
.nf-glass-pick input {
width: 80px;
accent-color: var(--nf-accent);
}
.nf-screen-pick {
position: relative;
display: inline-flex;
align-items: center;
}
.nf-screen-pick > summary {
list-style: none;
cursor: pointer;
padding: 6px 10px;
font-size: 14px;
}
.nf-screen-pick > summary::-webkit-details-marker {
display: none;
}
.nf-screen-menu {
position: absolute;
top: calc(100% + 6px);
right: 0;
z-index: 20;
display: grid;
gap: 10px;
width: 260px;
padding: 12px;
border: 1px solid var(--nf-line);
border-radius: 14px;
background: var(--nf-chrome-solid);
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.nf-screen-menu .nf-check {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
color: var(--nf-text);
}
.nf-screen-hint {
margin: 0;
font-size: 12px;
color: var(--nf-muted);
}
.nf-accent-pick input[type="color"] {
width: 22px;
height: 22px;
padding: 0;
border: 1px solid var(--nf-line);
border-radius: 50%;
background: none;
cursor: pointer;
}
.nf-accent-pick input[type="color"]::-webkit-color-swatch-wrapper {
padding: 2px;
}
.nf-accent-pick input[type="color"]::-webkit-color-swatch {
border: none;
border-radius: 50%;
}
.nf-accent-reset {
border: none;
background: none;
color: var(--nf-muted);
cursor: pointer;
font-size: 14px;
padding: 0 2px;
}
.nf-nav {
display: flex;
align-items: center;
gap: 6px;
padding: 10px 14px;
overflow-x: auto;
scrollbar-width: none;
flex: none;
}
/* a desktop shows a thin scrollbar while the pointer rests on the bar */
.nf-nav:hover {
scrollbar-width: thin;
}
/* wrapped: several lines, at most about three before the bar itself scrolls */
.nf-nav-wrap {
flex-wrap: wrap;
overflow-x: visible;
overflow-y: auto;
max-height: 132px;
}
.nf-nav-floor {
flex: none;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--nf-muted);
margin-left: 6px;
}
.nf-nav-toggle {
flex: none;
margin-left: auto;
position: sticky;
right: 0;
min-width: 34px;
padding-left: 8px;
padding-right: 8px;
}
.nf-nav .nf-chip {
box-shadow: none;
border: 1px solid var(--nf-line);
}
.nf-sep {
flex: none;
width: 1px;
margin: 4px 4px;
background: var(--nf-line);
}
.nf-stage-wrap {
position: relative;
flex: 1;
min-height: 0;
display: flex;
container-type: size;
container-name: nf;
}
.nf-stage-wrap nf-view3d {
flex: 1;
}
.nf-room-panel {
position: absolute;
top: 58px;
right: 14px;
bottom: 14px;
width: min(360px, calc(100% - 28px));
display: flex;
flex-direction: column;
justify-content: flex-start;
pointer-events: none;
}
/* folded, the panel is only its title bar: on a wide stage it drops to the bottom edge, above the switches, instead of hanging in the picture */
.nf-room-panel[folded] {
justify-content: flex-end;
bottom: 62px;
}
.nf-clean .nf-room-panel[folded] {
bottom: 14px;
}
/* the switches sit at the bottom (as in the card), where they never meet the energy values or warnings */
nf-view3d {
--nf-bottom-inset: 52px;
}
.nf-clean nf-view3d {
--nf-bottom-inset: 0px;
}
.nf-furnish-bar {
bottom: 68px;
}
/* small landscape tablets: the room panel gets a little more of the width, its rows stay easy to hit */
@container nf ((min-width: 701px) and (max-width: 1180px)) {
.nf-room-panel {
width: min(420px, 44%);
}
}
/* phones and portrait tablets: panel as a sheet at the bottom, the switches step aside */
@container nf ((max-width: 700px) or ((orientation: portrait) and (max-width: 1000px))) {
.nf-room-panel {
top: auto;
left: 8px;
right: 8px;
bottom: 8px;
width: auto;
height: 55%;
justify-content: flex-end;
}
.nf-room-open .nf-overlay {
display: none;
}
}
.nf-overlay {
position: absolute;
right: 12px;
bottom: 12px;
/* room for the search button and the row beside it (eye, lock, walk, time travel) */
left: 236px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
align-items: center;
pointer-events: none;
}
.nf-overlay > * {
pointer-events: auto;
}
/* phones: the bar only holds the switches button and "back", so it can span the bottom; the buttons of the view sit above it */
@container nf (max-width: 700px) {
.nf-overlay {
left: 12px;
}
.nf-switches {
left: 0;
width: auto;
}
}
/* the switches: a menu that opens upwards from the bar, over the stage, closed by a tap beside it or Escape */
.nf-switches-veil {
position: fixed;
inset: 0;
z-index: 4;
}
.nf-switches {
position: absolute;
right: 0;
bottom: calc(100% + 8px);
z-index: 5;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
width: min(520px, calc(100cqw - 24px));
max-height: min(60vh, 420px);
overflow-y: auto;
overscroll-behavior: contain;
padding: 12px;
border: 1px solid var(--nf-line);
border-radius: 14px;
background: var(--nf-chrome-solid);
box-shadow: var(--nf-shadow);
}
.nf-switches .nf-seg {
flex-wrap: wrap;
}
.nf-switches .nf-chip {
box-shadow: none;
}
.nf-caret {
font-size: 0.75em;
opacity: 0.7;
}
.nf-quality button {
padding: 5px 11px;
min-height: 30px;
font-size: 13px;
}
.nf-message,
.nf-empty {
padding: 32px 20px;
color: var(--nf-muted);
text-align: center;
}
.nf-empty {
display: grid;
justify-items: center;
gap: 12px;
margin: auto;
}
`;var Jc=new WeakMap,Qc=new WeakMap;function St(n,e){let t=Qc.get(n)??n,r=Jc.get(t)??new WeakMap;Jc.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let u of l.placements)u.entity_id.startsWith("cover.")&&o.set(u.entity_id,{tilt:u.cover_tilt==="none"?null:u.cover_tilt,position:u.position});for(let l of Le(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,u]of o){let c=t.states[l];if(!c)continue;let m={...c.attributes,nf_cover_control:!0},d=Pt(t,u.position);d===null&&(d=typeof c.attributes.current_position=="number"?c.attributes.current_position:null),d!==null&&(m.current_position=d);let h=u.tilt?t.states[u.tilt]:c,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:u.tilt?Pt(t,u.tilt):null;g!==null&&(m.current_tilt_position=g,m.supported_features=Number(m.supported_features??0)|128);let _=c.state;typeof m.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=m.current_position>0?"open":"closed"),s[l]={...c,state:_,attributes:m}}let a={...t,states:s,callService:async(l,u,c={})=>{if(l!=="cover")return t.callService(l,u,c);let m=Array.isArray(c.entity_id)?c.entity_id:[c.entity_id],d=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,u,{...c,entity_id:h});let _={...c,entity_id:h},b=u;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(c.entity_id)?Promise.all(m.map(d)):d(m[0])}};return Qc.set(a,t),r.set(e,a),a}var is=class extends Q{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 Ft(this);store=new ui(ci());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:ft(Et(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,r=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`
${t!==null?p``:f}`}t=(e,t)=>$(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=Rr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(r=>r.id===this._floorId)&&(this._floorId=null,this._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 r=fn(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:r},r}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:r}=e.detail;if(r==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);r&&(this._roomId=r===this._roomId?null:r,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(r=>ai(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>li(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>ai(r,e,i=>i.rotation=ts(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>li(r,e,i=>i.rotation=ts(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Lc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Oc(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(r=>({...r,floors:r.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._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&&kr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",r=f;return e&&(this._mode==="editor"&&this.isAdmin?r=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?r=this.renderExtensions():r=this.renderView(e)),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}
${r}
`}choiceRow(e,t,r,i,o,s=f){return p`
${t.map(a=>p``)}${s}
`}accentPicker(){let e=this._prefs.accent;return p``}renderViewOptions(){let e=this._prefs;return p`
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
${this.choiceRow("theme",qr,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))}
${V(this.hass)?f:p`
${e.announceMuted?"\u{1F507}":"\u{1F4E2}"}
`}
`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",r=this.data.saveState,i=(s,a,l="")=>p``,o=r==="saving"?"saving":r==="saved"?"saved":"save_error";return p``}renderNotices(){let e=this.data,t=[];if(this._variablesNotice&&t.push(p`${this._variablesNotice}
`),e.needsRestart&&t.push(e.versionGap==="frontend"?p`
${this.t("needs_reload",{frontend:e.frontendVersion,backend:e.backendVersion??"?"})}
`:p`${e.backendVersion?this.t("needs_restart",{version:e.backendVersion,frontend:e.frontendVersion}):this.t("needs_restart_old")}
`),e.saveState==="error"&&e.saveError&&t.push(p`${this.t("save_failed_detail",{error:e.saveError})}
`),e.draft&&this.isAdmin){let r=new Date(e.draft.savedAt).toLocaleString(this.hass?.language);t.push(p`
${this.t("draft_found",{time:r})}
`)}return t.length>0?p`${t}
`:f}whenEditorLoaded(e){return this._editorReady?e():(Pc().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p``)}renderExtensions(){return this.whenEditorLoaded(()=>p`{this.data.reloadPacks()}}
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}>`)}renderEditor(e){return this.whenEditorLoaded(()=>p`this.setPref("roomNames",t.detail.value)}
.packs=${this.data.packs}
.loadCardEditor=${qn}
@packs-changed=${()=>{this.data.reloadPacks()}}
@building-changed=${t=>this.data.edit(t.detail.building)}
>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p``}let r=Mn(ru(t).map(i=>this.hass.states[i]));return r.count<2?f:p``}renderNav(e){let t=e.floors.filter(u=>!this._floorId||u.id===this._floorId),r=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p``:f,s=r?p`
${[...e.floors].reverse().map(u=>p``)}
${o} ${this.allOffChip(e)}
`:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(u=>[t.length>1&&u.rooms.length?p`${u.name}`:f,...u.rooms.map(c=>p``)]),l=this.t(i?"nav_row":"nav_wrap");return p``}toggleChip(e,t,r){return p``}renderOverlay(e){let t=this._prefs,r=this.t,i=(c,m)=>p`${[c,m].map(([d,h,g])=>p``)}
`,o=["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?p``:f,u=p``;return this._switchesOpen?p`
this._switchesOpen=!1}>
c.key==="Escape"&&(this._switchesOpen=!1)}>
${["auto","cut","slope"].map(c=>p``)}
${a&&!this._floorId?i([t.explode,()=>this.setPref("explode",!0),r("floors_apart")],[!t.explode,()=>this.setPref("explode",!1),r("floors_stacked")]):f}
${!this._floorId&&e.settings.roof.type!=="none"?p`
`:f}
${a&&this._floorId?p`
${s.map(c=>p``)}
`:f}
${o.map(c=>p``)}
${this.toggleChip("roomNames","room_names_short")}
${this.toggleChip("weather","weather_short","weather_hint")}
${t.timeSlider?this.renderTimeOfDay():f}
${u}${l}
`:p`${u}${l}
`}renderView(e){if(!e.floors.some(i=>i.rooms.length))return p`
${this.t(this.isAdmin?e.floors.length?"no_rooms_admin":"no_building_admin":"no_building")}
${this.isAdmin?p`
`:f}
`;let t=this._prefs,r=e.floors.flatMap(i=>i.rooms).find(i=>i.id===this._roomId)??null;return this.furnishHost.hass=this.hass,this.furnishHost.building=e,p`
${t.clean?f:this.renderNav(e)}
this.setPref("clean",!t.clean)}
?weather=${t.weather}
.panelOpen=${!!this._roomId||this._outside}
.floorId=${e.floors.length>1?this._floorId:e.floors[0]?.id??null}
.roomId=${this._roomId}
.outsideOpen=${this._outside}
.wallMode=${this._wallMode}
.solidWalls=${t.solidWalls}
.explode=${t.explode}
.keepRoof=${t.keepRoof}
.markerMode=${t.markers}
.heatMode=${t.heat}
.theme=${Zr(t.theme,this.sunState())}
.timeOfDay=${this._timeOfDay}
.clock=${t.clock==="none"?null:t.clock}
.announcements=${!V(this.hass)&&!t.announceMuted}
.glassWalls=${t.glassWalls}
.screenName=${t.screenName||null}
.lockButton=${!0}
.walkButton=${!0}
.travelButton=${!0}
.accent=${t.accent}
.centralOpen=${t.menuOpen}
.keepCamera=${t.keepCamera}
.plain=${t.plain}
.rightBack=${t.rightBack}
.readable=${t.readable}
.zoom=${t.zoom/100}
?furnish=${this._furnish}
.selectedFurniture=${this._selFurniture}
@furniture-select=${i=>this._selFurniture=i.detail.id}
@furniture-move=${i=>this.applyEdit(o=>Bc(o,i.detail.id,i.detail.x,i.detail.z))}
@device-select=${i=>this._selDevice=i.detail.id}
@device-move=${i=>this.applyEdit(o=>Wc(o,i.detail.id,i.detail.x,i.detail.z))}
.quality=${t.quality}
?showStats=${t.stats}
@room-tap=${this.onRoomTap}
@floor-tap=${i=>this.openFloor(i.detail.floorId)}
@back=${()=>this.back()}
>
${r?p`i.rooms.some(o=>o.id===this._roomId))??null}
.confirmEntities=${bt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
.rooms=${e.floors.flatMap(i=>i.rooms)}
@mood-change=${i=>this.saveMoods(i.detail.roomId,i.detail.moods)}
@close=${()=>this._roomId=null}
>`:this._outside?p`this._outside=!1}
>`:f}
${t.clean?f:this.renderOverlay(e)}
${this._furnish?Uc(this.furnishHost,this._selFurniture,this._selDevice):f}
`}static styles=[_e,Te,Yc,Er]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",is);var Gf=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Xc=(n,e)=>Number(n)*60+Number(e);function Vn(n,e,t=new Date){if(!n||n==="off")return!1;if(n==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let r=Gf.exec(n.trim());if(!r)return!1;let i=Xc(r[1],r[2]),o=Xc(r[3],r[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s=i&&s0&&(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 ed(n,e){return n?n.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(r=>({id:r.id,name:r.name||"\u2013",floorId:t.id}))})):[]}var td=J`
ha-card {
overflow: hidden;
background: var(--nf-bg);
height: 100%;
}
/* night (kiosk): the whole card dimmed */
ha-card.nf-night .nf-card-body {
filter: brightness(0.55);
}
.nf-card-body {
position: relative;
display: flex;
height: 100%;
container-type: size;
container-name: nf;
}
nf-view3d {
flex: 1;
}
.nf-card-msg {
margin: auto;
color: var(--nf-muted);
padding: 16px;
text-align: center;
}
/* the room buttons: a row along the top, clear of the toggles at the left and the corner buttons at the right */
.nf-card-rooms {
position: absolute;
top: 8px;
left: 56px;
right: 56px;
z-index: 3;
display: flex;
align-items: center;
gap: 6px;
overflow-x: auto;
padding-bottom: 2px;
scrollbar-width: none;
}
/* with the room's side panel open the row ends where the panel starts */
@container nf (min-width: 700px) {
.nf-card-rooms-beside {
right: 372px;
}
}
.nf-card-rooms::-webkit-scrollbar {
display: none;
}
.nf-card-rooms button {
flex: none;
}
.nf-card-rooms-floor {
flex: none;
color: var(--nf-soft);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-left: 6px;
}
.nf-card-controls {
position: absolute;
left: 60px;
right: 10px;
bottom: 10px;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 8px;
pointer-events: none;
}
.nf-card-controls > * {
pointer-events: auto;
}
.nf-card-full {
position: absolute;
right: 10px;
top: 10px;
width: 38px;
height: 38px;
border: 0;
border-radius: 12px;
background: var(--nf-chrome);
color: var(--nf-text);
box-shadow: var(--nf-shadow);
font-size: 18px;
cursor: pointer;
}
.nf-card-dash {
width: auto;
min-width: 38px;
padding: 0 12px;
font-size: 14px;
font-weight: 600;
}
.nf-card-dash-2 {
right: 56px;
}
.nf-card-panel {
position: absolute;
top: 10px;
right: 10px;
bottom: 10px;
width: min(340px, calc(100% - 20px));
display: flex;
flex-direction: column;
pointer-events: none;
}
/* folded, only the title bar is left: it drops to the bottom edge instead of hanging in the picture */
.nf-card-panel[folded] {
justify-content: flex-end;
}
/* phones and portrait tablets: the room panel becomes a sheet at the bottom */
@container nf ((max-width: 700px) or ((orientation: portrait) and (max-width: 1000px))) {
.nf-card-panel {
top: auto;
left: 8px;
right: 8px;
bottom: 8px;
width: auto;
height: 55%;
justify-content: flex-end;
}
}
`;function os(n,e){let t=n.template,r=t?e?.[t]:void 0;if(!r)return n;let{type:i,template:o,...s}=r;return{...s,...n}}function nd(n,e){let t=new Set(e),r=[];for(let o of n.floors){let s=o.rooms.filter(u=>t.has(u.id));if(!s.length)continue;let a=(u,c)=>s.some(m=>m.points.length>=3&&H([u,c],m.points)),l=new Set(s.map(u=>u.id));r.push({...o,rooms:s,openings:o.openings.filter(u=>l.has(u.room_id)),furniture:o.furniture.filter(u=>a(u.x,u.z)),placements:o.placements.filter(u=>a(u.x,u.z)),walls:(o.walls??[]).filter(u=>a((u.a[0]+u.b[0])/2,(u.a[1]+u.b[1])/2)),outdoor:[]})}let i={...n.settings.roof,type:"none",sections:[],solar:[]};return{...n,floors:r,settings:{...n.settings,roof:i}}}var en="nf-outside",ss=class extends Q{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},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Ft(this);kiosk=new di({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,this._roomNames=null}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 qn(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=os(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=os(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Rr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let r=Vn(this._config?.night,this.hass);r!==this._night&&(this._night=r)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}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 r=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==r)&&(this.roomsMemo={source:e,ids:r,result:nd(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,r=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===r)?r:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),r=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`${a.map(([l,u,c])=>p``)}
`;return p`
${e.canGoBack?p``:f}
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",r("walls_auto")],[e.walls==="cut",()=>this._walls="cut",r("walls_cut")],[e.walls==="slope",()=>this._walls="slope",r("walls_slope")]]):f}
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,r("floors_apart")],[!e.explode,()=>this._explode=!1,r("floors_stacked")]]):f}
${i.length>0?o(r("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,r(s==="none"?"heat_off":`heat_short_${s}`)])):f}
`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let r=ed(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,u)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=u===this._roomId?null:u},s=fn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===en?null:en};return p`
${r.map(l=>p`${i?p`${l.floorName}`:f}${l.rooms.map(u=>p``)}`)}
${s?p``:f}
`}renderCorners(){let e=this._config,t=this.t,r=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!r?p``:f}
${e?.dashboard&&!r?p``:f}`}renderStage(e){let t=this.plan(),r=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=r?.controls_hidden!==void 0||(r?.controls_hide_after??0)>0;return p`({id:`card_${a}`,...s}))??null}
.heatMode=${e.heat}
.theme=${Zr(r?.theme,this.hass?.states["sun.sun"]?.state)}
.clock=${r?.clock&&r.clock!=="none"?r.clock:null}
.lockButton=${r?.lock_button!==!1}
.walkButton=${r?.walk_button!==!1}
.travelButton=${r?.time_travel!==!1}
.accent=${r?.accent??null}
.furnitureColors=${r?.furniture_colors??null}
.showEnergy=${r?.energy??!0}
.flows=${r?.flows??null}
.holograms=${r?.holograms??null}
.floorThumbs=${this.thumbs}
.roomLabels=${this._roomNames??r?.room_names!==!1}
.roomNamesButton=${!0}
@room-names-change=${s=>this._roomNames=s.detail.value}
.floorStack=${r?.floor_stack??"dim"}
.panelOpen=${!!this._roomId&&r?.room_panel!==!1}
.alerts=${r?.alerts!==!1}
.alertJump=${!!r?.alert_jump}
.announcements=${!V(this.hass)&&r?.announcements!==!1&&!Zc()}
.sensorBar=${r?.sensor_bar!==!1}
.glassWalls=${typeof r?.glass_walls=="number"?Math.min(100,Math.max(0,r.glass_walls)):null}
.screenName=${r?.screen_name??qc()}
.scenes=${r?.scenes!==!1}
.clean=${this._clean}
.cleanButton=${o}
@clean-toggle=${i}
?weather=${r?.weather!==!1}
.weatherEntityId=${r?.weather_entity??null}
.weatherDensity=${r?.weather_density??1}
.dimmed=${this._night}
.autoOrbit=${this._orbit}
.startView=${r?.start_view??null}
style=${e.showBar?"--nf-bottom-inset: 52px":""}
@room-tap=${s=>{this.canSwitch&&t.floors.length>1&&s.detail.floorId&&e.floorId!==s.detail.floorId?(this._floorId=s.detail.floorId,this._roomId=null):s.detail.roomId&&(this._roomId=s.detail.roomId===this._roomId?null:s.detail.roomId)}}
@floor-tap=${s=>{this._floorId=s.detail.floorId,this._roomId=null}}
@back=${()=>this.back()}
>`}renderRoomPanel(){let e=this.plan();return p`t.rooms).find(t=>t.id===this._roomId)??null}
.floor=${e.floors.find(t=>t.rooms.some(r=>r.id===this._roomId))??null}
.outside=${this._roomId===en?fn(this.hass,e.floors):null}
.confirmEntities=${bt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
@close=${()=>this._roomId=null}
>`}render(){if(this.hass&&kr(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let r=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p`
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(r):p`
${this.data.error??(e?$(this.hass,"no_building"):$(this.hass,"loading"))}
`}
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
${this.renderRoomButtons(r)}
${r.showBar&&e?this.renderBar(r):f}
${this.renderCorners()}
`}static styles=[_e,Te,td,Er]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",ss);let n=window;n.customCards=n.customCards??[],n.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}zi();
/*! Bundled license information:
@lit/reactive-element/css-tag.js:
(**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
@lit/reactive-element/reactive-element.js:
lit-html/lit-html.js:
lit-element/lit-element.js:
(**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/is-server.js:
(**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
*/