Compare commits

...
2 Commits
16 changed files with 1358 additions and 313 deletions

No files matched your search

+52 -29
View File
@@ -1,9 +1,9 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */ /*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var D0=1.3,U0=(i,e=new Date().toISOString().slice(0,10))=>!!i.due&&i.due<=e;var Vl={lawn:.012,terrace:.12,path:.02,driveway:.02,street:.02,sidewalk:.12,gravel:.018,river:.008,stream:.006,pool:-.25,bed:.15,wild:.03,hedge:1.2,fence:1,pergola:2.2};function jr(i){return i==="hedge"||i==="fence"||i==="pergola"}function lf(i,e,t){let n=i.slope??0;if(!n||i.type==="pool")return 0;let r=i.slope_dir??"x",s=(c,u)=>r==="x"?c:r==="-x"?-c:r==="z"?u:-u,o=1/0,a=-1/0;for(let[c,u]of i.points){let h=s(c,u);o=Math.min(o,h),a=Math.max(a,h)}if(a-o<1e-6)return 0;let l=Math.min(1,Math.max(0,(s(e,t)-o)/(a-o)));return n*l}function N1(i,e,t,n){return ea(i)+(e.offset??0)+Vl[e.type]-lf(e,t,n)}function ea(i){return i.elevation>.3?0:-.2}function k0(i,e,t){let n=(i.outdoor??[]).filter(s=>!jr(s.type)&&s.type!=="pool"&&Ge([e,t],s.points)),r=[...n].reverse().find(s=>s.cut)??n[0];return r?N1(i,r,e,t):ea(i)}var B0=i=>i.cut??(i.type==="pool"||i.type==="river"||i.type==="stream");function z0(i){let e=Number.isFinite(i.texture_scale)?Math.max(.05,Math.min(20,i.texture_scale)):1,t=Number.isFinite(i.texture_rotation)?(i.texture_rotation%360+360)%360:0;return{scale:e,rotation:t}}var O1={type:"none",pitch:35,overhang:.4},V0="#d6cfc2",cf="#e8e3da",wI={wall_exterior:.24,wall_interior:.12,grid:.05,north:0,roof:{...O1}};var G0=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_uplight","lamp_table","lamp_wall","led_strip","lamp_bollard","lamp_garden"]),Gl=1.75;function H0(i){return G0.has(i)||!!_t(i)?.light}var D1=new Set(["table","table_round","coffee_table","desk","nightstand","sideboard","dresser","kitchen","island","worktop","tv_board","dishwasher","washer","dryer"]);function Qr(i){switch(i.type){case"home_battery":return i.variant==="wall"?.5:0;case"kitchen_wall":return 1.45;case"tv_wall":return Math.max(0,1.3-i.h/2);case"radiator":return .12;case"inverter":return 1.1;case"wallbox":return 1;case"meter":return .4;default:return 0}}var W0=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan"]);function X0(i,e){return i.filter(t=>t.elevation<e.elevation).flatMap(t=>t.rooms.filter(n=>n.points.length>=3&&n.ceiling!=null&&n.ceiling>t.height+.005&&t.elevation+n.ceiling>e.elevation+.05)).map(t=>t.points)}var es=i=>i?.floor_offset&&Number.isFinite(i.floor_offset)?i.floor_offset:0;function Y0(i,e,t){let n=i.rooms.find(r=>r.points.length>=3&&r.floor_offset&&Ge([e,t],r.points));return es(n)}function uf(i,e,t){let n=i.rooms.find(r=>r.points.length>=3&&Ge([e,t],r.points));return n?.ceiling!=null&&n.ceiling>0?n.ceiling:i.height}var Hl=(i,e)=>e.ceiling_y!=null&&e.ceiling_y>0?e.ceiling_y:uf(i,e.x,e.z);function q0(i,e,t){let n=0;for(let r of i.furniture)!(D1.has(r.type)||_t(r.type)?.surface)||!Ge([e,t],ns(r))||(n=Math.max(n,r.h));return n}var U1=new Set([...G0,"radiator","robot_vacuum","inverter","home_battery","wallbox","meter","tv_board","tv_wall","desk","fridge","fridge_smart","stove","kitchen_tall","dishwasher","washer","dryer","kitchen","island","sink"]);var k1=["interior","front","front_glass","sidelight","sidelights","glass","sliding","passage"],B1=["standard","bars","glass_wall"];function Sr(i,e){return i.type==="door"?i.style&&k1.includes(i.style)?i.style:e?"front":"interior":i.style&&B1.includes(i.style)?i.style:"standard"}function $0(i,e,t,n){if(e!=="sidelight"&&e!=="sidelights")return null;let r=e==="sidelights",s=i-.04,o=Math.min(1.05,Math.max(.6,s-(r?.6:.3))),a=(s-o)/(r?2:1),l=n.sidelight_width??a,c=r?n.sidelight_width2??n.sidelight_width??a:0;l=Math.max(.1,l),c=r?Math.max(.1,c):0;let u=s-.5;if(l+c>u){let f=Math.max(0,u)/(l+c);l*=f,c*=f}return r?{panels:[[.02,.02+l],[i-.02-c,i-.02]],x0:.02+l,x1:i-.02-c}:(t?!!n.sidelight_hinge:!n.sidelight_hinge)?{panels:[[.02,.02+l]],x0:.02+l,x1:i-.02}:{panels:[[i-.02-l,i-.02]],x0:.02,x1:i-.02-l}}function K0(i){return i==="front"||i==="front_glass"||i==="sidelight"||i==="sidelights"}function ts(i){let e=0;for(let t=0;t<i.length;t++){let[n,r]=i[t],[s,o]=i[(t+1)%i.length];e+=n*o-s*r}return e/2}function wr(i){return Math.abs(ts(i))}function Gs(i){let e=ts(i);if(Math.abs(e)<1e-9){let r=i.length||1;return[i.reduce((s,o)=>s+o[0],0)/r,i.reduce((s,o)=>s+o[1],0)/r]}let t=0,n=0;for(let r=0;r<i.length;r++){let[s,o]=i[r],[a,l]=i[(r+1)%i.length],c=s*l-a*o;t+=(s+a)*c,n+=(o+l)*c}return[t/(6*e),n/(6*e)]}function Z0(i){if(i.length!==4)return!1;for(let e=0;e<4;e++){let[t,n]=i[e],[r,s]=i[(e+1)%4];if(Math.abs(t-r)>1e-6&&Math.abs(n-s)>1e-6)return!1}return!0}function J0(i){let e=1/0,t=1/0,n=-1/0,r=-1/0;for(let[s,o]of i)e=Math.min(e,s),t=Math.min(t,o),n=Math.max(n,s),r=Math.max(r,o);return{x0:e,z0:t,x1:n,z1:r}}function ns(i){let e=i.rotation*Math.PI/180,t=Math.cos(e),n=Math.sin(e),r=i.w/2,s=i.d/2;return[[-r,-s],[r,-s],[r,s],[-r,s]].map(([o,a])=>[i.x+o*t-a*n,i.z+o*n+a*t])}function Ge(i,e){let t=!1;for(let n=0,r=e.length-1;n<e.length;r=n++){let[s,o]=e[n],[a,l]=e[r];o>i[1]!=l>i[1]&&i[0]<(a-s)*(i[1]-o)/(l-o)+s&&(t=!t)}return t}var z1=[],na=newLine truncated var D0=1.3,U0=(i,e=new Date().toISOString().slice(0,10))=>!!i.due&&i.due<=e;var Vl={lawn:.012,terrace:.12,path:.02,driveway:.02,pavers:.025,stepping_stones:.025,natural_stone:.03,street:.02,sidewalk:.12,gravel:.018,river:.008,stream:.006,pool:-.25,bed:.15,wild:.03,hedge:1.2,fence:1,pergola:2.2};function jr(i){return i==="hedge"||i==="fence"||i==="pergola"}function lf(i,e,t){let n=i.slope??0;if(!n||i.type==="pool")return 0;let r=i.slope_dir??"x",s=(c,u)=>r==="x"?c:r==="-x"?-c:r==="z"?u:-u,o=1/0,a=-1/0;for(let[c,u]of i.points){let h=s(c,u);o=Math.min(o,h),a=Math.max(a,h)}if(a-o<1e-6)return 0;let l=Math.min(1,Math.max(0,(s(e,t)-o)/(a-o)));return n*l}function N1(i,e,t,n){return ea(i)+(e.offset??0)+Vl[e.type]-lf(e,t,n)}function ea(i){return i.elevation>.3?0:-.2}function k0(i,e,t){let n=(i.outdoor??[]).filter(s=>!jr(s.type)&&s.type!=="pool"&&Ge([e,t],s.points)),r=[...n].reverse().find(s=>s.cut)??n[0];return r?N1(i,r,e,t):ea(i)}var B0=i=>i.cut??(i.type==="pool"||i.type==="river"||i.type==="stream");function z0(i){let e=Number.isFinite(i.texture_scale)?Math.max(.05,Math.min(20,i.texture_scale)):1,t=Number.isFinite(i.texture_rotation)?(i.texture_rotation%360+360)%360:0;return{scale:e,rotation:t}}var O1={type:"none",pitch:35,overhang:.4},V0="#d6cfc2",cf="#e8e3da",wI={wall_exterior:.24,wall_interior:.12,grid:.05,north:0,roof:{...O1}};var G0=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan","lamp_floor","lamp_uplight","lamp_table","lamp_wall","led_strip","lamp_bollard","lamp_garden"]),Gl=1.75;function H0(i){return G0.has(i)||!!_t(i)?.light}var D1=new Set(["table","table_round","coffee_table","desk","nightstand","sideboard","dresser","kitchen","island","worktop","tv_board","dishwasher","washer","dryer"]);function Qr(i){switch(i.type){case"home_battery":return i.variant==="wall"?.5:0;case"kitchen_wall":return 1.45;case"tv_wall":return Math.max(0,1.3-i.h/2);case"radiator":return .12;case"inverter":return 1.1;case"wallbox":return 1;case"meter":return .4;default:return 0}}var W0=new Set(["lamp_ceiling","lamp_downlight","lamp_spot","lamp_panel","lamp_pendant","ceiling_fan"]);function X0(i,e){return i.filter(t=>t.elevation<e.elevation).flatMap(t=>t.rooms.filter(n=>n.points.length>=3&&n.ceiling!=null&&n.ceiling>t.height+.005&&t.elevation+n.ceiling>e.elevation+.05)).map(t=>t.points)}var es=i=>i?.floor_offset&&Number.isFinite(i.floor_offset)?i.floor_offset:0;function Y0(i,e,t){let n=i.rooms.find(r=>r.points.length>=3&&r.floor_offset&&Ge([e,t],r.points));return es(n)}function uf(i,e,t){let n=i.rooms.find(r=>r.points.length>=3&&Ge([e,t],r.points));return n?.ceiling!=null&&n.ceiling>0?n.ceiling:i.height}var Hl=(i,e)=>e.ceiling_y!=null&&e.ceiling_y>0?e.ceiling_y:uf(i,e.x,e.z);function q0(i,e,t){let n=0;for(let r of i.furniture)!(D1.has(r.type)||_t(r.type)?.surface)||!Ge([e,t],ns(r))||(n=Math.max(n,r.h));return n}var U1=new Set([...G0,"radiator","robot_vacuum","inverter","home_battery","wallbox","meter","tv_board","tv_wall","desk","fridge","fridge_smart","stove","kitchen_tall","dishwasher","washer","dryer","kitchen","island","sink"]);var k1=["interior","front","front_glass","sidelight","sidelights","glass","sliding","passage"],B1=["standard","bars","glass_wall"];function Sr(i,e){return i.type==="door"?i.style&&k1.includes(i.style)?i.style:e?"front":"interior":i.style&&B1.includes(i.style)?i.style:"standard"}function $0(i,e,t,n){if(e!=="sidelight"&&e!=="sidelights")return null;let r=e==="sidelights",s=i-.04,o=Math.min(1.05,Math.max(.6,s-(r?.6:.3))),a=(s-o)/(r?2:1),l=n.sidelight_width??a,c=r?n.sidelight_width2??n.sidelight_width??a:0;l=Math.max(.1,l),c=r?Math.max(.1,c):0;let u=s-.5;if(l+c>u){let f=Math.max(0,u)/(l+c);l*=f,c*=f}return r?{panels:[[.02,.02+l],[i-.02-c,i-.02]],x0:.02+l,x1:i-.02-c}:(t?!!n.sidelight_hinge:!n.sidelight_hinge)?{panels:[[.02,.02+l]],x0:.02+l,x1:i-.02}:{panels:[[i-.02-l,i-.02]],x0:.02,x1:i-.02-l}}function K0(i){return i==="front"||i==="front_glass"||i==="sidelight"||i==="sidelights"}function ts(i){let e=0;for(let t=0;t<i.length;t++){let[n,r]=i[t],[s,o]=i[(t+1)%i.length];e+=n*o-s*r}return e/2}function wr(i){return Math.abs(ts(i))}function Gs(i){let e=ts(i);if(Math.abs(e)<1e-9){let r=i.length||1;return[i.reduce((s,o)=>s+o[0],0)/r,i.reduce((s,o)=>s+o[1],0)/r]}let t=0,n=0;for(let r=0;r<i.length;r++){let[s,o]=i[r],[a,l]=i[(r+1)%i.length],c=s*l-a*o;t+=(s+a)*c,n+=(o+l)*c}return[t/(6*e),n/(6*e)]}function Z0(i){if(i.length!==4)return!1;for(let e=0;e<4;e++){let[t,n]=i[e],[r,s]=i[(e+1)%4];if(Math.abs(t-r)>1e-6&&Math.abs(n-s)>1e-6)return!1}return!0}function J0(i){let e=1/0,t=1/0,n=-1/0,r=-1/0;for(let[s,o]of i)e=Math.min(e,s),t=Math.min(t,o),n=Math.max(n,s),r=Math.max(r,o);return{x0:e,z0:t,x1:n,z1:r}}function ns(i){let e=i.rotation*Math.PI/180,t=Math.cos(e),n=Math.sin(e),r=i.w/2,s=i.d/2;return[[-r,-s],[r,-s],[r,s],[-r,s]].map(([o,a])=>[i.x+o*t-a*n,i.z+o*n+a*t])}function Ge(i,e){let t=!1;for(let n=0,r=e.length-1;n<e.length;r=n++){let[s,o]=e[n],[a,l]=e[r];o>i[1]!=l>i[1]&&i[0]<(a-s)Line truncated
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,ZS=`void main() { }`,ZS=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`,Si=class extends mn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=KS,this.fragmentShader=ZS,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=_s(e.uniforms),this.uniformsGroups=$S(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new W().setHex(r.value);break;case"v2":this.uniforms[n].value=new Ue().fromArray(r.value);break;case"v3":this.uniforms[n].value=new U().fromArray(r.value);break;case"v4":this.uniforms[n].value=new vt().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Xe().fromArray(r.value);break;case"m4":this.uniforms[n].value=new ze().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},Dc=class extends Si{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},In=class extends mn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new W(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new W(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qa,this.normalScale=new Ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Kn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShad Line truncated }`,Si=class extends mn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=KS,this.fragmentShader=ZS,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=_s(e.uniforms),this.uniformsGroups=$S(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new W().setHex(r.value);break;case"v2":this.uniforms[n].value=new Ue().fromArray(r.value);break;case"v3":this.uniforms[n].value=new U().fromArray(r.value);break;case"v4":this.uniforms[n].value=new vt().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Xe().fromArray(r.value);break;case"m4":this.uniforms[n].value=new ze().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},Dc=class extends Si{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},In=class extends mn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new W(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new W(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qa,this.normalScale=new Ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Kn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShad Line truncated
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,pw=`#ifdef USE_ALPHAHASH #endif`,pw=`#ifdef USE_ALPHAHASH
const float ALPHA_HASH_SCALE = 0.05; const float ALPHA_HASH_SCALE = 0.05;
@@ -51,9 +51,9 @@ var D0=1.3,U0=(i,e=new Date().toISOString().slice(0,10))=>!!i.due&&i.due<=e;var
#else #else
if ( diffuseColor.a < alphaTest ) discard; if ( diffuseColor.a < alphaTest ) discard;
#endif #endif
#endif`,yw=`#ifdef USE_ALPHATEST #endif`,bw=`#ifdef USE_ALPHATEST
uniform float alphaTest; uniform float alphaTest;
#endif`,bw=`#ifdef USE_AOMAP #endif`,yw=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion; reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT ) #if defined( USE_CLEARCOAT )
@@ -1525,10 +1525,10 @@ vec3 getLightProbeGridIrradiance( highp sampler3D probesSH, vec3 probesMin, vec3
#endif`,x2=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER #endif`,x2=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
varying float vFragDepth; varying float vFragDepth;
varying float vIsPerspective; varying float vIsPerspective;
#endif`,y2=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER #endif`,b2=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
vFragDepth = 1.0 + gl_Position.w; vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,b2=`#ifdef USE_MAP #endif`,y2=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv ); vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE #ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
@@ -2824,7 +2824,7 @@ void main() {
gl_FragColor.a *= opacity; gl_FragColor.a *= opacity;
#include <tonemapping_fragment> #include <tonemapping_fragment>
#include <colorspace_fragment> #include <colorspace_fragment>
}`,yT=`#include <common> }`,bT=`#include <common>
#include <batching_pars_vertex> #include <batching_pars_vertex>
#include <uv_pars_vertex> #include <uv_pars_vertex>
#include <displacementmap_pars_vertex> #include <displacementmap_pars_vertex>
@@ -2851,7 +2851,7 @@ void main() {
#include <logdepthbuf_vertex> #include <logdepthbuf_vertex>
#include <clipping_planes_vertex> #include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw; vHighPrecisionZW = gl_Position.zw;
}`,bT=`#if DEPTH_PACKING == 3200 }`,yT=`#if DEPTH_PACKING == 3200
uniform float opacity; uniform float opacity;
#endif #endif
#include <common> #include <common>
@@ -3821,7 +3821,7 @@ void main() {
#include <tonemapping_fragment> #include <tonemapping_fragment>
#include <colorspace_fragment> #include <colorspace_fragment>
#include <fog_fragment> #include <fog_fragment>
}`,tt={alphahash_fragment:dw,alphahash_pars_fragment:pw,alphamap_fragment:mw,alphamap_pars_fragment:gw,alphatest_fragment:xw,alphatest_pars_fragment:yw,aomap_fragment:bw,aomap_pars_fragment:vw,batching_pars_vertex:_w,batching_vertex:Mw,begin_vertex:Sw,beginnormal_vertex:ww,bsdfs:Tw,iridescence_fragment:Aw,bumpmap_pars_fragment:Ew,clipping_planes_fragment:Rw,clipping_planes_pars_fragment:Cw,clipping_planes_pars_vertex:Pw,clipping_planes_vertex:Iw,color_fragment:Lw,color_pars_fragment:Fw,color_pars_vertex:Nw,color_vertex:Ow,common:Dw,defaultnormal_vertex:Uw,displacementmap_pars_vertex:kw,displacementmap_vertex:Bw,emissivemap_fragment:zw,emissivemap_pars_fragment:Vw,colorspace_fragment:Gw,colorspace_pars_fragment:Hw,envmap_fragment:Ww,envmap_common_pars_fragment:Xw,envmap_pars_fragment:Yw,envmap_pars_vertex:qw,envmap_physical_pars_fragment:r2,envmap_vertex:$w,fog_vertex:Kw,fog_pars_vertex:Zw,fog_fragment:Jw,fog_pars_fragment:jw,gradientmap_pars_fragment:Qw,lightmap_pars_fragment:e2,lights_lambert_fragment:t2,lights_lambert_pars_fragment:n2,lights_pars_begin:i2,lights_toon_fragment:s2,lights_toon_pars_fragment:o2,lights_phong_fragment:a2,lights_phong_pars_fragment:l2,lights_physical_fragment:c2,lights_physical_pars_fragment:u2,lights_fragment_begin:h2,lights_fragment_maps:f2,lights_fragment_end:d2,lightprobes_pars_fragment:p2,logdepthbuf_fragment:m2,logdepthbuf_pars_fragment:g2,logdepthbuf_pars_vertex:x2,logdepthbuf_vertex:y2,map_fragment:b2,map_pars_fragment:v2,map_particle_fragment:_2,map_particle_pars_fragment:M2,metalnessmap_fragment:S2,metalnessmap_pars_fragment:w2,morphinstance_vertex:T2,morphcolor_vertex:A2,morphnormal_vertex:E2,morphtarget_pars_vertex:R2,morphtarget_vertex:C2,normal_fragment_begin:P2,normal_fragment_maps:I2,normal_pars_fragment:L2,normal_pars_vertex:F2,normal_vertex:N2,normalmap_pars_fragment:O2,clearcoat_normal_fragment_begin:D2,clearcoat_normal_fragment_maps:U2,clearcoat_pars_fragment:k2,iridescence_pars_fragment:B2,opaque_fragment:z2,packing:V2,premultiplied_alpha_fragment:G2,project_vertex:H2,dithering_fragment:W2,dithering_pars_fragment:X2,roughnessmap_fragment:Y2,roughnessmap_pars_fragment:q2,shadowmap_pars_fragment:$2,shadowmap_pars_vertex:K2,shadowmap_vertex:Z2,shadowmask_pars_fragment:J2,skinbase_vertex:j2,skinning_pars_vertex:Q2,skinning_vertex:eT,skinnormal_vertex:tT,specularmap_fragment:nT,specularmap_pars_fragment:iT,tonemapping_fragment:rT,tonemapping_pars_fragment:sT,transmission_fragment:oT,transmission_pars_fragment:aT,uv_pars_fragment:lT,uv_pars_vertex:cT,uv_vertex:uT,worldpos_vertex:hT,background_vert:fT,background_frag:dT,backgroundCube_vert:pT,backgroundCube_frag:mT,cube_vert:gT,cube_frag:xT,depth_vert:yT,depth_frag:bT,distance_vert:vT,distance_frag:_T,equirect_vert:MT,equirect_frag:ST,linedashed_vert:wT,linedashed_frag:TT,meshbasic_vert:AT,meshbasic_frag:ET,meshlambert_vert:RT,meshlambert_frag:CT,meshmatcap_vert:PT,meshmatcap_frag:IT,meshnormal_vert:LT,meshnormal_frag:FT,meshphong_vert:NT,meshphong_frag:OT,meshphysical_vert:DT,meshphysical_frag:UT,meshtoon_vert:kT,meshtoon_frag:BT,points_vert:zT,points_frag:VT,shadow_vert:GT,shadow_frag:HT,sprite_vert:WT,sprite_frag:XT},_e={common:{diffuse:{value:new W(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Xe},alphaMap:{value:null},alphaMapTransform:{value:new Xe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Xe}},envmap:{envMap:{value:null},envMapRotation:{value:new Xe},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Xe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Xe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Xe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Xe},normalScale:{value:new Ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Xe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Xe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Xe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Xe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new W(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],prop Line truncated }`,tt={alphahash_fragment:dw,alphahash_pars_fragment:pw,alphamap_fragment:mw,alphamap_pars_fragment:gw,alphatest_fragment:xw,alphatest_pars_fragment:bw,aomap_fragment:yw,aomap_pars_fragment:vw,batching_pars_vertex:_w,batching_vertex:Mw,begin_vertex:Sw,beginnormal_vertex:ww,bsdfs:Tw,iridescence_fragment:Aw,bumpmap_pars_fragment:Ew,clipping_planes_fragment:Rw,clipping_planes_pars_fragment:Cw,clipping_planes_pars_vertex:Pw,clipping_planes_vertex:Iw,color_fragment:Lw,color_pars_fragment:Fw,color_pars_vertex:Nw,color_vertex:Ow,common:Dw,defaultnormal_vertex:Uw,displacementmap_pars_vertex:kw,displacementmap_vertex:Bw,emissivemap_fragment:zw,emissivemap_pars_fragment:Vw,colorspace_fragment:Gw,colorspace_pars_fragment:Hw,envmap_fragment:Ww,envmap_common_pars_fragment:Xw,envmap_pars_fragment:Yw,envmap_pars_vertex:qw,envmap_physical_pars_fragment:r2,envmap_vertex:$w,fog_vertex:Kw,fog_pars_vertex:Zw,fog_fragment:Jw,fog_pars_fragment:jw,gradientmap_pars_fragment:Qw,lightmap_pars_fragment:e2,lights_lambert_fragment:t2,lights_lambert_pars_fragment:n2,lights_pars_begin:i2,lights_toon_fragment:s2,lights_toon_pars_fragment:o2,lights_phong_fragment:a2,lights_phong_pars_fragment:l2,lights_physical_fragment:c2,lights_physical_pars_fragment:u2,lights_fragment_begin:h2,lights_fragment_maps:f2,lights_fragment_end:d2,lightprobes_pars_fragment:p2,logdepthbuf_fragment:m2,logdepthbuf_pars_fragment:g2,logdepthbuf_pars_vertex:x2,logdepthbuf_vertex:b2,map_fragment:y2,map_pars_fragment:v2,map_particle_fragment:_2,map_particle_pars_fragment:M2,metalnessmap_fragment:S2,metalnessmap_pars_fragment:w2,morphinstance_vertex:T2,morphcolor_vertex:A2,morphnormal_vertex:E2,morphtarget_pars_vertex:R2,morphtarget_vertex:C2,normal_fragment_begin:P2,normal_fragment_maps:I2,normal_pars_fragment:L2,normal_pars_vertex:F2,normal_vertex:N2,normalmap_pars_fragment:O2,clearcoat_normal_fragment_begin:D2,clearcoat_normal_fragment_maps:U2,clearcoat_pars_fragment:k2,iridescence_pars_fragment:B2,opaque_fragment:z2,packing:V2,premultiplied_alpha_fragment:G2,project_vertex:H2,dithering_fragment:W2,dithering_pars_fragment:X2,roughnessmap_fragment:Y2,roughnessmap_pars_fragment:q2,shadowmap_pars_fragment:$2,shadowmap_pars_vertex:K2,shadowmap_vertex:Z2,shadowmask_pars_fragment:J2,skinbase_vertex:j2,skinning_pars_vertex:Q2,skinning_vertex:eT,skinnormal_vertex:tT,specularmap_fragment:nT,specularmap_pars_fragment:iT,tonemapping_fragment:rT,tonemapping_pars_fragment:sT,transmission_fragment:oT,transmission_pars_fragment:aT,uv_pars_fragment:lT,uv_pars_vertex:cT,uv_vertex:uT,worldpos_vertex:hT,background_vert:fT,background_frag:dT,backgroundCube_vert:pT,backgroundCube_frag:mT,cube_vert:gT,cube_frag:xT,depth_vert:bT,depth_frag:yT,distance_vert:vT,distance_frag:_T,equirect_vert:MT,equirect_frag:ST,linedashed_vert:wT,linedashed_frag:TT,meshbasic_vert:AT,meshbasic_frag:ET,meshlambert_vert:RT,meshlambert_frag:CT,meshmatcap_vert:PT,meshmatcap_frag:IT,meshnormal_vert:LT,meshnormal_frag:FT,meshphong_vert:NT,meshphong_frag:OT,meshphysical_vert:DT,meshphysical_frag:UT,meshtoon_vert:kT,meshtoon_frag:BT,points_vert:zT,points_frag:VT,shadow_vert:GT,shadow_frag:HT,sprite_vert:WT,sprite_frag:XT},_e={common:{diffuse:{value:new W(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Xe},alphaMap:{value:null},alphaMapTransform:{value:new Xe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Xe}},envmap:{envMap:{value:null},envMapRotation:{value:new Xe},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Xe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Xe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Xe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Xe},normalScale:{value:new Ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Xe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Xe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Xe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Xe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new W(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],prop Line truncated
varying vec3 vWorldDirection; varying vec3 vWorldDirection;
@@ -3856,9 +3856,9 @@ void main() {
gl_FragColor = texture2D( tEquirect, sampleUV ); gl_FragColor = texture2D( tEquirect, sampleUV );
} }
`},r=new Mi(5,5,5),s=new Si({name:"CubemapFromEquirect",uniforms:_s(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:un,blending:xs});s.uniforms.tEquirect.value=t;let o=new Se(r,s),a=t.minFilter;return t.minFilter===Fn&&(t.minFilter=Ht),new _o(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}},$x=256,jT=3,QT=20,xy=256,yy=16,eA=3,tA=new U,nA=new W,Ro=class i{constructor(e){this._renderer=e,this._cubeSize=0,this._sourceTarget=null,this._cubeCamera=new _o(1,10,null),this._boxMesh=new Se(new Mi(5,5,5),null),this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null,this._integrationMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=tA}=s,l=this._renderer;this._setSize(o);let c=this._allocateTarget(),u=this._getSourceTarget(!0);t>0&&(u.texture.mipmapsAutoUpdate=!1);let h=l.autoClear,f=l.autoClearColor,d=l.autoClearDepth,p=l.autoClearStencil,x=e.background;l.autoClear=!0,l.autoClearColor=!0,l.autoClearDepth=!0,l.autoClearStencil=!0,x===null&&(e.background=l.getClearColor(nA));let g=new _o(n,r,u);return g.position.copy(a),g.update(l,e),l.autoClear=h,l.autoClearColor=f,l.autoClearDepth=d,l.autoClearStencil=p,e.background=x,t>0&&(u.texture.mipmapsAutoUpdate=!0,this._blur(c,t)),this._applyPMREM(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Jx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Zx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._sourceTarget!==null&&this._sourceTarget.dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._integrationMaterial!==null&&this._integrationMaterial.dispose(),this._boxMesh.geometry.dispose()}static lodToRoughness(e,t){return t>0?1-Math.sqrt(1-e/t):0}_setSize(e){this._cubeSize=Math.max($x,wd(e))}_fromTexture(e,t){e.mapping===bs||e.mapping===So?this._setSize(e.image.length===0?$x:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4);let n=t||this._allocateTarget();return this._textureToCubemap(e),this._applyPMREM(n),n}_allocateTarget(){let e=this._cubeSize,t=Kx(e,!1,!1),n=Math.log2(e)-jT;for(let r=0;r<=n;r++)t.texture.mipmaps.push({width:e>>r,height:e>>r});return t.texture.name="PMREM",t.texture.isPMREMTexture=!0,t}_getSourceTarget(e=!1){let t=this._cubeSize,n=this._sourceTarget;return(n===null||n.width!==t||e&&n.depthBuffer===!1)&&(n!==null&&n.dispose(),this._sourceTarget=Kx(t,!0,e)),this._sourceTarget}_compileMaterial(e){this._boxMesh.material=e,this._renderer.compile(this._boxMesh,this._cubeCamera.children[0])}_renderCube(e,t,n){let r=this._boxMesh,s=this._cubeCamera;r.material=n,s.renderTarget=e,s.activeMipmapLevel=t;let o=e.width>>t;e.viewport.set(0,0,o,o),s.update(this._renderer,r),e.viewport.set(0,0,e.width,e.height)}_textureToCubemap(e){let t;e.mapping===bs||e.mapping===So?(this._cubemapMaterial===null&&(this._cubemapMaterial=Jx()),t=this._cubemapMaterial,t.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):(this._equirectMaterial===null&&(this._equirectMaterial=Zx()),t=this._equirectMaterial),t.uniforms.envMap.value=e,this._renderCube(this._getSourceTarget(),0,t)}_applyPMREM(e){this._ggxMaterial===null&&(this._ggxMaterial=iA(),this._integrationMaterial=rA());let t=this._cubeSize,n=e.texture.mipmaps.length-1,r=this._ggxMaterial.uniforms;r.envMap.value=this._sourceTarget.texture;let s=this._integrationMaterial.uniforms;s.envMap.value=this._sourceTarget.texture,s.sourceLod.value=Math.log2(t/yy);for(let o=0;o<=n;o++){let a=i.lodToRoughness(o,n);if(o>n-eA)s.roughness.value=a,this._renderCube(e,o,this._integrationMaterial);else{let l=a>0?Math.log2(t)+.5*Math.log2(6/(xy*Math.pow(a,4)))+.5:0;r.roughness.value=a,r.lodBias.value=l,this._renderCube(e,o,this._ggxMaterial)}}}_blur(e,t){this._blurMaterial===null&&(this._blurMaterial=sA());let n=this._blurMaterial,r=n.uniforms,s=this._sourceTarget;r.sigma.value=Math.min(t,Math.PI)/Math.SQRT2,r.envMap.value=s.texture,this._renderCube(e,0,n),r.envMap.value=e.texture,this._renderCube(s,0,n)}};function Kx(i,e,t){return new nl(i,{minFilter:Fn,generateMipmaps:e,type:li,colorSpace:Mn,depthBuffer:t})}function il(i,e,t){return new Si({name:i,uniforms:e,vertexShader:tt.cube_vert,fragmentShader:t,side:un,blending:xs,depthTest:!1,depthWrite:!1})}function iA(){return il("PMREMGGXConvolution",{envMap:{value:null},roughness:{value:0},lodBias:{value:0}},` `},r=new Mi(5,5,5),s=new Si({name:"CubemapFromEquirect",uniforms:_s(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:un,blending:xs});s.uniforms.tEquirect.value=t;let o=new Se(r,s),a=t.minFilter;return t.minFilter===Fn&&(t.minFilter=Ht),new _o(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}},$x=256,jT=3,QT=20,xb=256,bb=16,eA=3,tA=new U,nA=new W,Ro=class i{constructor(e){this._renderer=e,this._cubeSize=0,this._sourceTarget=null,this._cubeCamera=new _o(1,10,null),this._boxMesh=new Se(new Mi(5,5,5),null),this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null,this._integrationMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=tA}=s,l=this._renderer;this._setSize(o);let c=this._allocateTarget(),u=this._getSourceTarget(!0);t>0&&(u.texture.mipmapsAutoUpdate=!1);let h=l.autoClear,f=l.autoClearColor,d=l.autoClearDepth,p=l.autoClearStencil,x=e.background;l.autoClear=!0,l.autoClearColor=!0,l.autoClearDepth=!0,l.autoClearStencil=!0,x===null&&(e.background=l.getClearColor(nA));let g=new _o(n,r,u);return g.position.copy(a),g.update(l,e),l.autoClear=h,l.autoClearColor=f,l.autoClearDepth=d,l.autoClearStencil=p,e.background=x,t>0&&(u.texture.mipmapsAutoUpdate=!0,this._blur(c,t)),this._applyPMREM(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Jx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Zx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._sourceTarget!==null&&this._sourceTarget.dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._integrationMaterial!==null&&this._integrationMaterial.dispose(),this._boxMesh.geometry.dispose()}static lodToRoughness(e,t){return t>0?1-Math.sqrt(1-e/t):0}_setSize(e){this._cubeSize=Math.max($x,wd(e))}_fromTexture(e,t){e.mapping===ys||e.mapping===So?this._setSize(e.image.length===0?$x:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4);let n=t||this._allocateTarget();return this._textureToCubemap(e),this._applyPMREM(n),n}_allocateTarget(){let e=this._cubeSize,t=Kx(e,!1,!1),n=Math.log2(e)-jT;for(let r=0;r<=n;r++)t.texture.mipmaps.push({width:e>>r,height:e>>r});return t.texture.name="PMREM",t.texture.isPMREMTexture=!0,t}_getSourceTarget(e=!1){let t=this._cubeSize,n=this._sourceTarget;return(n===null||n.width!==t||e&&n.depthBuffer===!1)&&(n!==null&&n.dispose(),this._sourceTarget=Kx(t,!0,e)),this._sourceTarget}_compileMaterial(e){this._boxMesh.material=e,this._renderer.compile(this._boxMesh,this._cubeCamera.children[0])}_renderCube(e,t,n){let r=this._boxMesh,s=this._cubeCamera;r.material=n,s.renderTarget=e,s.activeMipmapLevel=t;let o=e.width>>t;e.viewport.set(0,0,o,o),s.update(this._renderer,r),e.viewport.set(0,0,e.width,e.height)}_textureToCubemap(e){let t;e.mapping===ys||e.mapping===So?(this._cubemapMaterial===null&&(this._cubemapMaterial=Jx()),t=this._cubemapMaterial,t.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):(this._equirectMaterial===null&&(this._equirectMaterial=Zx()),t=this._equirectMaterial),t.uniforms.envMap.value=e,this._renderCube(this._getSourceTarget(),0,t)}_applyPMREM(e){this._ggxMaterial===null&&(this._ggxMaterial=iA(),this._integrationMaterial=rA());let t=this._cubeSize,n=e.texture.mipmaps.length-1,r=this._ggxMaterial.uniforms;r.envMap.value=this._sourceTarget.texture;let s=this._integrationMaterial.uniforms;s.envMap.value=this._sourceTarget.texture,s.sourceLod.value=Math.log2(t/bb);for(let o=0;o<=n;o++){let a=i.lodToRoughness(o,n);if(o>n-eA)s.roughness.value=a,this._renderCube(e,o,this._integrationMaterial);else{let l=a>0?Math.log2(t)+.5*Math.log2(6/(xb*Math.pow(a,4)))+.5:0;r.roughness.value=a,r.lodBias.value=l,this._renderCube(e,o,this._ggxMaterial)}}}_blur(e,t){this._blurMaterial===null&&(this._blurMaterial=sA());let n=this._blurMaterial,r=n.uniforms,s=this._sourceTarget;r.sigma.value=Math.min(t,Math.PI)/Math.SQRT2,r.envMap.value=s.texture,this._renderCube(e,0,n),r.envMap.value=e.texture,this._renderCube(s,0,n)}};function Kx(i,e,t){return new nl(i,{minFilter:Fn,generateMipmaps:e,type:li,colorSpace:Mn,depthBuffer:t})}function il(i,e,t){return new Si({name:i,uniforms:e,vertexShader:tt.cube_vert,fragmentShader:t,side:un,blending:xs,depthTest:!1,depthWrite:!1})}function iA(){return il("PMREMGGXConvolution",{envMap:{value:null},roughness:{value:0},lodBias:{value:0}},`
#define GGX_SAMPLES ${xy}u #define GGX_SAMPLES ${xb}u
varying vec3 vWorldDirection; varying vec3 vWorldDirection;
@@ -3940,7 +3940,7 @@ void main() {
gl_FragColor = vec4( prefilteredColor / totalWeight, 1.0 ); gl_FragColor = vec4( prefilteredColor / totalWeight, 1.0 );
} }
`)}function rA(){return il("PMREMGGXIntegration",{envMap:{value:null},roughness:{value:0},sourceLod:{value:0},sourceSize:{value:yy}},` `)}function rA(){return il("PMREMGGXIntegration",{envMap:{value:null},roughness:{value:0},sourceLod:{value:0},sourceSize:{value:bb}},`
varying vec3 vWorldDirection; varying vec3 vWorldDirection;
@@ -4075,7 +4075,7 @@ void main() {
gl_FragColor = vec4( textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ).rgb, 1.0 ); gl_FragColor = vec4( textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ).rgb, 1.0 );
} }
`)}function oA(i){let e=new WeakMap,t=new WeakMap,n=null;function r(f,d=!1){return f==null?null:d?o(f):s(f)}function s(f){if(f&&f.isTexture){let d=f.mapping;if(d===Kc||d===Zc)if(e.has(f)){let p=e.get(f).texture;return a(p,f.mapping)}else{let p=f.image;if(p&&p.height>0){let x=new nl(p.height);return x.fromEquirectangularTexture(i,f),e.set(f,x),f.addEventListener("dispose",c),a(x.texture,f.mapping)}else return null}}return f}function o(f){if(f&&f.isTexture&&f.isPMREMTexture!==!0){let d=f.mapping,p=d===Kc||d===Zc,x=d===bs||d===So;if(p||x){let g=t.get(f),m=g!==void 0?g.texture.pmremVersion:0;if(f.isRenderTargetTexture&&f.pmremVersion!==m)return n===null&&(n=new Ro(i)),g=p?n.fromEquirectangular(f,g):n.fromCubemap(f,g),g.texture.pmremVersion=f.pmremVersion,t.set(f,g),g.texture;if(g!==void 0)return g.texture;{let y=f.image;return p&&y&&y.height>0||x&&y&&l(y)?(n===null&&(n=new Ro(i)),g=p?n.fromEquirectangular(f):n.fromCubemap(f),g.texture.pmremVersion=f.pmremVersion,t.set(f,g),f.addEventListener("dispose",u),g.texture):null}}}return f}function a(f,d){return d===Kc?f.mapping=bs:d===Zc&&(f.mapping=So),f}function l(f){let d=0,p=6;for(let x=0;x<p;x++)f[x]!==void 0&&d++;return d===p}function c(f){let d=f.target;d.removeEventListener("dispose",c);let p=e.get(d);p!==void 0&&(e.delete(d),p.dispose())}function u(f){let d=f.target;d.removeEventListener("dispose",u);let p=t.get(d);p!==void 0&&(t.delete(d),p.dispose())}function h(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:h}}function aA(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let r=t(n);return r===null&&as("WebGLRenderer: "+n+" extension not supported."),r}}}function lA(i,e,t,n){let r={},s=new WeakMap,o=new FinalizationRegistry(p=>delete r[p]);function a(p){l(p.target)}function l(p){p.index!==null&&e.remove(p.index);for(let g in p.attributes)e.remove(p.attributes[g]);p.removeEventListener("dispose",a),delete r[p.id],o.unregister(p);let x=s.get(p);x&&(e.remove(x),s.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function c(p,x){return r[x.id]!==void 0||(x.addEventListener("dispose",a),r[x.id]=new WeakRef(x),o.register(x,x.id,x),t.memory.geometries++),x}function u(p){let x=p.attributes;for(let g in x)e.update(x[g],i.ARRAY_BUFFER)}function h(p){let x=p.index,g=p.attributes.position,m=0;if(g===void 0)return;let y=x!==null?x.array.length:g.array.length/3-1,_=g.count>=65535?us:Ma,b=new _(Math.ceil(y/3)*6,1),M=b.array;if(x!==null){let v=x.array;m=x.version;for(let w=0,R=0;w<y;w+=3){let T=v[w+0],C=v[w+1],L=v[w+2];M[R++]=T,M[R++]=C,M[R++]=C,M[R++]=L,M[R++]=L,M[R++]=T}}else{m=g.version;for(let v=0,w=0;v<y;v+=3){let R=v+0,T=v+1,C=v+2;M[w++]=R,M[w++]=T,M[w++]=T,M[w++]=C,M[w++]=C,M[w++]=R}}b.version=m;let S=s.get(p);S&&e.remove(S),s.set(p,b)}function f(p){let x=s.get(p);if(x){let g=p.index;g!==null&&x.version<g.version&&h(p)}else h(p);return s.get(p)}function d(){for(let p in r){let x=r[p].deref();x!==void 0&&l(x)}}return{get:c,update:u,getWireframeAttribute:f,dispose:d}}function cA(i,e,t){let n;function r(h){n=h}let s,o;function a(h){s=h.type,o=h.bytesPerElement}function l(h,f){i.drawElements(n,f,s,h*o),t.update(f,n,1)}function c(h,f,d){d!==0&&(i.drawElementsInstanced(n,f,s,h*o,d),t.update(f,n,d))}function u(h,f,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,h,0,d);let x=0;for(let g=0;g<d;g++)x+=f[g];t.update(x,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function uA(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:We("WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function hA(i,e,t){let n=new WeakMap,r=new vt;function s(o,a,l){let c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=u!==void 0?u.length:0,f=n.get(a);if(f===void 0||f.count!==h){let R=function(){v.dispose(),n.delete(a),a.removeEventListener("dispose",R)};f!==void 0&&f.texture.dispose();let d=a.morphAttributes.position!==void 0,p=a.morphAttributes.normal!==void 0,x=a.morphAttributes.color!==void 0,g=a.morphAttributes.position||[],m=a.morphAttributes.normal||[],y=a.morphAttributes.color||[],_=0;d===!0&&(_=1),p===!0&&(_=2),x===!0&&(_=3);let b=a.attributes.position.count*_, Line truncated `)}function oA(i){let e=new WeakMap,t=new WeakMap,n=null;function r(f,d=!1){return f==null?null:d?o(f):s(f)}function s(f){if(f&&f.isTexture){let d=f.mapping;if(d===Kc||d===Zc)if(e.has(f)){let p=e.get(f).texture;return a(p,f.mapping)}else{let p=f.image;if(p&&p.height>0){let x=new nl(p.height);return x.fromEquirectangularTexture(i,f),e.set(f,x),f.addEventListener("dispose",c),a(x.texture,f.mapping)}else return null}}return f}function o(f){if(f&&f.isTexture&&f.isPMREMTexture!==!0){let d=f.mapping,p=d===Kc||d===Zc,x=d===ys||d===So;if(p||x){let g=t.get(f),m=g!==void 0?g.texture.pmremVersion:0;if(f.isRenderTargetTexture&&f.pmremVersion!==m)return n===null&&(n=new Ro(i)),g=p?n.fromEquirectangular(f,g):n.fromCubemap(f,g),g.texture.pmremVersion=f.pmremVersion,t.set(f,g),g.texture;if(g!==void 0)return g.texture;{let b=f.image;return p&&b&&b.height>0||x&&b&&l(b)?(n===null&&(n=new Ro(i)),g=p?n.fromEquirectangular(f):n.fromCubemap(f),g.texture.pmremVersion=f.pmremVersion,t.set(f,g),f.addEventListener("dispose",u),g.texture):null}}}return f}function a(f,d){return d===Kc?f.mapping=ys:d===Zc&&(f.mapping=So),f}function l(f){let d=0,p=6;for(let x=0;x<p;x++)f[x]!==void 0&&d++;return d===p}function c(f){let d=f.target;d.removeEventListener("dispose",c);let p=e.get(d);p!==void 0&&(e.delete(d),p.dispose())}function u(f){let d=f.target;d.removeEventListener("dispose",u);let p=t.get(d);p!==void 0&&(t.delete(d),p.dispose())}function h(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:h}}function aA(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let r=t(n);return r===null&&as("WebGLRenderer: "+n+" extension not supported."),r}}}function lA(i,e,t,n){let r={},s=new WeakMap,o=new FinalizationRegistry(p=>delete r[p]);function a(p){l(p.target)}function l(p){p.index!==null&&e.remove(p.index);for(let g in p.attributes)e.remove(p.attributes[g]);p.removeEventListener("dispose",a),delete r[p.id],o.unregister(p);let x=s.get(p);x&&(e.remove(x),s.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function c(p,x){return r[x.id]!==void 0||(x.addEventListener("dispose",a),r[x.id]=new WeakRef(x),o.register(x,x.id,x),t.memory.geometries++),x}function u(p){let x=p.attributes;for(let g in x)e.update(x[g],i.ARRAY_BUFFER)}function h(p){let x=p.index,g=p.attributes.position,m=0;if(g===void 0)return;let b=x!==null?x.array.length:g.array.length/3-1,_=g.count>=65535?us:Ma,y=new _(Math.ceil(b/3)*6,1),M=y.array;if(x!==null){let v=x.array;m=x.version;for(let w=0,R=0;w<b;w+=3){let T=v[w+0],C=v[w+1],L=v[w+2];M[R++]=T,M[R++]=C,M[R++]=C,M[R++]=L,M[R++]=L,M[R++]=T}}else{m=g.version;for(let v=0,w=0;v<b;v+=3){let R=v+0,T=v+1,C=v+2;M[w++]=R,M[w++]=T,M[w++]=T,M[w++]=C,M[w++]=C,M[w++]=R}}y.version=m;let S=s.get(p);S&&e.remove(S),s.set(p,y)}function f(p){let x=s.get(p);if(x){let g=p.index;g!==null&&x.version<g.version&&h(p)}else h(p);return s.get(p)}function d(){for(let p in r){let x=r[p].deref();x!==void 0&&l(x)}}return{get:c,update:u,getWireframeAttribute:f,dispose:d}}function cA(i,e,t){let n;function r(h){n=h}let s,o;function a(h){s=h.type,o=h.bytesPerElement}function l(h,f){i.drawElements(n,f,s,h*o),t.update(f,n,1)}function c(h,f,d){d!==0&&(i.drawElementsInstanced(n,f,s,h*o,d),t.update(f,n,d))}function u(h,f,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,h,0,d);let x=0;for(let g=0;g<d;g++)x+=f[g];t.update(x,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function uA(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:We("WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function hA(i,e,t){let n=new WeakMap,r=new vt;function s(o,a,l){let c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=u!==void 0?u.length:0,f=n.get(a);if(f===void 0||f.count!==h){let R=function(){v.dispose(),n.delete(a),a.removeEventListener("dispose",R)};f!==void 0&&f.texture.dispose();let d=a.morphAttributes.position!==void 0,p=a.morphAttributes.normal!==void 0,x=a.morphAttributes.color!==void 0,g=a.morphAttributes.position||[],m=a.morphAttributes.normal||[],b=a.morphAttributes.color||[],_=0;d===!0&&(_=1),p===!0&&(_=2),x===!0&&(_=3);let y=a.attributes.position.count*_, Line truncated
precision highp float; precision highp float;
uniform mat4 modelViewMatrix; uniform mat4 modelViewMatrix;
@@ -4121,9 +4121,9 @@ void main() {
#ifdef SRGB_TRANSFER #ifdef SRGB_TRANSFER
gl_FragColor = sRGBTransferOETF( gl_FragColor ); gl_FragColor = sRGBTransferOETF( gl_FragColor );
#endif #endif
}`,depthTest:!1,depthWrite:!1}),f=new Se(u,h),d=new zn(-1,1,1,-1,0,1),p=null,x=null,g=!1,m,y=null,_=[],b=!1;this.setSize=function(M,S){o.setSize(M,S),a!==null&&a.setSize(M,S),l!==null&&l.setSize(M,S);for(let v=0;v<_.length;v++){let w=_[v];w.setSize&&w.setSize(M,S)}},this.setEffects=function(M){_=M,b=_.length>0&&_[0].isRenderPass===!0;let S=o.width,v=o.height;_.length>0&&a===null&&(a=new wn(S,v,{type:li,depthBuffer:!1,stencilBuffer:!1}),l=new wn(S,v,{type:li,depthBuffer:!1,stencilBuffer:!1}));let w=r===!0&&_.some(R=>R.needsDepthTexture===!0);w!==(o.depthTexture!==null)&&(w===!0&&c===null&&(c=new nr(S,v),s===!0&&(c.format=hr,c.type=vs)),o.dispose(),o.depthTexture=w?c:null,o.resolveDepthBuffer=w,o.storeMultisampledDepthBuffer=w);for(let R=0;R<_.length;R++){let T=_[R];T.setSize&&T.setSize(S,v),w&&T.needsDepthTexture===!0&&T.setDepthTexture&&T.setDepthTexture(c)}},this.begin=function(M,S){if(g||M.toneMapping===Ri&&_.length===0)return!1;if(y=S,S!==null){let v=S.width,w=S.height;(o.width!==v||o.height!==w)&&this.setSize(v,w)}return b===!1&&M.setRenderTarget(o),m=M.toneMapping,M.toneMapping=Ri,!0},this.hasRenderPass=function(){return b},this.end=function(M,S){M.toneMapping=m,g=!0;let v=o,w=a;for(let R=0;R<_.length;R++){let T=_[R];T.enabled!==!1&&(T.render(M,w,v,S),T.needsSwap!==!1&&(v=w,w=w===a?l:a))}if(p!==M.outputColorSpace||x!==M.toneMapping){p=M.outputColorSpace,x=M.toneMapping,h.defines={},it.getTransfer(p)===Mt&&(h.defines.SRGB_TRANSFER="");let R=dA[x];R&&(h.defines[R]=""),h.needsUpdate=!0}h.uniforms.tDiffuse.value=v.texture,M.setRenderTarget(y),M.render(f,d),y=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){o.dispose(),a!==null&&a.dispose(),l!==null&&l.dispose(),u.dispose(),h.dispose()}}var by=new Kt,vy=new nr(1,1),_y=new Ea(1),My=new _a,Sy=new Lc,wy=new Aa,jx=[],Qx=[],ey=new Float32Array(16),ty=new Float32Array(9),ny=new Float32Array(4);function Co(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=jx[r];if(s===void 0&&(s=new Float32Array(r),jx[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function jt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function Qt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Uu(i,e){let t=Qx[e];t===void 0&&(t=new Int32Array(e),Qx[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function mA(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function gA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(jt(t,e))return;i.uniform2fv(this.addr,e),Qt(t,e)}}function xA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(jt(t,e))return;i.uniform3fv(this.addr,e),Qt(t,e)}}function yA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(jt(t,e))return;i.uniform4fv(this.addr,e),Qt(t,e)}}function bA(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(jt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Qt(t,e)}else{if(jt(t,n))return;ny.set(n),i.uniformMatrix2fv(this.addr,!1,ny),Qt(t,n)}}function vA(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(jt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Qt(t,e)}else{if(jt(t,n))return;ty.set(n),i.uniformMatrix3fv(this.addr,!1,ty),Qt(t,n)}}function _A(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(jt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Qt(t,e)}else{if(jt(t,n))return;ey.set(n),i.uniformMatrix4fv(this.addr,!1,ey),Qt(t,n)}}function MA(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function SA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(jt(t,e))return;i.uniform2iv(this.addr,e),Qt(t,e)}}function wA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(jt(t,e))return;i.uniform3iv(this.addr,e),Qt(t,e)}}function TA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(jt(t,e))return;i.uniform4iv(this.addr,e),Qt(t,e)}}function AA(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function EA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(jt(t,e))return;i.uniform2uiv(this.addr,e),Qt(t,e)}}function RA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(jt(t,e))return;i.uniform3uiv(thi Line truncated }`,depthTest:!1,depthWrite:!1}),f=new Se(u,h),d=new zn(-1,1,1,-1,0,1),p=null,x=null,g=!1,m,b=null,_=[],y=!1;this.setSize=function(M,S){o.setSize(M,S),a!==null&&a.setSize(M,S),l!==null&&l.setSize(M,S);for(let v=0;v<_.length;v++){let w=_[v];w.setSize&&w.setSize(M,S)}},this.setEffects=function(M){_=M,y=_.length>0&&_[0].isRenderPass===!0;let S=o.width,v=o.height;_.length>0&&a===null&&(a=new wn(S,v,{type:li,depthBuffer:!1,stencilBuffer:!1}),l=new wn(S,v,{type:li,depthBuffer:!1,stencilBuffer:!1}));let w=r===!0&&_.some(R=>R.needsDepthTexture===!0);w!==(o.depthTexture!==null)&&(w===!0&&c===null&&(c=new nr(S,v),s===!0&&(c.format=hr,c.type=vs)),o.dispose(),o.depthTexture=w?c:null,o.resolveDepthBuffer=w,o.storeMultisampledDepthBuffer=w);for(let R=0;R<_.length;R++){let T=_[R];T.setSize&&T.setSize(S,v),w&&T.needsDepthTexture===!0&&T.setDepthTexture&&T.setDepthTexture(c)}},this.begin=function(M,S){if(g||M.toneMapping===Ri&&_.length===0)return!1;if(b=S,S!==null){let v=S.width,w=S.height;(o.width!==v||o.height!==w)&&this.setSize(v,w)}return y===!1&&M.setRenderTarget(o),m=M.toneMapping,M.toneMapping=Ri,!0},this.hasRenderPass=function(){return y},this.end=function(M,S){M.toneMapping=m,g=!0;let v=o,w=a;for(let R=0;R<_.length;R++){let T=_[R];T.enabled!==!1&&(T.render(M,w,v,S),T.needsSwap!==!1&&(v=w,w=w===a?l:a))}if(p!==M.outputColorSpace||x!==M.toneMapping){p=M.outputColorSpace,x=M.toneMapping,h.defines={},it.getTransfer(p)===Mt&&(h.defines.SRGB_TRANSFER="");let R=dA[x];R&&(h.defines[R]=""),h.needsUpdate=!0}h.uniforms.tDiffuse.value=v.texture,M.setRenderTarget(b),M.render(f,d),b=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){o.dispose(),a!==null&&a.dispose(),l!==null&&l.dispose(),u.dispose(),h.dispose()}}var yb=new Kt,vb=new nr(1,1),_b=new Ea(1),Mb=new _a,Sb=new Lc,wb=new Aa,jx=[],Qx=[],eb=new Float32Array(16),tb=new Float32Array(9),nb=new Float32Array(4);function Co(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=jx[r];if(s===void 0&&(s=new Float32Array(r),jx[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function jt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function Qt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Uu(i,e){let t=Qx[e];t===void 0&&(t=new Int32Array(e),Qx[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function mA(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function gA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(jt(t,e))return;i.uniform2fv(this.addr,e),Qt(t,e)}}function xA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(jt(t,e))return;i.uniform3fv(this.addr,e),Qt(t,e)}}function bA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(jt(t,e))return;i.uniform4fv(this.addr,e),Qt(t,e)}}function yA(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(jt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Qt(t,e)}else{if(jt(t,n))return;nb.set(n),i.uniformMatrix2fv(this.addr,!1,nb),Qt(t,n)}}function vA(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(jt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Qt(t,e)}else{if(jt(t,n))return;tb.set(n),i.uniformMatrix3fv(this.addr,!1,tb),Qt(t,n)}}function _A(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(jt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Qt(t,e)}else{if(jt(t,n))return;eb.set(n),i.uniformMatrix4fv(this.addr,!1,eb),Qt(t,n)}}function MA(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function SA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(jt(t,e))return;i.uniform2iv(this.addr,e),Qt(t,e)}}function wA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(jt(t,e))return;i.uniform3iv(this.addr,e),Qt(t,e)}}function TA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(jt(t,e))return;i.uniform4iv(this.addr,e),Qt(t,e)}}function AA(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function EA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(jt(t,e))return;i.uniform2uiv(this.addr,e),Qt(t,e)}}function RA(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(jt(t,e))return;i.uniform3uiv(thi Line truncated
`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){let a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(` `),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){let a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(`
`)}var sy=new Xe;function sE(i){it._getMatrix(sy,it.workingColorSpace,i);let e=`mat3( ${sy.elements.map(t=>t.toFixed(4))} )`;switch(it.getTransfer(i)){case ba:return[e,"LinearTransferOETF"];case Mt:return[e,"sRGBTransferOETF"];default:return Oe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function oy(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+` `)}var sb=new Xe;function sE(i){it._getMatrix(sb,it.workingColorSpace,i);let e=`mat3( ${sb.elements.map(t=>t.toFixed(4))} )`;switch(it.getTransfer(i)){case ya:return[e,"LinearTransferOETF"];case Mt:return[e,"sRGBTransferOETF"];default:return Oe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function ob(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+`
`+s+` `+s+`
@@ -4131,7 +4131,7 @@ void main() {
`)}var aE={[nd]:"Linear",[id]:"Reinhard",[rd]:"Cineon",[sd]:"ACESFilmic",[ad]:"AgX",[ld]:"Neutral",[od]:"Custom"};function lE(i,e){let t=aE[e];return t===void 0?(Oe("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var Du=new U;function cE(){it.getLuminanceCoefficients(Du);let i=Du.x.toFixed(4),e=Du.y.toFixed(4),t=Du.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` `)}var aE={[nd]:"Linear",[id]:"Reinhard",[rd]:"Cineon",[sd]:"ACESFilmic",[ad]:"AgX",[ld]:"Neutral",[od]:"Custom"};function lE(i,e){let t=aE[e];return t===void 0?(Oe("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var Du=new U;function cE(){it.getLuminanceCoefficients(Du);let i=Du.x.toFixed(4),e=Du.y.toFixed(4),t=Du.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
`)}function uE(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(tl).join(` `)}function uE(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(tl).join(`
`)}function hE(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` `)}function hE(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
`)}function fE(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let s=i.getActiveAttrib(e,r),o=s.name,a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function tl(i){return i!==""}function ay(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_SUN_LIGHTS/g,e.numSunLights).replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g,e.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows).replace(/NUM_LIGHT_PROBE_GRIDS/g,e.numLightProbeGrids)}function ly(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var dE=/^[ \t]*#include +<([\w\d./]+)>/gm;function Vd(i){return i.replace(dE,pE)}function pE(i,e){let t=tt[e];if(t===void 0)throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">");return Vd(t)}var mE=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function cy(i){return i.replace(mE,gE)}function gE(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function uy(i){let e=`precision ${i.precision} float; `)}function fE(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let s=i.getActiveAttrib(e,r),o=s.name,a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function tl(i){return i!==""}function ab(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_SUN_LIGHTS/g,e.numSunLights).replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g,e.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows).replace(/NUM_LIGHT_PROBE_GRIDS/g,e.numLightProbeGrids)}function lb(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var dE=/^[ \t]*#include +<([\w\d./]+)>/gm;function Vd(i){return i.replace(dE,pE)}function pE(i,e){let t=tt[e];if(t===void 0)throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">");return Vd(t)}var mE=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function cb(i){return i.replace(mE,gE)}function gE(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function ub(i){let e=`precision ${i.precision} float;
precision ${i.precision} int; precision ${i.precision} int;
precision ${i.precision} sampler2D; precision ${i.precision} sampler2D;
precision ${i.precision} samplerCube; precision ${i.precision} samplerCube;
@@ -4151,28 +4151,28 @@ void main() {
`;return i.precision==="highp"?e+=` `;return i.precision==="highp"?e+=`
#define HIGH_PRECISION`:i.precision==="mediump"?e+=` #define HIGH_PRECISION`:i.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=` #define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}var xE={[Wa]:"SHADOWMAP_TYPE_PCF",[Mo]:"SHADOWMAP_TYPE_VSM"};function yE(i){return xE[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var bE={[So]:"ENVMAP_MODE_REFRACTION"};function vE(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":bE[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var _E={[$c]:"ENVMAP_BLENDING_MULTIPLY",[Sx]:"ENVMAP_BLENDING_MIX",[wx]:"ENVMAP_BLENDING_ADD"};function ME(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":_E[i.combine]||"ENVMAP_BLENDING_NONE"}function SE(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=yE(t),c=t.envMapPMREM===!0?"ENVMAP_TYPE_PMREM":"ENVMAP_TYPE_CUBE",u=vE(t),h=ME(t),f=uE(t),d=hE(s),p=r.createProgram(),x,g,m=t.glslVersion?"#version "+t.glslVersion+` #define LOW_PRECISION`),e}var xE={[Wa]:"SHADOWMAP_TYPE_PCF",[Mo]:"SHADOWMAP_TYPE_VSM"};function bE(i){return xE[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var yE={[So]:"ENVMAP_MODE_REFRACTION"};function vE(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":yE[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var _E={[$c]:"ENVMAP_BLENDING_MULTIPLY",[Sx]:"ENVMAP_BLENDING_MIX",[wx]:"ENVMAP_BLENDING_ADD"};function ME(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":_E[i.combine]||"ENVMAP_BLENDING_NONE"}function SE(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=bE(t),c=t.envMapPMREM===!0?"ENVMAP_TYPE_PMREM":"ENVMAP_TYPE_CUBE",u=vE(t),h=ME(t),f=uE(t),d=hE(s),p=r.createProgram(),x,g,m=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(x=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d].filter(tl).join(` `:"";t.isRawShaderMaterial?(x=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d].filter(tl).join(`
`),x.length>0&&(x+=` `),x.length>0&&(x+=`
`),g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d].filter(tl).join(` `),g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d].filter(tl).join(`
`),g.length>0&&(g+=` `),g.length>0&&(g+=`
`)):(x=[uy(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.diffuseRoughnessMapUv?"#define DIFFUSE_ROUGHNESSMAP_UV "+t.diffuseRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_ Line truncated `)):(x=[ub(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.diffuseRoughnessMapUv?"#define DIFFUSE_ROUGHNESSMAP_UV "+t.diffuseRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_ Line truncated
`].filter(tl).join(` `].filter(tl).join(`
`),g=[uy(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",t.envMapPMREM?"#define ENVMAP_MAX_LOD "+t.envMapMaxLod+".0":"",t.envMapPMREM?"#define ENVMAP_SIZE "+t.envMapSize+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.diffuseRoughness?"#define USE_DIFFUSE_ROUGHNESS":"",t.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.retroreflection?"#define USE_RETROREFLECTION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ri?"#define TONE_MAPPING":"",t.toneMapping!==Ri?tt.tonemapping_pars_fragment:"",t.toneMapping!==Ri?lE("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",tt.colorspace_pars_fragment,oE("linearToOutputTexel",t.outputColorSpace),cE(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `),g=[ub(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",t.envMapPMREM?"#define ENVMAP_MAX_LOD "+t.envMapMaxLod+".0":"",t.envMapPMREM?"#define ENVMAP_SIZE "+t.envMapSize+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.diffuseRoughness?"#define USE_DIFFUSE_ROUGHNESS":"",t.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.retroreflection?"#define USE_RETROREFLECTION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ri?"#define TONE_MAPPING":"",t.toneMapping!==Ri?tt.tonemapping_pars_fragment:"",t.toneMapping!==Ri?lE("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",tt.colorspace_pars_fragment,oE("linearToOutputTexel",t.outputColorSpace),cE(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(tl).join(` `].filter(tl).join(`
`)),o=Vd(o),o=ay(o,t),o=ly(o,t),a=Vd(a),a=ay(a,t),a=ly(a,t),o=cy(o),a=cy(a),t.isRawShaderMaterial!==!0&&(m=`#version 300 es `)),o=Vd(o),o=ab(o,t),o=lb(o,t),a=Vd(a),a=ab(a,t),a=lb(a,t),o=cb(o),a=cb(a),t.isRawShaderMaterial!==!0&&(m=`#version 300 es
`,x=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(` `,x=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+` `)+`
`+x,g=["#define varying in",t.glslVersion===Md?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Md?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `+x,g=["#define varying in",t.glslVersion===Md?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Md?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+` `)+`
`+g);let y=m+x+o,_=m+g+a,b=ry(r,r.VERTEX_SHADER,y),M=ry(r,r.FRAGMENT_SHADER,_);r.attachShader(p,b),r.attachShader(p,M),t.index0AttributeName!==void 0?r.bindAttribLocation(p,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(p,0,"position"),r.linkProgram(p);function S(T){if(i.debug.checkShaderErrors){let C=r.getProgramInfoLog(p)||"",L=r.getShaderInfoLog(b)||"",O=r.getShaderInfoLog(M)||"",P=C.trim(),I=L.trim(),D=O.trim(),F=!0,H=!0;if(r.getProgramParameter(p,r.LINK_STATUS)===!1)if(F=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,p,b,M);else{let k=oy(r,b,"vertex"),X=oy(r,M,"fragment");We("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(p,r.VALIDATE_STATUS)+` `+g);let b=m+x+o,_=m+g+a,y=rb(r,r.VERTEX_SHADER,b),M=rb(r,r.FRAGMENT_SHADER,_);r.attachShader(p,y),r.attachShader(p,M),t.index0AttributeName!==void 0?r.bindAttribLocation(p,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(p,0,"position"),r.linkProgram(p);function S(T){if(i.debug.checkShaderErrors){let C=r.getProgramInfoLog(p)||"",L=r.getShaderInfoLog(y)||"",O=r.getShaderInfoLog(M)||"",P=C.trim(),I=L.trim(),D=O.trim(),F=!0,H=!0;if(r.getProgramParameter(p,r.LINK_STATUS)===!1)if(F=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,p,y,M);else{let k=ob(r,y,"vertex"),X=ob(r,M,"fragment");We("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(p,r.VALIDATE_STATUS)+`
Material Name: `+T.name+` Material Name: `+T.name+`
Material Type: `+T.type+` Material Type: `+T.type+`
Program Info Log: `+P+` Program Info Log: `+P+`
`+k+` `+k+`
`+X)}else P!==""?Oe("WebGLProgram: Program Info Log:",P):(I===""||D==="")&&(H=!1);H&&(T.diagnostics={runnable:F,programLog:P,vertexShader:{log:I,prefix:x},fragmentShader:{log:D,prefix:g}})}r.deleteShader(b),r.deleteShader(M),v=new Eo(r,p),w=fE(r,p)}let v;this.getUniforms=function(){return v===void 0&&S(this),v};let w;this.getAttributes=function(){return w===void 0&&S(this),w};let R=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return R===!1&&(R=r.getProgramParameter(p,nE)),R},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(p),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=iE++,this.cacheKey=e,this.usedTimes=1,this.program=p,this.vertexShader=b,this.fragmentShader=M,this}var wE=0,Gd=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new Hd(e),t.set(e,n)),n}},Hd=class{constructor(e){this.id=wE++,this.code=e,this.usedTimes=0}};function TE(i){return i===Br||i===Za||i===Ja}function AE(i,e,t,n,r,s){let o=new po,a=new Gd,l=new Set,c=[],u=new Map,h=n.logarithmicDepthBuffer,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function d(v){return l.add(v),v===0?"uv":`uv${v}`}function p(v,w,R,T,C,L){let O=T.fog,P=C.geometry,I=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?T.environment:null,D=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,F=e.get(v.envMap||I,D),H=f[v.type],k=n.precision;v.precision!==null&&(k=n.getMaxPrecision(v.precision),k!==v.precision&&Oe("WebGLProgram.getParameters:",v.precision,"not supported, using",k,"instead."));let X=P.morphAttributes.position||P.morphAttributes.normal||P.morphAttributes.color,V=X!==void 0?X.length:0,re=0;P.morphAttributes.position!==void 0&&(re=1),P.morphAttributes.normal!==void 0&&(re=2),P.morphAttributes.color!==void 0&&(re=3);let ye,Y,Q,se;if(H){let ve=Ii[H];ye=ve.vertexShader,Y=ve.fragmentShader}else{ye=v.vertexShader,Y=v.fragmentShader;let ve=a.getVertexShaderStage(v),St=a.getFragmentShaderStage(v);a.update(v,ve,St),Q=ve.id,se=St.id}let we=i.getRenderTarget(),le=i.state.buffers.depth.getReversed(),Ne=C.isInstancedMesh===!0,at=C.isBatchedMesh===!0,Ae=!!v.map,ft=!!v.matcap,yt=!!F,nt=yt&&F.isPMREMTexture===!0,Yt=!!v.aoMap,Bt=!!v.lightMap,on=!!v.bumpMap&&v.wireframe===!1,Nt=!!v.normalMap,xi=!!v.displacementMap,en=!!v.emissiveMap,Hn=!!v.metalnessMap,Wn=!!v.roughnessMap,Xn=v.anisotropy>0,G=v.clearcoat>0,Yn=v.diffuseRoughness>0,Pt=v.dispersion>0,It=v.retroreflectivity>0,be=v.iridescence>0,Zt=v.sheen>0,Ve=v.transmission>0,qe=Xn&&!!v.anisotropyMap,N=G&&!!v.clearcoatMap,A=G&&!!v.clearcoatNormalMap,K=G&&!!v.clearcoatRoughnessMap,oe=Yn&&!!v.diffuseRoughnessMap,ie=be&&!!v.iridescenceMap,he=be&&!!v.iridescenceThicknessMap,ge=Zt&&!!v.sheenColorMap,ee=Zt&&!!v.sheenRoughnessMap,te=!!v.specularMap,de=!!v.specularColorMap,B=!!v.specularIntensityMap,ne=Ve&&!!v.transmissionMap,j=Ve&&!!v.thicknessMap,pe=!!v.gradientMap,ce=!!v.alphaMap,fe=v.alphaTest>0,De=!!v.alphaHash,Qe=!!v.extensions,ae=Ri;v.toneMapped&&(we===null||we.isXRRenderTarget===!0)&&(ae=i.toneMapping);let ke=nt?F.isCompressedCubeTexture?F.image[0].mipmaps:F.mipmaps:null,je={shaderID:H,shaderType:v.type,shaderName:v.name,vertexShader:ye,fragmentShader:Y,defines:v.defines,customVertexShaderID:Q,customFragmentShaderID:se,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:k,batching:at,batchingColor:at&&C._colorsTexture!==null,instancing:Ne,instancingColor:Ne&&C.instanceColor!==null,instancingMorph:Ne&&C.morphTexture!==null,outputColorSpace:we===null?i.outputColorSpace:we.isXRRenderTarget===!0?we.texture.colorSpace:it.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:Ae,matcap:ft,envMap:yt,envMapMode:yt&&F.mapping,envMapPMREM:nt,envMapMaxLod:nt?ke.length-1:null,envMapSize:nt?ke[0].width:null,aoMap:Yt,lightMap:Bt,bumpMap:on,normalMap:Nt,displacementMap:xi,emissiveMap:en,normalMapObjec Line truncated `+X)}else P!==""?Oe("WebGLProgram: Program Info Log:",P):(I===""||D==="")&&(H=!1);H&&(T.diagnostics={runnable:F,programLog:P,vertexShader:{log:I,prefix:x},fragmentShader:{log:D,prefix:g}})}r.deleteShader(y),r.deleteShader(M),v=new Eo(r,p),w=fE(r,p)}let v;this.getUniforms=function(){return v===void 0&&S(this),v};let w;this.getAttributes=function(){return w===void 0&&S(this),w};let R=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return R===!1&&(R=r.getProgramParameter(p,nE)),R},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(p),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=iE++,this.cacheKey=e,this.usedTimes=1,this.program=p,this.vertexShader=y,this.fragmentShader=M,this}var wE=0,Gd=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new Hd(e),t.set(e,n)),n}},Hd=class{constructor(e){this.id=wE++,this.code=e,this.usedTimes=0}};function TE(i){return i===Br||i===Za||i===Ja}function AE(i,e,t,n,r,s){let o=new po,a=new Gd,l=new Set,c=[],u=new Map,h=n.logarithmicDepthBuffer,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function d(v){return l.add(v),v===0?"uv":`uv${v}`}function p(v,w,R,T,C,L){let O=T.fog,P=C.geometry,I=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?T.environment:null,D=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,F=e.get(v.envMap||I,D),H=f[v.type],k=n.precision;v.precision!==null&&(k=n.getMaxPrecision(v.precision),k!==v.precision&&Oe("WebGLProgram.getParameters:",v.precision,"not supported, using",k,"instead."));let X=P.morphAttributes.position||P.morphAttributes.normal||P.morphAttributes.color,V=X!==void 0?X.length:0,re=0;P.morphAttributes.position!==void 0&&(re=1),P.morphAttributes.normal!==void 0&&(re=2),P.morphAttributes.color!==void 0&&(re=3);let be,Y,Q,se;if(H){let ve=Ii[H];be=ve.vertexShader,Y=ve.fragmentShader}else{be=v.vertexShader,Y=v.fragmentShader;let ve=a.getVertexShaderStage(v),St=a.getFragmentShaderStage(v);a.update(v,ve,St),Q=ve.id,se=St.id}let we=i.getRenderTarget(),le=i.state.buffers.depth.getReversed(),Ne=C.isInstancedMesh===!0,at=C.isBatchedMesh===!0,Ae=!!v.map,ft=!!v.matcap,bt=!!F,nt=bt&&F.isPMREMTexture===!0,Yt=!!v.aoMap,Bt=!!v.lightMap,on=!!v.bumpMap&&v.wireframe===!1,Nt=!!v.normalMap,xi=!!v.displacementMap,en=!!v.emissiveMap,Hn=!!v.metalnessMap,Wn=!!v.roughnessMap,Xn=v.anisotropy>0,G=v.clearcoat>0,Yn=v.diffuseRoughness>0,Pt=v.dispersion>0,It=v.retroreflectivity>0,ye=v.iridescence>0,Zt=v.sheen>0,Ve=v.transmission>0,qe=Xn&&!!v.anisotropyMap,N=G&&!!v.clearcoatMap,A=G&&!!v.clearcoatNormalMap,K=G&&!!v.clearcoatRoughnessMap,oe=Yn&&!!v.diffuseRoughnessMap,ie=ye&&!!v.iridescenceMap,he=ye&&!!v.iridescenceThicknessMap,ge=Zt&&!!v.sheenColorMap,ee=Zt&&!!v.sheenRoughnessMap,te=!!v.specularMap,de=!!v.specularColorMap,B=!!v.specularIntensityMap,ne=Ve&&!!v.transmissionMap,j=Ve&&!!v.thicknessMap,pe=!!v.gradientMap,ce=!!v.alphaMap,fe=v.alphaTest>0,De=!!v.alphaHash,Qe=!!v.extensions,ae=Ri;v.toneMapped&&(we===null||we.isXRRenderTarget===!0)&&(ae=i.toneMapping);let ke=nt?F.isCompressedCubeTexture?F.image[0].mipmaps:F.mipmaps:null,je={shaderID:H,shaderType:v.type,shaderName:v.name,vertexShader:be,fragmentShader:Y,defines:v.defines,customVertexShaderID:Q,customFragmentShaderID:se,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:k,batching:at,batchingColor:at&&C._colorsTexture!==null,instancing:Ne,instancingColor:Ne&&C.instanceColor!==null,instancingMorph:Ne&&C.morphTexture!==null,outputColorSpace:we===null?i.outputColorSpace:we.isXRRenderTarget===!0?we.texture.colorSpace:it.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:Ae,matcap:ft,envMap:bt,envMapMode:bt&&F.mapping,envMapPMREM:nt,envMapMaxLod:nt?ke.length-1:null,envMapSize:nt?ke[0].width:null,aoMap:Yt,lightMap:Bt,bumpMap:on,normalMap:Nt,displacementMap:xi,emissiveMap:en,normalMapObjec Line truncated
gl_Position = vec4( position, 1.0 ); gl_Position = vec4( position, 1.0 );
}`,UE=`uniform sampler2D shadow_pass; }`,UE=`uniform sampler2D shadow_pass;
uniform vec2 resolution; uniform vec2 resolution;
@@ -4199,7 +4199,7 @@ void main() {
squared_mean = squared_mean / samples; squared_mean = squared_mean / samples;
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
}`,kE=[new U(1,0,0),new U(-1,0,0),new U(0,1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1)],BE=[new U(0,-1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1),new U(0,-1,0),new U(0,-1,0)],py=new ze,el=new U,Ud=new U;function zE(i,e,t){let n=new Nr,r=new Ue,s=new Ue,o=new vt,a=new Uc,l=new kc,c={},u=t.maxTextureSize,h={[Ai]:un,[un]:Ai,[ht]:ht},f=new Si({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ue},radius:{value:4}},vertexShader:DE,fragmentShader:UE}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let p=new Pe;p.setAttribute("position",new wt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let x=new Se(p,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Wa;let m=this.type;this.render=function(S,v,w){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||S.length===0)return;this.type===rx&&(Oe("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=Wa);let R=i.getRenderTarget(),T=i.getActiveCubeFace(),C=i.getActiveMipmapLevel(),L=i.state;L.setBlending(xs),L.buffers.depth.getReversed()===!0?L.buffers.color.setClear(0,0,0,0):L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);let O=m!==this.type;O&&v.traverse(function(P){P.material&&(Array.isArray(P.material)?P.material.forEach(I=>I.needsUpdate=!0):P.material.needsUpdate=!0)});for(let P=0,I=S.length;P<I;P++){let D=S[P],F=D.shadow;if(F===void 0){Oe("WebGLShadowMap:",D,"has no shadow.");continue}if(F.autoUpdate===!1&&F.needsUpdate===!1)continue;r.copy(F.mapSize);let H=F.getFrameExtents();r.multiply(H),s.copy(F.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/H.x),r.x=s.x*H.x,F.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/H.y),r.y=s.y*H.y,F.mapSize.y=s.y));let k=i.state.buffers.depth.getReversed();if(F.camera._reversedDepth=k,F.map===null||O===!0){if(F.map!==null&&(F.map.depthTexture!==null&&(F.map.depthTexture.dispose(),F.map.depthTexture=null),F.map.dispose()),this.type===Mo){if(D.isPointLight){Oe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}F.map=new wn(r.x,r.y,{format:Br,type:li,minFilter:Ht,magFilter:Ht,generateMipmaps:!1}),F.map.texture.name=D.name+".shadowMap",F.map.depthTexture=new nr(r.x,r.y,Vn),F.map.depthTexture.name=D.name+".shadowMapDepth",F.map.depthTexture.format=Zi,F.map.depthTexture.compareFunction=null,F.map.depthTexture.minFilter=Ut,F.map.depthTexture.magFilter=Ut}else D.isPointLight?(F.map=new nl(r.x),F.map.depthTexture=new Ea(r.x,ai)):(F.map=new wn(r.x,r.y),F.map.depthTexture=new nr(r.x,r.y,ai)),F.map.depthTexture.name=D.name+".shadowMap",F.map.depthTexture.format=Zi,this.type===Wa?(F.map.depthTexture.compareFunction=k?yd:xd,F.map.depthTexture.minFilter=Ht,F.map.depthTexture.magFilter=Ht):(F.map.depthTexture.compareFunction=null,F.map.depthTexture.minFilter=Ut,F.map.depthTexture.magFilter=Ut);F.camera.updateProjectionMatrix()}F.map.isWebGLCubeRenderTarget!==!0&&(F.map.width!==r.x||F.map.height!==r.y)&&F.map.setSize(r.x,r.y);let X=F.map.isWebGLCubeRenderTarget?6:F.getViewportCount();D.isPointLight!==!0&&F.updateMatrices(D,w);let V=(F.camera.layers.mask&4294967294)!==0?F.camera.layers:w.layers;for(let re=0;re<X;re++){let ye=F.getCamera(re);if(D.isPointLight){let Y=F.camera,Q=F.matrix,se=D.distance||Y.far;se!==Y.far&&(Y.far=se,Y.updateProjectionMatrix()),el.setFromMatrixPosition(D.matrixWorld),Y.position.copy(el),Ud.copy(Y.position),Ud.add(kE[re]),Y.up.copy(BE[re]),Y.lookAt(Ud),Y.updateMatrixWorld(),Q.makeTranslation(-el.x,-el.y,-el.z),py.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),F._frustum.setFromProjectionMatrix(py,Y.coordinateSystem,Y.reversedDepth)}if(F.map.isWebGLCubeRenderTarget)i.setRenderTarget(F.map,re),i.clear();else{re===0&&(i.setRenderTarget(F.map),i.clear());let Y=F.getViewport(re);o.set(s.x*Y.x,s.y*Y.y,s.x*Y.z,s.y*Y.w),L.viewport(o)}n=F.getFrustum(re),b(v,w,ye,D,V,this.type)}F.isPointLightShadow!==!0&&this.type===Mo&&y(F,w),F.needsUpdate=!1}m=this.type,g.needsUpdate=!1,i.setRenderTarget(R,T,C)};function y(S,v){let w=e.update(x);f.defines.VSM_SAMPLES!==S.blurSamples&&(f.defines.VSM_SAMPLES=S.blurSamples,d.defines.VSM_SAMPLES=S.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),S.mapPass===null?S.mapPass=new wn(r.x,r.y,{format:Br,type:li}):(S.mapPass.width!==S.map.width||S.mapPass.height!==S.map.height)&&S.mapPass.setSize(S.map.width,S.map.height),f.uniforms.shadow_pass.value=S.map.depthTexture,f.uniforms.resolution.value.set(S.map.width,S.map.height),f.uniforms.radius.value=S.radius,i.setRenderTarget(S.mapPass),i.clear(),i.renderBufferDirect(v,null,w,f,x,null),d.uniforms.shadow_pass.value=S.mapPass.texture,d.uniforms.resolution.value.set(S.map.width,S.map.height),d.uniforms.radius.value=S.radius,i.setRenderTarget(S.map),i.clear(),i.renderBufferDirect(v,null,w,d,x,null)}function _(S,v,w,R){let T=null,C=w.isPointLight===!0?S.customDistanceMaterial:S.customDepthMaterial;if(C!==void 0)T=C;else if(T=w.isPointLight===!0?l:a,i.localClippingEnabled& Line truncated }`,kE=[new U(1,0,0),new U(-1,0,0),new U(0,1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1)],BE=[new U(0,-1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1),new U(0,-1,0),new U(0,-1,0)],pb=new ze,el=new U,Ud=new U;function zE(i,e,t){let n=new Nr,r=new Ue,s=new Ue,o=new vt,a=new Uc,l=new kc,c={},u=t.maxTextureSize,h={[Ai]:un,[un]:Ai,[ht]:ht},f=new Si({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ue},radius:{value:4}},vertexShader:DE,fragmentShader:UE}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let p=new Pe;p.setAttribute("position",new wt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let x=new Se(p,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Wa;let m=this.type;this.render=function(S,v,w){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||S.length===0)return;this.type===rx&&(Oe("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=Wa);let R=i.getRenderTarget(),T=i.getActiveCubeFace(),C=i.getActiveMipmapLevel(),L=i.state;L.setBlending(xs),L.buffers.depth.getReversed()===!0?L.buffers.color.setClear(0,0,0,0):L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);let O=m!==this.type;O&&v.traverse(function(P){P.material&&(Array.isArray(P.material)?P.material.forEach(I=>I.needsUpdate=!0):P.material.needsUpdate=!0)});for(let P=0,I=S.length;P<I;P++){let D=S[P],F=D.shadow;if(F===void 0){Oe("WebGLShadowMap:",D,"has no shadow.");continue}if(F.autoUpdate===!1&&F.needsUpdate===!1)continue;r.copy(F.mapSize);let H=F.getFrameExtents();r.multiply(H),s.copy(F.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/H.x),r.x=s.x*H.x,F.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/H.y),r.y=s.y*H.y,F.mapSize.y=s.y));let k=i.state.buffers.depth.getReversed();if(F.camera._reversedDepth=k,F.map===null||O===!0){if(F.map!==null&&(F.map.depthTexture!==null&&(F.map.depthTexture.dispose(),F.map.depthTexture=null),F.map.dispose()),this.type===Mo){if(D.isPointLight){Oe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}F.map=new wn(r.x,r.y,{format:Br,type:li,minFilter:Ht,magFilter:Ht,generateMipmaps:!1}),F.map.texture.name=D.name+".shadowMap",F.map.depthTexture=new nr(r.x,r.y,Vn),F.map.depthTexture.name=D.name+".shadowMapDepth",F.map.depthTexture.format=Zi,F.map.depthTexture.compareFunction=null,F.map.depthTexture.minFilter=Ut,F.map.depthTexture.magFilter=Ut}else D.isPointLight?(F.map=new nl(r.x),F.map.depthTexture=new Ea(r.x,ai)):(F.map=new wn(r.x,r.y),F.map.depthTexture=new nr(r.x,r.y,ai)),F.map.depthTexture.name=D.name+".shadowMap",F.map.depthTexture.format=Zi,this.type===Wa?(F.map.depthTexture.compareFunction=k?bd:xd,F.map.depthTexture.minFilter=Ht,F.map.depthTexture.magFilter=Ht):(F.map.depthTexture.compareFunction=null,F.map.depthTexture.minFilter=Ut,F.map.depthTexture.magFilter=Ut);F.camera.updateProjectionMatrix()}F.map.isWebGLCubeRenderTarget!==!0&&(F.map.width!==r.x||F.map.height!==r.y)&&F.map.setSize(r.x,r.y);let X=F.map.isWebGLCubeRenderTarget?6:F.getViewportCount();D.isPointLight!==!0&&F.updateMatrices(D,w);let V=(F.camera.layers.mask&4294967294)!==0?F.camera.layers:w.layers;for(let re=0;re<X;re++){let be=F.getCamera(re);if(D.isPointLight){let Y=F.camera,Q=F.matrix,se=D.distance||Y.far;se!==Y.far&&(Y.far=se,Y.updateProjectionMatrix()),el.setFromMatrixPosition(D.matrixWorld),Y.position.copy(el),Ud.copy(Y.position),Ud.add(kE[re]),Y.up.copy(BE[re]),Y.lookAt(Ud),Y.updateMatrixWorld(),Q.makeTranslation(-el.x,-el.y,-el.z),pb.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),F._frustum.setFromProjectionMatrix(pb,Y.coordinateSystem,Y.reversedDepth)}if(F.map.isWebGLCubeRenderTarget)i.setRenderTarget(F.map,re),i.clear();else{re===0&&(i.setRenderTarget(F.map),i.clear());let Y=F.getViewport(re);o.set(s.x*Y.x,s.y*Y.y,s.x*Y.z,s.y*Y.w),L.viewport(o)}n=F.getFrustum(re),y(v,w,be,D,V,this.type)}F.isPointLightShadow!==!0&&this.type===Mo&&b(F,w),F.needsUpdate=!1}m=this.type,g.needsUpdate=!1,i.setRenderTarget(R,T,C)};function b(S,v){let w=e.update(x);f.defines.VSM_SAMPLES!==S.blurSamples&&(f.defines.VSM_SAMPLES=S.blurSamples,d.defines.VSM_SAMPLES=S.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),S.mapPass===null?S.mapPass=new wn(r.x,r.y,{format:Br,type:li}):(S.mapPass.width!==S.map.width||S.mapPass.height!==S.map.height)&&S.mapPass.setSize(S.map.width,S.map.height),f.uniforms.shadow_pass.value=S.map.depthTexture,f.uniforms.resolution.value.set(S.map.width,S.map.height),f.uniforms.radius.value=S.radius,i.setRenderTarget(S.mapPass),i.clear(),i.renderBufferDirect(v,null,w,f,x,null),d.uniforms.shadow_pass.value=S.mapPass.texture,d.uniforms.resolution.value.set(S.map.width,S.map.height),d.uniforms.radius.value=S.radius,i.setRenderTarget(S.map),i.clear(),i.renderBufferDirect(v,null,w,d,x,null)}function _(S,v,w,R){let T=null,C=w.isPointLight===!0?S.customDistanceMaterial:S.customDepthMaterial;if(C!==void 0)T=C;else if(T=w.isPointLight===!0?l:a,i.localClippingEnabled& Line truncated
void main() { void main() {
gl_Position = vec4( position, 1.0 ); gl_Position = vec4( position, 1.0 );
@@ -4223,7 +4223,7 @@ void main() {
} }
}`,Wd=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Ra(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new Si({vertexShader:WE,fragmentShader:XE,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Se(new sn(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Xd=class extends vi{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,f=null,d=null,p=null,x=typeof XRWebGLBinding<"u",g=new Wd,m={},y=t.getContextAttributes(),_=null,b=null,M=[],S=[],v=new Ue,w=null,R=null,T=new Jt;T.viewport=new vt;let C=new Jt;C.viewport=new vt;let L=[T,C],O=new Yc,P=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let Q=M[Y];return Q===void 0&&(Q=new mo,M[Y]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(Y){let Q=M[Y];return Q===void 0&&(Q=new mo,M[Y]=Q),Q.getGripSpace()},this.getHand=function(Y){let Q=M[Y];return Q===void 0&&(Q=new mo,M[Y]=Q),Q.getHandSpace()};function D(Y){let Q=S.indexOf(Y.inputSource);if(Q===-1)return;let se=M[Q];se!==void 0&&(se.update(Y.inputSource,Y.frame,c||o),se.dispatchEvent({type:Y.type,data:Y.inputSource}))}function F(){r.removeEventListener("select",D),r.removeEventListener("selectstart",D),r.removeEventListener("selectend",D),r.removeEventListener("squeeze",D),r.removeEventListener("squeezestart",D),r.removeEventListener("squeezeend",D),r.removeEventListener("end",F),r.removeEventListener("inputsourceschange",H);for(let Y=0;Y<M.length;Y++){let Q=S[Y];Q!==null&&(S[Y]=null,M[Y].disconnect(Q))}P=null,I=null,g.reset();for(let Y in m)delete m[Y];if(e.setRenderTarget(_),d=null,f=null,h=null,r=null,b=null,ye.stop(),n.isPresenting=!1,e.setPixelRatio(w),e.setSize(v.width,v.height,!1),R!==null){let Y=R.camera;Y.fov=R.fov,Y.zoom=R.zoom,Y.updateProjectionMatrix(),R=null}n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,n.isPresenting===!0&&Oe("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){a=Y,n.isPresenting===!0&&Oe("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Y){c=Y},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return h===null&&x&&(h=new XRWebGLBinding(r,t)),h},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(Y){if(r=Y,r!==null){if(_=e.getRenderTarget(),r.addEventListener("select",D),r.addEventListener("selectstart",D),r.addEventListener("selectend",D),r.addEventListener("squeeze",D),r.addEventListener("squeezestart",D),r.addEventListener("squeezeend",D),r.addEventListener("end",F),r.addEventListener("inputsourceschange",H),y.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(v),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let se=null,we=null,le=null;y.depth&&(le=y.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,se=y.stencil?hr:Zi,we=y.stencil?vs:ai);let Ne={colorFormat:t.RGBA8,depthFormat:le,scaleFactor:s};h=this.getBinding(),f=h.createProjectionLayer(Ne),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),b=new wn(f.textureWidth,f.textureHeight,{format:On,type:Nn,depthTexture:new nr(f.textureWidth,f.textureHeight,we,void 0,void 0,void 0,void 0,void 0,void 0,se),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1,storeMultisampledDepthBuffer:f.ignoreDepthValues===!1,storeMultisampledStencilBuffer:f.ignoreDepthValues===!1})}else{let se={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(r,t,se),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),b=new wn(d.framebufferWidth,d.framebufferHeight,{format:On,type:Nn,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,storeMultisampledDepthBuffer:d.ignoreDepthValues===!1,storeMultisampledStencilBuffer:d.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),ye.setContext(r),ye.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function H(Y){for(let Q=0;Q<Y.removed.length;Q++){let se=Y.removed[Q],we=S.indexOf(se);we>=0&& Line truncated }`,Wd=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Ra(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new Si({vertexShader:WE,fragmentShader:XE,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Se(new sn(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Xd=class extends vi{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,f=null,d=null,p=null,x=typeof XRWebGLBinding<"u",g=new Wd,m={},b=t.getContextAttributes(),_=null,y=null,M=[],S=[],v=new Ue,w=null,R=null,T=new Jt;T.viewport=new vt;let C=new Jt;C.viewport=new vt;let L=[T,C],O=new Yc,P=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let Q=M[Y];return Q===void 0&&(Q=new mo,M[Y]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(Y){let Q=M[Y];return Q===void 0&&(Q=new mo,M[Y]=Q),Q.getGripSpace()},this.getHand=function(Y){let Q=M[Y];return Q===void 0&&(Q=new mo,M[Y]=Q),Q.getHandSpace()};function D(Y){let Q=S.indexOf(Y.inputSource);if(Q===-1)return;let se=M[Q];se!==void 0&&(se.update(Y.inputSource,Y.frame,c||o),se.dispatchEvent({type:Y.type,data:Y.inputSource}))}function F(){r.removeEventListener("select",D),r.removeEventListener("selectstart",D),r.removeEventListener("selectend",D),r.removeEventListener("squeeze",D),r.removeEventListener("squeezestart",D),r.removeEventListener("squeezeend",D),r.removeEventListener("end",F),r.removeEventListener("inputsourceschange",H);for(let Y=0;Y<M.length;Y++){let Q=S[Y];Q!==null&&(S[Y]=null,M[Y].disconnect(Q))}P=null,I=null,g.reset();for(let Y in m)delete m[Y];if(e.setRenderTarget(_),d=null,f=null,h=null,r=null,y=null,be.stop(),n.isPresenting=!1,e.setPixelRatio(w),e.setSize(v.width,v.height,!1),R!==null){let Y=R.camera;Y.fov=R.fov,Y.zoom=R.zoom,Y.updateProjectionMatrix(),R=null}n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,n.isPresenting===!0&&Oe("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){a=Y,n.isPresenting===!0&&Oe("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Y){c=Y},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return h===null&&x&&(h=new XRWebGLBinding(r,t)),h},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(Y){if(r=Y,r!==null){if(_=e.getRenderTarget(),r.addEventListener("select",D),r.addEventListener("selectstart",D),r.addEventListener("selectend",D),r.addEventListener("squeeze",D),r.addEventListener("squeezestart",D),r.addEventListener("squeezeend",D),r.addEventListener("end",F),r.addEventListener("inputsourceschange",H),b.xrCompatible!==!0&&await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(v),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let se=null,we=null,le=null;b.depth&&(le=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,se=b.stencil?hr:Zi,we=b.stencil?vs:ai);let Ne={colorFormat:t.RGBA8,depthFormat:le,scaleFactor:s};h=this.getBinding(),f=h.createProjectionLayer(Ne),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),y=new wn(f.textureWidth,f.textureHeight,{format:On,type:Nn,depthTexture:new nr(f.textureWidth,f.textureHeight,we,void 0,void 0,void 0,void 0,void 0,void 0,se),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1,storeMultisampledDepthBuffer:f.ignoreDepthValues===!1,storeMultisampledStencilBuffer:f.ignoreDepthValues===!1})}else{let se={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(r,t,se),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),y=new wn(d.framebufferWidth,d.framebufferHeight,{format:On,type:Nn,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,storeMultisampledDepthBuffer:d.ignoreDepthValues===!1,storeMultisampledStencilBuffer:d.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),be.setContext(r),be.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function H(Y){for(let Q=0;Q<Y.removed.length;Q++){let se=Y.removed[Q],we=S.indexOf(se);we>=0&& Line truncated
varying vec3 vNfGround; varying vec3 vNfGround;
varying float vNfSurface; varying float vNfSurface;
varying vec2 vNfSurfaceTransform; varying vec2 vNfSurfaceTransform;
@@ -4245,10 +4245,11 @@ float nfJoint(float v, float width) {
} }
// Keep the material recognizable in the day look: its general theme otherwise maps dark asphalt to near-white. // Keep the material recognizable in the day look: its general theme otherwise maps dark asphalt to near-white.
vec3 nfOutdoorDay(float kind) { vec3 nfOutdoorDay(float kind) {
if (kind > 14.5) return kind < 15.5 ? vec3(0.30, 0.28, 0.25) : kind < 16.5 ? vec3(0.38, 0.38, 0.32) : vec3(0.34, 0.30, 0.24);
if (kind < 1.5 || (kind > 6.5 && kind < 8.5)) return kind > 7.5 ? vec3(0.055, 0.17, 0.07) : vec3(0.12, 0.28, 0.08); if (kind < 1.5 || (kind > 6.5 && kind < 8.5)) return kind > 7.5 ? vec3(0.055, 0.17, 0.07) : vec3(0.12, 0.28, 0.08);
if (kind < 2.5) return vec3(0.38, 0.32, 0.25); if (kind < 2.5) return vec3(0.38, 0.32, 0.25);
if (kind < 4.5) return kind < 3.5 ? vec3(0.36, 0.34, 0.30) : vec3(0.23, 0.25, 0.27); if (kind < 4.5) return kind < 3.5 ? vec3(0.36, 0.34, 0.30) : vec3(0.23, 0.25, 0.27);
if ((kind > 4.5 && kind < 5.5) || kind > 12.5) return vec3(0.035, 0.22, 0.28); if ((kind > 4.5 && kind < 5.5) || (kind > 12.5 && kind < 14.5)) return vec3(0.035, 0.22, 0.28);
if (kind < 6.5) return vec3(0.15, 0.09, 0.045); if (kind < 6.5) return vec3(0.15, 0.09, 0.045);
if (kind < 9.5) return vec3(0.27, 0.15, 0.065); if (kind < 9.5) return vec3(0.27, 0.15, 0.065);
if (kind < 10.5) return vec3(0.07, 0.075, 0.085); if (kind < 10.5) return vec3(0.07, 0.075, 0.085);
@@ -4281,6 +4282,28 @@ vec3 nfOutdoorTexture(vec3 position, float kind) {
float c = cos(angle), s = sin(angle); float c = cos(angle), s = sin(angle);
p = vec2(c * p.x + s * p.y, -s * p.x + c * p.y) / max(vNfSurfaceTransform.x, 0.05); p = vec2(c * p.x + s * p.y, -s * p.x + c * p.y) / max(vNfSurfaceTransform.x, 0.05);
float broad = nfNoise(p * 1.7); float broad = nfNoise(p * 1.7);
if (kind > 16.5) return nfPebbles(p * 2.3, false);
if (kind > 15.5) {
// Separate garden slabs with generous green gaps; texture scale changes slab size and spacing together.
vec2 cell = p / 0.85;
cell.x += mod(floor(cell.y), 2.0) * 0.12;
vec2 f = fract(cell), aa = max(fwidth(cell), vec2(0.001));
vec2 lo = smoothstep(vec2(0.12), vec2(0.12) + aa, f);
vec2 hi = 1.0 - smoothstep(vec2(0.88) - aa, vec2(0.88), f);
float slab = lo.x * lo.y * hi.x * hi.y;
vec3 stone = vec3(0.85 + nfGrain(floor(cell)) * 0.24) * (0.9 + nfNoise(p * 32.0) * 0.18);
vec3 grass = vec3(0.23, 0.62, 0.18) * (0.8 + broad * 0.4);
return mix(grass, stone, slab);
}
if (kind > 14.5) {
vec2 cell = p / vec2(0.2, 0.16);
cell.x += mod(floor(cell.y), 2.0) * 0.5;
float wobble = (nfNoise(p * 14.0) - 0.5) * 0.08;
float seam = max(nfJoint(cell.x + wobble, 0.03), nfJoint(cell.y + wobble, 0.03));
float bevel = max(nfJoint(cell.x + wobble, 0.1), nfJoint(cell.y + wobble, 0.1));
float variation = 0.7 + nfGrain(floor(cell)) * 0.55;
return vec3(mix(variation * (1.0 - bevel * 0.18), 0.28, seam * nfDetail(cell)));
}
if (kind < 1.5 || (kind > 6.5 && kind < 8.5)) { if (kind < 1.5 || (kind > 6.5 && kind < 8.5)) {
if (kind > 7.5) return nfPebbles(p * 14.0, true); if (kind > 7.5) return nfPebbles(p * 14.0, true);
float blades = nfNoise(p * vec2(65, 24)); float blades = nfNoise(p * vec2(65, 24));
@@ -4297,7 +4320,7 @@ vec3 nfOutdoorTexture(vec3 position, float kind) {
float grain = mix(1.0, 0.88 + nfNoise(p * 80.0) * 0.24, nfDetail(p * 80.0)); float grain = mix(1.0, 0.88 + nfNoise(p * 80.0) * 0.24, nfDetail(p * 80.0));
return vec3(mix(variation, 0.35, joint * nfDetail(tile)) * grain); return vec3(mix(variation, 0.35, joint * nfDetail(tile)) * grain);
} }
if ((kind > 4.5 && kind < 5.5) || kind > 12.5) { if ((kind > 4.5 && kind < 5.5) || (kind > 12.5 && kind < 14.5)) {
// Water: broad ripples and smaller crossing highlights, with a tighter scale in streams. // Water: broad ripples and smaller crossing highlights, with a tighter scale in streams.
vec2 water = p * (kind > 13.5 ? 1.8 : 1.0); vec2 water = p * (kind > 13.5 ? 1.8 : 1.0);
float wave = sin(water.x * 8.0 + sin(water.y * 3.0) + broad * 3.0); float wave = sin(water.x * 8.0 + sin(water.y * 3.0) + broad * 3.0);
@@ -4332,7 +4355,7 @@ ${FR}`).replace("#include <opaque_fragment>",`if (vNfSurface > 0.5) {
if (uTheme == 2) outgoingLight = nfOutdoorDay(vNfSurface) * (0.7 + dot(outgoingLight, vec3(0.299, 0.587, 0.114)) * 0.4); if (uTheme == 2) outgoingLight = nfOutdoorDay(vNfSurface) * (0.7 + dot(outgoingLight, vec3(0.299, 0.587, 0.114)) * 0.4);
outgoingLight *= nfOutdoorTexture(vNfGround, vNfSurface); outgoingLight *= nfOutdoorTexture(vNfGround, vNfSurface);
} }
#include <opaque_fragment>`)},i.customProgramCacheKey=()=>`${t()}-outdoor-textures-2`,i}function Ap(i,e){return ea(i)+(e.offset??0)+(jr(e.type)?.01:Vl[e.type])}function Qu(i,e){let t=i[e];return jr(t.type)||t.type==="pool"?[]:i.filter((n,r)=>r!==e&&B0(n)&&n.points.length>=3&&n.points.every(s=>Ge(s,t.points))).map(n=>bl(n.points))}var eh=(i,e)=>i.map((t,n)=>[n,t,i[(n+1)%i.length]]).filter(([t])=>t!==e);function _l(i,e){if(i.area.outline!==!1)for(let[,t,n]of eh(i.poly,i.openEdge))i.lines.seg([t[0],e(t[0],t[1]),t[1]],[n[0],e(n[0],n[1]),n[1]],i.edge,$e)}function NR(i){let{buf:e,poly:t,base:n,top:r,look:s}=i,o=new W(s.color);for(let[l,c,u]of Gr(t)){let[h,f,d]=[t[l],t[c],t[u]];e.tri([h[0],n+r,h[1]],[d[0],n+r,d[1]],[f[0],n+r,f[1]],o,o,o,void 0,$e)}let a=new W(s.side);for(let[,l,c]of eh(t,-1))e.tri([c[0],n+r,c[1]],[c[0],n+.06,c[1]],[l[0],n+.06,l[1]],a,a,a,void 0,$e),e.tri([c[0],n+r,c[1]],[l[0],n+.06,l[1]],[l[0],n+r,l[1]],a,a,a,void 0,$e);_l(i,()=>n+.06),_l(i,()=>n+r+.005)}function OR(i){let{buf:e,lines:t,poly:n,area:r,top:s,look:o,groundAt:a,edge:l,openEdge:c}=i;for(let[u,h,f]of eh(n,c)){let d=Math.hypot(f[0]-h[0],f[1]-h[1]),p=Math.max(1,Math.round(d/2)),x=Db(r,h,f).map(({gate:M,offset:S})=>({gate:M,layout:Ub(h,f,M,S,!!M.open)})).filter(M=>!!M.layout),g=M=>x.some(S=>M>S.layout.from-.15&&M<S.layout.to+.15),m=c>=0&&u===c-1?p:p-1;for(let M=0;M<=m;M++){if(g(d*M/p))continue;let S=h[0]+(f[0]-h[0])*M/p,v=h[1]+(f[1]-h[1])*M/p,w=a(S,v);vl(e,[S,v],.04,w,w+s,o.side,o.color)}let y=[],_=0;for(let M of x)y.push([_,M.layout.from]),_=M.layout.to;y.push([_,d]);let b=M=>[h[0]+(f[0]-h[0])*M/d,h[1]+(f[1]-h[1])*M/d];for(let[M,S]of y){if(S-M<.02)continue;let[v,w]=[b(M),b(S)];for(let R of[.35,.85])t.seg([v[0],a(v[0],v[1])+R*s,v[1]],[w[0],a(w[0],w[1])+R*s,w[1]],l,$e)}for(let{layout:M}of x){for(let S of M.posts){let v=a(S[0],S[1]);vl(e,S,.07,v,v+s*1.05,o.side,o.color)}for(let S of M.leaves)DR(i,S.a,S.b)}}}function DR(i,e,t){let{buf:n,lines:r,top:s,look:o,groundAt:a,edge:l}=i,c=Math.hypot(t[0]-e[0],t[1]-e[1]);if(c<.05)return;let[u,h]=[a(e[0],e[1]),a(t[0],t[1])],f=h-u;for(let[p,x]of[[.12,.2],[.78,.86]])Ju(n,e,t,.05,u+p*s,u+x*s,o.side,o.color,f);let d=Math.max(2,Math.round(c/.18));for(let p=0;p<=d;p++){let x=p/d,g=e[0]+(t[0]-e[0])*x,m=e[1]+(t[1]-e[1])*x,y=u+f*x;vl(n,[g,m],p===0||p===d?.03:.012,y+.1*s,y+.9*s,o.side,o.color)}r.seg([e[0],u+.2*s,e[1]],[t[0],h+.78*s,t[1]],l,$e)}function UR(i){let{buf:e,lines:t,poly:n,area:r,top:s,look:o,groundAt:a,edge:l,openEdge:c}=i;for(let u of n){let h=a(u[0],u[1]);vl(e,u,.06,h,h+s,o.side,o.color)}for(let[,u,h]of eh(n,c)){let[f,d]=[a(u[0],u[1]),a(h[0],h[1])];Ju(e,u,h,.12,f+s-.16,f+s,o.side,o.color,d-f),r.bracing&&(t.seg([u[0],f+.25,u[1]],[h[0],d+s-.25,h[1]],l,$e),t.seg([h[0],d+.25,h[1]],[u[0],f+s-.25,u[1]],l,$e))}if(Z0(n)){let u=J0(n),h=u.x1-u.x0>=u.z1-u.z0,[f,d]=h?[u.x0,u.x1-u.x0]:[u.z0,u.z1-u.z0],p=Math.max(1,Math.round(d/.6));for(let x=1;x<p;x++){let g=f+d*x/p,m=h?[g,u.z0+.06]:[u.x0+.06,g],y=h?[g,u.z1-.06]:[u.x1-.06,g],_=a(m[0],m[1]);Ju(e,m,y,.06,_+s-.04,_+s+.08,o.side,o.color,a(y[0],y[1])-_)}}_l(i,(u,h)=>a(u,h)+s+.004)}function kR(i,e,t){let{buf:n,lines:r,poly:s,area:o,top:a,look:l,groundAt:c,base:u,edge:h}=i,f=u-(o.slope??0),d=(x,g)=>c(x,g)+a,p=Qu(e,t);if(Tt(n,s,f,o.slope?d:u+a,l.side,l.color,{aoFrom:f,holes:p}),_l(i,(x,g)=>d(x,g)+.004),o.type==="hedge"&&_l(i,(x,g)=>c(x,g)+.004),o.outline!==!1)for(let x of p)x.forEach((g,m)=>{let y=x[(m+1)%x.length];r.seg([g[0],d(g[0],g[1])+.004,g[1]],[y[0],d(y[0],y[1])+.004,y[1]],h,$e)})}function zb(i){let e=i.opacity;return e==null||!(e<1)?1:Math.max(.1,Math.round(e*20)/20)}function Ep(i,e,t,n,r){i.surface??=Array(i.p.length/3).fill(0),i.surfaceTransform??=Array.from({length:i.p.length/3*2},(a,l)=>l%2===0?1:0);let s=ea(t),o=t.outdoor??[];o.forEach((a,l)=>{if(a.points.length<3)return;let c=s+(a.offset??0),u=kb[a.type],h=bl(a.points),f=zb(a),d=i;f<1&&n&&r&&(n.has(f)||n.set(f,r()),d=n.get(f)),d.surface??=Array(d.p.length/3).fill(0),d.surfaceTransform??=Array.from({length:d.p.length/3*2},(m,y)=>y%2===0?1:0);let p=d.p.length/3,x={buf:d,lines:e,area:a,poly:h,base:c,groundAt:(m,y)=>c-lf(a,m,y),top:jr(a.type)&&a.height?a.height:Vl[a.type],look:u,edge:Be(u.edge,u.edgeAlpha),openEdge:a.open&&(a.type==="fence"||a.type==="pergola")?h.length-1:-1};a.type==="pool"?NR(x):a.type==="fence"?OR(x):a.type==="pergola"?UR(x):kR(x,o,l),d.surface.fill(Bb[a.type],p);let g=z0(a);for(let m=p;m<d.p.length/3;m++)d.surfaceTransform[m*2]=g.scale,d.surfaceTransform[m*2+1]=g.rotation*Math.PI/180})}var Vb=.012,BR=.012;function zR(){let i=[],e=[],t=[],n=[];return{add(r,s,o,a,l,c,u){for(let h of[r,s,o,r,o,a])i.push(h[0],h[1],h[2]),e.push(l[0],l[1],l[2]),t.push(c),n.push(u)},finish:r=>({pos:new Float32Array(i),normal:new Float32Array(e),room:Int16Array.from(t),fold:new Float32Array(n),doors:r})}}function Wb(i,e){let[t,n]=[i.b[0]-i.a[0],i.b[1]-i.a[1]],r=Math.hypot(t,n)||1;return Math.abs((e.start[0]-i.a[0])*n-(e.start[1]-i.a[1])*t)/r<.02&&Math.abs((e.axis[0]*t+e.axis[1]*n)/r)>.99}function VR(i,e,t,n) Line truncated #include <opaque_fragment>`)},i.customProgramCacheKey=()=>`${t()}-outdoor-textures-2`,i}function Ap(i,e){return ea(i)+(e.offset??0)+(jr(e.type)?.01:Vl[e.type])}function Qu(i,e){let t=i[e];return jr(t.type)||t.type==="pool"?[]:i.filter((n,r)=>r!==e&&B0(n)&&n.points.length>=3&&n.points.every(s=>Ge(s,t.points))).map(n=>yl(n.points))}var eh=(i,e)=>i.map((t,n)=>[n,t,i[(n+1)%i.length]]).filter(([t])=>t!==e);function _l(i,e){if(i.area.outline!==!1)for(let[,t,n]of eh(i.poly,i.openEdge))i.lines.seg([t[0],e(t[0],t[1]),t[1]],[n[0],e(n[0],n[1]),n[1]],i.edge,$e)}function NR(i){let{buf:e,poly:t,base:n,top:r,look:s}=i,o=new W(s.color);for(let[l,c,u]of Gr(t)){let[h,f,d]=[t[l],t[c],t[u]];e.tri([h[0],n+r,h[1]],[d[0],n+r,d[1]],[f[0],n+r,f[1]],o,o,o,void 0,$e)}let a=new W(s.side);for(let[,l,c]of eh(t,-1))e.tri([c[0],n+r,c[1]],[c[0],n+.06,c[1]],[l[0],n+.06,l[1]],a,a,a,void 0,$e),e.tri([c[0],n+r,c[1]],[l[0],n+.06,l[1]],[l[0],n+r,l[1]],a,a,a,void 0,$e);_l(i,()=>n+.06),_l(i,()=>n+r+.005)}function OR(i){let{buf:e,lines:t,poly:n,area:r,top:s,look:o,groundAt:a,edge:l,openEdge:c}=i;for(let[u,h,f]of eh(n,c)){let d=Math.hypot(f[0]-h[0],f[1]-h[1]),p=Math.max(1,Math.round(d/2)),x=Dy(r,h,f).map(({gate:M,offset:S})=>({gate:M,layout:Uy(h,f,M,S,!!M.open)})).filter(M=>!!M.layout),g=M=>x.some(S=>M>S.layout.from-.15&&M<S.layout.to+.15),m=c>=0&&u===c-1?p:p-1;for(let M=0;M<=m;M++){if(g(d*M/p))continue;let S=h[0]+(f[0]-h[0])*M/p,v=h[1]+(f[1]-h[1])*M/p,w=a(S,v);vl(e,[S,v],.04,w,w+s,o.side,o.color)}let b=[],_=0;for(let M of x)b.push([_,M.layout.from]),_=M.layout.to;b.push([_,d]);let y=M=>[h[0]+(f[0]-h[0])*M/d,h[1]+(f[1]-h[1])*M/d];for(let[M,S]of b){if(S-M<.02)continue;let[v,w]=[y(M),y(S)];for(let R of[.35,.85])t.seg([v[0],a(v[0],v[1])+R*s,v[1]],[w[0],a(w[0],w[1])+R*s,w[1]],l,$e)}for(let{layout:M}of x){for(let S of M.posts){let v=a(S[0],S[1]);vl(e,S,.07,v,v+s*1.05,o.side,o.color)}for(let S of M.leaves)DR(i,S.a,S.b)}}}function DR(i,e,t){let{buf:n,lines:r,top:s,look:o,groundAt:a,edge:l}=i,c=Math.hypot(t[0]-e[0],t[1]-e[1]);if(c<.05)return;let[u,h]=[a(e[0],e[1]),a(t[0],t[1])],f=h-u;for(let[p,x]of[[.12,.2],[.78,.86]])Ju(n,e,t,.05,u+p*s,u+x*s,o.side,o.color,f);let d=Math.max(2,Math.round(c/.18));for(let p=0;p<=d;p++){let x=p/d,g=e[0]+(t[0]-e[0])*x,m=e[1]+(t[1]-e[1])*x,b=u+f*x;vl(n,[g,m],p===0||p===d?.03:.012,b+.1*s,b+.9*s,o.side,o.color)}r.seg([e[0],u+.2*s,e[1]],[t[0],h+.78*s,t[1]],l,$e)}function UR(i){let{buf:e,lines:t,poly:n,area:r,top:s,look:o,groundAt:a,edge:l,openEdge:c}=i;for(let u of n){let h=a(u[0],u[1]);vl(e,u,.06,h,h+s,o.side,o.color)}for(let[,u,h]of eh(n,c)){let[f,d]=[a(u[0],u[1]),a(h[0],h[1])];Ju(e,u,h,.12,f+s-.16,f+s,o.side,o.color,d-f),r.bracing&&(t.seg([u[0],f+.25,u[1]],[h[0],d+s-.25,h[1]],l,$e),t.seg([h[0],d+.25,h[1]],[u[0],f+s-.25,u[1]],l,$e))}if(Z0(n)){let u=J0(n),h=u.x1-u.x0>=u.z1-u.z0,[f,d]=h?[u.x0,u.x1-u.x0]:[u.z0,u.z1-u.z0],p=Math.max(1,Math.round(d/.6));for(let x=1;x<p;x++){let g=f+d*x/p,m=h?[g,u.z0+.06]:[u.x0+.06,g],b=h?[g,u.z1-.06]:[u.x1-.06,g],_=a(m[0],m[1]);Ju(e,m,b,.06,_+s-.04,_+s+.08,o.side,o.color,a(b[0],b[1])-_)}}_l(i,(u,h)=>a(u,h)+s+.004)}function kR(i,e,t){let{buf:n,lines:r,poly:s,area:o,top:a,look:l,groundAt:c,base:u,edge:h}=i,f=u-(o.slope??0),d=(x,g)=>c(x,g)+a,p=Qu(e,t);if(Tt(n,s,f,o.slope?d:u+a,l.side,l.color,{aoFrom:f,holes:p}),_l(i,(x,g)=>d(x,g)+.004),o.type==="hedge"&&_l(i,(x,g)=>c(x,g)+.004),o.outline!==!1)for(let x of p)x.forEach((g,m)=>{let b=x[(m+1)%x.length];r.seg([g[0],d(g[0],g[1])+.004,g[1]],[b[0],d(b[0],b[1])+.004,b[1]],h,$e)})}function zy(i){let e=i.opacity;return e==null||!(e<1)?1:Math.max(.1,Math.round(e*20)/20)}function Ep(i,e,t,n,r){i.surface??=Array(i.p.length/3).fill(0),i.surfaceTransform??=Array.from({length:i.p.length/3*2},(a,l)=>l%2===0?1:0);let s=ea(t),o=t.outdoor??[];o.forEach((a,l)=>{if(a.points.length<3)return;let c=s+(a.offset??0),u=ky[a.type],h=yl(a.points),f=zy(a),d=i;f<1&&n&&r&&(n.has(f)||n.set(f,r()),d=n.get(f)),d.surface??=Array(d.p.length/3).fill(0),d.surfaceTransform??=Array.from({length:d.p.length/3*2},(m,b)=>b%2===0?1:0);let p=d.p.length/3,x={buf:d,lines:e,area:a,poly:h,base:c,groundAt:(m,b)=>c-lf(a,m,b),top:jr(a.type)&&a.height?a.height:Vl[a.type],look:u,edge:Be(u.edge,u.edgeAlpha),openEdge:a.open&&(a.type==="fence"||a.type==="pergola")?h.length-1:-1};a.type==="pool"?NR(x):a.type==="fence"?OR(x):a.type==="pergola"?UR(x):kR(x,o,l),d.surface.fill(By[a.type],p);let g=z0(a);for(let m=p;m<d.p.length/3;m++)d.surfaceTransform[m*2]=g.scale,d.surfaceTransform[m*2+1]=g.rotation*Math.PI/180})}var Vy=.012,BR=.012;function zR(){let i=[],e=[],t=[],n=[];return{add(r,s,o,a,l,c,u){for(let h of[r,s,o,r,o,a])i.push(h[0],h[1],h[2]),e.push(l[0],l[1],l[2]),t.push(c),n.push(u)},finish:r=>({pos:new Float32Array(i),normal:new Float32Array(e),room:Int16Array.from(t),fold:new Float32Array(n),doors:r})}}function Wy(i,e){let[t,n]=[i.b[0]-i.a[0],i.b[1]-i.a[1]],r=Math.hypot(t,n)||1;return Math.abs((e.start[0]-i.a[0])*n-(e.start[1]-i.a[1])*t)/r<.02&&Math.abs((e.axis[0]*t+e.axis[1]*n)/r)>.99}function VR(i,e,t,n) Line truncated
attribute float fold; attribute float fold;
uniform int uStanding; uniform int uStanding;
uniform int uGlass; uniform int uGlass;
@@ -4366,7 +4389,7 @@ uniform float uGlassAlpha;`),t!=="glass"&&(n.fragmentShader=n.fragmentShader.rep
if (vNfPaint > 0.5) diffuseColor.rgb = vColor.rgb; if (vNfPaint > 0.5) diffuseColor.rgb = vColor.rgb;
#endif`)),t==="glass"&&(n.fragmentShader=n.fragmentShader.replace("#include <color_fragment>",`#include <color_fragment> #endif`)),t==="glass"&&(n.fragmentShader=n.fragmentShader.replace("#include <color_fragment>",`#include <color_fragment>
diffuseColor.rgb = diffuseColor.rgb * 1.7 + vec3(0.015, 0.05, 0.075); diffuseColor.rgb = diffuseColor.rgb * 1.7 + vec3(0.015, 0.05, 0.075);
diffuseColor.a *= uGlassAlpha;`))},i.customProgramCacheKey=()=>`nf-fold-${t}`,i}var Lp=["neon","blueprint","day"],XO=["auto",...Lp];var Kb=i=>Lp.indexOf(i),th={value:new U(.22,.88,1)},nh={value:0};function Zb(i){let e=/^#?([0-9a-f]{6})$/i.exec(i?.trim()??"");if(!e)return null;let t=Number.parseInt(e[1],16);return[(t>>16&255)/255,(t>>8&255)/255,(t&255)/255]}var $R=` diffuseColor.a *= uGlassAlpha;`))},i.customProgramCacheKey=()=>`nf-fold-${t}`,i}var Lp=["neon","blueprint","day"],XO=["auto",...Lp];var Ky=i=>Lp.indexOf(i),th={value:new U(.22,.88,1)},nh={value:0};function Zy(i){let e=/^#?([0-9a-f]{6})$/i.exec(i?.trim()??"");if(!e)return null;let t=Number.parseInt(e[1],16);return[(t>>16&255)/255,(t>>8&255)/255,(t&255)/255]}var $R=`
uniform int uTheme; uniform int uTheme;
uniform vec3 uAccent; uniform vec3 uAccent;
uniform int uAccentOn; uniform int uAccentOn;
@@ -4405,7 +4428,7 @@ vNfTile = tile;`,JR=`#ifdef USE_MAP
vec4 sampledDiffuseColor = textureGrad(map, nfUv, dFdx(vMapUv) / vec2(3.0, 2.0), dFdy(vMapUv) / vec2(3.0, 2.0)); vec4 sampledDiffuseColor = textureGrad(map, nfUv, dFdx(vMapUv) / vec2(3.0, 2.0), dFdy(vMapUv) / vec2(3.0, 2.0));
diffuseColor *= sampledDiffuseColor; diffuseColor *= sampledDiffuseColor;
#endif`;function jR(i){let e=new Ye({map:i,transparent:!0,blending:Ft,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-2});return e.onBeforeCompile=t=>{t.vertexShader=t.vertexShader.replace("#include <common>",KR).replace("#include <begin_vertex>",ZR),t.fragmentShader=t.fragmentShader.replace("#include <common>",`#include <common> #endif`;function jR(i){let e=new Ye({map:i,transparent:!0,blending:Ft,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-2});return e.onBeforeCompile=t=>{t.vertexShader=t.vertexShader.replace("#include <common>",KR).replace("#include <begin_vertex>",ZR),t.fragmentShader=t.fragmentShader.replace("#include <common>",`#include <common>
varying vec2 vNfTile;`).replace("#include <map_fragment>",JR)},e.customProgramCacheKey=()=>"nf-pattern",e}var ih=(i={})=>new Ye({vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1,...i});function Jb({mask:i,look:e,theme:t,textures:n}){let r=(o={})=>new Ye({vertexColors:!0,...o}),s=(o,a)=>$b(o,i,a);return{floor:Jn(r(),e),pattern:jR(n.pattern),wall:ju(Jn(s(r(),"solid"),e)),glassWall:s(r({transparent:!0,depthWrite:!1}),"glass"),shadow:r({blending:Xa,premultipliedAlpha:!0,transparent:!0,depthWrite:!1,side:ht,polygonOffset:!0,polygonOffsetFactor:-1}),lines:Jn(s(new Lt({vertexColors:!0,transparent:!0,blending:Ml(t),depthWrite:!1})),e,!0),glow:s(ih({side:ht,polygonOffset:!0,polygonOffsetFactor:-3}),"solid"),frames:Jn(s(r({side:ht})),e),glass:s(ih({side:ht})),blinds:Jn(s(r({map:n.blinds,side:ht})),e),lamps:Jn(r(),e),halos:new cn({map:n.halo,size:.9,sizeAttenuation:!0,vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1}),cones:ih({side:ht}),screens:ih({side:ht}),ghosts:[]}}var rh=i=>Object.assign(document.createElement("span"),{className:i});function jb(i,e){let t=Object.assign(document.createElement("button"),{className:"nf-dev"});t.dataset.entity=i,t.append(rh("nf-dev-icon"),rh("nf-dev-text"),rh("nf-dev-watt"),rh("nf-dev-name"));let n,r=!1,s=a=>{let{x:l,y:c}=e.centre(t);a(i,l,c)},o=()=>clearTimeout(n);t.addEventListener("pointerdown",a=>{if(e.furnishing())return e.pressedWhileFurnishing(i);a.stopPropagation(),r=!1,o(),n=setTimeout(()=>{r=!0,s(e.hold)},500)});for(let a of["pointerleave","pointercancel","pointerup"])t.addEventListener(a,o);return t.addEventListener("contextmenu",a=>a.preventDefault()),t.addEventListener("click",a=>{if(a.stopPropagation(),e.furnishing())return e.selectWhileFurnishing(i);r||s(e.tap)}),t.addEventListener("keydown",a=>{(a.key==="Enter"&&a.shiftKey||a.key==="ContextMenu")&&(a.preventDefault(),s(e.hold))}),t}function Qb(i,e=10,t="NextFloor"){let n=[];for(let{positions:o,lift:a}of i)for(let l=0;l+8<o.length;l+=9){let c=[0,3,6].map(x=>[o[l+x]*e,-o[l+x+2]*e,(o[l+x+1]+a)*e]),[u,h,f]=c,d=[(h[1]-u[1])*(f[2]-u[2])-(h[2]-u[2])*(f[1]-u[1]),(h[2]-u[2])*(f[0]-u[0])-(h[0]-u[0])*(f[2]-u[2]),(h[0]-u[0])*(f[1]-u[1])-(h[1]-u[1])*(f[0]-u[0])],p=Math.hypot(d[0],d[1],d[2]);p<1e-9||n.push([d[0]/p,d[1]/p,d[2]/p,...u,...h,...f])}let r=new Uint8Array(84+n.length*50),s=new DataView(r.buffer);return r.set(new TextEncoder().encode(`${t} STL`.slice(0,79)),0),s.setUint32(80,n.length,!0),n.forEach((o,a)=>{let l=84+a*50;o.forEach((c,u)=>s.setFloat32(l+u*4,c,!0))}),r}var Ps=Math.PI/180;function ev(i,e,t){let n=i.getTime()/864e5-10957.5,r=(357.529+.98560028*n)*Ps,o=(280.459+.98564736*n+1.915*Math.sin(r)+.02*Math.sin(2*r))*Ps,a=(23.439-36e-8*n)*Ps,l=Math.atan2(Math.cos(a)*Math.sin(o),Math.cos(o)),c=Math.asin(Math.sin(a)*Math.sin(o)),h=(((18.697374558+24.06570982441908*n)%24+24)%24*15+t)*Ps-l,f=e*Ps,d=Math.asin(Math.sin(f)*Math.sin(c)+Math.cos(f)*Math.cos(c)*Math.cos(h)),p=Math.atan2(Math.sin(h),Math.cos(h)*Math.sin(f)-Math.tan(c)*Math.cos(f))/Ps+180;return{elevation:d/Ps,azimuth:(p%360+360)%360}}function Fp(i,e){let t=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).formatToParts(new Date(i)).map(n=>[n.type,Number(n.value)]));return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)}function tv(i,e,t=new Date){let[n,r]=[Math.floor(i),Math.round(i%1*60)];if(e)try{let o=new Date(Fp(t.getTime(),e)),a=Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate(),n,r),l=a-(Fp(a,e)-a);return l=a-(Fp(l,e)-l),new Date(l)}catch{}let s=new Date(t);return s.setHours(n,r,0,0),s}function QR(i,e=new Date){let t=[];for(let n=0;n<=24;n+=.25){let r=ev(tv(Math.min(n,23.99),i.zone,e),i.latitude,i.longitude);r.elevation<0||t.push(nv(i,r))}return t}function nv(i,e){let[t,n]=Do(e.azimuth,i.north),r=Math.max(0,e.elevation)*Math.PI/180;return[i.centre[0]+t*i.radius*Math.cos(r),Math.sin(r)*i.radius*.9,i.centre[1]+n*i.radius*Math.cos(r)]}function eC(i,e){let t=document.createElement("canvas");t.width=t.height=64;let n=t.getContext("2d");n&&(n.font="bold 44px system-ui, sans-serif",n.fillStyle=e,n.textAlign="center",n.textBaseline="middle",n.fillText(i,32,34));let r=new er(new _i({map:new zt(t),transparent:!0,depthWrite:!1,depthTest:!1}));return r.renderOrder=20,r}var sh=class{group=new et;key="";constructor(){this.group.visible=!1,this.group.renderOrder=15}update(e,t,n){let r=e?`${e.centre},${e.radius.toFixed(1)},${e.north},${e.latitude.toFixed(2)},${e.longitude.toFixed(2)},${new Date().toDateString()},${n},${t?`${t.elevation.toFixed(0)},${t.azimuth.toFixed(0)}`:"-"}`:"off";if(r===this.key)return;if(this.key=r,this.clear(),!e){this.group.visible=!1;return}this.group.visible=!0;let s=n+.05,o=[];for(let h=0;h<=96;h++){let f=h/96*Math.PI*2;o.push(e.centre[0]+Math.cos(f)*e.radius,s,e.centre[1]+Math.sin(f)*e.radius)}let a=new Pe;a.setAttribute("position",new Le(o,3)),this.group.add(new Pn(a,new Lt({color:7311304 Line truncated varying vec2 vNfTile;`).replace("#include <map_fragment>",JR)},e.customProgramCacheKey=()=>"nf-pattern",e}var ih=(i={})=>new Ye({vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1,...i});function Jy({mask:i,look:e,theme:t,textures:n}){let r=(o={})=>new Ye({vertexColors:!0,...o}),s=(o,a)=>$y(o,i,a);return{floor:Jn(r(),e),pattern:jR(n.pattern),wall:ju(Jn(s(r(),"solid"),e)),glassWall:s(r({transparent:!0,depthWrite:!1}),"glass"),shadow:r({blending:Xa,premultipliedAlpha:!0,transparent:!0,depthWrite:!1,side:ht,polygonOffset:!0,polygonOffsetFactor:-1}),lines:Jn(s(new Lt({vertexColors:!0,transparent:!0,blending:Ml(t),depthWrite:!1})),e,!0),glow:s(ih({side:ht,polygonOffset:!0,polygonOffsetFactor:-3}),"solid"),frames:Jn(s(r({side:ht})),e),glass:s(ih({side:ht})),blinds:Jn(s(r({map:n.blinds,side:ht})),e),lamps:Jn(r(),e),halos:new cn({map:n.halo,size:.9,sizeAttenuation:!0,vertexColors:!0,transparent:!0,blending:Ft,depthWrite:!1}),cones:ih({side:ht}),screens:ih({side:ht}),ghosts:[]}}var rh=i=>Object.assign(document.createElement("span"),{className:i});function jy(i,e){let t=Object.assign(document.createElement("button"),{className:"nf-dev"});t.dataset.entity=i,t.append(rh("nf-dev-icon"),rh("nf-dev-text"),rh("nf-dev-watt"),rh("nf-dev-name"));let n,r=!1,s=a=>{let{x:l,y:c}=e.centre(t);a(i,l,c)},o=()=>clearTimeout(n);t.addEventListener("pointerdown",a=>{if(e.furnishing())return e.pressedWhileFurnishing(i);a.stopPropagation(),r=!1,o(),n=setTimeout(()=>{r=!0,s(e.hold)},500)});for(let a of["pointerleave","pointercancel","pointerup"])t.addEventListener(a,o);return t.addEventListener("contextmenu",a=>a.preventDefault()),t.addEventListener("click",a=>{if(a.stopPropagation(),e.furnishing())return e.selectWhileFurnishing(i);r||s(e.tap)}),t.addEventListener("keydown",a=>{(a.key==="Enter"&&a.shiftKey||a.key==="ContextMenu")&&(a.preventDefault(),s(e.hold))}),t}function Qy(i,e=10,t="NextFloor"){let n=[];for(let{positions:o,lift:a}of i)for(let l=0;l+8<o.length;l+=9){let c=[0,3,6].map(x=>[o[l+x]*e,-o[l+x+2]*e,(o[l+x+1]+a)*e]),[u,h,f]=c,d=[(h[1]-u[1])*(f[2]-u[2])-(h[2]-u[2])*(f[1]-u[1]),(h[2]-u[2])*(f[0]-u[0])-(h[0]-u[0])*(f[2]-u[2]),(h[0]-u[0])*(f[1]-u[1])-(h[1]-u[1])*(f[0]-u[0])],p=Math.hypot(d[0],d[1],d[2]);p<1e-9||n.push([d[0]/p,d[1]/p,d[2]/p,...u,...h,...f])}let r=new Uint8Array(84+n.length*50),s=new DataView(r.buffer);return r.set(new TextEncoder().encode(`${t} STL`.slice(0,79)),0),s.setUint32(80,n.length,!0),n.forEach((o,a)=>{let l=84+a*50;o.forEach((c,u)=>s.setFloat32(l+u*4,c,!0))}),r}var Ps=Math.PI/180;function ev(i,e,t){let n=i.getTime()/864e5-10957.5,r=(357.529+.98560028*n)*Ps,o=(280.459+.98564736*n+1.915*Math.sin(r)+.02*Math.sin(2*r))*Ps,a=(23.439-36e-8*n)*Ps,l=Math.atan2(Math.cos(a)*Math.sin(o),Math.cos(o)),c=Math.asin(Math.sin(a)*Math.sin(o)),h=(((18.697374558+24.06570982441908*n)%24+24)%24*15+t)*Ps-l,f=e*Ps,d=Math.asin(Math.sin(f)*Math.sin(c)+Math.cos(f)*Math.cos(c)*Math.cos(h)),p=Math.atan2(Math.sin(h),Math.cos(h)*Math.sin(f)-Math.tan(c)*Math.cos(f))/Ps+180;return{elevation:d/Ps,azimuth:(p%360+360)%360}}function Fp(i,e){let t=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).formatToParts(new Date(i)).map(n=>[n.type,Number(n.value)]));return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)}function tv(i,e,t=new Date){let[n,r]=[Math.floor(i),Math.round(i%1*60)];if(e)try{let o=new Date(Fp(t.getTime(),e)),a=Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate(),n,r),l=a-(Fp(a,e)-a);return l=a-(Fp(l,e)-l),new Date(l)}catch{}let s=new Date(t);return s.setHours(n,r,0,0),s}function QR(i,e=new Date){let t=[];for(let n=0;n<=24;n+=.25){let r=ev(tv(Math.min(n,23.99),i.zone,e),i.latitude,i.longitude);r.elevation<0||t.push(nv(i,r))}return t}function nv(i,e){let[t,n]=Do(e.azimuth,i.north),r=Math.max(0,e.elevation)*Math.PI/180;return[i.centre[0]+t*i.radius*Math.cos(r),Math.sin(r)*i.radius*.9,i.centre[1]+n*i.radius*Math.cos(r)]}function eC(i,e){let t=document.createElement("canvas");t.width=t.height=64;let n=t.getContext("2d");n&&(n.font="bold 44px system-ui, sans-serif",n.fillStyle=e,n.textAlign="center",n.textBaseline="middle",n.fillText(i,32,34));let r=new er(new _i({map:new zt(t),transparent:!0,depthWrite:!1,depthTest:!1}));return r.renderOrder=20,r}var sh=class{group=new et;key="";constructor(){this.group.visible=!1,this.group.renderOrder=15}update(e,t,n){let r=e?`${e.centre},${e.radius.toFixed(1)},${e.north},${e.latitude.toFixed(2)},${e.longitude.toFixed(2)},${new Date().toDateString()},${n},${t?`${t.elevation.toFixed(0)},${t.azimuth.toFixed(0)}`:"-"}`:"off";if(r===this.key)return;if(this.key=r,this.clear(),!e){this.group.visible=!1;return}this.group.visible=!0;let s=n+.05,o=[];for(let h=0;h<=96;h++){let f=h/96*Math.PI*2;o.push(e.centre[0]+Math.cos(f)*e.radius,s,e.centre[1]+Math.sin(f)*e.radius)}let a=new Pe;a.setAttribute("position",new Le(o,3)),this.group.add(new Pn(a,new Lt({color:7311304 Line truncated
/*! Bundled license information: /*! Bundled license information:
three/build/three.core.js: three/build/three.core.js:
+228 -228
View File
@@ -1,13 +1,13 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */ /*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var w={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=n=>n===void 0?n:JSON.parse(JSON.stringify(n)));var jn=globalThis,qn=jn.ShadowRoot&&(jn.ShadyCSS===void 0||jn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,_i=Symbol(),gs=new WeakMap,rn=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==_i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(qn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=gs.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&gs.set(t,e))}return e}toString(){return this.cssText}},_s=n=>new rn(typeof n=="string"?n:n+"",void 0,_i),J=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new rn(t,n,_i)},bs=(n,e)=>{if(qn)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=jn.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},bi=qn?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return _s(t)})(n):n;var{is:yd,defineProperty:vd,getOwnPropertyDescriptor:wd,getOwnPropertyNames:xd,getOwnPropertySymbols:kd,getPrototypeOf:Sd}=Object,Zn=globalThis,ys=Zn.trustedTypes,$d=ys?ys.emptyScript:"",Md=Zn.reactiveElementPolyfillSupport,on=(n,e)=>n,yi={toAttribute(n,e){switch(e){case Boolean:n=n?$d:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},ws=(n,e)=>!yd(n,e),vs={attribute:!0,type:String,converter:yi,reflect:!1,useDefault:!1,hasChanged:ws};Symbol.metadata??=Symbol("metadata"),Zn.litPropertyMetadata??=new WeakMap;var Le=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=vs){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&vd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=wd(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??vs}static _$Ei(){if(this.hasOwnProperty(on("elementProperties")))return;let e=Sd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(on("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(on("properties"))){let t=this.properties,r=[...xd(t),...kd(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(bi(i))}else e!==void 0&&t.push(bi(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated var w={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=n=>n===void 0?n:JSON.parse(JSON.stringify(n)));var Zn=globalThis,Yn=Zn.ShadowRoot&&(Zn.ShadyCSS===void 0||Zn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vi=Symbol(),ys=new WeakMap,sn=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==vi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Yn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ys.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ys.set(t,e))}return e}toString(){return this.cssText}},vs=n=>new sn(typeof n=="string"?n:n+"",void 0,vi),Q=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new sn(t,n,vi)},ws=(n,e)=>{if(Yn)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=Zn.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},wi=Yn?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return vs(t)})(n):n;var{is:xd,defineProperty:kd,getOwnPropertyDescriptor:Sd,getOwnPropertyNames:$d,getOwnPropertySymbols:Md,getPrototypeOf:Ad}=Object,Jn=globalThis,xs=Jn.trustedTypes,Ed=xs?xs.emptyScript:"",Rd=Jn.reactiveElementPolyfillSupport,an=(n,e)=>n,xi={toAttribute(n,e){switch(e){case Boolean:n=n?Ed:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Ss=(n,e)=>!xd(n,e),ks={attribute:!0,type:String,converter:xi,reflect:!1,useDefault:!1,hasChanged:Ss};Symbol.metadata??=Symbol("metadata"),Jn.litPropertyMetadata??=new WeakMap;var Oe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ks){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&kd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=Sd(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ks}static _$Ei(){if(this.hasOwnProperty(an("elementProperties")))return;let e=Ad(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(an("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(an("properties"))){let t=this.properties,r=[...$d(t),...Md(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(wi(i))}else e!==void 0&&t.push(wi(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
\f\r]`,sn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ss=/-->/g,$s=/>/g,ut=RegExp(`>|${vi}(?:([^\\s"'>=/]+)(${vi}*=${vi}*(?:[^ \f\r]`,ln=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,As=/-->/g,Es=/>/g,ht=RegExp(`>|${ki}(?:([^\\s"'>=/]+)(${ki}*=${ki}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ms=/'/g,As=/"/g,Ts=/^(?:script|style|textarea|title)$/i,Ri=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),p=Ri(1),ne=Ri(2),kg=Ri(3),mt=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Rs=new WeakMap,dt=ht.createTreeWalker(ht,129);function Fs(n,e){if(!Ai(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return ks!==void 0?ks.createHTML(e):e}var Ed=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=sn;for(let a=0;a<t;a++){let l=n[a],c,u,h=-1,m=0;for(;m<l.length&&(s.lastIndex=m,u=s.exec(l),u!==null);)m=s.lastIndex,s===sn?u[1]==="!--"?s=Ss:u[1]!==void 0?s=$s:u[2]!==void 0?(Ts.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=ut):u[3]!==void 0&&(s=ut):s===ut?u[0]===">"?(s=i??sn,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?ut:u[3]==='"'?As:Ms):s===As||s===Ms?s=ut:s===Ss||s===$s?s=sn:(s=ut,i=void 0);let d=s===ut&&n[a+1].startsWith("/>")?" ":"";o+=s===sn?l+Ad:h>=0?(r.push(c),l.slice(0,h)+Es+l.slice(h)+tt+d):l+tt+(h===-2?a:d)}return[Fs(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},cn=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=Ed(e,t);if(this.el=n.createElement(c,r),dt.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=dt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Es)){let m=u[s++],d=i.getAttribute(h).split(tt),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:d,ctor:g[1]==="."?xi:g[1]==="?"?ki:g[1]==="@"?Si:At}),i.removeAttribute(h)}else h.startsWith(tt)&&(l.push({type:6,index:o}),i.removeAttribute(h));if(Ts.test(i.tagName)){let h=i.textContent.split(tt),m=h.length-1;if(m>0){i.textContent=Yn?Yn.emptyScript:"";for(let d=0;d<m;d++)i.append(h[d],an()),dt.nextNode(),l.push({type:2,index:++o});i.append(h[m],an())}}}else if(i.nodeType===8)if(i.data===zs)l.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(tt,h+1))!==-1;)l.push({type:7,index:o}),h+=tt.length-1}o++}}static createElement(e,t){let r=ht.createElement("template");return r.innerHTML=e,r}};function Mt(n,e,t=n,r){if(e===mt)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=ln(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Mt(n,i._$AS(n,e.values),i,r)),e}var wi=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??ht).importNode(t,!0);dt.currentNode=i;let o=dt.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new un(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new $i(o,this,e)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=dt.nextNode(),s++)}return dt.currentNode=ht,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},un=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Mt(this,e,t),ln(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==mt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Rd(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&ln(this._$AH)?this._$AA.nextSibling.data=e:this.T(ht.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=cn.createElement(Fs(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new wi(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Rs.get(e.strings);return t===void 0&&Rs.set(e.strings,t=new cn(e)),t}k(e){Ai(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(an()),this.O(an()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=xs(e).nextSibling;xs(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},At=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this.Line truncated \f\r"'\`<>=]|("|')|))|$)`,"g"),Rs=/'/g,zs=/"/g,Hs=/^(?:script|style|textarea|title)$/i,Ti=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),p=Ti(1),re=Ti(2),Mg=Ti(3),ft=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Ts=new WeakMap,mt=pt.createTreeWalker(pt,129);function Ps(n,e){if(!zi(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ms!==void 0?Ms.createHTML(e):e}var Fd=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=ln;for(let a=0;a<t;a++){let l=n[a],c,u,h=-1,m=0;for(;m<l.length&&(s.lastIndex=m,u=s.exec(l),u!==null);)m=s.lastIndex,s===ln?u[1]==="!--"?s=As:u[1]!==void 0?s=Es:u[2]!==void 0?(Hs.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=ht):u[3]!==void 0&&(s=ht):s===ht?u[0]===">"?(s=i??ln,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?ht:u[3]==='"'?zs:Rs):s===zs||s===Rs?s=ht:s===As||s===Es?s=ln:(s=ht,i=void 0);let d=s===ht&&n[a+1].startsWith("/>")?" ":"";o+=s===ln?l+zd:h>=0?(r.push(c),l.slice(0,h)+Fs+l.slice(h)+nt+d):l+nt+(h===-2?a:d)}return[Ps(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},dn=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=Fd(e,t);if(this.el=n.createElement(c,r),mt.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=mt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Fs)){let m=u[s++],d=i.getAttribute(h).split(nt),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:d,ctor:g[1]==="."?$i:g[1]==="?"?Mi:g[1]==="@"?Ai:Rt}),i.removeAttribute(h)}else h.startsWith(nt)&&(l.push({type:6,index:o}),i.removeAttribute(h));if(Hs.test(i.tagName)){let h=i.textContent.split(nt),m=h.length-1;if(m>0){i.textContent=Qn?Qn.emptyScript:"";for(let d=0;d<m;d++)i.append(h[d],cn()),mt.nextNode(),l.push({type:2,index:++o});i.append(h[m],cn())}}}else if(i.nodeType===8)if(i.data===Ds)l.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(nt,h+1))!==-1;)l.push({type:7,index:o}),h+=nt.length-1}o++}}static createElement(e,t){let r=pt.createElement("template");return r.innerHTML=e,r}};function Et(n,e,t=n,r){if(e===ft)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=un(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Et(n,i._$AS(n,e.values),i,r)),e}var Si=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??pt).importNode(t,!0);mt.currentNode=i;let o=mt.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new hn(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new Ei(o,this,e)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=mt.nextNode(),s++)}return mt.currentNode=pt,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},hn=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Et(this,e,t),un(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==ft&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Td(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&un(this._$AH)?this._$AA.nextSibling.data=e:this.T(pt.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=dn.createElement(Ps(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Si(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Ts.get(e.strings);return t===void 0&&Ts.set(e.strings,t=new dn(e)),t}k(e){zi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(cn()),this.O(cn()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=$s(e).nextSibling;$s(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Rt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this.Line truncated
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt: Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated {url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed: A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated {url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated
:host { :host {
--nf-text: var(--primary-text-color, #e1e1e1); --nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b); --nf-muted: var(--secondary-text-color, #9b9b9b);
@@ -35,7 +35,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
font-family: var(--nf-font); font-family: var(--nf-font);
color: var(--nf-text); color: var(--nf-text);
} }
`,Tr=J` `,Dr=Q`
:host([readable]) { :host([readable]) {
--secondary-text-color: var(--primary-text-color, #e1e1e1); --secondary-text-color: var(--primary-text-color, #e1e1e1);
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent); --divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
@@ -46,7 +46,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
:host([readable]) .nf-overlay { :host([readable]) .nf-overlay {
zoom: 1.2; zoom: 1.2;
} }
`,He=J` `,Pe=Q`
/* a group of switches: one rounded pill, the active one tinted with the accent */ /* a group of switches: one rounded pill, the active one tinted with the accent */
.nf-seg { .nf-seg {
display: inline-flex; display: inline-flex;
@@ -209,20 +209,20 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
min-height: 40px; min-height: 40px;
} }
} }
`;function Fr(n){return n?.themes?.darkMode===!1?"light":"dark"}function vn(n,e){let t=new Set;return e.flatMap(r=>{let i=String(n?.states[r]?.attributes.symcon_source_entity||r),o=n?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var _l,lo=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(_l??=import(t).catch(i=>{throw _l=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!vn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}> `;function Hr(n){return n?.themes?.darkMode===!1?"light":"dark"}function xn(n,e){let t=new Set;return e.flatMap(r=>{let i=String(n?.states[r]?.attributes.symcon_source_entity||r),o=n?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var vl,ho=class extends X{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(vl??=import(t).catch(i=>{throw vl=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!xn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg> <svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
</button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",lo);function G(n,e,t=""){let r=vn(n,e);return r.length?p`<nf-trend-button .hass=${n} .ids=${r} .label=${t}></nf-trend-button>`:f}var co=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,r,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,r,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,r){let i=this.hass.states[t],o=fe(i),s=i?.attributes,a=r&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${De(i)}${G(this.hass,[t],e)}</b> </button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=Q`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",ho);function U(n,e,t=""){let r=xn(n,e);return r.length?p`<nf-trend-button .hass=${n} .ids=${r} .label=${t}></nf-trend-button>`:f}var mo=class extends X{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,r,i){if(W(this.hass,e)){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,r,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}}value(e,t,r){let i=this.hass.states[t],o=ge(i),s=i?.attributes,a=r&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${De(i)}${U(this.hass,[t],e)}</b>
${r&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${le(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!le(i)})}}>${le(i)?"Ein":"Aus"}</button>`:r&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(ge(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a} ${r&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${ce(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!ce(i)})}}>${ce(i)?"Ein":"Aus"}</button>`:r&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(_e(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
@change=${l=>{let c=l.target;c.value.trim()&&c.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(c.value)})}} />`:f} @change=${l=>{let c=l.target;c.value.trim()&&c.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(c.value)})}} />`:f}
</div>`}schedule(e){let t=this.hass.states[e];if(!t?.attributes.symcon_schedule)return p`<p class="missing">Schaltuhr nicht verfügbar</p>`;let r=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=r.find(c=>c.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=c=>`${String(c.hour).padStart(2,"0")}:${String(c.minute).padStart(2,"0")}${c.second?`:${String(c.second).padStart(2,"0")}`:""}`;return p`<details class="schedule"><summary>${String(t.attributes.friendly_name??"Schaltuhr")}</summary> </div>`}schedule(e){let t=this.hass.states[e];if(!t?.attributes.symcon_schedule)return p`<p class="missing">Schaltuhr nicht verfügbar</p>`;let r=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=r.find(c=>c.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=c=>`${String(c.hour).padStart(2,"0")}:${String(c.minute).padStart(2,"0")}${c.second?`:${String(c.second).padStart(2,"0")}`:""}`;return p`<details class="schedule"><summary>${String(t.attributes.friendly_name??"Schaltuhr")}</summary>
<label class="nf-check"><input type="checkbox" .checked=${t.state==="on"} ?disabled=${this._pending.has(e)} @change=${c=>{this.send(e,"schedule","set_active",{active:c.target.checked})}} /> Aktiv</label> <label class="nf-check"><input type="checkbox" .checked=${t.state==="on"} ?disabled=${this._pending.has(e)||!W(this.hass,e)} @change=${c=>{this.send(e,"schedule","set_active",{active:c.target.checked})}} /> Aktiv</label>
${o>0?p`<p class="next">Nächster Schaltpunkt: ${new Date(o*1e3).toLocaleString(this.hass.language)}${s?` \xB7 ${s.name}`:""}</p>`:f} ${o>0?p`<p class="next">Nächster Schaltpunkt: ${new Date(o*1e3).toLocaleString(this.hass.language)}${s?` \xB7 ${s.name}`:""}</p>`:f}
${i.length?i.map(c=>p`<div class="schedule-group"><b>${a.filter((u,h)=>c.days&1<<h).join(" \xB7 ")}</b><div class="points"> ${i.length?i.map(c=>p`<div class="schedule-group"><b>${a.filter((u,h)=>c.days&1<<h).join(" \xB7 ")}</b><div class="points">
${[...c.points].sort((u,h)=>u.hour*3600+u.minute*60+u.second-(h.hour*3600+h.minute*60+h.second)).map(u=>{let h=r.find(m=>m.id===u.action);return p`<span class="point"><time>${l(u)}</time><span class="dot" style=${`background:#${Number(h?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${h?.name||"Aktion"}</span>`})} ${[...c.points].sort((u,h)=>u.hour*3600+u.minute*60+u.second-(h.hour*3600+h.minute*60+h.second)).map(u=>{let h=r.find(m=>m.id===u.action);return p`<span class="point"><time>${l(u)}</time><span class="dot" style=${`background:#${Number(h?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${h?.name||"Aktion"}</span>`})}
</div></div>`):p`<p class="missing">Keine Schaltpunkte vorhanden.</p>`} </div></div>`):p`<p class="missing">Keine Schaltpunkte vorhanden.</p>`}
</details>`}render(){if(!this.hass||!this.room)return f;let e=gl.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],r=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${r||e.length?p`<section><h3>Raumklima</h3>${r?this.value("Fu\xDFbodenheizung",r,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f} </details>`}render(){if(!this.hass||!this.room)return f;let e=yl.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],r=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${r||e.length?p`<section><h3>Raumklima</h3>${r?this.value("Fu\xDFbodenheizung",r,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
${t.length?p`<section><h3>Schaltuhren</h3>${t.map(i=>this.schedule(i))}</section>`:f} ${t.length?p`<section><h3>Schaltuhren</h3>${t.map(i=>this.schedule(i))}</section>`:f}
${this._error?p`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[ye,He,J` ${this._error?p`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[ve,Pe,Q`
:host { display:block; } :host { display:block; }
section { margin:18px 0; } section { margin:18px 0; }
h3 { font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--nf-muted); margin:0 0 8px; } h3 { font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--nf-muted); margin:0 0 8px; }
@@ -240,14 +240,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.point time { font-variant-numeric:tabular-nums; } .point time { font-variant-numeric:tabular-nums; }
.dot { width:8px; height:8px; border-radius:50%; } .dot { width:8px; height:8px; border-radius:50%; }
.error { color:var(--nf-danger,#ff6b7a); font-size:12px; } .error { color:var(--nf-danger,#ff6b7a); font-size:12px; }
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",co);var dm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Ue(n,e){let t=e.show_when;if(!t?.entity||!n)return!0;let r=n.states[t.entity];if(!r||C(r))return!0;let i=String(r.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):dm.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function uo(n,e){let t=[];for(let r of e.floors)for(let i of r.furniture)Ue(n,i)||t.push(i.id);return t.sort()}function bl(n,e){if(!e.length)return n;let t=new Set(e);return{...n,floors:n.floors.map(r=>r.furniture.some(i=>t.has(i.id))?{...r,furniture:r.furniture.filter(i=>!t.has(i.id))}:r)}}function ae(n,e){if(!Ci(e))return $(n,`furn_${e}`);let t=X(e);return t?hm(t,e,n?.language??navigator.language):$(n,"pack_missing_item")}function hm(n,e,t){return n.name[t.split("-")[0]]??Xa(t,e)??ia(n,t)}var ee=(n,e)=>[n[0]-e[0],n[1]-e[1]],Pe=(n,e)=>[n[0]+e[0],n[1]+e[1]],Se=(n,e)=>[n[0]*e,n[1]*e],ue=(n,e)=>n[0]*e[0]+n[1]*e[1],je=(n,e)=>n[0]*e[1]-n[1]*e[0],qe=n=>Math.hypot(n[0],n[1]),$e=n=>{let e=qe(n)||1;return[n[0]/e,n[1]/e]},ho=n=>[-n[1],n[0]],mo=n=>[n[1],-n[0]];function yl(n){let e=n.heightEnd!==void 0;return{...n,a:n.b,b:n.a,left:n.right,right:n.left,roomLeft:n.roomRight,roomRight:n.roomLeft,height:e?n.heightEnd:n.height,heightEnd:e?n.height:void 0}}function mm(n,e){let t=n.map(r=>({...r}));for(let r of e){let i=t.find(o=>o.room_id===r.room_id&&o.edge===r.edge&&(Math.abs(o.t1-r.t0)<1e-6||Math.abs(r.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,r.t0),i.t1=Math.max(i.t1,r.t1)):t.push({...r})}return t}function pm(n,e,t){if(n.a===e.b)return!1;let r=$e(ee(t[n.b],t[n.a])),i=$e(ee(t[e.b],t[e.a]));return Math.abs(je(r,i))>1e-6||ue(r,i)<=0||n.free||e.free||n.heightEnd!==void 0||e.heightEnd!==void 0?!1:n.height===e.height&&n.exterior===e.exterior&&n.roomLeft===e.roomLeft&&n.roomRight===e.roomRight&&Math.abs(n.left-e.left)<=1e-9&&Math.abs(n.right-e.right)<=1e-9}function vl(n,e,t=new Set){let r=n.slice();for(;;){let i=new Map;r.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=r[a[0]].b===s?r[a[0]]:yl(r[a[0]]),c=r[a[1]].a===s?r[a[1]]:yl(r[a[1]]);if(!pm(l,c,e))continue;let u={...l,b:c.b,sources:mm(l.sources,c.sources)};o=[...r.filter((h,m)=>m!==a[0]&&m!==a[1]),u];break}if(!o)return r;r=o}}function wl(n,e){let t=new Map;n.forEach((i,o)=>{let s=$e(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:Se(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let r=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)r.set(l.key,{left:Pe(s,Se(ho(l.d),l.left)),right:Pe(s,Se(mo(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,c)=>{let u=o[(c+1)%o.length],h=Pe(s,Se(ho(l.d),l.left)),m=Pe(s,Se(mo(u.d),u.right)),d=je(l.d,u.d);if(Math.abs(d)<1e-4)return;let g=Pe(h,Se(l.d,je(ee(m,h),u.d)/d));qe(ee(g,s))>a||(r.get(l.key).left=g,r.get(u.key).right=g)})}return r}function xl(n,e){let t=n.filter((r,i)=>qe(ee(r,n[(i+1)%n.length]))>e);for(;;){if(t.length<=3)return t;let r=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[ee(i,s),ee(a,i)];return Math.abs(je($e(l),$e(c)))<1e-7&&ue(l,c)>0});if(r===-1)return t;t=t.filter((i,o)=>o!==r)}}function fm(n){let e=[];return{points:e,idOf(t){let r=e.findIndex(i=>Math.abs(i[0]-t[0])<=n&&Math.abs(i[1]-t[1])<=n);return r>=0?r:(e.push([t[0],t[1]]),e.length-1)}}}function gm(n,e){let t=[];for(let r of n){let i=r.points;if(i.length<3||Math.abs(gt(i))<1e-6)continue;let o=gt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:r.id,edge:l,forward:!0}:{u:c,v:a,room:r.id,edge:l,forward:!1})})}return t}function _m(n,e,t){let r=[];for(let i of n){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=qe(a),c=Se(a,1/l),u=e.map((m,d)=>({id:d,rel:ee(m,o)})).filter(({id:m,rel:d})=>m!==i.u&&m!==i.v&&ue(d,c)>t&&ue(d,c)<l-t&&Math.abs(je(c,d))<=t).map(({id:m,rel:d})=>({t:ue(d,c),id:m})).sort((m,d)=>m.t-d.t),h=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let m=0;m+1<h.length;m++){let[d,g]=[h[m],h[m+1]];r.push({u:d.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?d.t:l-g.t,t1:i.forward?g.t:l-d.t,forward:i.forward})}}return r}var kl=n=>({room_id:n.room,edge:n.edge,t0:n.t0,t1:n.t1});function bm(n,e){let t=new Map(n.map(a=>[a.id,a])),r=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;r.set(l,[...r.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(r.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null; Line truncated `]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",mo);var pm=new Set(["on","home","open","true","active","playing","heat","heating"]);function je(n,e){let t=e.show_when;if(!t?.entity||!n)return!0;let r=n.states[t.entity];if(!r||C(r))return!0;let i=String(r.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):pm.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function po(n,e){let t=[];for(let r of e.floors)for(let i of r.furniture)je(n,i)||t.push(i.id);return t.sort()}function wl(n,e){if(!e.length)return n;let t=new Set(e);return{...n,floors:n.floors.map(r=>r.furniture.some(i=>t.has(i.id))?{...r,furniture:r.furniture.filter(i=>!t.has(i.id))}:r)}}function le(n,e){if(!Oi(e))return M(n,`furn_${e}`);let t=ee(e);return t?fm(t,e,n?.language??navigator.language):M(n,"pack_missing_item")}function fm(n,e,t){return n.name[t.split("-")[0]]??rl(t,e)??aa(n,t)}var te=(n,e)=>[n[0]-e[0],n[1]-e[1]],Ie=(n,e)=>[n[0]+e[0],n[1]+e[1]],$e=(n,e)=>[n[0]*e,n[1]*e],de=(n,e)=>n[0]*e[0]+n[1]*e[1],qe=(n,e)=>n[0]*e[1]-n[1]*e[0],Ze=n=>Math.hypot(n[0],n[1]),Me=n=>{let e=Ze(n)||1;return[n[0]/e,n[1]/e]},fo=n=>[-n[1],n[0]],go=n=>[n[1],-n[0]];function xl(n){let e=n.heightEnd!==void 0;return{...n,a:n.b,b:n.a,left:n.right,right:n.left,roomLeft:n.roomRight,roomRight:n.roomLeft,height:e?n.heightEnd:n.height,heightEnd:e?n.height:void 0}}function gm(n,e){let t=n.map(r=>({...r}));for(let r of e){let i=t.find(o=>o.room_id===r.room_id&&o.edge===r.edge&&(Math.abs(o.t1-r.t0)<1e-6||Math.abs(r.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,r.t0),i.t1=Math.max(i.t1,r.t1)):t.push({...r})}return t}function _m(n,e,t){if(n.a===e.b)return!1;let r=Me(te(t[n.b],t[n.a])),i=Me(te(t[e.b],t[e.a]));return Math.abs(qe(r,i))>1e-6||de(r,i)<=0||n.free||e.free||n.heightEnd!==void 0||e.heightEnd!==void 0?!1:n.height===e.height&&n.exterior===e.exterior&&n.roomLeft===e.roomLeft&&n.roomRight===e.roomRight&&Math.abs(n.left-e.left)<=1e-9&&Math.abs(n.right-e.right)<=1e-9}function kl(n,e,t=new Set){let r=n.slice();for(;;){let i=new Map;r.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=r[a[0]].b===s?r[a[0]]:xl(r[a[0]]),c=r[a[1]].a===s?r[a[1]]:xl(r[a[1]]);if(!_m(l,c,e))continue;let u={...l,b:c.b,sources:gm(l.sources,c.sources)};o=[...r.filter((h,m)=>m!==a[0]&&m!==a[1]),u];break}if(!o)return r;r=o}}function Sl(n,e){let t=new Map;n.forEach((i,o)=>{let s=Me(te(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:$e(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let r=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)r.set(l.key,{left:Ie(s,$e(fo(l.d),l.left)),right:Ie(s,$e(go(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,c)=>{let u=o[(c+1)%o.length],h=Ie(s,$e(fo(l.d),l.left)),m=Ie(s,$e(go(u.d),u.right)),d=qe(l.d,u.d);if(Math.abs(d)<1e-4)return;let g=Ie(h,$e(l.d,qe(te(m,h),u.d)/d));Ze(te(g,s))>a||(r.get(l.key).left=g,r.get(u.key).right=g)})}return r}function $l(n,e){let t=n.filter((r,i)=>Ze(te(r,n[(i+1)%n.length]))>e);for(;;){if(t.length<=3)return t;let r=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[te(i,s),te(a,i)];return Math.abs(qe(Me(l),Me(c)))<1e-7&&de(l,c)>0});if(r===-1)return t;t=t.filter((i,o)=>o!==r)}}function bm(n){let e=[];return{points:e,idOf(t){let r=e.findIndex(i=>Math.abs(i[0]-t[0])<=n&&Math.abs(i[1]-t[1])<=n);return r>=0?r:(e.push([t[0],t[1]]),e.length-1)}}}function ym(n,e){let t=[];for(let r of n){let i=r.points;if(i.length<3||Math.abs(bt(i))<1e-6)continue;let o=bt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:r.id,edge:l,forward:!0}:{u:c,v:a,room:r.id,edge:l,forward:!1})})}return t}function vm(n,e,t){let r=[];for(let i of n){let[o,s]=[e[i.u],e[i.v]],a=te(s,o),l=Ze(a),c=$e(a,1/l),u=e.map((m,d)=>({id:d,rel:te(m,o)})).filter(({id:m,rel:d})=>m!==i.u&&m!==i.v&&de(d,c)>t&&de(d,c)<l-t&&Math.abs(qe(c,d))<=t).map(({id:m,rel:d})=>({t:de(d,c),id:m})).sort((m,d)=>m.t-d.t),h=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let m=0;m+1<h.length;m++){let[d,g]=[h[m],h[m+1]];r.push({u:d.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?d.t:l-g.t,t1:i.forward?g.t:l-d.t,forward:i.forward})}}return r}var Ml=n=>({room_id:n.room,edge:n.edge,t0:n.t0,t1:n.t1});function wm(n,e){let t=new Map(n.map(a=>[a.id,a])),r=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;r.set(l,[...r.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(r.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null Line truncated
<h4>${An[e]} ${Ie[e]}</h4> <h4>${Rn[e]} ${Ce[e]}</h4>
${this.readings.filter(t=>t.kind===e).map(t=>p`<div class="reading" title=${`${t.manual?"Eigener Z\xE4hler":"Bereichsz\xE4hler"}${t.incomplete?" \xB7 Err: Mindestens ein Wert fehlt; angezeigt wird die Summe der verf\xFCgbaren Werte.":""} ${this.readings.filter(t=>t.kind===e).map(t=>p`<div class="reading" title=${`${t.manual?"Eigener Z\xE4hler":"Bereichsz\xE4hler"}${t.incomplete?" \xB7 Err: Mindestens ein Wert fehlt; angezeigt wird die Summe der verf\xFCgbaren Werte.":""}
${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states[r]?.attributes.friendly_name||r).join(` ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states[r]?.attributes.friendly_name||r).join(`
`)}`}> `)}`}>
<span>${Vt(t)}${t.manual?p` <small>· Zähler</small>`:""}</span><b>${Ne(this.hass,t)}${G(this.hass,t.sources,`${Ie[t.kind]} \xB7 ${Vt(t)}`)}</b> <span>${Gt(t)}${t.manual?p` <small>· Zähler</small>`:""}</span><b>${Le(this.hass,t)}${U(this.hass,t.sources,`${Ce[t.kind]} \xB7 ${Gt(t)}`)}</b>
</div>`)} </div>`)}
</section>`)}`}static styles=J` </section>`)}`}static styles=Q`
:host { display:block; color:var(--nf-text); font:inherit; } :host { display:block; color:var(--nf-text); font:inherit; }
section { padding:10px 0; border-bottom:1px solid var(--nf-line,#ffffff20); } section { padding:10px 0; border-bottom:1px solid var(--nf-line,#ffffff20); }
section:last-child { border:0; } section:last-child { border:0; }
@@ -256,12 +256,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.reading span { color:var(--nf-muted,#aaa); } .reading span { color:var(--nf-muted,#aaa); }
b { white-space:nowrap; font-variant-numeric:tabular-nums; } b { white-space:nowrap; font-variant-numeric:tabular-nums; }
small { font-size:.85em; } small { font-size:.85em; }
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",vo);var xo=Math.PI/180,Kl=3,Gl=.1,wo=1/6,Ul=(n,e)=>[Math.sin((e+n)*xo),-Math.cos((e+n)*xo)],Im=["N","NE","E","SE","S","SW","W","NW"];function Cm(n,e,t){return jl(n,e,t).map(r=>r.normal)}function jl(n,e,t){let r=[];for(let i of n.openings){if(i.room_id!==e.id||i.type==="garage")continue;let o=Ml(i,n.rooms,n.walls??[]),s=o?Rl(t,i,o):null;if(!s||!s.wall.exterior)continue;let{wall:a}=s,l=Math.hypot(a.b[0]-a.a[0],a.b[1]-a.a[1]);if(l<1e-6)continue;let c=[-(a.b[1]-a.a[1])/l,(a.b[0]-a.a[0])/l],u=a.roomLeft===e.id?c:[-c[0],-c[1]];r.push({opening:i,normal:[-u[0],-u[1]]})}return r}function Nm(n,e){let t=((Math.atan2(n[0],-n[1])/xo-e)%360+360)%360;return Im[Math.round(t/45)%8]}var Bl=new WeakMap;function ql(n,e){let t=Bl.get(e);return t||(t=Lt(e.rooms,{exterior:n.settings.wall_exterior,interior:n.settings.wall_interior},e.walls??[]).walls,Bl.set(e,t)),t}var Vl=new WeakMap;function Kt(n,e,t,r,i=new Date){let o=`${t.id}|${i.toISOString().slice(0,10)}|${n.settings.north??0}|${r.latitude},${r.longitude},${r.zone??""}`,s=Vl.get(e);s||Vl.set(e,s=new Map);let a=s.get(o);if(a)return a;let l=Lm(n,e,t,r,i);return s.set(o,l),l}function Lm(n,e,t,r,i){let o=n.settings.north??0,s=Cm(e,t,ql(n,e)),a=[...new Set(s.map(c=>Nm(c,o)))];if(!s.length)return{hours:0,facing:a};let l=0;for(let c=wo/2;c<24;c+=wo){let u=ft(Rt(c,r.zone,i),r.latitude,r.longitude);if(u.elevation<Kl)continue;let h=Ul(u.azimuth,o);s.some(m=>m[0]*h[0]+m[1]*h[1]>Gl)&&l++}return{hours:Math.round(l*wo*10)/10,facing:a}}function Zl(n,e,t,r,i=new Date().getFullYear()){return Array.from({length:12},(o,s)=>Kt(n,e,t,r,new Date(Date.UTC(i,s,15,12))).hours)}function Yl(n,e,t,r,i=new Date){let o=ft(i,r.latitude,r.longitude);if(o.elevation<Kl)return[];let s=Ul(o.azimuth,n.settings.north??0);return jl(e,t,ql(n,e)).filter(a=>a.normal[0]*s[0]+a.normal[1]*s[1]>Gl).map(a=>a.opening)}var Jl=n=>6.112*Math.exp(17.62*n/(243.12+n));function Gt(n,e,t=4){if(n===null||e===null)return null;let r=Math.min(100,e*Jl(n)/Jl(n-t));return Math.round(Math.min(100,Math.max(0,(r-65)/20*100)))}function Br(n,e,t){return t!==null&&t>=70?"mould":n!==null&&n>=1e3?"co2":e!==null&&e>=65?"humidity":null}function vt(n=new Date,e=50){let t=n.getMonth(),r=t>=4&&t<=8;return e<0?!r:r}function Vr(n,e,t,r=!1){let i=[];if(n!==null){let[s,a]=r?[22,26]:[20,23],l=n<s?s-n:n>a?n-a:0;i.push(Math.max(0,100-l*15))}if(e!==null){let s=e<40?40-e:e>60?e-60:0;i.push(Math.max(0,100-s*4))}if(t!==null&&i.push(Math.max(0,Math.min(100,100-(t-800)/600*100))),!i.length)return null;let o=i.reduce((s,a)=>s+a,0)/i.length;return Math.round(Math.min(o,Math.min(...i)+30))}var Om={temperature:{deviceClass:"temperature",unit:"\xB0C",stops:[[16,[.2,.45,1]],[20,[.15,.85,.75]],[22.5,[.95,.8,.3]],[26,[1,.28,.18]]]},humidity:{deviceClass:"humidity",unit:"%",stops:[[30,[.95,.6,.2]],[45,[.3,.88,.5]],[60,[.2,.78,1]],[75,[.32,.4,.98]]]},co2:{deviceClass:"carbon_dioxide",unit:"ppm",stops:[[450,[.3,.88,.5]],[800,[.98,.84,.3]],[1200,[1,.5,.2]],[1600,[.98,.25,.25]]]},mould:{deviceClass:"",unit:"%",stops:[[0,[.3,.88,.5]],[40,[.98,.84,.3]],[70,[1,.5,.2]],[100,[.75,.2,.55]]]},comfort:{deviceClass:"",unit:"",stops:[[0,[.98,.25,.25]],[40,[1,.5,.2]],[65,[.98,.84,.3]],[85,[.3,.88,.5]],[100,[.2,.8,.7]]]},power:{deviceClass:"power",unit:"W",stops:[[0,[.25,.4,.6]],[100,[.3,.88,.5]],[500,[.98,.84,.3]],[1500,[1,.5,.2]],[3e3,[.98,.25,.25]]]},sun:{deviceClass:"",unit:"h",stops:[[0,[.22,.3,.55]],[2,[.35,.6,.85]],[4,[.98,.84,.3]],[7,[1,.62,.2]],[10,[1,.42,.25]]]}},Wm={deviceClass:"temperature",unit:"\xB0C",stops:[[19,[.2,.45,1]],[22.5,[.15,.85,.75]],[25.5,[.95,.8,.3]],[29,[1,.28,.18]]]};function Kr(n,e=!1){return n==="temperature"&&e?Wm:Om[n]}var Bm=(n,e,t)=>[n[0]+(e[0]-n[0])*t,n[1]+(e[1]-n[1])*t,n[2]+(e[2]-n[2])*t];function Ql(n,e,t=!1){let{stops:r}=Kr(n,t),i=r.findIndex(([c])=>e<=c);if(i===-1)return r[r.length-1][1];if(i===0)return r[0][1];let[o,s]=r[i-1],[a,l]=r[i];return Bm(s,l,(e-o)/(a-o))}function ko(n,e,t,r){let i=Wt(n,r,e.floors?.flatMap(s=>s.rooms)??t.rooms).filter(s=>s.kind==="electricity"&&s.metric==="power");if(i.length)return i.find(s=>s.unit==="W")?.value??null;let o=null;for(let s of So(n,e,t,r)){let a=q(n.states[s]);a!==null&&(o=(o??0)+Math.max(0,a))}return o}function So(n,e,t,r){let i=Wt(n,r,e.floors?.flatMap(h=>h.rooms)??t.rooms).filter(h=>h.kind==="electricity"&&h.metric==="power");if(i.length)return i.filter(h=>h.unit==="W").flatMap(h=>h.sources);let{grid:o,solar:s,battery:a}=e.energy,l=new Set([o,s,a].filter(Boolean)),c=new Set,u=(h,m)=>r.points.length>=3&&H([h,m],r.points);for(let h of t.placements){let m=u(h.x,h.z)?ve(n,h.entity_id):null;m&&c.add(m)}for(let h of t.furniture){if(!u(h.x,h.z))continue;let m=h.power&&h.power!=="none"?h.power:h.entity&&h.entity!=="none"?ve(n,h.entity):null;m&&c.add(m);for(let d of h.gang_entities??[]){let g=d&&d!=="none"?ve(n,d):null;g&&c.add(g)}}return[...c].filter(h=>!l.has(h))}function Xl(n,e,t){let r=new Map;for(let i of e.floors)for( Line truncated `};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",ko);var $o=Math.PI/180,jl=3,ql=.1,So=1/6,Zl=(n,e)=>[Math.sin((e+n)*$o),-Math.cos((e+n)*$o)],Lm=["N","NE","E","SE","S","SW","W","NW"];function Om(n,e,t){return Yl(n,e,t).map(r=>r.normal)}function Yl(n,e,t){let r=[];for(let i of n.openings){if(i.room_id!==e.id||i.type==="garage")continue;let o=Rl(i,n.rooms,n.walls??[]),s=o?Tl(t,i,o):null;if(!s||!s.wall.exterior)continue;let{wall:a}=s,l=Math.hypot(a.b[0]-a.a[0],a.b[1]-a.a[1]);if(l<1e-6)continue;let c=[-(a.b[1]-a.a[1])/l,(a.b[0]-a.a[0])/l],u=a.roomLeft===e.id?c:[-c[0],-c[1]];r.push({opening:i,normal:[-u[0],-u[1]]})}return r}function Wm(n,e){let t=((Math.atan2(n[0],-n[1])/$o-e)%360+360)%360;return Lm[Math.round(t/45)%8]}var Gl=new WeakMap;function Jl(n,e){let t=Gl.get(e);return t||(t=Wt(e.rooms,{exterior:n.settings.wall_exterior,interior:n.settings.wall_interior},e.walls??[]).walls,Gl.set(e,t)),t}var Ul=new WeakMap;function Ut(n,e,t,r,i=new Date){let o=`${t.id}|${i.toISOString().slice(0,10)}|${n.settings.north??0}|${r.latitude},${r.longitude},${r.zone??""}`,s=Ul.get(e);s||Ul.set(e,s=new Map);let a=s.get(o);if(a)return a;let l=Bm(n,e,t,r,i);return s.set(o,l),l}function Bm(n,e,t,r,i){let o=n.settings.north??0,s=Om(e,t,Jl(n,e)),a=[...new Set(s.map(c=>Wm(c,o)))];if(!s.length)return{hours:0,facing:a};let l=0;for(let c=So/2;c<24;c+=So){let u=_t(zt(c,r.zone,i),r.latitude,r.longitude);if(u.elevation<jl)continue;let h=Zl(u.azimuth,o);s.some(m=>m[0]*h[0]+m[1]*h[1]>ql)&&l++}return{hours:Math.round(l*So*10)/10,facing:a}}function Ql(n,e,t,r,i=new Date().getFullYear()){return Array.from({length:12},(o,s)=>Ut(n,e,t,r,new Date(Date.UTC(i,s,15,12))).hours)}function Xl(n,e,t,r,i=new Date){let o=_t(i,r.latitude,r.longitude);if(o.elevation<jl)return[];let s=Zl(o.azimuth,n.settings.north??0);return Yl(e,t,Jl(n,e)).filter(a=>a.normal[0]*s[0]+a.normal[1]*s[1]>ql).map(a=>a.opening)}var ec=n=>6.112*Math.exp(17.62*n/(243.12+n));function jt(n,e,t=4){if(n===null||e===null)return null;let r=Math.min(100,e*ec(n)/ec(n-t));return Math.round(Math.min(100,Math.max(0,(r-65)/20*100)))}function Kr(n,e,t){return t!==null&&t>=70?"mould":n!==null&&n>=1e3?"co2":e!==null&&e>=65?"humidity":null}function xt(n=new Date,e=50){let t=n.getMonth(),r=t>=4&&t<=8;return e<0?!r:r}function Gr(n,e,t,r=!1){let i=[];if(n!==null){let[s,a]=r?[22,26]:[20,23],l=n<s?s-n:n>a?n-a:0;i.push(Math.max(0,100-l*15))}if(e!==null){let s=e<40?40-e:e>60?e-60:0;i.push(Math.max(0,100-s*4))}if(t!==null&&i.push(Math.max(0,Math.min(100,100-(t-800)/600*100))),!i.length)return null;let o=i.reduce((s,a)=>s+a,0)/i.length;return Math.round(Math.min(o,Math.min(...i)+30))}var Vm={temperature:{deviceClass:"temperature",unit:"\xB0C",stops:[[16,[.2,.45,1]],[20,[.15,.85,.75]],[22.5,[.95,.8,.3]],[26,[1,.28,.18]]]},humidity:{deviceClass:"humidity",unit:"%",stops:[[30,[.95,.6,.2]],[45,[.3,.88,.5]],[60,[.2,.78,1]],[75,[.32,.4,.98]]]},co2:{deviceClass:"carbon_dioxide",unit:"ppm",stops:[[450,[.3,.88,.5]],[800,[.98,.84,.3]],[1200,[1,.5,.2]],[1600,[.98,.25,.25]]]},mould:{deviceClass:"",unit:"%",stops:[[0,[.3,.88,.5]],[40,[.98,.84,.3]],[70,[1,.5,.2]],[100,[.75,.2,.55]]]},comfort:{deviceClass:"",unit:"",stops:[[0,[.98,.25,.25]],[40,[1,.5,.2]],[65,[.98,.84,.3]],[85,[.3,.88,.5]],[100,[.2,.8,.7]]]},power:{deviceClass:"power",unit:"W",stops:[[0,[.25,.4,.6]],[100,[.3,.88,.5]],[500,[.98,.84,.3]],[1500,[1,.5,.2]],[3e3,[.98,.25,.25]]]},sun:{deviceClass:"",unit:"h",stops:[[0,[.22,.3,.55]],[2,[.35,.6,.85]],[4,[.98,.84,.3]],[7,[1,.62,.2]],[10,[1,.42,.25]]]}},Km={deviceClass:"temperature",unit:"\xB0C",stops:[[19,[.2,.45,1]],[22.5,[.15,.85,.75]],[25.5,[.95,.8,.3]],[29,[1,.28,.18]]]};function Ur(n,e=!1){return n==="temperature"&&e?Km:Vm[n]}var Gm=(n,e,t)=>[n[0]+(e[0]-n[0])*t,n[1]+(e[1]-n[1])*t,n[2]+(e[2]-n[2])*t];function tc(n,e,t=!1){let{stops:r}=Ur(n,t),i=r.findIndex(([c])=>e<=c);if(i===-1)return r[r.length-1][1];if(i===0)return r[0][1];let[o,s]=r[i-1],[a,l]=r[i];return Gm(s,l,(e-o)/(a-o))}function Mo(n,e,t,r){let i=Vt(n,r,e.floors?.flatMap(s=>s.rooms)??t.rooms).filter(s=>s.kind==="electricity"&&s.metric==="power");if(i.length)return i.find(s=>s.unit==="W")?.value??null;let o=null;for(let s of Ao(n,e,t,r)){let a=Z(n.states[s]);a!==null&&(o=(o??0)+Math.max(0,a))}return o}function Ao(n,e,t,r){let i=Vt(n,r,e.floors?.flatMap(h=>h.rooms)??t.rooms).filter(h=>h.kind==="electricity"&&h.metric==="power");if(i.length)return i.filter(h=>h.unit==="W").flatMap(h=>h.sources);let{grid:o,solar:s,battery:a}=e.energy,l=new Set([o,s,a].filter(Boolean)),c=new Set,u=(h,m)=>r.points.length>=3&&H([h,m],r.points);for(let h of t.placements){let m=u(h.x,h.z)?we(n,h.entity_id):null;m&&c.add(m)}for(let h of t.furniture){if(!u(h.x,h.z))continue;let m=h.power&&h.power!=="none"?h.power:h.entity&&h.entity!=="none"?we(n,h.entity):null;m&&c.add(m);for(let d of h.gang_entities??[]){let g=d&&d!=="none"?we(n,d):null;g&&c.add(g)}}return[...c].filter(h=>!l.has(h))}function nc(n,e,t){let r=new Map;for(let i of e.floors)for( Line truncated
<path d=${Ar(n)} /> <path d=${Rr(n)} />
</svg>`,qr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Ao=n=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${n} /></svg>`,gp=24,_p=10,Ro=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Ur(e))this.call("light",t.service,t.data)}renderMoods(e,t){let r=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!r.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>U(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...r,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(Gr)}]),this._moodName=null};return p`<div class="nf-rp-moods"> </svg>`,Yr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},zo=n=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${n} /></svg>`,yp=24,vp=10,To=class extends X{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of qr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let r=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!r.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>j(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...r,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(jr)}]),this._moodName=null};return p`<div class="nf-rp-moods">
${r.map(l=>p`<span class="nf-rp-mood"> ${r.map(l=>p`<span class="nf-rp-mood">
<button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button> <button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button>
${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,h=o.find(m=>m.id===u.value);u.value="",h&&this.runMood(hc(l,s(h)))}}> ${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,h=o.find(m=>m.id===u.value);u.value="",h&&this.runMood(fc(l,s(h)))}}>
<option value="">→</option> <option value="">→</option>
${o.map(c=>p`<option value=${c.id}>${c.name}</option>`)} ${o.map(c=>p`<option value=${c.id}>${c.name}</option>`)}
</select>`:f} </select>`:f}
@@ -271,98 +271,98 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
><input type="text" maxlength="40" placeholder=${this.t("mood_new")} .value=${this._moodName} @input=${l=>this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} /> ><input type="text" maxlength="40" placeholder=${this.t("mood_new")} .value=${this._moodName} @input=${l=>this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} />
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span <button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
>`:f} >`:f}
</div>`}async loadCurve(e){let t=be(this.hass,this.floor,e,"temperature"),r=t.length?t:U(this.hass,e).filter(s=>s.startsWith("climate."));if(!r.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await zn(this.hass,r,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Ut(this.hass,s,o+(i-o)*l/96),u=r.map(h=>h.startsWith("climate.")?Number(c.states[h]?.attributes.current_temperature):Number(c.states[h]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((h,m)=>h+m,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(V(this.hass)){this._energy=null;return}let t=So(this.hass,this.building,this.floor,e);try{let r=await rc(this.hass,t);this.room?.id===e.id&&(this._energy=r)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let r=U(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!r.length||r.some(s=>s.state!=="off"))return f;let i=Math.max(...r.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<_p?f:p`<div class="nf-rp-shade"> </div>`}async loadCurve(e){let t=ye(this.hass,this.floor,e,"temperature"),r=t.length?t:j(this.hass,e).filter(s=>s.startsWith("climate."));if(!r.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await Fn(this.hass,r,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=qt(this.hass,s,o+(i-o)*l/96),u=r.map(h=>h.startsWith("climate.")?Number(c.states[h]?.attributes.current_temperature):Number(c.states[h]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((h,m)=>h+m,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(B(this.hass)){this._energy=null;return}let t=Ao(this.hass,this.building,this.floor,e);try{let r=await sc(this.hass,t);this.room?.id===e.id&&(this._energy=r)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let r=j(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!r.length||r.some(s=>s.state!=="off"))return f;let i=Math.max(...r.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<vp?f:p`<div class="nf-rp-shade">
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span> <span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span>
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button> <button class="nf-btn nf-rp-small" ?disabled=${!t.some(s=>W(this.hass,s.entity_id))} @click=${()=>this.call("light","turn_off",{entity_id:t.filter(s=>W(this.hass,s.entity_id)).map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let r=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!r.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of r)(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})};return p`<div class="nf-rp-shade nf-rp-open-heat"> </div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let r=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!r.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of r){if(!W(this.hass,a.entity_id))continue;(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})}};return p`<div class="nf-rp-shade nf-rp-open-heat">
<span>🪟 ${this.t("open_heating_hint",{n:o.length})}</span> <span>🪟 ${this.t("open_heating_hint",{n:o.length})}</span>
<button class="nf-btn nf-rp-small" @click=${s}>${this.t("open_heating_off")}</button> <button class="nf-btn nf-rp-small" ?disabled=${!r.some(a=>W(this.hass,a.entity_id))} @click=${s}>${this.t("open_heating_off")}</button>
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i=Z(this.hass,this.floor,e,"temperature");if(i===null||i<gp)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||C(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(Yl(this.building,this.floor,e,{latitude:t,longitude:r}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`<div class="nf-rp-shade"> </div>`}renderShade(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i=Y(this.hass,this.floor,e,"temperature");if(i===null||i<yp)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||C(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(Xl(this.building,this.floor,e,{latitude:t,longitude:r}).flatMap(a=>[a.cover,a.cover2].filter(o)))].filter(a=>W(this.hass,a));return s.length?p`<div class="nf-rp-shade">
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${L(this.hass,ce(this.hass,i),1)} ${re(this.hass)}`})}</span> <span>☀ ${this.t("shade_hint",{n:s.length,temp:`${L(this.hass,ue(this.hass,i),1)} ${ie(this.hass)}`})}</span>
<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button> <button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button>
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i={latitude:t,longitude:r};if(!Kt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=p`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}> </div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i={latitude:t,longitude:r};if(!Ut(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=p`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
☀ ${this.t("room_sun_year")} ☀ ${this.t("room_sun_year")}
</button>`;if(!this._sunYear)return s;let a=Zl(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,h)=>new Date(2026,h,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s} </button>`;if(!this._sunYear)return s;let a=Ql(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,h)=>new Date(2026,h,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,h)=>`${c[h]} ${L(this.hass,u,1)} h`).join(", ")}> <div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,h)=>`${c[h]} ${L(this.hass,u,1)} h`).join(", ")}>
${a.map((u,h)=>p`<span title=${`${L(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[h]}</b></span>`)} ${a.map((u,h)=>p`<span title=${`${L(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[h]}</b></span>`)}
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,r=t?this.hass.states[t]:void 0,i=r?{value:Number(r.state),unit:String(r.attributes.unit_of_measurement??"")}:null,o=ic(e.month,i),s=a=>`${L(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}> </div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,r=t?this.hass.states[t]:void 0,i=r?{value:Number(r.state),unit:String(r.attributes.unit_of_measurement??"")}:null,o=ac(e.month,i),s=a=>`${L(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${L(this.hass,o.value,2)} ${o.currency}`:""} ⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${L(this.hass,o.value,2)} ${o.currency}`:""}
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),r=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-r),s=e.map(c=>c===null?null:c-r+o*.1),a=Tn(s,220,36,o*1.2),l=c=>`${L(this.hass,ce(this.hass,c),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}> </p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),r=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-r),s=e.map(c=>c===null?null:c-r+o*.1),a=Dn(s,220,36,o*1.2),l=c=>`${L(this.hass,ue(this.hass,c),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${ne`<path d=${a}></path>`}</svg> <svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${re`<path d=${a}></path>`}</svg>
<span>24 h · ${l(r)} – ${l(i)}</span> <span>24 h · ${l(r)} – ${l(i)}</span>
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,r){this.hass.callService(e,t,r)}renderClean(e){let t=e.clean_entity,r=t?this.hass.states[t]:void 0;if(!t||!r)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${C(r)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=En(e);for(let r of t.off)this.call(r.domain,r.service,r.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=En(e);return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let r of t.placements)if(r.entity_id===e)return r}name(e){return this.placedAs(e)?.name?.trim()||O(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>ke(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,r){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||r()};return p`<button </div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return M(this.hass,e,t)}call(e,t,r){(Array.isArray(r.entity_id)?r.entity_id:[r.entity_id]).some(o=>typeof o!="string"||!W(this.hass,o))||this.hass.callService(e,t,r)}renderClean(e){let t=e.clean_entity,r=t?this.hass.states[t]:void 0;if(!t||!r||!W(this.hass,t))return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${C(r)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=Tn(e.filter(r=>W(this.hass,r.entity_id)));for(let r of t.off)this.call(r.domain,r.service,r.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=Tn(e.filter(r=>W(this.hass,r.entity_id)));return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let r of t.placements)if(r.entity_id===e)return r}name(e){return this.placedAs(e)?.name?.trim()||O(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>Se(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,r){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||r()};return p`<button
class="nf-switch" class="nf-switch"
role="switch" role="switch"
aria-checked=${t?"true":"false"} aria-checked=${t?"true":"false"}
aria-label=${this.name(e.entity_id)} aria-label=${this.name(e.entity_id)}
?disabled=${C(e)} ?disabled=${C(e)||!W(this.hass,e.entity_id)}
@click=${i} @click=${i}
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let r=e??U(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?La(this.hass,this.floor,t):{shown:r,more:[]}},a=ji(this.hass,s).map(E=>E.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(E=>!!E&&E!=="none"),u=new Set(c.map(E=>this.hass.states[E]?.attributes.symcon_id).filter(Boolean)),h=(this._showAll?[...o,...a]:o).filter(E=>!V(this.hass)||!u.has(this.hass.states[E]?.attributes.symcon_id)),m=E=>h.filter(D=>E.includes(P(D))).map(D=>this.hass.states[D]),d=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),y=m(["switch","fan","lock"]),S=m(["sensor","binary"]),k=m(["scene","script"]),M=this.facts(_),z=d.filter(E=>E.state==="on");return p`<section class="nf-rp" aria-label=${t.name}> ></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let r=e??j(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Va(this.hass,this.floor,t):{shown:r,more:[]}},a=Yi(this.hass,s).map(x=>x.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(x=>!!x&&x!=="none"),u=new Set(c.map(x=>this.hass.states[x]?.attributes.symcon_id).filter(Boolean)),h=(this._showAll?[...o,...a]:o).filter(x=>!B(this.hass)||!u.has(this.hass.states[x]?.attributes.symcon_id)),m=x=>h.filter(D=>x.includes(P(D))).map(D=>this.hass.states[D]),d=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),y=m(["switch","fan","lock"]),$=m(["sensor","binary"]),S=m(["scene","script"]),A=t.symcon_read_room===!1?[]:this.facts(_),z=d.filter(x=>x.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
<header class="nf-rp-head"> <header class="nf-rp-head">
<div> <div>
<h2>${t.name}</h2> <h2>${t.name}</h2>
${M.length?p`<p class="nf-rp-facts">${M.map((E,D)=>p`${D?" \xB7 ":f}${E}`)}</p>`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()} ${A.length?p`<p class="nf-rp-facts">${A.map((x,D)=>p`${D?" \xB7 ":f}${x}`)}</p>`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()}
${this.renderOpenWhileHeating(_)} ${this.renderEmptyLights(t,z)} ${this.renderOpenWhileHeating(_)} ${this.renderEmptyLights(t,z)}
${this.renderCurve()} ${this.renderCurve()}
</div> </div>
<button class="nf-rp-close" aria-label=${this.t(this._folded?"panel_unfold":"panel_fold")} title=${this.t(this._folded?"panel_unfold":"panel_fold")} aria-expanded=${this._folded?"false":"true"} @click=${()=>this._folded=!this._folded}> <button class="nf-rp-close" aria-label=${this.t(this._folded?"panel_unfold":"panel_fold")} title=${this.t(this._folded?"panel_unfold":"panel_fold")} aria-expanded=${this._folded?"false":"true"} @click=${()=>this._folded=!this._folded}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${this._folded?ne`<path d="M6 14l6-6 6 6" />`:ne`<path d="M6 12h12" />`}</svg> <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${this._folded?re`<path d="M6 14l6-6 6 6" />`:re`<path d="M6 12h12" />`}</svg>
</button> </button>
<button class="nf-rp-close" aria-label=${this.t("close")} @click=${()=>this.fire("close")}> <button class="nf-rp-close" aria-label=${this.t("close")} @click=${()=>this.fire("close")}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18" /></svg> <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18" /></svg>
</button> </button>
</header> </header>
<div class="nf-rp-body" ?hidden=${this._folded}> <div class="nf-rp-body" ?hidden=${this._folded}>
<nf-utility-report .hass=${this.hass} .readings=${Wt(this.hass,t,this.building?.floors.flatMap(E=>E.rooms))}></nf-utility-report> <nf-utility-report .hass=${this.hass} .readings=${Vt(this.hass,t,this.building?.floors.flatMap(x=>x.rooms))}></nf-utility-report>
${this.renderAllOff([...d,...b,...y])} ${this.renderAllOff([...d,...b,...y])}
${this.renderClean(t)} ${this.renderClean(t)}
${!t.area_id&&!e&&!(V(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!h.length&&!(V(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f} ${t.symcon_read_room===!1?p`<p class="nf-rp-note">${this.t(h.length?"access_room_devices":"access_room_geometry")}</p>`:!t.area_id&&!e&&!(B(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!h.length&&!(B(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
${k.length?this.section("panel_scenes",[p`<div class="nf-rp-scenes"> ${S.length?this.section("panel_scenes",[p`<div class="nf-rp-scenes">
${k.map(E=>p`<button ${S.map(x=>p`<button
class="nf-btn" class="nf-btn"
?disabled=${C(E)} ?disabled=${C(x)}
@click=${()=>this.call(P(E.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:E.entity_id})} @click=${()=>this.call(P(x.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:x.entity_id})}
> >
${this.name(E.entity_id)} ${this.name(x.entity_id)}
</button>`)} </button>`)}
</div>`]):f} </div>`]):f}
${d.length?this.section("panel_lights",[...d.map(E=>this.lightRow(E)),...t?[this.renderMoods(t,d)]:[]],p`${z.length<d.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_on",{entity_id:d.filter(E=>!C(E)).map(E=>E.entity_id)})}> ${d.length?this.section("panel_lights",[...d.map(x=>W(this.hass,x.entity_id)?this.lightRow(x):this.sensorRow(x)),...t&&d.some(x=>W(this.hass,x.entity_id))?[this.renderMoods(t,d)]:[]],p`${d.some(x=>x.state!=="on"&&W(this.hass,x.entity_id))?p`<button class="nf-btn nf-rp-small" ?disabled=${!d.some(x=>W(this.hass,x.entity_id))} @click=${()=>this.call("light","turn_on",{entity_id:d.filter(x=>!C(x)&&W(this.hass,x.entity_id)).map(x=>x.entity_id)})}>
${this.t("panel_all_on")} ${this.t("panel_all_on")}
</button>`:f}${z.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:z.map(E=>E.entity_id)})}> </button>`:f}${z.some(x=>W(this.hass,x.entity_id))?p`<button class="nf-btn nf-rp-small" ?disabled=${!z.some(x=>W(this.hass,x.entity_id))} @click=${()=>this.call("light","turn_off",{entity_id:z.filter(x=>W(this.hass,x.entity_id)).map(x=>x.entity_id)})}>
${this.t("panel_all_off")} ${this.t("panel_all_off")}
</button>`:f}`):f} </button>`:f}`):f}
${g.length?this.section("panel_covers",g.map(E=>this.coverRow(E)),g.length>1&&mr(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:mr(g,this.confirmEntities)})}> ${g.length?this.section("panel_covers",g.map(x=>W(this.hass,x.entity_id)?this.coverRow(x):this.sensorRow(x)),g.length>1&&fr(g.filter(x=>W(this.hass,x.entity_id)),this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:fr(g.filter(x=>W(this.hass,x.entity_id)),this.confirmEntities)})}>
${this.t("panel_all_open")}</button ${this.t("panel_all_open")}</button
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:mr(g,this.confirmEntities)})}> ><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:fr(g.filter(x=>W(this.hass,x.entity_id)),this.confirmEntities)})}>
${this.t("panel_all_close")} ${this.t("panel_all_close")}
</button>`:f):f} </button>`:f):f}
${V(this.hass)?p`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f} ${B(this.hass)?p`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f}
${_.length?this.section("panel_climate",_.map(E=>this.climateRow(E))):f} ${_.length?this.section("panel_climate",_.map(x=>W(this.hass,x.entity_id)?this.climateRow(x):this.sensorRow(x))):f}
${b.length?this.section("panel_media",b.map(E=>this.mediaRow(E))):f} ${b.length?this.section("panel_media",b.map(x=>W(this.hass,x.entity_id)?this.mediaRow(x):this.sensorRow(x))):f}
${y.length?this.section("panel_switches",y.map(E=>this.switchRow(E))):f} ${y.length?this.section("panel_switches",y.map(x=>W(this.hass,x.entity_id)?this.switchRow(x):this.sensorRow(x))):f}
${S.length?this.section("panel_sensors",S.map(E=>this.sensorRow(E))):f} ${$.length?this.section("panel_sensors",$.map(x=>this.sensorRow(x))):f}
${this.extraValues(t)} ${this.extraValues(t)}
${!V(this.hass)&&pl(this.hass)&&ml(this.hass,this.floor,t)?this.announceSection(t):f} ${!B(this.hass)&&bl(this.hass)&&_l(this.hass,this.floor,t)?this.announceSection(t):f}
${this.pluginSections(t,h)} ${this.pluginSections(t,h)}
${l?p`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}> ${l?p`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}>
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})} ${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
</button>`:f} </button>`:f}
</div> </div>
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(r=>!r.outside&&H([r.x,r.z],e.points)).map(r=>({name:r.name||O(this.hass,r.entity_id),rows:Rr(this.hass,r.values)})),...this.floor.furniture.filter(r=>H([r.x,r.z],e.points)).map(r=>({name:r.name||(r.entity&&r.entity!=="none"?O(this.hass,r.entity):ae(this.hass,r.type)),rows:[...jr(this.hass,r),...Rr(this.hass,r.values)]}))].filter(r=>r.rows.length);return t.length?this.section("device_values",t.map(r=>p`<div class="nf-extra-values"><b>${r.name}</b>${r.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${G(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],r=this.room;if(!r)return t;let i=(T,R)=>{let A=Z(this.hass,this.floor,r,T);if(A===null)return null;if(T==="temperature")return`${L(this.hass,ce(this.hass,A),1)} ${re(this.hass)}`;let I=be(this.hass,this.floor,r,T)[0],N=this.hass.states[I]?.attributes.unit_of_measurement??R;return`${L(this.hass,A,1)} ${N}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${G(this.hass,be(this.hass,this.floor,r,"temperature"),"Temperatur")}`):o&&r.climate?.temperature!=="none"&&t.push(p`${L(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${G(this.hass,be(this.hass,this.floor,r,"humidity"),"Luftfeuchte")}`);let l=Z(this.hass,this.floor??null,r,"illuminance");l!==null&&t.push(p`☀ ${L(this.hass,l,0)} lx${G(this.hass,be(this.hass,this.floor,r,"illuminance"),"Helligkeit")}`);let c=Wt(this.hass,r,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),u=!c&&this.floor&&this.building?ko(this.hass,this.building,this.floor,r):null;c?t.push(p`⚡ ${Ne(this.hass,c)}${G(this.hass,c.sources,"Leistung")}`):u!==null&&t.push(`\u26A1 ${wt(this.hass,u)}`);let h=this.floor?this.floor.openings.filter(T=>T.room_id===r.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];h.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:$o(Date.now()-Math.min(...h))})}`);let m=U(this.hass,r).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(R=>Date.parse(String(R.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:$o(Date.now()-T)})}`)}let d=this.building?ac(this.hass,this.building).filter(T=>T.roomId===r.id&&T.level<sc):[];d.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:d.length,names:d.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(r.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:y,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&y!==void 0&&this.building&&!_.includes("sun")){let T=Kt(this.building,this.floor,r,{latitude:b,longitude:y,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:L(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=Z(this.hass,this.floor,r,"temperature"),M=Z(this.hass,this.floor,r,"humidity"),z=Br(Z(this.hass,this.floor,r,"co2"),M,Gt(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let E=Vr(k,M,Z(this.hass,this.floor,r,"co2"),vt(new Date,this.hass.config?.latitude)),D=r.hvac?.status;return D&&D!=="none"?t.push(p`${De(this.hass.states[D])}${G(this.hass,[D],"Raumstatus")}`):E!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:E})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),r=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");r(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>r(o)}>${o}</button>`)}</div> </section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(r=>!r.outside&&H([r.x,r.z],e.points)).map(r=>({name:r.name||O(this.hass,r.entity_id),rows:zr(this.hass,r.values)})),...this.floor.furniture.filter(r=>H([r.x,r.z],e.points)).map(r=>({name:r.name||(r.entity&&r.entity!=="none"?O(this.hass,r.entity):le(this.hass,r.type)),rows:[...Zr(this.hass,r),...zr(this.hass,r.values)]}))].filter(r=>r.rows.length);return t.length?this.section("device_values",t.map(r=>p`<div class="nf-extra-values"><b>${r.name}</b>${r.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${U(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],r=this.room;if(!r)return t;let i=(T,R)=>{let E=Y(this.hass,this.floor,r,T);if(E===null)return null;if(T==="temperature")return`${L(this.hass,ue(this.hass,E),1)} ${ie(this.hass)}`;let I=ye(this.hass,this.floor,r,T)[0],N=this.hass.states[I]?.attributes.unit_of_measurement??R;return`${L(this.hass,E,1)} ${N}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${U(this.hass,ye(this.hass,this.floor,r,"temperature"),"Temperatur")}`):o&&r.climate?.temperature!=="none"&&t.push(p`${L(this.hass,o.attributes.current_temperature,1)} ${ie(this.hass)}${U(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${U(this.hass,ye(this.hass,this.floor,r,"humidity"),"Luftfeuchte")}`);let l=Y(this.hass,this.floor??null,r,"illuminance");l!==null&&t.push(p`☀ ${L(this.hass,l,0)} lx${U(this.hass,ye(this.hass,this.floor,r,"illuminance"),"Helligkeit")}`);let c=Vt(this.hass,r,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),u=!c&&this.floor&&this.building?Mo(this.hass,this.building,this.floor,r):null;c?t.push(p`⚡ ${Le(this.hass,c)}${U(this.hass,c.sources,"Leistung")}`):u!==null&&t.push(`\u26A1 ${kt(this.hass,u)}`);let h=this.floor?this.floor.openings.filter(T=>T.room_id===r.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];h.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Eo(Date.now()-Math.min(...h))})}`);let m=j(this.hass,r).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(R=>Date.parse(String(R.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Eo(Date.now()-T)})}`)}let d=this.building?uc(this.hass,this.building).filter(T=>T.roomId===r.id&&T.level<cc):[];d.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:d.length,names:d.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(r.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:y,time_zone:$}=this.hass.config??{};if(this.floor&&b!==void 0&&y!==void 0&&this.building&&!_.includes("sun")){let T=Ut(this.building,this.floor,r,{latitude:b,longitude:y,zone:$});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:L(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let S=Y(this.hass,this.floor,r,"temperature"),A=Y(this.hass,this.floor,r,"humidity"),z=Kr(Y(this.hass,this.floor,r,"co2"),A,jt(S,A));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let x=Gr(S,A,Y(this.hass,this.floor,r,"co2"),xt(new Date,this.hass.config?.latitude)),D=r.hvac?.status;return D&&D!=="none"?t.push(p`${De(this.hass.states[D])}${U(this.hass,[D],"Raumstatus")}`):x!==null&&(S!==null||A!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:x})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),r=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");r(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>r(o)}>${o}</button>`)}</div>
<form class="nf-rp-say" @submit=${i}> <form class="nf-rp-say" @submit=${i}>
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} /> <input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button> <button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
</form> </form>
${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Ys({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}> ${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Xs({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
<div class="nf-rp-sec-head"><h3>${i.title}</h3></div> <div class="nf-rp-sec-head"><h3>${i.title}</h3></div>
${typeof i.content=="string"?p`<p class="nf-rp-note">${i.content}</p>`:i.content} ${typeof i.content=="string"?p`<p class="nf-rp-note">${i.content}</p>`:i.content}
</div>`)}section(e,t,r=f){return p`<div class="nf-rp-sec"> </div>`)}section(e,t,r=f){return p`<div class="nf-rp-sec">
<div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${r}</div> <div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${r}</div>
${t} ${t}
</div>`}lightRow(e){let t=e.attributes,r=e.state==="on",i=t.supported_color_modes??[],o=i.some(d=>d!=="onoff"),s=i.includes("color_temp"),a=i.some(d=>["hs","rgb","rgbw","rgbww","xy"].includes(d)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,c=t.min_color_temp_kelvin??2200,u=t.max_color_temp_kelvin??6500,h=e.entity_id,m=!!this.placedAs(h)?.simple;return p`<div class="nf-rp-row"> </div>`}lightRow(e){let t=e.attributes,r=e.state==="on",i=t.supported_color_modes??[],o=i.some(d=>d!=="onoff"),s=i.includes("color_temp"),a=i.some(d=>["hs","rgb","rgbw","rgbww","xy"].includes(d)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,c=t.min_color_temp_kelvin??2200,u=t.max_color_temp_kelvin??6500,h=e.entity_id,m=!!this.placedAs(h)?.simple;return p`<div class="nf-rp-row">
<span class="nf-rp-icon ${r?"nf-rp-on":""}">${qt("light")}</span> <span class="nf-rp-icon ${r?"nf-rp-on":""}">${Yt("light")}</span>
${this.nameButton(h)} ${this.nameButton(h)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span> <span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
${this.toggle(e,r,()=>this.call("light","toggle",{entity_id:h}))} ${this.toggle(e,r,()=>this.call("light","toggle",{entity_id:h}))}
${o&&!m?p`<label class="nf-rp-slider" ${o&&!m?p`<label class="nf-rp-slider"
><span>${this.t("brightness")}</span> ><span>${this.t("brightness")}</span>
@@ -384,23 +384,23 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@change=${d=>this.call("light","turn_on",{entity_id:h,color_temp_kelvin:Number(d.target.value)})} @change=${d=>this.call("light","turn_on",{entity_id:h,color_temp_kelvin:Number(d.target.value)})}
/></label>`:f} /></label>`:f}
${r&&a&&!m?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}> ${r&&a&&!m?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
${fp.map(d=>p`<button ${bp.map(d=>p`<button
class="nf-rp-swatch" class="nf-rp-swatch"
style="--c: rgb(${d.join(",")})" style="--c: rgb(${d.join(",")})"
aria-label="rgb(${d.join(", ")})" aria-label="rgb(${d.join(", ")})"
@click=${()=>this.call("light","turn_on",{entity_id:h,rgb_color:d})} @click=${()=>this.call("light","turn_on",{entity_id:h,rgb_color:d})}
></button>`)} ></button>`)}
</div>`:f} </div>`:f}
</div>`}coverRow(e){let t=kr(this.hass,this.building?.floors??[],e.entity_id);e=Sr(this.hass,e,t);let r=e.attributes,i=r.supported_features??0,o=e.entity_id,s=C(e)&&!pn(e);return p`<div class="nf-rp-row"> </div>`}coverRow(e){let t=$r(this.hass,this.building?.floors??[],e.entity_id);e=Mr(this.hass,e,t);let r=e.attributes,i=r.supported_features??0,o=e.entity_id,s=C(e)&&!gn(e);return p`<div class="nf-rp-row">
<span class="nf-rp-icon">${qt("cover")}</span> <span class="nf-rp-icon">${Yt("cover")}</span>
${this.nameButton(o)} ${this.nameButton(o)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span> <span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
<div class="nf-rp-buttons"> <div class="nf-rp-buttons">
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","open_cover",{entity_id:o})}>${this.t("cover_open")}</button> <button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","open_cover",{entity_id:o})}>${this.t("cover_open")}</button>
${i&pp?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f} ${i&_p?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","close_cover",{entity_id:o})}>${this.t("cover_close")}</button> <button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","close_cover",{entity_id:o})}>${this.t("cover_close")}</button>
</div> </div>
${i&mp&&typeof r.current_position=="number"?p`<label class="nf-rp-slider" ${i&gp&&typeof r.current_position=="number"?p`<label class="nf-rp-slider"
><span>${this.t("position")}</span> ><span>${this.t("position")}</span>
<input <input
type="range" type="range"
@@ -424,12 +424,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${i&32?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:o})}>${this.t("cover_tilt_close")}</button>`:f} ${i&32?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:o})}>${this.t("cover_tilt_close")}</button>`:f}
</div>`:f} </div>`:f}
</div>`}climateRow(e){let t=e.attributes,r=e.entity_id,i=typeof t.temperature=="number"?t.temperature:null,o=t.target_temp_step??.5,s=t.min_temp??5,a=t.max_temp??30,l=t.hvac_modes??[],c=u=>this.call("climate","set_temperature",{entity_id:r,temperature:Math.min(a,Math.max(s,Math.round(u/o)*o))});return p`<div class="nf-rp-row"> </div>`}climateRow(e){let t=e.attributes,r=e.entity_id,i=typeof t.temperature=="number"?t.temperature:null,o=t.target_temp_step??.5,s=t.min_temp??5,a=t.max_temp??30,l=t.hvac_modes??[],c=u=>this.call("climate","set_temperature",{entity_id:r,temperature:Math.min(a,Math.max(s,Math.round(u/o)*o))});return p`<div class="nf-rp-row">
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${qt("climate")}</span> <span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Yt("climate")}</span>
${this.nameButton(r)} ${this.nameButton(r)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span> <span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
${i!==null?p`<div class="nf-rp-stepper nf-rp-wide"> ${i!==null?p`<div class="nf-rp-stepper nf-rp-wide">
<button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>c(i-o)}>−</button> <button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>c(i-o)}>−</button>
<span><small>${this.t("target_temp")}</small> ${L(this.hass,i,1)} ${re(this.hass)}</span> <span><small>${this.t("target_temp")}</small> ${L(this.hass,i,1)} ${ie(this.hass)}</span>
<button class="nf-btn" aria-label=${this.t("temp_up")} @click=${()=>c(i+o)}>+</button> <button class="nf-btn" aria-label=${this.t("temp_up")} @click=${()=>c(i+o)}>+</button>
</div>`:f} </div>`:f}
${l.length>1?p`<div class="nf-rp-chips"> ${l.length>1?p`<div class="nf-rp-chips">
@@ -441,20 +441,20 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${this.stateLabel(u)} ${this.stateLabel(u)}
</button>`)} </button>`)}
</div>`:f} </div>`:f}
</div>`}stateOf(e,t=se(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let r=P(e.entity_id);return e.state==="unknown"&&r!=="sensor"&&r!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,r=this.t(t);return r===t?e:r}mediaRow(e){let t=e.attributes,r=e.entity_id,i=C(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return p`<div class="nf-rp-row"> </div>`}stateOf(e,t=ae(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let r=P(e.entity_id);return e.state==="unknown"&&r!=="sensor"&&r!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,r=this.t(t);return r===t?e:r}mediaRow(e){let t=e.attributes,r=e.entity_id,i=C(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return p`<div class="nf-rp-row">
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${qt("media")}</span> <span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Yt("media")}</span>
${this.nameButton(r)} ${this.nameButton(r)}
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}${G(this.hass,[e.entity_id])}</span> <span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}${U(this.hass,[e.entity_id])}</span>
${o?p`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f} ${o?p`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f}
<div class="nf-rp-buttons nf-rp-wide"> <div class="nf-rp-buttons nf-rp-wide">
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:r})}> <button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:r})}>
${Ao(qr.previous)} ${zo(Yr.previous)}
</button> </button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${C(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:r})}> <button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${C(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:r})}>
${Ao(e.state==="playing"?qr.pause:qr.play)} ${zo(e.state==="playing"?Yr.pause:Yr.play)}
</button> </button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:r})}> <button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:r})}>
${Ao(qr.next)} ${zo(Yr.next)}
</button> </button>
</div> </div>
${typeof t.volume_level=="number"?p`<label class="nf-rp-slider" ${typeof t.volume_level=="number"?p`<label class="nf-rp-slider"
@@ -466,16 +466,16 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.value=${String(Math.round(t.volume_level*100))} .value=${String(Math.round(t.volume_level*100))}
@change=${s=>this.call("media_player","volume_set",{entity_id:r,volume_level:Number(s.target.value)/100})} @change=${s=>this.call("media_player","volume_set",{entity_id:r,volume_level:Number(s.target.value)/100})}
/></label>`:f} /></label>`:f}
</div>`}switchRow(e){let t=e.entity_id,r=P(t),i=t.slice(0,t.indexOf(".")),o=r==="lock"?e.state==="unlocked"||e.state==="open":te(e),s=()=>r==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return p`<div class="nf-rp-row"> </div>`}switchRow(e){let t=e.entity_id,r=P(t),i=t.slice(0,t.indexOf(".")),o=r==="lock"?e.state==="unlocked"||e.state==="open":ne(e),s=()=>r==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return p`<div class="nf-rp-row">
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${qt(r)}</span> <span class="nf-rp-icon ${o?"nf-rp-on":""}">${Yt(r)}</span>
${this.nameButton(t)} ${this.nameButton(t)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span> <span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
${this.toggle(e,o,s)} ${this.toggle(e,o,s)}
</div>`}sensorRow(e){let t=P(e.entity_id),r=t==="binary"&&e.state==="on";return p`<div class="nf-rp-row"> </div>`}sensorRow(e){let t=P(e.entity_id),r=t==="binary"&&e.state==="on";return p`<div class="nf-rp-row">
<span class="nf-rp-icon ${r?"nf-rp-on":""}">${qt(t)}</span> <span class="nf-rp-icon ${r?"nf-rp-on":""}">${Yt(t)}</span>
${this.nameButton(e.entity_id)} ${this.nameButton(e.entity_id)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span> <span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[ye,He,J` </div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[ve,Pe,Q`
:host { :host {
display: block; display: block;
} }
@@ -856,32 +856,32 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
outline: 2px solid var(--nf-accent); outline: 2px solid var(--nf-accent);
outline-offset: 2px; outline-offset: 2px;
} }
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Ro);function xc(n){if(!n)return"";let e=Math.min(.8,Math.max(0,n.dim??.35)),t=n.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(n.image)?n.image:null,r=n.color&&/^#[0-9a-f]{6}$/i.test(n.color)?n.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${r?` ${r}`:""}`:r?`;background:${r}`:""}var bp=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],kc=[34,211,238];function Eo(n){return n?bp.find(([e])=>e.test(n))?.[1]??kc:kc}function zo(n){if(n.state==="playing"||n.state==="paused")return!0;let e=t=>typeof n.attributes[t]=="string"&&n.attributes[t]!=="";return n.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var To=n=>n.state==="playing"||n.state==="on"&&zo(n);function Sc(n,e){let t=[],r=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||r.has(i.entity))continue;r.add(i.entity);let o=n.states[i.entity];if(!o)continue;let s=o.attributes,a=u=>typeof s[u]=="string"?s[u]:"",l=a("app_name")||a("source")||a("app_id")||null,c=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:To(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:c,color:Eo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==i.entity):[],rings:i.rings??1})}return t}function $c(n){let e=new Map(n.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],r=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!r.has(a)&&(r.add(a),t.push([i,s]))}return t}var yp=3;function Mc(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(n.states[s])||r.push({id:o.id,at:{floorId:i.id,x:o.x,y:oe(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??yp))})}return r}var Zr=n=>n&&n!=="none"?n:null,Ac=n=>Math.min(1,Math.max(0,n));function Rc(n,e){let t=new Map;for(let r of e.settings.roof?.windows??[]){let i=Ve(n,{cover:Zr(r.cover),contact:Zr(r.contact),tilt:Zr(r.tilt)},"window"),o=Zr(r.window),s=o?n.states[o]:void 0,a=i.open;if(s&&!C(s)){let l=s.attributes.current_position;a=typeof l=="number"?Ac(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(r.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function vp(n,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return n.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var st=(n,e)=>typeof n[e]=="string"?n[e]:"";function Ec(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!vr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:vp(i,o),l=a?n.states[a]:void 0;if(!l||!zo(l))continue;let c=l.attributes,u=st(c,"app_name")||st(c,"source")||null;r.push({id:o.id,furnitureId:o.id,floorId:i.id,color:Eo(u),title:st(c,"media_title")||st(c,"media_channel")||u||"",subtitle:st(c,"media_artist")||st(c,"media_series_title")||st(c,"media_album_name"),app:u,picture:st(c,"entity_picture")||null,playing:To(l),ambilight:o.ambilight??1})}return r}function zc(n){let e=n.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function Tc(n,e){return(n===null?0:Ac((n+4)/16))*(1-.45*e)}function at(n,e){return n.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&n.states[e]?e:Object.keys(n.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Yr=new Set(["contact_lost","unlocked_night","own"]);function wp(n,e){let t=n.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let r=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(r);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return r.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var xp=600*1e3,kp=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Sp=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),Fc=(n,e)=>{if(e.startsWith("binary_sensor."))return Sp.get(String(n.states[e]?.attributes.device_class))};function $p(n,e){let t=new Set,r=[];for(let i of n.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),r.push({floorId:i.id,roomId:o.room_id,entity:a}))}return r}function Dc(n,e,t,r){let i=[];for(let a o Line truncated `]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",To);function $c(n){if(!n)return"";let e=Math.min(.8,Math.max(0,n.dim??.35)),t=n.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(n.image)?n.image:null,r=n.color&&/^#[0-9a-f]{6}$/i.test(n.color)?n.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${r?` ${r}`:""}`:r?`;background:${r}`:""}var wp=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],Mc=[34,211,238];function Fo(n){return n?wp.find(([e])=>e.test(n))?.[1]??Mc:Mc}function Do(n){if(n.state==="playing"||n.state==="paused")return!0;let e=t=>typeof n.attributes[t]=="string"&&n.attributes[t]!=="";return n.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Ho=n=>n.state==="playing"||n.state==="on"&&Do(n);function Ac(n,e){let t=[],r=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||r.has(i.entity))continue;r.add(i.entity);let o=n.states[i.entity];if(!o)continue;let s=o.attributes,a=u=>typeof s[u]=="string"?s[u]:"",l=a("app_name")||a("source")||a("app_id")||null,c=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:Ho(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:c,color:Fo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==i.entity):[],rings:i.rings??1})}return t}function Ec(n){let e=new Map(n.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],r=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!r.has(a)&&(r.add(a),t.push([i,s]))}return t}var xp=3;function Rc(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!ne(n.states[s])||r.push({id:o.id,at:{floorId:i.id,x:o.x,y:se(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??xp))})}return r}var Jr=n=>n&&n!=="none"?n:null,zc=n=>Math.min(1,Math.max(0,n));function Tc(n,e){let t=new Map;for(let r of e.settings.roof?.windows??[]){let i=Ke(n,{cover:Jr(r.cover),contact:Jr(r.contact),tilt:Jr(r.tilt)},"window"),o=Jr(r.window),s=o?n.states[o]:void 0,a=i.open;if(s&&!C(s)){let l=s.attributes.current_position;a=typeof l=="number"?zc(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(r.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function kp(n,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return n.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var at=(n,e)=>typeof n[e]=="string"?n[e]:"";function Fc(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!xr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:kp(i,o),l=a?n.states[a]:void 0;if(!l||!Do(l))continue;let c=l.attributes,u=at(c,"app_name")||at(c,"source")||null;r.push({id:o.id,furnitureId:o.id,floorId:i.id,color:Fo(u),title:at(c,"media_title")||at(c,"media_channel")||u||"",subtitle:at(c,"media_artist")||at(c,"media_series_title")||at(c,"media_album_name"),app:u,picture:at(c,"entity_picture")||null,playing:Ho(l),ambilight:o.ambilight??1})}return r}function Dc(n){let e=n.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function Hc(n,e){return(n===null?0:zc((n+4)/16))*(1-.45*e)}function lt(n,e){return n.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&n.states[e]?e:Object.keys(n.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Qr=new Set(["contact_lost","unlocked_night","own"]);function Sp(n,e){let t=n.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let r=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(r);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return r.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var $p=600*1e3,Mp=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Ap=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),Pc=(n,e)=>{if(e.startsWith("binary_sensor."))return Ap.get(String(n.states[e]?.attributes.device_class))};function Ep(n,e){let t=new Set,r=[];for(let i of n.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),r.push({floorId:i.id,roomId:o.room_id,entity:a}))}return r}function Ic(n,e,t,r){let i=[];for(let a o Line truncated
${ne`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle> ${re`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(r*Math.max(0,Math.min(1,n))).toFixed(1)} ${r.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`} <circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(r*Math.max(0,Math.min(1,n))).toFixed(1)} ${r.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
</svg>`}function Pf(n,e,t,r){let i=e.summary,o=c=>$(n,c),s=e.autarky,a=r?p`<button class="live-fold" title=${o(r.folded?"live_unfold":"live_fold")} aria-label=${o(r.folded?"live_unfold":"live_fold")} aria-expanded=${!r.folded} @click=${r.toggle}>${r.folded?"+":"\u2212"}</button>`:f;if(r?.folded){let c=i.solar!==null?`\u2600 ${ze(n,i.solar)}`:i.consumption!==null?`\u2302 ${ze(n,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}> </svg>`}function Nf(n,e,t,r){let i=e.summary,o=c=>M(n,c),s=e.autarky,a=r?p`<button class="live-fold" title=${o(r.folded?"live_unfold":"live_fold")} aria-label=${o(r.folded?"live_unfold":"live_fold")} aria-expanded=${!r.folded} @click=${r.toggle}>${r.folded?"+":"\u2212"}</button>`:f;if(r?.folded){let c=i.solar!==null?`\u2600 ${Te(n,i.solar)}`:i.consumption!==null?`\u2302 ${Te(n,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
${s!==null?p`<div class="live-own">${Wn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f} ${s!==null?p`<div class="live-own">${Vn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
${c?p`<b>${c}</b>`:s===null?p`<b>⌂</b>`:f} ${c?p`<b>${c}</b>`:s===null?p`<b>⌂</b>`:f}
${a} ${a}
</div>`}let l=[];if(i.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${ze(n,i.solar)}</b></div>`),i.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${ze(n,i.consumption)}</b></div>`),i.rest!==void 0&&i.rest!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_rest")}</span><b>${ze(n,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let c=i.battery===null||Math.abs(i.battery)<15?"":i.battery>0?" \u2193":" \u2191";l.push(p`<div class="live-row live-battery"><span>▮ ${o("energy_battery")}${c}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${ze(n,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let c=i.grid<-15;l.push(p`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${o(c?"energy_grid_export":"energy_grid_import")}</span><b>${ze(n,i.grid)}</b></div>`)}for(let c of e.meters??[])l.push(p`<div class="live-row live-meter"><span>${c.icon} ${c.label}</span><b>${c.value}</b></div>`);return p`<div class="live-card live-card-house" data-i=${t}> </div>`}let l=[];if(i.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${Te(n,i.solar)}</b></div>`),i.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${Te(n,i.consumption)}</b></div>`),i.rest!==void 0&&i.rest!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_rest")}</span><b>${Te(n,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let c=i.battery===null||Math.abs(i.battery)<15?"":i.battery>0?" \u2193":" \u2191";l.push(p`<div class="live-row live-battery"><span>▮ ${o("energy_battery")}${c}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${Te(n,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let c=i.grid<-15;l.push(p`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${o(c?"energy_grid_export":"energy_grid_import")}</span><b>${Te(n,i.grid)}</b></div>`)}for(let c of e.meters??[])l.push(p`<div class="live-row live-meter"><span>${c.icon} ${c.label}</span><b>${c.value}</b></div>`);return p`<div class="live-card live-card-house" data-i=${t}>
${a} ${a}
${s!==null?p`<div class="live-own">${Wn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f} ${s!==null?p`<div class="live-own">${Vn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
<div class="live-rows">${l}</div> <div class="live-rows">${l}</div>
${Cf(n,e.curves)} ${If(n,e.week)} ${Of(n,e.curves)} ${Lf(n,e.week)}
</div>`}function If(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let r=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(c,u,h)=>c===null||c<=0?f:ne`<rect x=${u.toFixed(1)} y=${(o-c/r*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/r*o).toFixed(1)} class=${h}></rect>`,l=c=>c.reduce((u,h)=>u+(h??0),0);return p`<div class="live-day live-week" title=${$(n,"live_week_hint",{solar:L(n,l(e.solar),0),use:L(n,l(e.use),0)})}> </div>`}function Lf(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let r=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(c,u,h)=>c===null||c<=0?f:re`<rect x=${u.toFixed(1)} y=${(o-c/r*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/r*o).toFixed(1)} class=${h}></rect>`,l=c=>c.reduce((u,h)=>u+(h??0),0);return p`<div class="live-day live-week" title=${M(n,"live_week_hint",{solar:L(n,l(e.solar),0),use:L(n,l(e.use),0)})}>
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true"> <svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
${e.days.map((c,u)=>ne`${a(e.solar[u],u*s+s*.1,"live-week-solar")}${a(e.use[u],u*s+s*.5,"live-week-use")}`)} ${e.days.map((c,u)=>re`${a(e.solar[u],u*s+s*.1,"live-week-solar")}${a(e.use[u],u*s+s*.5,"live-week-use")}`)}
</svg> </svg>
<span>7 ${$(n,"live_days")}</span> <span>7 ${M(n,"live_days")}</span>
</div>`}function Cf(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let r=Math.max(...t)*1.08||1,[i,o]=[150,34],s=Tn(e.solar,i,o,r),a=Tn(e.use,i,o,r);return p`<div class="live-day" title=${$(n,"live_day_hint")}> </div>`}function Of(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let r=Math.max(...t)*1.08||1,[i,o]=[150,34],s=Dn(e.solar,i,o,r),a=Dn(e.use,i,o,r);return p`<div class="live-day" title=${M(n,"live_day_hint")}>
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true"> <svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
${s?ne`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f} ${s?re`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f}
${a?ne`<path d=${a} class="live-day-use"></path>`:f} ${a?re`<path d=${a} class="live-day-use"></path>`:f}
</svg> </svg>
<span>24 h</span> <span>24 h</span>
</div>`}function Nf(n,e,t,r){let i=e.car,o=(u,h)=>$(n,u,h),s=Au(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${ze(n,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${L(n,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,c=(u,h,m,d)=>p`<button class="live-btn ${u?"live-on":""}" title=${h} aria-label=${h} aria-pressed=${u??!1} @click=${g=>(g.stopPropagation(),d())}>${m}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}> </div>`}function Wf(n,e,t,r){let i=e.car,o=(u,h)=>M(n,u,h),s=zu(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${Te(n,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${L(n,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,c=(u,h,m,d)=>p`<button class="live-btn ${u?"live-on":""}" title=${h} aria-label=${h} aria-pressed=${u??!1} @click=${g=>(g.stopPropagation(),d())}>${m}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
<div class="live-own"> <div class="live-own">
${Wn((i.soc??0)/100,s)} ${Vn((i.soc??0)/100,s)}
<div class="live-own-text"><b>${i.soc!==null?`${Math.round(i.soc)} %`:"\u2013"}</b><span>${i.range!==null?`${Math.round(i.range)} ${i.rangeUnit}`:""}</span></div> <div class="live-own-text"><b>${i.soc!==null?`${Math.round(i.soc)} %`:"\u2013"}</b><span>${i.range!==null?`${Math.round(i.range)} ${i.rangeUnit}`:""}</span></div>
</div> </div>
<div class="live-rows"> <div class="live-rows">
@@ -896,7 +896,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${l.charge&&i.home?c(i.charging,o("live_car_charge"),"\u26A1",()=>r(l.charge.split(".")[0],"toggle",l.charge)):f} ${l.charge&&i.home?c(i.charging,o("live_car_charge"),"\u26A1",()=>r(l.charge.split(".")[0],"toggle",l.charge)):f}
</div> </div>
</div> </div>
</div>`}function Lf(n,e,t,r){let i=e.media,o=l=>$(n,l),s=`rgb(${i.color.join(",")})`,a=(l,c,u)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${h=>(h.stopPropagation(),r("media_player",u,i.entity))}>${c}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}> </div>`}function Bf(n,e,t,r){let i=e.media,o=l=>M(n,l),s=`rgb(${i.color.join(",")})`,a=(l,c,u)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${h=>(h.stopPropagation(),r("media_player",u,i.entity))}>${c}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
${i.picture?p`<img class="live-cover" src=${i.picture} alt="" loading="lazy" />`:p`<div class="live-cover live-cover-none">♪</div>`} ${i.picture?p`<img class="live-cover" src=${i.picture} alt="" loading="lazy" />`:p`<div class="live-cover live-cover-none">♪</div>`}
<div class="live-rows"> <div class="live-rows">
<div class="live-title" title=${i.title}>${i.title||i.name}</div> <div class="live-title" title=${i.title}>${i.title||i.name}</div>
@@ -915,9 +915,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
/>`:f} />`:f}
</div> </div>
</div> </div>
</div>`}function Ru(n){let e=[...n.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"&&s.offsetWidth>0),t=[],r=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],c=r?r>l+16?Math.min(Math.max(a,l/2+8),r-l/2-8):r/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-c)}px`),{el:s,x:c,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>Number(a.el.dataset.priority||0)-Number(s.el.dataset.priority||0)||a.y-s.y);for(let s of o){let a=s.y;if((s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging"))&&r>s.w+16&&i>s.h+16){let h=[s.x,s.w/2+8,r-s.w/2-8,...t.flatMap(g=>[g.x0-s.w/2-8,g.x1+s.w/2+8])].filter(g=>g>=s.w/2+8&&g<=r-s.w/2-8).sort((g,_)=>Math.abs(g-s.x)-Math.abs(_-s.x)),m=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(g=>[g.y0-8,g.y1+s.h+8])].filter(g=>g>=s.h+8&&g<=i-8),d;for(let g of m){for(let _ of h)if(!t.some(b=>_-s.w/2<b.x1+6&&_+s.w/2>b.x0-6&&g-s.h<b.y1+6&&g>b.y0-6)){d={x:_,y:g};break}if(d)break}d&&(s.x=d.x,a=d.y)}for(let h=0;h<12;h++){let m={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},d=t.find(g=>m.x0<g.x1+6&&m.x1>g.x0-6&&m.y0<g.y1+6&&m.y1>g.y0-6);if(!d)break;a=d.y0-8}let l=s.y-a,c=!s.el.classList.contains("live-card-house")&&!s.el.classList.contains("live-card-roomclimate")&&s.el.dataset.focused!=="1",u=s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging");if(c&&i>0&&(a-s.h<8||a>i-8||!u&&Math.abs(l)>Math.max(100,Math.min(180,i*.25)))){s.el.style.visibility="hidden";continue}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a}),s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function Of(n,e,t){let r=e.printer,i=(c,u)=>$(n,c,u),o=r.progress??0,s=c=>new Intl.DateTimeFormat(n?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=r.remaining!==null?r.remaining>=60?`${Math.floor(r.remaining/60)} h ${Math.round(r.remaining%60)} min`:`${Math.round(r.remaining)} min`:null,l=[r.nozzle!==null?`${i("printer_nozzle")} ${Math.round(r.nozzle)}\xB0`:null,r.bed!==null?`${i("printer_bed")} ${Math.round(r.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${r.printing?"live-charging":""}" data-i=${t}> </div>`}function Tu(n){let e=[...n.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"&&s.offsetWidth>0),t=[],r=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],c=r?r>l+16?Math.min(Math.max(a,l/2+8),r-l/2-8):r/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-c)}px`),{el:s,x:c,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>Number(a.el.dataset.priority||0)-Number(s.el.dataset.priority||0)||a.y-s.y);for(let s of o){let a=s.y;if((s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging"))&&r>s.w+16&&i>s.h+16){let h=[s.x,s.w/2+8,r-s.w/2-8,...t.flatMap(g=>[g.x0-s.w/2-8,g.x1+s.w/2+8])].filter(g=>g>=s.w/2+8&&g<=r-s.w/2-8).sort((g,_)=>Math.abs(g-s.x)-Math.abs(_-s.x)),m=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(g=>[g.y0-8,g.y1+s.h+8])].filter(g=>g>=s.h+8&&g<=i-8),d;for(let g of m){for(let _ of h)if(!t.some(b=>_-s.w/2<b.x1+6&&_+s.w/2>b.x0-6&&g-s.h<b.y1+6&&g>b.y0-6)){d={x:_,y:g};break}if(d)break}d&&(s.x=d.x,a=d.y)}for(let h=0;h<12;h++){let m={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},d=t.find(g=>m.x0<g.x1+6&&m.x1>g.x0-6&&m.y0<g.y1+6&&m.y1>g.y0-6);if(!d)break;a=d.y0-8}let l=s.y-a,c=!s.el.classList.contains("live-card-house")&&!s.el.classList.contains("live-card-roomclimate")&&s.el.dataset.focused!=="1",u=s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging");if(c&&i>0&&(a-s.h<8||a>i-8||!u&&Math.abs(l)>Math.max(100,Math.min(180,i*.25)))){s.el.style.visibility="hidden";continue}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a}),s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function Vf(n,e,t){let r=e.printer,i=(c,u)=>M(n,c,u),o=r.progress??0,s=c=>new Intl.DateTimeFormat(n?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=r.remaining!==null?r.remaining>=60?`${Math.floor(r.remaining/60)} h ${Math.round(r.remaining%60)} min`:`${Math.round(r.remaining)} min`:null,l=[r.nozzle!==null?`${i("printer_nozzle")} ${Math.round(r.nozzle)}\xB0`:null,r.bed!==null?`${i("printer_bed")} ${Math.round(r.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${r.printing?"live-charging":""}" data-i=${t}>
<div class="live-own"> <div class="live-own">
${r.picture?p`<img class="live-print-pic" src=${r.picture} alt="" />`:Wn(o/100,r.printing?"#38bdf8":"#8aa0c8")} ${r.picture?p`<img class="live-print-pic" src=${r.picture} alt="" />`:Vn(o/100,r.printing?"#38bdf8":"#8aa0c8")}
<div class="live-own-text"><b>${r.progress!==null?`${Math.round(o)} %`:"\u2013"}</b><span>${i(`printer_${r.printing?"printing":/finish|complete|fertig/.test(r.status)?"done":/pause/.test(r.status)?"paused":/error|fail/.test(r.status)?"error":"idle"}`)}</span></div> <div class="live-own-text"><b>${r.progress!==null?`${Math.round(o)} %`:"\u2013"}</b><span>${i(`printer_${r.printing?"printing":/finish|complete|fertig/.test(r.status)?"done":/pause/.test(r.status)?"paused":/error|fail/.test(r.status)?"error":"idle"}`)}</span></div>
</div> </div>
<div class="live-rows"> <div class="live-rows">
@@ -928,30 +928,30 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${l?p`<div class="live-status">🌡 ${l}</div>`:f} ${l?p`<div class="live-status">🌡 ${l}</div>`:f}
${r.filaments.length?p`<div class="live-filaments">${r.filaments.map(c=>p`<i style=${`background:${c}`}></i>`)}</div>`:f} ${r.filaments.length?p`<div class="live-filaments">${r.filaments.map(c=>p`<i style=${`background:${c}`}></i>`)}</div>`:f}
</div> </div>
</div>`}function Wf(n,e,t){let r=e.pump,i=a=>$(n,a),o=a=>a===null?"\u2013":`${L(n,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[r.mode];return p`<div class="live-card live-card-heatpump ${r.mode==="idle"?"":"live-charging"}" data-i=${t}> </div>`}function Kf(n,e,t){let r=e.pump,i=a=>M(n,a),o=a=>a===null?"\u2013":`${L(n,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[r.mode];return p`<div class="live-card live-card-heatpump ${r.mode==="idle"?"":"live-charging"}" data-i=${t}>
<div class="live-own"> <div class="live-own">
${Wn(Math.min(1,(r.cop??0)/6),(r.cop??0)>=3.5?"#4ade80":(r.cop??0)>=2.5?"#facc15":"#fb923c")} ${Vn(Math.min(1,(r.cop??0)/6),(r.cop??0)>=3.5?"#4ade80":(r.cop??0)>=2.5?"#facc15":"#fb923c")}
<div class="live-own-text"><b>${r.cop!==null?L(n,r.cop,1):s}</b><span>${r.cop!==null?"COP":""}</span></div> <div class="live-own-text"><b>${r.cop!==null?L(n,r.cop,1):s}</b><span>${r.cop!==null?"COP":""}</span></div>
</div> </div>
<div class="live-rows"> <div class="live-rows">
<div class="live-title">${e.name}</div> <div class="live-title">${e.name}</div>
<div class="live-status">${s} ${i(`heatpump_${r.mode}`)}</div> <div class="live-status">${s} ${i(`heatpump_${r.mode}`)}</div>
${r.flow!==null||r.return!==null?p`<div class="live-row live-heat"><span>${i("heatpump_flow_return")}</span><b>${o(r.flow)} → ${o(r.return)}</b></div>`:f} ${r.flow!==null||r.return!==null?p`<div class="live-row live-heat"><span>${i("heatpump_flow_return")}</span><b>${o(r.flow)} → ${o(r.return)}</b></div>`:f}
${r.heat!==null?p`<div class="live-row live-heat"><span>${i("heatpump_heat")}</span><b>${ze(n,r.heat)}</b></div>`:f} ${r.heat!==null?p`<div class="live-row live-heat"><span>${i("heatpump_heat")}</span><b>${Te(n,r.heat)}</b></div>`:f}
${r.power!==null?p`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${ze(n,r.power)}</b></div>`:f} ${r.power!==null?p`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${Te(n,r.power)}</b></div>`:f}
${r.outside!==null?p`<div class="live-status">🌡 ${i("heatpump_outside")} ${o(r.outside)}</div>`:f} ${r.outside!==null?p`<div class="live-status">🌡 ${i("heatpump_outside")} ${o(r.outside)}</div>`:f}
</div> </div>
</div>`}function Bf(n,e,t){let r=(o,s,a)=>o===null?"\u2013":`${L(n,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>vn(n,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||$(n,"room")} \xB7 ${$(n,"climate")}`}> </div>`}function Gf(n,e,t){let r=(o,s,a)=>o===null?"\u2013":`${L(n,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>xn(n,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||M(n,"room")} \xB7 ${M(n,"climate")}`}>
${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${$(n,"climate_temperature")} aria-label=${$(n,"climate_temperature")}>🌡</span><b>${r(e.temperature===null?null:n?ce(n,e.temperature):e.temperature,1,n?re(n):"\xB0C")}</b>${G(n,e.sources?.temperature??[],$(n,"climate_temperature"))}</div>`:f} ${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${M(n,"climate_temperature")} aria-label=${M(n,"climate_temperature")}>🌡</span><b>${r(e.temperature===null?null:n?ue(n,e.temperature):e.temperature,1,n?ie(n):"\xB0C")}</b>${U(n,e.sources?.temperature??[],M(n,"climate_temperature"))}</div>`:f}
${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${$(n,"climate_humidity")} aria-label=${$(n,"climate_humidity")}>💧</span><b>${r(e.humidity,0,"%")}</b>${G(n,e.sources?.humidity??[],$(n,"climate_humidity"))}</div>`:f} ${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${M(n,"climate_humidity")} aria-label=${M(n,"climate_humidity")}>💧</span><b>${r(e.humidity,0,"%")}</b>${U(n,e.sources?.humidity??[],M(n,"climate_humidity"))}</div>`:f}
${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${$(n,"climate_co2")} aria-label=${$(n,"climate_co2")}>☁</span><b>${r(e.co2,0,"ppm")}</b>${G(n,e.sources?.co2??[],$(n,"climate_co2"))}</div>`:f} ${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${M(n,"climate_co2")} aria-label=${M(n,"climate_co2")}>☁</span><b>${r(e.co2,0,"ppm")}</b>${U(n,e.sources?.co2??[],M(n,"climate_co2"))}</div>`:f}
${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${$(n,"climate_illuminance")} aria-label=${$(n,"climate_illuminance")}>☀</span><b>${r(e.illuminance,0,"lx")}</b>${G(n,e.sources?.illuminance??[],$(n,"climate_illuminance"))}</div>`:f} ${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${M(n,"climate_illuminance")} aria-label=${M(n,"climate_illuminance")}>☀</span><b>${r(e.illuminance,0,"lx")}</b>${U(n,e.sources?.illuminance??[],M(n,"climate_illuminance"))}</div>`:f}
</div>`}function Vf(n,e,t){let r=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${ze(n,e.power)}`;return p`<div class="live-card live-card-power ${(e.readings??[]).length?"live-card-charging":""}" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}> </div>`}function Uf(n,e,t){let r=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${Te(n,e.power)}`;return p`<div class="live-card live-card-power ${(e.readings??[]).length?"live-card-charging":""}" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}>
<div class="live-power-name">${e.name}</div>${e.powerEntity?p`<div class="live-row"><span aria-hidden="true">⚡</span><b>${r}</b>${G(n,[e.powerEntity],e.name)}</div>`:f} <div class="live-power-name">${e.name}</div>${e.powerEntity?p`<div class="live-row"><span aria-hidden="true">⚡</span><b>${r}</b>${U(n,[e.powerEntity],e.name)}</div>`:f}
${(e.readings??[]).map(i=>p`<div class="live-row live-charging-row" data-reading=${i.id}><span class="live-charging-label" title=${i.label}><span aria-hidden="true">${i.icon}</span> ${i.label}</span><b title=${i.text}>${i.text}</b>${G(n,[i.entity],i.label)}</div>`)} ${(e.readings??[]).map(i=>p`<div class="live-row live-charging-row" data-reading=${i.id}><span class="live-charging-label" title=${i.label}><span aria-hidden="true">${i.icon}</span> ${i.label}</span><b title=${i.text}>${i.text}</b>${U(n,[i.entity],i.label)}</div>`)}
</div>`}function Eu(n,e,t,r,i=!1){return e.length?p`<div class="live-cards"> </div>`}function Fu(n,e,t,r,i=!1){return e.length?p`<div class="live-cards">
${e.map((o,s)=>o.kind==="roomclimate"?Bf(n,o,s):o.kind==="power"?Vf(n,o,s):o.kind==="hydronic"?p`<div class="live-card live-card-hydronic" data-i=${s} data-furniture=${o.item.id}><nf-hydronic-card .hass=${n} .item=${o.item} .readOnly=${o.readOnly}></nf-hydronic-card></div>`:i?f:o.kind==="house"?Pf(n,o,s,r):o.kind==="car"?Nf(n,o,s,t):o.kind==="printer"?Of(n,o,s):o.kind==="heatpump"?Wf(n,o,s):Lf(n,o,s,t))} ${e.map((o,s)=>o.kind==="roomclimate"?Gf(n,o,s):o.kind==="power"?Uf(n,o,s):o.kind==="hydronic"?p`<div class="live-card live-card-hydronic" data-i=${s} data-furniture=${o.item.id}><nf-hydronic-card .hass=${n} .item=${o.item} .readOnly=${o.readOnly}></nf-hydronic-card></div>`:i?f:o.kind==="house"?Nf(n,o,s,r):o.kind==="car"?Wf(n,o,s,t):o.kind==="printer"?Vf(n,o,s):o.kind==="heatpump"?Kf(n,o,s):Bf(n,o,s,t))}
</div>`:f}var zu=J` </div>`:f}var Du=Q`
.live-card.live-card-power { display:grid; gap:4px; min-width:90px; max-width:220px; box-sizing:border-box; } .live-card.live-card-power { display:grid; gap:4px; min-width:90px; max-width:220px; box-sizing:border-box; }
.live-power-name { font-size:11px; color:var(--nf-muted); overflow:hidden; text-overflow:ellipsis; } .live-power-name { font-size:11px; color:var(--nf-muted); overflow:hidden; text-overflow:ellipsis; }
.live-card-power .live-row { align-items:center; gap:6px; } .live-card-power .live-row { align-items:center; gap:6px; }
@@ -1298,7 +1298,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.04em; letter-spacing: 0.04em;
} }
`;function Qo(n){switch(n.kind){case"house":return{density:0,priority:100};case"roomclimate":return{density:24,priority:80};case"hydronic":return{density:42,priority:45};case"power":return n.power!==null&&Math.abs(n.power)>1?{density:48,priority:60}:n.readings?.length?{density:56,priority:30}:{density:n.power===null?64:72,priority:20};case"car":return{density:n.car.charging?36:60,priority:n.car.charging?60:20};case"printer":return{density:n.printer.printing?36:60,priority:n.printer.printing?60:20};case"heatpump":return{density:n.pump.mode!=="idle"?36:60,priority:n.pump.mode!=="idle"?60:20};case"media":return{density:48,priority:40}}}function Tu(n,e,t){let r=Qo(n).density;return r?Number.isFinite(e)&&e>=r*(t?.88:1.12):!0}function ci(n){return n.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Xo=n=>n.points.length>=3;function Fu(n,e,t){return n.rooms.filter(Xo).find(r=>H([e,t],r.points))}function Kf(n,e,t,r){let i=[];for(let a of e.rooms.filter(Xo)){let[l,c]=Te(a.points);i.push({kind:"room",name:a.name,where:r?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in n.states))return;o.add(a);let h=Fu(e,l,c),m=[h?.name,r?e.name:void 0].filter(d=>!!d).join(" \xB7 ");i.push({kind:"device",name:O(n,a),where:m,floorId:e.id,roomId:h?.id??null,entity:a,icon:P(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??Ht(P(a.entity_id)??"sensor",xe(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=xe(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Fu(e,a.x,a.z),c=[l?.name,r?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Du(n,e){let t=Ke(n,e.floors),r=e.floors.length>1,i=e.floors.flatMap(o=>Kf(n,o,t,r));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(m=>o.rooms.includes(m.id)&&Xo(m)).map(m=>({f:h,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=Te(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(h=>h.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return i}function Gf(n,e){return(ci(n.name).startsWith(e)?0:2)+(n.kind==="room"?0:1)}function Hu(n,e,t=8){let r=ci(e).split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=ci(e.trim());return n.filter(o=>{let s=ci([o.name,o.where,o.entity].filter(Boolean).join(" "));return r.every(a=>s.includes(a))}).map(o=>({item:o,cost:Gf(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var Uf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],jf=[2200,2700,3200,4e3,5e3,6500],qf=["hs","rgb","rgbw","rgbww","xy"],Zf=4,Pu=16,Iu=32,Yf=128;function ts(n){let e=n.attributes.supported_color_modes??[],t=e.some(r=>qf.includes(r));return{dim:e.some(r=>r!=="onoff"),color:t,temp:e.includes("color_temp")}}function ns(n){return((n.attributes.supported_features??0)&Zf)!==0&&typeof n.attributes.current_position=="number"}var es=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,r={}){this.hass.callService(e,t,{entity_id:this.entity,...r})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){ke(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((r,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${r}</div>`})}renderLight(e){let t=ts(e),r=e.state==="on",i=r&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):r?100:0,o=t.color?Uf.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?jf.map(s=>p`<button class="qm-swatch" style="background:${Jf(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}"> `;function ts(n){switch(n.kind){case"house":return{density:0,priority:100};case"roomclimate":return{density:24,priority:80};case"hydronic":return{density:42,priority:45};case"power":return n.power!==null&&Math.abs(n.power)>1?{density:48,priority:60}:n.readings?.length?{density:56,priority:30}:{density:n.power===null?64:72,priority:20};case"car":return{density:n.car.charging?36:60,priority:n.car.charging?60:20};case"printer":return{density:n.printer.printing?36:60,priority:n.printer.printing?60:20};case"heatpump":return{density:n.pump.mode!=="idle"?36:60,priority:n.pump.mode!=="idle"?60:20};case"media":return{density:48,priority:40}}}function Hu(n,e,t){let r=ts(n).density;return r?Number.isFinite(e)&&e>=r*(t?.88:1.12):!0}function di(n){return n.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var ns=n=>n.points.length>=3;function Pu(n,e,t){return n.rooms.filter(ns).find(r=>H([e,t],r.points))}function jf(n,e,t,r){let i=[];for(let a of e.rooms.filter(ns)){let[l,c]=Fe(a.points);i.push({kind:"room",name:a.name,where:r?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in n.states))return;o.add(a);let h=Pu(e,l,c),m=[h?.name,r?e.name:void 0].filter(d=>!!d).join(" \xB7 ");i.push({kind:"device",name:O(n,a),where:m,floorId:e.id,roomId:h?.id??null,entity:a,icon:P(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??It(P(a.entity_id)??"sensor",ke(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=ke(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Pu(e,a.x,a.z),c=[l?.name,r?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Iu(n,e){let t=Ge(n,e.floors),r=e.floors.length>1,i=e.floors.flatMap(o=>jf(n,o,t,r));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(m=>o.rooms.includes(m.id)&&ns(m)).map(m=>({f:h,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=Fe(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(h=>h.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return i}function qf(n,e){return(di(n.name).startsWith(e)?0:2)+(n.kind==="room"?0:1)}function Cu(n,e,t=8){let r=di(e).split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=di(e.trim());return n.filter(o=>{let s=di([o.name,o.where,o.entity].filter(Boolean).join(" "));return r.every(a=>s.includes(a))}).map(o=>({item:o,cost:qf(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var Zf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],Yf=[2200,2700,3200,4e3,5e3,6500],Jf=["hs","rgb","rgbw","rgbww","xy"],Qf=4,Nu=16,Lu=32,Xf=128;function is(n){let e=n.attributes.supported_color_modes??[],t=e.some(r=>Jf.includes(r));return{dim:e.some(r=>r!=="onoff"),color:t,temp:e.includes("color_temp")}}function os(n){return((n.attributes.supported_features??0)&Qf)!==0&&typeof n.attributes.current_position=="number"}var rs=class extends X{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return M(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,r={}){W(this.hass,this.entity)&&this.hass.callService(e,t,{entity_id:this.entity,...r})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){Se(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((r,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${r}</div>`})}renderLight(e){let t=is(e),r=e.state==="on",i=r&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):r?100:0,o=t.color?Zf.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?Yf.map(s=>p`<button class="qm-swatch" style="background:${eg(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
${this.ring(o)} ${this.ring(o)}
<button class="qm-power ${r?"qm-on":""}" aria-pressed=${r} @click=${()=>this.ask()&&this.call("light","toggle")}> <button class="qm-power ${r?"qm-on":""}" aria-pressed=${r} @click=${()=>this.ask()&&this.call("light","toggle")}>
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg> <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
@@ -1313,7 +1313,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.value=${String(Math.max(1,i))} .value=${String(Math.max(1,i))}
aria-label=${this.t("brightness")} aria-label=${this.t("brightness")}
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})} @change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
/>`:f}`}renderCover(e){e=Sr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,r=e.state==="opening"||e.state==="closing",i=ns(e),o=(u,h,m,d=!1)=>p`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${m}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),r)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||r||e.state==="open"||e.state==="closed";return p`<div class="qm-ring"> />`:f}`}renderCover(e){e=Mr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,r=e.state==="opening"||e.state==="closing",i=os(e),o=(u,h,m,d=!1)=>p`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${m}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),r)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||r||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
${this.ring(a)} ${this.ring(a)}
<button <button
class="qm-power qm-blind ${c&&l<100?"qm-on":""}" class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
@@ -1323,7 +1323,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@click=${()=>r?this.call("cover","stop_cover"):this.ask()&&this.call("cover",l>50?"open_cover":"close_cover")} @click=${()=>r?this.call("cover","stop_cover"):this.ask()&&this.call("cover",l>50?"open_cover":"close_cover")}
> >
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 4h16M5 4v15M19 4v15M7 8h10M7 12h10M7 16h10" /></svg> <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 4h16M5 4v15M19 4v15M7 8h10M7 12h10M7 16h10" /></svg>
<b>${t!==null?`${Math.round(t)} %`:se(this.hass,e)}</b> <b>${t!==null?`${Math.round(t)} %`:ae(this.hass,e)}</b>
</button> </button>
</div> </div>
${i?p`<input ${i?p`<input
@@ -1335,7 +1335,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
aria-label=${this.t("position")} aria-label=${this.t("position")}
@change=${u=>this.call("cover","set_cover_position",{position:Number(u.target.value)})} @change=${u=>this.call("cover","set_cover_position",{position:Number(u.target.value)})}
/>`:f} />`:f}
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,r=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&Yf&&r!==null?p`<label class="qm-tilt" ${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,r=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&Xf&&r!==null?p`<label class="qm-tilt"
><span>${this.t("cover_tilt")} · ${Math.round(r)} %</span> ><span>${this.t("cover_tilt")} · ${Math.round(r)} %</span>
<input <input
class="qm-slider" class="qm-slider"
@@ -1345,9 +1345,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.value=${String(r)} .value=${String(r)}
aria-label=${this.t("cover_tilt")} aria-label=${this.t("cover_tilt")}
@change=${i=>this.call("cover","set_cover_tilt_position",{entity_id:e.attributes.nf_cover_control?this.entity:this.tiltEntity||this.entity,tilt_position:Number(i.target.value)})} @change=${i=>this.call("cover","set_cover_tilt_position",{entity_id:e.attributes.nf_cover_control?this.entity:this.tiltEntity||this.entity,tilt_position:Number(i.target.value)})}
/></label>`:t&(Pu|Iu)?p`<div class="qm-tilt-buttons"> /></label>`:t&(Nu|Lu)?p`<div class="qm-tilt-buttons">
${t&Pu?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f} ${t&Nu?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&Iu?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f} ${t&Lu?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
</div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",r=e.entity_id.split(".")[0];return p`<div class="qm-ring qm-ring-small"> </div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",r=e.entity_id.split(".")[0];return p`<div class="qm-ring qm-ring-small">
<button <button
class="qm-power ${t?"qm-on":""}" class="qm-power ${t?"qm-on":""}"
@@ -1355,13 +1355,13 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@click=${()=>this.ask()&&(r==="lock"?this.call("lock",t?"lock":"unlock"):this.call("homeassistant","toggle"))} @click=${()=>this.ask()&&(r==="lock"?this.call("lock",t?"lock":"unlock"):this.call("homeassistant","toggle"))}
> >
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg> <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
<b>${se(this.hass,e)}</b> <b>${ae(this.hass,e)}</b>
</button> </button>
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),r=e.state==="playing",i=e.attributes,o=typeof i.volume_level=="number"?Math.round(i.volume_level*100):null,s=Array.isArray(i.source_list)?i.source_list.slice(0,24):[],a=[i.media_title,i.media_artist].filter(h=>typeof h=="string"&&h).join(" \xB7 "),l=h=>p`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${h} /></svg>`,c=(h,m,d,g=!1)=>p`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${m} title=${m} @click=${d}>${h}</button>`,u=t?[c(l(r?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(r?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),r),c(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),c(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return p`<div class="qm-ring ${u.length?"":"qm-ring-small"}"> </div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),r=e.state==="playing",i=e.attributes,o=typeof i.volume_level=="number"?Math.round(i.volume_level*100):null,s=Array.isArray(i.source_list)?i.source_list.slice(0,24):[],a=[i.media_title,i.media_artist].filter(h=>typeof h=="string"&&h).join(" \xB7 "),l=h=>p`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${h} /></svg>`,c=(h,m,d,g=!1)=>p`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${m} title=${m} @click=${d}>${h}</button>`,u=t?[c(l(r?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(r?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),r),c(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),c(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return p`<div class="qm-ring ${u.length?"":"qm-ring-small"}">
${this.ring(u)} ${this.ring(u)}
<button class="qm-power ${t?"qm-on":""}" aria-pressed=${t} @click=${()=>this.ask()&&this.call("media_player",t?"turn_off":"turn_on")}> <button class="qm-power ${t?"qm-on":""}" aria-pressed=${t} @click=${()=>this.ask()&&this.call("media_player",t?"turn_off":"turn_on")}>
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg> <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
<b>${o!==null&&t?`${o} %`:se(this.hass,e)}</b> <b>${o!==null&&t?`${o} %`:ae(this.hass,e)}</b>
</button> </button>
</div> </div>
${a?p`<div class="qm-media-title">${a}</div>`:f} ${a?p`<div class="qm-media-title">${a}</div>`:f}
@@ -1369,11 +1369,11 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${s.length?p`<div class="qm-play-head">${this.t("media_sources")}</div> ${s.length?p`<div class="qm-play-head">${this.t("media_sources")}</div>
<div class="qm-play">${s.map(h=>p`<button class="qm-chip ${i.source===h?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:h})}>${h}</button>`)}</div>`:f} <div class="qm-play">${s.map(h=>p`<button class="qm-chip ${i.source===h?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:h})}>${h}</button>`)}</div>`:f}
${this.presets?.length?p`<div class="qm-play-head">${this.t("presets")}</div> ${this.presets?.length?p`<div class="qm-play-head">${this.t("presets")}</div>
<div class="qm-play">${this.presets.map(h=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:h.type,media_content_id:h.content})}>${h.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=P(this.entity),r=C(e)&&!pn(e)?p`<p class="qm-note">${se(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}> <div class="qm-play">${this.presets.map(h=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:h.type,media_content_id:h.content})}>${h.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=P(this.entity),r=!W(this.hass,this.entity)||C(e)&&!gn(e)?p`<p class="qm-note">${ae(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}>
<div class="qm-title">${O(this.hass,this.entity)}</div> <div class="qm-title">${O(this.hass,this.entity)}</div>
${r} ${r}
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button> <button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
</div>`}static styles=[ye,J` </div>`}static styles=[ve,Q`
.qm-play-head { .qm-play-head {
margin: 10px 0 4px; margin: 10px 0 4px;
font-size: 11px; font-size: 11px;
@@ -1616,7 +1616,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.qm-note { .qm-note {
color: var(--nf-muted); color: var(--nf-muted);
} }
`]};function Jf(n){let e=Math.min(1,Math.max(0,(n-2200)/4300)),t=(r,i)=>Math.round(r+(i-r)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",es);var Qf=new URL(import.meta.url),Xf=new URL("./nextfloor-3d.js?v=3c3ea11cac21",Qf).href,Cu;function Nu(){return Cu??=import(Xf),Cu}function Lu(n){if(!n||n.state!=="on")return 0;let e=typeof n.attributes.percentage=="number"?n.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var Ou="weather.nextfloor_symcon",Bu={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},Wu=new WeakMap;function eg(n){let e=n.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function ui(n,e){if(!V(n))return n;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(d=>d&&d!=="none"))return n;let r=Wu.get(n)??new WeakMap;Wu.set(n,r);let i=r.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=d=>t[d]&&t[d]!=="none"?n.states[t[d]]:void 0;for(let d of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(d),_=ge(g);_!==null&&(o[d]=d==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${d}_unit`]=g.attributes.unit_of_measurement)}for(let d of["wind_speed","wind_gust_speed"]){let g=s(d),_=ge(g);_!==null&&(o[d]=ti(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=fe(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=eg(De(s("condition"))),c=e.rain_sensor?n.states[e.rain_sensor]:void 0,u=le(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),le(s("lightning"))?l=u?"lightning-rainy":"lightning":le(s("snow"))?l=u?"snowy-rainy":"snowy":le(s("fog"))?l="fog":u===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&u===!1&&(l="sunny");let h={entity_id:Ou,state:l??"unknown",attributes:o},m={...n,states:{...n.states,[Ou]:h}};return r.set(e,m),m}var rs=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?p`<span class="value" title=${`${Vt(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Ne(this.hass,e)}</b>${e.period!=="total"?p`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${G(this.hass,e.sources,`${Ie[e.kind]} \xB7 ${Vt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return Oe.map(t=>{let r=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(r.length,i.length)},(o,s)=>p`<div class="row"><span class="kind" title=${Ie[t]}>${s?"":`${An[t]} ${Ie[t]}`}</span>${r[s]?this.value(r[s]):p`<span></span>`}${i[s]?this.value(i[s]):p`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?Ce(this.hass,t,e):Ol(this.hass,this.floors);return p`${Oe.map(a=>{let l=s.filter(c=>c.kind===a);return l.length?p`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Ie[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${An[a]} ${Ie[a]}</span><div class="values">${l.map(c=>this.value(c))}</div></div>`:f})}`}let i=(t?Bt(this.hass,t,e,!0).map(s=>({...s,hasDetails:s.rooms.length>0})):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:Ce(this.hass,s,e),rooms:[],hasDetails:Bt(this.hass,s,e,!0).length>0}))).filter(s=>s.readings.length||s.hasDetails);if(!i.lLine truncated `]};function eg(n){let e=Math.min(1,Math.max(0,(n-2200)/4300)),t=(r,i)=>Math.round(r+(i-r)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",rs);var tg=new URL(import.meta.url),ng=new URL("./nextfloor-3d.js?v=d63a1d893eb1",tg).href,Ou;function Wu(){return Ou??=import(ng),Ou}function Bu(n){if(!n||n.state!=="on")return 0;let e=typeof n.attributes.percentage=="number"?n.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var Vu="weather.nextfloor_symcon",Gu={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},Ku=new WeakMap;function rg(n){let e=n.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function hi(n,e){if(!B(n))return n;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(d=>d&&d!=="none"))return n;let r=Ku.get(n)??new WeakMap;Ku.set(n,r);let i=r.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=d=>t[d]&&t[d]!=="none"?n.states[t[d]]:void 0;for(let d of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(d),_=_e(g);_!==null&&(o[d]=d==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${d}_unit`]=g.attributes.unit_of_measurement)}for(let d of["wind_speed","wind_gust_speed"]){let g=s(d),_=_e(g);_!==null&&(o[d]=ri(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=ge(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=rg(De(s("condition"))),c=e.rain_sensor?n.states[e.rain_sensor]:void 0,u=ce(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),ce(s("lightning"))?l=u?"lightning-rainy":"lightning":ce(s("snow"))?l=u?"snowy-rainy":"snowy":ce(s("fog"))?l="fog":u===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&u===!1&&(l="sunny");let h={entity_id:Vu,state:l??"unknown",attributes:o},m={...n,states:{...n.states,[Vu]:h}};return r.set(e,m),m}var ss=class extends X{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?p`<span class="value" title=${`${Gt(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Le(this.hass,e)}</b>${e.period!=="total"?p`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${U(this.hass,e.sources,`${Ce[e.kind]} \xB7 ${Gt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return We.map(t=>{let r=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(r.length,i.length)},(o,s)=>p`<div class="row"><span class="kind" title=${Ce[t]}>${s?"":`${Rn[t]} ${Ce[t]}`}</span>${r[s]?this.value(r[s]):p`<span></span>`}${i[s]?this.value(i[s]):p`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?Ne(this.hass,t,e):Vl(this.hass,this.floors);return p`${We.map(a=>{let l=s.filter(c=>c.kind===a);return l.length?p`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Ce[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${Rn[a]} ${Ce[a]}</span><div class="values">${l.map(c=>this.value(c))}</div></div>`:f})}`}let i=(t?Kt(this.hass,t,e,!0).map(s=>({...s,hasDetails:s.rooms.length>0})):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:Ne(this.hass,s,e),rooms:[],hasDetails:Kt(this.hass,s,e,!0).length>0}))).filter(s=>s.readings.length||s.hasDetails);if(!i.lLine truncated
<button class="heading" aria-expanded=${!o} @click=${()=>{this.folded=!o}}><span>${t?"Bereiche":"Stockwerke"}<small>${t?.name||"Gesamtgeb\xE4ude"}</small></span><span aria-hidden="true">${o?"+":"\u2212"}</span></button> <button class="heading" aria-expanded=${!o} @click=${()=>{this.folded=!o}}><span>${t?"Bereiche":"Stockwerke"}<small>${t?.name||"Gesamtgeb\xE4ude"}</small></span><span aria-hidden="true">${o?"+":"\u2212"}</span></button>
${o?f:p`<div class="entries"><div class="columns"><span></span><span title="Leistung bzw. Durchfluss">Leistung</span><span>Energie / Verbrauch</span></div> ${o?f:p`<div class="entries"><div class="columns"><span></span><span title="Leistung bzw. Durchfluss">Leistung</span><span>Energie / Verbrauch</span></div>
${i.map(s=>p`<section class="entry" data-area=${t?s.id:f}> ${i.map(s=>p`<section class="entry" data-area=${t?s.id:f}>
@@ -1627,7 +1627,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</section>`)} </section>`)}
</section>`)} </section>`)}
</div>`} </div>`}
</section>`}static styles=J` </section>`}static styles=Q`
:host { display:flex; width:100%; min-height:0; max-height:100%; color:var(--nf-text); font:12px/1.4 system-ui,sans-serif; pointer-events:auto; } :host { display:flex; width:100%; min-height:0; max-height:100%; color:var(--nf-text); font:12px/1.4 system-ui,sans-serif; pointer-events:auto; }
:host([inline]) { display:flex; flex-wrap:wrap; align-items:stretch; gap:6px; width:auto; max-width:100%; } :host([inline]) { display:flex; flex-wrap:wrap; align-items:stretch; gap:6px; width:auto; max-width:100%; }
.meter { padding:5px 9px; border-radius:10px; background:var(--nf-chrome); border-left:2px solid var(--nf-line); backdrop-filter:blur(6px); } .meter { padding:5px 9px; border-radius:10px; background:var(--nf-chrome); border-left:2px solid var(--nf-line); backdrop-filter:blur(6px); }
@@ -1660,43 +1660,43 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.kind { color:var(--nf-muted); font-size:10px; white-space:nowrap; } .kind { color:var(--nf-muted); font-size:10px; white-space:nowrap; }
.row .value b { font-size:11px; font-weight:normal; } .row .value b { font-size:11px; font-weight:normal; }
@media(max-width:600px) { .entries { max-height:32vh; } } @media(max-width:600px) { .entries { max-height:32vh; } }
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",rs);var Vu="image:";function is(n,e,t){let r=(e??"").trim();if(!r)return null;if(r.startsWith(Vu))return t(r.slice(Vu.length));if(/^(https?:\/\/|\/)/.test(r))return r;if(/^[a-z_]+\.[a-z0-9_]+$/.test(r)){let i=n?.states[r]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Bn=n=>Number(n);function Kn(n){if(Array.isArray(n)){let[o,s]=[Bn(n[0]),Bn(n[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!n||typeof n!="object")return null;let{x:e,y:t}=n,[r,i]=[Bn(e),Bn(t)];return Number.isFinite(r)&&Number.isFinite(i)?[r,i]:null}function Ku(n){return n?Kn(n.charger)??Kn(n.charger_position):null}function Gu(n){for(let[e,t]of Object.entries(n.states))if(e.startsWith("camera.")&&(Kn(t.attributes?.vacuum_position)??Ku(t.attributes)))return e;return null}var tg=n=>Array.isArray(n)?typeof n[0]=="number":!!n&&typeof n=="object",Vn=(n,e)=>e?[n[0],-n[1]]:n;function ng(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Vn(n.ga,e),[i,o]=Vn(n.gb,e),[s,a]=n.a,[l,c]=n.b,[u,h]=[i-t,o-r],[m,d]=[l-s,c-a],g=Math.hypot(u,h),_=Math.hypot(m,d);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,y=Math.atan2(d,m)-Math.atan2(h,u),[S,k]=[Math.cos(y),Math.sin(y)];return M=>{let z=Vn(M,e),[E,D]=[z[0]-t,z[1]-r];return[s+b*(E*S-D*k),a+b*(E*k+D*S)]}}function rg(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Vn(n.ga,e),[i,o]=Vn(n.gb,e),s=Math.atan2(n.b[1]-n.a[1],n.b[0]-n.a[0])-Math.atan2(o-r,i-t);return Number.isFinite(s)?s:null}function Uu(n,e,t){if(!e)return null;let r=n.states[e]?.attributes;if(!r)return null;let i=ng(t)??(g=>g),o=rg(t)??0,s=t?.mirror===!0?-1:1,a=r.vacuum_position,l=Kn(a),c=l?(()=>{let[g,_]=i(l),b=Bn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let y=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(y),Math.sin(y))}})():null,u=Ku(r),h=Array.isArray(r.path)?r.path:[],m=h.length>0&&tg(h[0])?[h]:h,d=[];for(let g of m){let _=[];for(let b of Array.isArray(g)?g:[]){let y=Kn(b);y&&_.push(i(y))}_.length>1&&d.push(_)}return!c&&!u&&!d.length?null:{pose:c,charger:u?i(u):null,path:d}}var ju="nextfloor.lock3d",qu=520,ss=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig="";thumbTimer;thumbSig="";thumbsAt=0;armTimer;forecastAt=0;forecastKey Line truncated `};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",ss);var Uu="image:";function as(n,e,t){let r=(e??"").trim();if(!r)return null;if(r.startsWith(Uu))return t(r.slice(Uu.length));if(/^(https?:\/\/|\/)/.test(r))return r;if(/^[a-z_]+\.[a-z0-9_]+$/.test(r)){let i=n?.states[r]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Kn=n=>Number(n);function Un(n){if(Array.isArray(n)){let[o,s]=[Kn(n[0]),Kn(n[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!n||typeof n!="object")return null;let{x:e,y:t}=n,[r,i]=[Kn(e),Kn(t)];return Number.isFinite(r)&&Number.isFinite(i)?[r,i]:null}function ju(n){return n?Un(n.charger)??Un(n.charger_position):null}function qu(n){for(let[e,t]of Object.entries(n.states))if(e.startsWith("camera.")&&(Un(t.attributes?.vacuum_position)??ju(t.attributes)))return e;return null}var ig=n=>Array.isArray(n)?typeof n[0]=="number":!!n&&typeof n=="object",Gn=(n,e)=>e?[n[0],-n[1]]:n;function og(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Gn(n.ga,e),[i,o]=Gn(n.gb,e),[s,a]=n.a,[l,c]=n.b,[u,h]=[i-t,o-r],[m,d]=[l-s,c-a],g=Math.hypot(u,h),_=Math.hypot(m,d);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,y=Math.atan2(d,m)-Math.atan2(h,u),[$,S]=[Math.cos(y),Math.sin(y)];return A=>{let z=Gn(A,e),[x,D]=[z[0]-t,z[1]-r];return[s+b*(x*$-D*S),a+b*(x*S+D*$)]}}function sg(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Gn(n.ga,e),[i,o]=Gn(n.gb,e),s=Math.atan2(n.b[1]-n.a[1],n.b[0]-n.a[0])-Math.atan2(o-r,i-t);return Number.isFinite(s)?s:null}function Zu(n,e,t){if(!e)return null;let r=n.states[e]?.attributes;if(!r)return null;let i=og(t)??(g=>g),o=sg(t)??0,s=t?.mirror===!0?-1:1,a=r.vacuum_position,l=Un(a),c=l?(()=>{let[g,_]=i(l),b=Kn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let y=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(y),Math.sin(y))}})():null,u=ju(r),h=Array.isArray(r.path)?r.path:[],m=h.length>0&&ig(h[0])?[h]:h,d=[];for(let g of m){let _=[];for(let b of Array.isArray(g)?g:[]){let y=Un(b);y&&_.push(i(y))}_.length>1&&d.push(_)}return!c&&!u&&!d.length?null:{pose:c,charger:u?i(u):null,path:d}}var Yu="nextfloor.lock3d",Ju=520,cs=class extends X{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig="";thumbTimer;thumbSig="";thumbsAt=0;armTimer;forecastAt=0;forecastKey Line truncated
${e.map(t=>p`<button class="nf-chip" aria-pressed=${!this.hiddenLayers.has(t.id)} @click=${()=>this.toggleLayer(t.id)}>${this.hiddenLayers.has(t.id)?"\u25CC":"\u{1F441}"} ${t.name}</button>`)} ${e.map(t=>p`<button class="nf-chip" aria-pressed=${!this.hiddenLayers.has(t.id)} @click=${()=>this.toggleLayer(t.id)}>${this.hiddenLayers.has(t.id)?"\u25CC":"\u{1F441}"} ${t.name}</button>`)}
</div>`}syncDevices(e){let t=this.viewer,r=this.building;if(!t||!r||!this.hass)return;let i=this._travel,o=i&&!i.loading?Ut(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Be(o,r.floors),this.furnitureLinks=Ke(o,r.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Dc(o,r,this.weatherEntityId,this.openingLinks):null,this.watched=Oc({hass:o,building:r,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(v=>this.shownStates.get(v)!==o.states[v])))return;uo(o,r).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(v=>[v,o.states[v]])),this.syncHydronics(t,r,o),this.refreshToday(r),this.refreshForecast(r);let a=Sn(o,r),l=rl(o,r.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(o):r);this.placementInfo=new Map(l.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let c=this.furnitureMarkers(o,r,new Set(l.map(v=>v.id)),new Set(a.map(v=>v.powerEntity)));a.push(...c.consumers);let u=$n(o,r,a,Ze(r,v=>this.furnitureLinks?.get(v.id)?.power??null)),h=new Map(a.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=bt(o,r.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of r.floors)for(let x of v.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?o.states[x.temp_entity]:void 0,F=x.pump_entity?o.states[x.pump_entity]:void 0,[W,_e]=Te(x.points),ct=B&&Number.isFinite(Number(B.state))?`${L(o,ce(o,fr(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",$t=!!F&&te(F);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:v.id,roomId:null,x:W,z:_e,y:cr(v,x,W,_e)+.7,icon:Fe(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&o.areas?.[x.area_id]?.name||$(o,`out_${x.type}`),text:[ct,$t?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:$t,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let v of r.floors){for(let x of v.placements)x.pin_offset&&d.set(`${v.id}:${x.entity_id}`,x.pin_offset);for(let x of v.furniture)x.pin_offset&&d.set(`f:${x.id}`,x.pin_offset)}let g=v=>{let x=v.lamp?void 0:(v.furnitureId?d.get(`f:${v.furnitureId}`):void 0)??d.get(`${v.floorId}:${v.id}`);return x?{...v,x:v.x+(x.x??0),z:v.z+(x.z??0),y:v.y+(x.y??0)}:v};t.setDevices([...[...l,...c.markers].map(g).map(v=>{let x=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:h.get(v.id)??null,B={...v,power:x,powerText:x===null?void 0:he(o,x),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(o,r,u,v.furnitureId)??v.text},F=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",W=m.has(v.id)||!!v.furnitureId&&m.has(v.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:v.show==="always",caption:F}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Na(o,r.floors)),t.setCovers(Za(o,r)),t.setRobots(this.robotInfos(o,r));let _=new Map;for(let v of r.floors)for(let x of v.furniture)!X(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||_.set(x.id,Ji(o,v.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(Rc(o,r)),t.setParked(Po(o,r)),t.setGateStates(Uc(o,r));let b=new Map(r.floors.flatMap(v=>v.openings.map(x=>[x.id,x.type]))),y=new Map([...this.openingLinks].map(([v,x])=>[v,Ve(o,x,b.get(v))]));t.setOpeningStates(y),this.setAlerts(this.alertSrc?Fo(o,r,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...c.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...y].map(([v,x])=>`${v}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=S,v||this.scheduleThumbs(1500)}let k=su(o,r,a,r.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),M=this.liveCars(o,r);for(let v of M){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let x=r.floors.flatMap(W=>W.furniture.filter(_e=>_e.type==="wallbox").map(_e=>({floorId:W.id,x:_e.x,z:_e.z,y:1}))).sort((W,_e)=>Math.hypot(W.x-v.at.x,W.z-v.at.z)-Math.hypot(_e.x-v.at.x,_e.z-v.at.z))[0],B=x&&x.floorId===v.at.floorId&&Math.hypot(x.x-v.at.x,x.z-v.at.z)<9,F=x??Nn(r);!F||!v.car.charging&&!B||k.arcs.push({key:`car:${v.spot}`,from:F,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...F,y:.35},{floorId:v.at.floorId,x:(F.x+v.at.x)/2,z:(F.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let z=Nn(r);for(let v of this.liveHeatPumps(r)){let x=v.pump.heat??(v.Line truncated </div>`}syncDevices(e){let t=this.viewer,r=this.building;if(!t||!r||!this.hass)return;let i=this._travel,o=i&&!i.loading?qt(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Ve(o,r.floors),this.furnitureLinks=Ge(o,r.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Ic(o,r,this.weatherEntityId,this.openingLinks):null,this.watched=Vc({hass:o,building:r,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(v=>this.shownStates.get(v)!==o.states[v])))return;po(o,r).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(v=>[v,o.states[v]])),this.syncHydronics(t,r,o),this.refreshToday(r),this.refreshForecast(r);let a=Mn(o,r),l=al(o,r.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(o):r);this.placementInfo=new Map(l.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let c=this.furnitureMarkers(o,r,new Set(l.map(v=>v.id)),new Set(a.map(v=>v.powerEntity)));a.push(...c.consumers);let u=An(o,r,a,Ye(r,v=>this.furnitureLinks?.get(v.id)?.power??null)),h=new Map(a.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=vt(o,r.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of r.floors)for(let k of v.outdoor??[]){if(!k.area_id&&!k.temp_entity&&!k.pump_entity)continue;let K=k.temp_entity?o.states[k.temp_entity]:void 0,F=k.pump_entity?o.states[k.pump_entity]:void 0,[V,be]=Fe(k.points),dt=K&&Number.isFinite(Number(K.state))?`${L(o,ue(o,_r(Number(K.state),K.attributes.unit_of_measurement)),1)} ${ie(o)}`:"",At=!!F&&ne(F);l.push({id:k.area_id?`outdoor:${k.id}`:k.pump_entity??k.temp_entity,floorId:v.id,roomId:null,x:V,z:be,y:dr(v,k,V,be)+.7,icon:He(k.type==="pool"?"pool":k.type==="terrace"?"table-chair":"tree-outline"),name:k.area_id&&o.areas?.[k.area_id]?.name||M(o,`out_${k.type}`),text:[dt,At?M(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:At,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let v of r.floors){for(let k of v.placements)k.pin_offset&&d.set(`${v.id}:${k.entity_id}`,k.pin_offset);for(let k of v.furniture)k.pin_offset&&d.set(`f:${k.id}`,k.pin_offset)}let g=v=>{let k=v.lamp?void 0:(v.furnitureId?d.get(`f:${v.furnitureId}`):void 0)??d.get(`${v.floorId}:${v.id}`);return k?{...v,x:v.x+(k.x??0),z:v.z+(k.z??0),y:v.y+(k.y??0)}:v};t.setDevices([...[...l,...c.markers].map(g).map(v=>{let k=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:h.get(v.id)??null,K={...v,power:k,powerText:k===null?void 0:me(o,k),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(o,r,u,v.furnitureId)??v.text},F=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",V=m.has(v.id)||!!v.furnitureId&&m.has(v.furnitureId);return{...K,pin:this.showPin(K)&&!V,full:v.show==="always",caption:F}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ba(o,r.floors)),t.setCovers(Xa(o,r)),t.setRobots(this.robotInfos(o,r));let _=new Map;for(let v of r.floors)for(let k of v.furniture)!ee(k.type)?.pet||!k.room_sensor||k.room_sensor==="none"||_.set(k.id,eo(o,v.rooms.filter(K=>K.points.length>=3),null,k.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(Tc(o,r)),t.setParked(No(o,r)),t.setGateStates(Zc(o,r));let b=new Map(r.floors.flatMap(v=>v.openings.map(k=>[k.id,k.type]))),y=new Map([...this.openingLinks].map(([v,k])=>[v,Ke(o,k,b.get(v))]));t.setOpeningStates(y),this.setAlerts(this.alertSrc?Po(o,r,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let $=[...l,...c.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(k=>k.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...y].map(([v,k])=>`${v}:${k.open}:${k.cover===null?"-":k.cover.toFixed(1)}`).join(";");if($!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=$,v||this.scheduleThumbs(1500)}let S=cu(o,r,a,r.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),A=this.liveCars(o,r);for(let v of A){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let k=r.floors.flatMap(V=>V.furniture.filter(be=>be.type==="wallbox").map(be=>({floorId:V.id,x:be.x,z:be.z,y:1}))).sort((V,be)=>Math.hypot(V.x-v.at.x,V.z-v.at.z)-Math.hypot(be.x-v.at.x,be.z-v.at.z))[0],K=k&&k.floorId===v.at.floorId&&Math.hypot(k.x-v.at.x,k.z-v.at.z)<9,F=k??On(r);!F||!v.car.charging&&!K||S.arcs.push({key:`car:${v.spot}`,from:F,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...K?{via:[{...F,y:.35},{floorId:v.at.floorId,x:(F.x+v.at.x)/2,z:(F.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let z=On(r);for(let v of this.liveHeatPumps(r)){let k=v.pump.heat??(vLine truncated
<button class="nf-thumbs-fold" title=${$(this.hass,r?"thumbs_show":"thumbs_fold")} aria-label=${$(this.hass,r?"thumbs_show":"thumbs_fold")} @click=${i}>${r?"\u25B8":"\u25C2"}</button> <button class="nf-thumbs-fold" title=${M(this.hass,r?"thumbs_show":"thumbs_fold")} aria-label=${M(this.hass,r?"thumbs_show":"thumbs_fold")} @click=${i}>${r?"\u25B8":"\u25C2"}</button>
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}> <button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg> <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg>
<span>${$(this.hass,"all_floors")}</span> <span>${M(this.hass,"all_floors")}</span>
</button> </button>
${t.map(o=>p`<button class="nf-thumb" aria-pressed=${this.floorId===o.floorId} @click=${()=>this.fire("floor-tap",{floorId:o.floorId})}> ${t.map(o=>p`<button class="nf-thumb" aria-pressed=${this.floorId===o.floorId} @click=${()=>this.fire("floor-tap",{floorId:o.floorId})}>
${r?f:p`<img src=${o.url} alt="" />`} ${r?f:p`<img src=${o.url} alt="" />`}
<span>${e.get(o.floorId)??""}</span> <span>${e.get(o.floorId)??""}</span>
</button>`)} </button>`)}
</nav>`}onDeviceHold(e,t,r){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:r}:ke(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"&&ts(s).dim){let c=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&ns(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-r/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){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,hl(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()||!ll(e,this.screenName)||!cl(e))return;let r=ul(e.message);this._announcement={message:e.message,until:Date.now()+r},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,r),dl(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${$(this.hass,"close")} @click=${()=>this._announcement=null}> </nav>`}onDeviceHold(e,t,r){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:r}:Se(this,e)}onDeviceSwipe(e,t,r,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||C(s)||!W(this.hass,e)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&is(s).dim){let c=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&os(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-r/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){if(this._swipe&&!W(this.hass,this._swipe.entity))return;let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,gl(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()||!hl(e,this.screenName)||!ml(e))return;let r=pl(e.message);this._announcement={message:e.message,until:Date.now()+r},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,r),fl(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${M(this.hass,"close")} @click=${()=>this._announcement=null}>
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span> <span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span>
</button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return p`<div class="nf-alert-banner" role="alert"> </button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return p`<div class="nf-alert-banner" role="alert">
${t.map(r=>p`<button class="nf-alert nf-alert-${r.kind}" style=${r.color?`border-left-color:${r.color}`:""} title=${Do(this.hass,e,r)} @click=${()=>this.jumpTo(r)}>${Do(this.hass,e,r)}</button>`)} ${t.map(r=>p`<button class="nf-alert nf-alert-${r.kind}" style=${r.color?`border-left-color:${r.color}`:""} title=${Io(this.hass,e,r)} @click=${()=>this.jumpTo(r)}>${Io(this.hass,e,r)}</button>`)}
${this._alerts.length>3?p`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f} ${this._alerts.length>3?p`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f}
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),r=t?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`<div class="nf-scenes"> </div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),r=t?j(this.hass,t).filter(o=>P(o)==="scene"||P(o)==="script").slice(0,6):[];if(!r.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
${r.map(o=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${O(this.hass,o,i)}</button>`)} ${r.map(o=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${O(this.hass,o,i)}</button>`)}
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return p`<button class="nf-find-btn" title=${$(this.hass,"find")} aria-label=${$(this.hass,"find")} @click=${()=>this._find=""}> </div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return p`<button class="nf-find-btn" title=${M(this.hass,"find")} aria-label=${M(this.hass,"find")} @click=${()=>this._find=""}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5" /><path d="M16 16l4.5 4.5" /></svg> <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5" /><path d="M16 16l4.5 4.5" /></svg>
</button>`;let t=Hu(this.findIndex??=Du(this.hass,e),this._find);return p`<div class="nf-find"> </button>`;let t=Cu(this.findIndex??=Iu(this.hass,e),this._find);return p`<div class="nf-find">
<input <input
type="search" type="search"
placeholder=${$(this.hass,"find_placeholder")} placeholder=${M(this.hass,"find_placeholder")}
.value=${this._find} .value=${this._find}
@input=${r=>this._find=r.target.value} @input=${r=>this._find=r.target.value}
@keydown=${r=>{r.key==="Escape"&&(this._find=null),r.key==="Enter"&&t[0]&&this.goTo(t[0])}} @keydown=${r=>{r.key==="Escape"&&(this._find=null),r.key==="Enter"&&t[0]&&this.goTo(t[0])}}
/> />
<button class="nf-find-close" aria-label=${$(this.hass,"close")} @click=${()=>this._find=null}>✕</button> <button class="nf-find-close" aria-label=${M(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
${this._find.trim()?p`<div class="nf-find-list"> ${this._find.trim()?p`<div class="nf-find-list">
${t.length?t.map(r=>p`<button @click=${()=>this.goTo(r)}> ${t.length?t.map(r=>p`<button @click=${()=>this.goTo(r)}>
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${r.icon?Ar(r.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span> <span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${r.icon?Rr(r.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
<span><b>${r.name}</b>${r.where?p`<small>${r.where}</small>`:f}</span> <span><b>${r.name}</b>${r.where?p`<small>${r.where}</small>`:f}</span>
</button>`):p`<p>${$(this.hass,"find_none")}</p>`} </button>`):p`<p>${M(this.hass,"find_none")}</p>`}
</div>`:f} </div>`:f}
</div>`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let r=(b,y)=>$(t,b,y),i=p`<button </div>`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let r=(b,y)=>M(t,b,y),i=p`<button
class="nf-central-btn ${this._central?"nf-central-on":""}" class="nf-central-btn ${this._central?"nf-central-on":""}"
title=${r("central")} title=${r("central")}
aria-label=${r("central")} aria-label=${r("central")}
@@ -1704,7 +1704,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@click=${()=>{this._central=!this._central,this._armed=null}} @click=${()=>{this._central=!this._central,this._armed=null}}
> >
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg> <svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg>
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Qi(t,b).lights),l=s.flatMap(b=>Qi(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,h=(b,y,S,k)=>{if(k.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(y,S,{entity_id:k})}},m=(b,y,S,k,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>h(b,S,k,M)}> </button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>to(t,b).lights).filter(b=>W(t,b)),l=s.flatMap(b=>to(t,b).covers).filter(b=>W(t,b)),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,h=(b,y,$,S)=>{if(S.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(y,$,{entity_id:S})}},m=(b,y,$,S,A)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!A.length} @click=${()=>h(b,$,S,A)}>
${this._armed===b?r("central_sure"):r(y)} ${this._armed===b?r("central_sure"):r(y)}
</button>`,d=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!d[b]||!o||d[b]===o.id)),_=this.buttons??e.settings.buttons??[];return p`${i} </button>`,d=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!d[b]||!o||d[b]===o.id)),_=this.buttons??e.settings.buttons??[];return p`${i}
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${r("central")}> <div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${r("central")}>
@@ -1721,11 +1721,11 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</div>`:f} </div>`:f}
<b>${r("central_favorites")}</b> <b>${r("central_favorites")}</b>
${g.length?p`<div class="nf-central-favs"> ${g.length?p`<div class="nf-central-favs">
${g.map(b=>{let[y,S]=Va(b),k=t.states[b],M=y==="homeassistant"&&k?.state==="on";return p`<button ${g.map(b=>{let[y,$]=ja(b),S=t.states[b],A=y==="homeassistant"&&S?.state==="on";return p`<button
class="nf-chip" class="nf-chip"
aria-pressed=${M||this._sceneFired===b} aria-pressed=${A||this._sceneFired===b}
?disabled=${C(k)} ?disabled=${C(S)||!W(t,b)}
@click=${()=>{t.callService(y,S,{entity_id:b}),this._sceneFired=b,setTimeout(()=>this._sceneFired=null,600)}} @click=${()=>{t.callService(y,$,{entity_id:b}),this._sceneFired=b,setTimeout(()=>this._sceneFired=null,600)}}
> >
${O(t,b)} ${O(t,b)}
</button>`})} </button>`})}
@@ -1733,17 +1733,17 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${_.length?p`<div class="nf-central-favs"> ${_.length?p`<div class="nf-central-favs">
${_.map(b=>p`<button ${_.map(b=>p`<button
class="nf-chip nf-own-btn" class="nf-chip nf-own-btn"
aria-pressed=${Ka(t,b)} aria-pressed=${qa(t,b)}
@click=${y=>{Xi(t,y.currentTarget,b),b.action!=="service"&&(this._central=!1)}} @click=${y=>{no(t,y.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
> >
${b.icon?p`<ha-icon .icon=${b.icon.startsWith("mdi:")?b.icon:`mdi:${b.icon}`}></ha-icon>`:f}${b.label} ${b.icon?p`<ha-icon .icon=${b.icon.startsWith("mdi:")?b.icon:`mdi:${b.icon}`}></ha-icon>`:f}${b.label}
</button>`)} </button>`)}
</div>`:f} </div>`:f}
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(ju,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 zn(this.hass,pc(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:fc(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`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}> </div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Yu,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 Fn(this.hass,_c(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:bc(i,r,t),loading:!1}}catch{this._travel=null,this._error=M(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let r=this._travel;if(!r)return;let i=r.t+250*r.speed;i>=r.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>M(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}>
<button class="nf-travel-play" aria-label=${e(t.playing?"travel_pause":"travel_play")} ?disabled=${t.loading} @click=${()=>this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}</button> <button class="nf-travel-play" aria-label=${e(t.playing?"travel_pause":"travel_play")} ?disabled=${t.loading} @click=${()=>this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}</button>
<b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b> <b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b>
<div class="nf-travel-track"> <div class="nf-travel-track">
<svg viewBox="0 0 1000 10" preserveAspectRatio="none" aria-hidden="true">${t.moments.map(a=>ne`<rect x=${(a-t.from)/o*1e3} y="0" width="1.6" height="10" />`)}</svg> <svg viewBox="0 0 1000 10" preserveAspectRatio="none" aria-hidden="true">${t.moments.map(a=>re`<rect x=${(a-t.from)/o*1e3} y="0" width="1.6" height="10" />`)}</svg>
<input type="range" min=${t.from} max=${t.to} step="60000" .value=${String(t.t)} ?disabled=${t.loading} aria-label=${e("travel")} @input=${a=>this.travelTo(Number(a.target.value))} /> <input type="range" min=${t.from} max=${t.to} step="60000" .value=${String(t.t)} ?disabled=${t.loading} aria-label=${e("travel")} @input=${a=>this.travelTo(Number(a.target.value))} />
</div> </div>
<select aria-label=${e("travel_speed")} @change=${a=>this._travel={...t,speed:Number(a.target.value)}}> <select aria-label=${e("travel_speed")} @change=${a=>this._travel={...t,speed:Number(a.target.value)}}>
@@ -1752,32 +1752,32 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<button class="nf-travel-span" aria-pressed=${t.hours===24} @click=${()=>{this.openTravel(24)}}>24 h</button> <button class="nf-travel-span" aria-pressed=${t.hours===24} @click=${()=>{this.openTravel(24)}}>24 h</button>
<button class="nf-travel-span" aria-pressed=${t.hours===168} @click=${()=>{this.openTravel(168)}}>7 ${e("travel_days")}</button> <button class="nf-travel-span" aria-pressed=${t.hours===168} @click=${()=>{this.openTravel(168)}}>7 ${e("travel_days")}</button>
<button class="nf-travel-live" @click=${()=>{this.openTravel(null)}}>● ${e("travel_live")}</button> <button class="nf-travel-live" @click=${()=>{this.openTravel(null)}}>● ${e("travel_live")}</button>
</div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let 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`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}> </div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let 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=>M(this.hass,r),t=this._stick??[0,0];return p`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}>
${this._walking?"\u2715":ne`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="13" cy="4" r="2" /><path d="M10 21l2-6 3 3v5M9 12l1-4 4 1 3 3M8 9l-2 4" /></svg>`} ${this._walking?"\u2715":re`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="13" cy="4" r="2" /><path d="M10 21l2-6 3 3v5M9 12l1-4 4 1 3 3M8 9l-2 4" /></svg>`}
</button> </button>
${this._walking?p`<div class="nf-stick" @pointerdown=${r=>this.stickMove(r,!0)} @pointermove=${r=>this.stickMove(r)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}> ${this._walking?p`<div class="nf-stick" @pointerdown=${r=>this.stickMove(r,!0)} @pointermove=${r=>this.stickMove(r)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}>
<span style="transform:translate(${t[0]*34}px, ${t[1]*34}px)"></span> <span style="transform:translate(${t[0]*34}px, ${t[1]*34}px)"></span>
</div> </div>
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=$(this.hass,this._locked?"lock3d_off":"lock3d_on");return p`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}> <p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=M(this.hass,this._locked?"lock3d_off":"lock3d_on");return p`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="5" y="11" width="14" height="9" rx="2" /> <rect x="5" y="11" width="14" height="9" rx="2" />
${this._locked?ne`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:ne`<path d="M8 11V8a4 4 0 0 1 7.5-2" />`} ${this._locked?re`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:re`<path d="M8 11V8a4 4 0 0 1 7.5-2" />`}
</svg> </svg>
</button>`}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`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${i}</b><span>${o}</span></div>`}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`<button </button>`}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`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${i}</b><span>${o}</span></div>`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=M(this.hass,this.clean?"controls_show":"controls_hide");return p`<button
class="nf-eye ${this.clean?"nf-eye-clean":""}" class="nf-eye ${this.clean?"nf-eye-clean":""}"
title=${e} title=${e}
aria-label=${e} aria-label=${e}
aria-pressed=${this.clean} aria-pressed=${this.clean}
@click=${()=>this.dispatchEvent(new CustomEvent("clean-toggle",{bubbles:!0,composed:!0}))} @click=${()=>this.dispatchEvent(new CustomEvent("clean-toggle",{bubbles:!0,composed:!0}))}
> >
${this.clean?ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M12 6a9.8 9.8 0 0 1 9 6 9.8 9.8 0 0 1-9 6 9.8 9.8 0 0 1-9-6 9.8 9.8 0 0 1 9-6m0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4" /></svg>`:ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M2.4 3.8 3.8 2.4l17.8 17.8-1.4 1.4-3.3-3.3A10.5 10.5 0 0 1 12 19a9.8 9.8 0 0 1-9-6 10.3 10.3 0 0 1 3.6-4.3L2.4 3.8M12 7a4 4 0 0 1 4 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3m-4 4a4 4 0 0 0 5.5 3.7l-5.2-5.2c-.2.5-.3 1-.3 1.5m4-7a9.8 9.8 0 0 1 9 6 10 10 0 0 1-2.6 3.6l-1.4-1.4A8 8 0 0 0 18.8 12 8 8 0 0 0 9.6 7.2L8 5.6A10.3 10.3 0 0 1 12 4" /></svg>`} ${this.clean?re`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M12 6a9.8 9.8 0 0 1 9 6 9.8 9.8 0 0 1-9 6 9.8 9.8 0 0 1-9-6 9.8 9.8 0 0 1 9-6m0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4" /></svg>`:re`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M2.4 3.8 3.8 2.4l17.8 17.8-1.4 1.4-3.3-3.3A10.5 10.5 0 0 1 12 19a9.8 9.8 0 0 1-9-6 10.3 10.3 0 0 1 3.6-4.3L2.4 3.8M12 7a4 4 0 0 1 4 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3m-4 4a4 4 0 0 0 5.5 3.7l-5.2-5.2c-.2.5-.3 1-.3 1.5m4-7a9.8 9.8 0 0 1 9 6 10 10 0 0 1-2.6 3.6l-1.4-1.4A8 8 0 0 0 18.8 12 8 8 0 0 0 9.6 7.2L8 5.6A10.3 10.3 0 0 1 12 4" /></svg>`}
</button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return p`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px"> </button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return p`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
<span>${O(this.hass,e.entity)}</span> <span>${O(this.hass,e.entity)}</span>
<b>${t?$(this.hass,"swipe_off"):`${e.value} %`}</b> <b>${t?M(this.hass,"swipe_off"):`${e.value} %`}</b>
<i><em style="height:${e.value}%"></em></i> <i><em style="height:${e.value}%"></em></i>
</div>`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?eo(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`<div class="nf-menu-backdrop" @click=${r}></div> </div>`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?ro(i.gang_entities,ee(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`<div class="nf-menu-backdrop" @click=${r}></div>
<div class="nf-plate-menu" style="left:${Math.max(8,e.x-110)}px;top:${Math.max(8,e.y-20-e.ids.length*46)}px" role="menu"> <div class="nf-plate-menu" style="left:${Math.max(8,e.x-110)}px;top:${Math.max(8,e.y-20-e.ids.length*46)}px" role="menu">
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{r(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${O(t,i)}</span><i>${s?se(t,s):"\u2013"}</i></button>`})} ${e.ids.map((i,o)=>{let s=t.states[i],a=ne(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{r(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${O(t,i)}</span><i>${s?ae(t,s):"\u2013"}</i></button>`})}
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),r=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(r-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return p`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div> </div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),r=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(r-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return p`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
<nf-quick-menu <nf-quick-menu
style="left:${o}px;top:${s}px" style="left:${o}px;top:${s}px"
@@ -1788,28 +1788,28 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))} .presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))}
?confirmSwitch=${this.confirmSet.has(e.entity)} ?confirmSwitch=${this.confirmSet.has(e.entity)}
.myPosition=${this.myPositionOf(e.entity)} .myPosition=${this.myPositionOf(e.entity)}
.tiltEntity=${kr(this.hass,this.building?.floors??[],e.entity)} .tiltEntity=${$r(this.hass,this.building?.floors??[],e.entity)}
@close=${()=>this._menu=null} @close=${()=>this._menu=null}
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&jo().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&&Xi(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??Ze(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ke(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=Zi(this.hass,e),a=O(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&&ga.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;ol(this.hass,e)}else ke(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 Zs({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=>ke(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}> ></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&Yo().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&&no(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??Ye(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&Se(this,a);return}let o=P(e);if(this.hass.symconObjects!==void 0&&!W(this.hass,e)){this.hass.states[e]&&(this._menu={entity:e,x:t,y:r});return}if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:r};return}if(o==="lock"){let s=Qi(this.hass,e),a=O(this.hass,e);confirm(M(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&va.has(o)){if(this.confirmSet.has(e)&&!confirm(M(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;cl(this.hass,e)}else Se(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 Qs({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=>Se(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
<div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${$(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div> <div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${M(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
<div class="nf-pw-body">${e.node}</div> <div class="nf-pw-body">${e.node}</div>
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let r=[];for(let i of e.floors)for(let o of i.furniture){if(!wu(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=vu(t,s?.entity??s?.power??null);a&&r.push({id:o.id,name:o.name||ae(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},pump:a})}return r}livePrinters(e){let t=this.hass,r=[];if(!t)return r;for(let i of e.floors)for(let o of i.furniture){if(!Zo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=qo(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||r.push({id:o.id,name:o.name||ae(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},printer:a})}return r}liveCars(e,t){let r=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Mu(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Ho(e,o),l=a?Lc(o,a):null,c=o.name||(a?ae(e,a):ae(e,o.type));r.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+(l?.h??.2)+.6},car:s})}return r}liveMedia(e,t){let r=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&r.push({entity:s,name:o.name||ae(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.push({entity:o.entity_id,name:o.name||O(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Sc(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,fu(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,bu(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=_u(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"),c=String(a?.precipitation_unit??"mm"),u=r.language??navigator.language,h=new Intl.DateTimeFormat(u,{weekday:"short"}),m=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return p`<section class="nf-forecast" aria-label=${$(r,"forecast")}> </div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let r=[];for(let i of e.floors)for(let o of i.furniture){if(!Su(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=ku(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:se(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(!Qo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Jo(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:se(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=Ru(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Co(e,o),l=a?Bc(o,a):null,c=o.name||(a?le(e,a):le(e,o.type));r.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:se(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:se(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.push({entity:o.entity_id,name:o.name||O(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Ac(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,bu(t,r,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,r=e.settings.forecast&&t?lt(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,wu(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=vu(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=lt(r,this.weatherEntityId??t.settings.weather_entity),a=s?r.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=r.language??navigator.language,h=new Intl.DateTimeFormat(u,{weekday:"short"}),m=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return p`<section class="nf-forecast" aria-label=${M(r,"forecast")}>
<ul> <ul>
${o.map((d,g)=>p`<li> ${o.map((d,g)=>p`<li>
<span class="nf-fc-day">${g===0?$(r,"today"):h.format(new Date(d.day))}</span> <span class="nf-fc-day">${g===0?M(r,"today"):h.format(new Date(d.day))}</span>
<span class="nf-fc-icon" aria-hidden="true">${d.icon}</span> <span class="nf-fc-icon" aria-hidden="true">${d.icon}</span>
<span class="nf-fc-temp" title=${l}><b>${m(d.high)}</b> <small>${m(d.low)}</small></span> <span class="nf-fc-temp" title=${l}><b>${m(d.high)}</b> <small>${m(d.low)}</small></span>
<span class="nf-fc-rain">${d.rain!==null&&d.rain>0?`\u{1F4A7}${d.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:d.chance!==null&&d.chance>0?`\u{1F4A7}${Math.round(d.chance)} %`:""}</span> <span class="nf-fc-rain">${d.rain!==null&&d.rain>0?`\u{1F4A7}${d.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:d.chance!==null&&d.chance>0?`\u{1F4A7}${Math.round(d.chance)} %`:""}</span>
</li>`)} </li>`)}
</ul> </ul>
</section>`}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:p`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let r=mu(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=pu([...r,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return $(t,"tomorrow");let h=new Date;return h.setDate(h.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(h)},c=i.flatMap((u,h)=>[(u.day??0)>0&&(i[h-1]?.day??0)!==u.day?p`<li class="nf-today-day">${l(u.day??0)}</li>`:f,p`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${$(t,"today")}> </section>`}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:p`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let r=gu(t,e,Date.now(),{today:M(t,"care_bin_today"),tomorrow:M(t,"care_bin_tomorrow")}),i=_u([...r,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return M(t,"tomorrow");let h=new Date;return h.setDate(h.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(h)},c=i.flatMap((u,h)=>[(u.day??0)>0&&(i[h-1]?.day??0)!==u.day?p`<li class="nf-today-day">${l(u.day??0)}</li>`:f,p`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${M(t,"today")}>
<button class="nf-today-head" aria-expanded=${o} @click=${()=>this._todayOpen=!o}> <button class="nf-today-head" aria-expanded=${o} @click=${()=>this._todayOpen=!o}>
<b>📅 ${$(t,"today")}</b><span>${s}</span> <b>📅 ${M(t,"today")}</b><span>${s}</span>
</button> </button>
${o?i.length?p`<ul> ${o?i.length?p`<ul>
${c} ${c}
</ul>`:p`<p class="nf-today-none">${$(t,"today_none")}</p>`:f} </ul>`:p`<p class="nf-today-none">${M(t,"today_none")}</p>`:f}
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let r=Ze(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};tc(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)?Ce(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?Ne(r,s):wt(r,a)}${l}`})}for(let[l,c,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let h=e.energy[l],m=h?r?.states[h]:void 0;m&&!C(m)&&i.push({icon:c,label:$(r,u),value:se(r,m)})}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=>$n(a,e,Sn(a,e),Ze(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=gc(t,r),o=Date.now(),s=o-24*36e5;zn(t,i,s,o,!0).then(a=>{this.dayCurves=_c(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}jo().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(r,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=Nn(t),h=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,d)=>d.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&h){let m=0,d=0,g=0;for(let _ of h.rooms)for(let[b,y]of _.points)m+=b,d+=y,g++;a.push({kind:"house",at:{floorId:h.id,x:g?m/g:u.x,z:g?d/g:u.z,y:h.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 m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}if(this.liveCardsOn&&!this.dimmed){a.push(...au(s,t,this.floorId,this.roomId)),a.push(...lu(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let m of t.floors)for(let d of m.furniture){if(!ot(d.type)||d.hydronic?.card===!1||this.floorId&&m.id!==this.floorId||!Ue(s,d))continue;let g=this.roomId?m.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([d.x,d.z],g.points))||a.push({kind:"hydronic",item:d,readOnly:!!this._travel,at:{floorId:m.id,x:d.x+(d.pin_offset?.x??0),z:d.z+(d.pin_offset?.z??0),y:oe(m,d)+d.h+.3+(d.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,d,g,_,b)=>this.placeLhCard(m,d,g,_,b):null)}placeLhCard(e,t,r,i,o){let s=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);if(!s)return;let a=this._liveCards[e],l=`${a.kind}:${a.at.floorId}:${a.at.x}:${a.at.z}`,c=s.dataset.zoomKey===l&&s.dataset.zoomVisible==="1",u=this.shadowRoot?.activeElement,h=!!u&&s.contains(u),m=h||Tu(a,o,c);s.dataset.zoomKey=l,s.dataset.zoomVisible=m?"1":"0",s.dataset.density=String(Math.round(o)),s.dataset.priority=String(h?110:Qo(a).priority),s.dataset.focused=h?"1":"0",s.dataset.x=String(t),s.dataset.y=String(r),s.style.visibility=i&&m?"visible":"hidden",e===this._liveCards.length-1&&Ru(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`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renLine truncated </section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let r=Ye(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};ic(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&&B(r)?Ne(r,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=B(r)?s?.value??null:o?.power_entity?Z(r?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${M(r,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Le(r,s):kt(r,a)}${l}`})}for(let[l,c,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let h=e.energy[l],m=h?r?.states[h]:void 0;m&&!C(m)&&i.push({icon:c,label:M(r,u),value:ae(r,m)})}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=>An(a,e,Mn(a,e),Ye(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=yc(t,r),o=Date.now(),s=o-24*36e5;Fn(t,i,s,o,!0).then(a=>{this.dayCurves=vc(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=>st(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(r,t,!!this._travel);return}Yo().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,se(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=On(t),h=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,d)=>d.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&h){let m=0,d=0,g=0;for(let _ of h.rooms)for(let[b,y]of _.points)m+=b,d+=y,g++;a.push({kind:"house",at:{floorId:h.id,x:g?m/g:u.x,z:g?d/g:u.z,y:h.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 m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}if(this.liveCardsOn&&!this.dimmed){a.push(...uu(s,t,this.floorId,this.roomId)),a.push(...du(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let m of t.floors)for(let d of m.furniture){if(!st(d.type)||d.hydronic?.card===!1||this.floorId&&m.id!==this.floorId||!je(s,d))continue;let g=this.roomId?m.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([d.x,d.z],g.points))||a.push({kind:"hydronic",item:d,readOnly:!!this._travel,at:{floorId:m.id,x:d.x+(d.pin_offset?.x??0),z:d.z+(d.pin_offset?.z??0),y:se(m,d)+d.h+.3+(d.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,d,g,_,b)=>this.placeLhCard(m,d,g,_,b):null)}placeLhCard(e,t,r,i,o){let s=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);if(!s)return;let a=this._liveCards[e],l=`${a.kind}:${a.at.floorId}:${a.at.x}:${a.at.z}`,c=s.dataset.zoomKey===l&&s.dataset.zoomVisible==="1",u=this.shadowRoot?.activeElement,h=!!u&&s.contains(u),m=h||Hu(a,o,c);s.dataset.zoomKey=l,s.dataset.zoomVisible=m?"1":"0",s.dataset.density=String(Math.round(o)),s.dataset.priority=String(h?110:ts(a).priority),s.dataset.focused=h?"1":"0",s.dataset.x=String(t),s.dataset.y=String(r),s.style.visibility=i&&m?"visible":"hidden",e===this._liveCards.length-1&&Tu(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`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renLine truncated
${s} ${s}
${this.liveCardsOn&&this._liveCards.some(c=>c.kind==="house")?f:l.map(c=>p`<div class="nf-energy-item nf-energy-${c.cls}"><span>${c.label}</span><b>${c.value}</b></div>`)} ${this.liveCardsOn&&this._liveCards.some(c=>c.kind==="house")?f:l.map(c=>p`<div class="nf-energy-item nf-energy-${c.cls}"><span>${c.label}</span><b>${c.value}</b></div>`)}
${this.flows!==null?f:p`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${a("flows_hint")} aria-label=${a("flows")} @click=${()=>this.toggleFlows()}> ${this.flows!==null?f:p`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${a("flows_hint")} aria-label=${a("flows")} @click=${()=>this.toggleFlows()}>
@@ -1817,38 +1817,38 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</button>`} </button>`}
${this.renderCardToggle()} ${this.renderCardToggle()}
${e} ${e}
</div>`}renderCardToggle(){return this.holograms!==null?f:p`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${$(this.hass,"holos_hint")} aria-label=${$(this.hass,"holos")} @click=${()=>this.toggleLhCards()}> </div>`}renderCardToggle(){return this.holograms!==null?f:p`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${M(this.hass,"holos_hint")} aria-label=${M(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
<span>${$(this.hass,"holos")}</span><b>◫</b> <span>${M(this.hass,"holos")}</span><b>◫</b>
</button>`}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=>Ce(this.hass,o,r).length||Bt(this.hass,o,r,!0).length)?p`<nf-utility-overview ?inline=${e} .hass=${this.hass} .floors=${t.floors} .floorId=${this.floorId} .compact=${this._narrowStage} </button>`}utilityOverview(e){let t=this.building;if(!t||!B(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=>Ne(this.hass,o,r).length||Kt(this.hass,o,r,!0).length)?p`<nf-utility-overview ?inline=${e} .hass=${this.hass} .floors=${t.floors} .floorId=${this.floorId} .compact=${this._narrowStage}
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:p`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=V(this.hass)?(this.building?.presence??[]).filter(c=>fl(this.hass,c.person,[0])).map(c=>p`<div class="nf-energy-item nf-presence-state"><span>${c.name||O(this.hass,c.person)}</span><b>${le(this.hass.states[c.person])===null?"\u2013":le(this.hass.states[c.person])?"Anwesend":"Abwesend"}${G(this.hass,[c.person],c.name||"Anwesenheit")}</b></div>`):[],o=V(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(c=>!!c[1]&&c[1]!=="none").map(([c,u])=>[Bu[c]||c,u]):[];V(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?p`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button> @utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:p`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=B(this.hass)?(this.building?.presence??[]).filter(c=>_a(this.hass,c.person,[0])).map(c=>p`<div class="nf-energy-item nf-presence-state"><span>${c.name||O(this.hass,c.person)}</span><b>${ce(this.hass.states[c.person])===null?"\u2013":ce(this.hass.states[c.person])?"Anwesend":"Abwesend"}${U(this.hass,[c.person],c.name||"Anwesenheit")}</b></div>`):[],o=B(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(c=>!!c[1]&&c[1]!=="none").map(([c,u])=>[Gu[c]||c,u]):[];B(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`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
<dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${c=>c.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.close()}>×</button></header>${o.map(([c,u])=>p`<p><span>${c}</span><b>${De(this.hass.states[u])}${G(this.hass,[u],c)}</b></p>`)}</dialog>`:f,a=V(this.hass)?(this.building?.floors??[]).filter(c=>!this.floorId||c.id===this.floorId).map(c=>({floor:c,readings:Ce(this.hass,c,this.building?.floors.flatMap(u=>u.rooms))})).filter(c=>c.readings.length):[],l=a.length?p`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button> <dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${c=>c.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.close()}>×</button></header>${o.map(([c,u])=>p`<p><span>${c}</span><b>${De(this.hass.states[u])}${U(this.hass,[u],c)}</b></p>`)}</dialog>`:f,a=B(this.hass)?(this.building?.floors??[]).filter(c=>!this.floorId||c.id===this.floorId).map(c=>({floor:c,readings:Ne(this.hass,c,this.building?.floors.flatMap(u=>u.rooms))})).filter(c=>c.readings.length):[],l=a.length?p`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button>
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${c=>c.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${a.map(({floor:c,readings:u})=>p`<h3>${c.name}</h3><nf-utility-report .hass=${this.hass} .readings=${u}></nf-utility-report>`)}</dialog>`:f;return[t,e,...i,s,l,...r.filter(c=>this.hass.states[c]).map(c=>p`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,c)} @click=${()=>ke(this,c)}> <dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${c=>c.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${a.map(({floor:c,readings:u})=>p`<h3>${c.name}</h3><nf-utility-report .hass=${this.hass} .readings=${u}></nf-utility-report>`)}</dialog>`:f;return[t,e,...i,s,l,...r.filter(c=>this.hass.states[c]).map(c=>p`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,c)} @click=${()=>Se(this,c)}>
<span>${O(this.hass,c)}</span><b>${se(this.hass,this.hass.states[c])}</b> <span>${O(this.hass,c)}</span><b>${ae(this.hass,this.hass.states[c])}</b>
</button>${G(this.hass,[c],O(this.hass,c))}`)]}renderMapCredit(){let e=this.building?.settings.map;return Gc(e)?p`<a class="nf-map-credit" href=${Co(e).href} target="_blank" rel="noopener">${Co(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=vt(new Date,this.hass?.config?.latitude??50),t=Kr(this.heatMode,e),r=this.heatMode==="temperature",i=r?ce(this.hass,t.stops[0][0]):t.stops[0][0],o=r?ce(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=r?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`<div class="nf-legend"> </button>${U(this.hass,[c],O(this.hass,c))}`)]}renderMapCredit(){let e=this.building?.settings.map;return qc(e)?p`<a class="nf-map-credit" href=${Oo(e).href} target="_blank" rel="noopener">${Oo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=xt(new Date,this.hass?.config?.latitude??50),t=Ur(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?ie(this.hass):t.unit,a=l=>M(this.hass,l);return p`<div class="nf-legend">
<b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?p` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b> <b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?p` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b>
<span class="nf-legend-bar" style="background:${ec(this.heatMode,e)}"></span> <span class="nf-legend-bar" style="background:${rc(this.heatMode,e)}"></span>
<span class="nf-legend-range"><span>${L(this.hass,i,0)} ${s}</span><span>${L(this.hass,o,0)} ${s}</span></span> <span class="nf-legend-range"><span>${L(this.hass,i,0)} ${s}</span><span>${L(this.hass,o,0)} ${s}</span></span>
${this.heatValues.size?f:p`<span class="nf-legend-none">${a("heat_none_found")}</span>`} ${this.heatValues.size?f:p`<span class="nf-legend-none">${a("heat_none_found")}</span>`}
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let r=(c,u)=>$(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>Yo(u.type)).map(u=>Jo(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Su(a);return p`<div class="nf-legend"> </div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let r=(c,u)=>M(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>Xo(u.type)).map(u=>es(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Au(a);return p`<div class="nf-legend">
<b>📶 ${r("heat_wifi")}</b> <b>📶 ${r("heat_wifi")}</b>
<span>${r("wifi_aps",{n:i.length,clients:s})}</span> <span>${r("wifi_aps",{n:i.length,clients:s})}</span>
${l.online+l.offline.length?p`<span>${r("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f} ${l.online+l.offline.length?p`<span>${r("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
${l.offline.length?p`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f} ${l.offline.length?p`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f}
${i.length?f:p`<span class="nf-legend-none">${r("wifi_none")}</span>`} ${i.length?f:p`<span class="nf-legend-none">${r("wifi_none")}</span>`}
</div>`}skyColor(){let e=Fn[this.theme]??Fn.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,c)=>Math.round(l+(a[c]-l)*t)).join(",")})`,i=Fn[this.theme]??Fn.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+xc(this.building?.settings.backdrop);return p`<div </div>`}skyColor(){let e=Hn[this.theme]??Hn.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,c)=>Math.round(l+(a[c]-l)*t)).join(",")})`,i=Hn[this.theme]??Hn.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+$c(this.building?.settings.backdrop);return p`<div
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""} ${e!==f?"nf-has-utility-overview":""}" class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""} ${e!==f?"nf-has-utility-overview":""}"
style=${o} style=${o}
> >
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${Eu(this.hass,this._liveCards,(s,a,l,c)=>this.hass?.callService(s,a,{entity_id:l,...c}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()} ${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${Fu(this.hass,this._liveCards,(s,a,l,c)=>this.hass?.callService(s,a,{entity_id:l,...c}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:p`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()} ${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.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`<span class="nf-stats" ${this.showStats&&this._stats?p`<span class="nf-stats"
><b>${this._stats.fps?$(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):$(this.hass,"stats_idle")}</b> ><b>${this._stats.fps?M(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):M(this.hass,"stats_idle")}</b>
${this._stats.busy.length?p`(${this._stats.busy.map(s=>$(this.hass,`stats_busy_${s}`)).join(", ")})`:f} · ${this._stats.busy.length?p`(${this._stats.busy.map(s=>M(this.hass,`stats_busy_${s}`)).join(", ")})`:f} ·
${$(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} · ${M(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${$(this.hass,this._stats.low?"stats_low":"stats_full",{r:L(this.hass,this._stats.pixelRatio,2)})}</span ${M(this.hass,this._stats.low?"stats_low":"stats_full",{r:L(this.hass,this._stats.pixelRatio,2)})}</span
>`:f} >`:f}
</div>`}static styles=[ye,He,zu,J` </div>`}static styles=[ve,Pe,Du,Q`
:host { :host {
display: block; display: block;
position: relative; position: relative;
@@ -3449,26 +3449,26 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
inset: auto 16px 16px; inset: auto 16px 16px;
color: var(--nf-danger); color: var(--nf-danger);
} }
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",ss);function he(n,e){return Math.abs(e)>=1e3?`${L(n,e/1e3,1)} kW`:`${Math.round(e)} W`}function os(n){return n.type==="tv_board"?n.h+.9:n.type==="tv_wall"||n.type==="kitchen_wall"?n.h+.25:n.h+.35}function og(n,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(n,e)}var Zu;function Yu(){let n=new URL("./nextfloor-editor.js?v=1a84ce4ff399",new URL(import.meta.url)).href;return Zu??=import(n),Zu}var sg=.25,Ju=n=>Math.round(n*1e3)/1e3,Qu=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function ls(n,e,t,r,i){let o=Qu(n,e,t);if(!o)return[r,i];let s=(a,l)=>H([a,l],o.points);return s(r,i)?[r,i]:s(r,t)?[r,t]:s(e,i)?[e,i]:[e,t]}function ag(n,e,t,r){return n.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(ue(ee(o,t),r))<.02&&Math.abs(ue(ee(a,t),r))<.02}))}var as=(n,e)=>Math.abs((n-e+540)%360-180);function Xu(n,e,t,r=sg){let i=Qu(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,c)=>{let u=o[(c+1)%o.length],h=qe(ee(u,l));if(h<.3)return;let m=[(u[0]-l[0])/h,(u[1]-l[1])/h],d=[-m[1]*s,m[0]*s],g=ue(ee([e.x,e.z],l),m);if(g<0||g>h)return;let _=ag(n,i,l,d)?t/2:0,b=ue(ee([e.x,e.z],l),d)-_,y=Math.atan2(-d[0],d[1])*180/Math.PI,k=[{rotation:y,extent:e.d/2},{rotation:y+90,extent:e.w/2},{rotation:y-90,extent:e.w/2}].reduce((z,E)=>as(e.rotation,E.rotation)<as(e.rotation,z.rotation)?E:z);if(as(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>r||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:Ju(e.x-d[0]*M),z:Ju(e.z-d[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function di(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 hi(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 ed(n,e){let t=structuredClone(n);for(let r of t.floors)r.furniture=r.furniture.filter(i=>i.id!==e);return t}function td(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 nd(n,e,t,r){return hi(n,e,(i,o)=>{[i.x,i.z]=ls(o,i.x,i.z,t,r)})}function rd(n,e,t,r){let i=n.settings.wall_interior??.12;return di(n,e,(o,s)=>{[o.x,o.z]=ls(s,o.x,o.z,t,r);let a=Xu(s,o,i);a&&Object.assign(o,a)})}var cs=(n,e)=>((n+e)%360+360)%360,id=n=>Number.parseFloat(n.replace(",",".")),Gn=(n,e)=>Math.round(n*10**e)/10**e;function us(n){let{min:e,max:t,accepts:r=()=>!0}=n,i=o=>{let s=id(o.target.value);!Number.isFinite(s)||!r(s)||n.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${n.title} `]};customElements.get("nf-view3d")||customElements.define("nf-view3d",cs);function me(n,e){return Math.abs(e)>=1e3?`${L(n,e/1e3,1)} kW`:`${Math.round(e)} W`}function ls(n){return n.type==="tv_board"?n.h+.9:n.type==="tv_wall"||n.type==="kitchen_wall"?n.h+.25:n.h+.35}function lg(n,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:ae(n,e)}var Qu;function Xu(){let n=new URL("./nextfloor-editor.js?v=2e4ad9d61b43",new URL(import.meta.url)).href;return Qu??=import(n),Qu}var cg=.25,ed=n=>Math.round(n*1e3)/1e3,td=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function ds(n,e,t,r,i){let o=td(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 ug(n,e,t,r){return n.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(de(te(o,t),r))<.02&&Math.abs(de(te(a,t),r))<.02}))}var us=(n,e)=>Math.abs((n-e+540)%360-180);function nd(n,e,t,r=cg){let i=td(n,e.x,e.z);if(!i)return null;let o=i.points,s=bt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],h=Ze(te(u,l));if(h<.3)return;let m=[(u[0]-l[0])/h,(u[1]-l[1])/h],d=[-m[1]*s,m[0]*s],g=de(te([e.x,e.z],l),m);if(g<0||g>h)return;let _=ug(n,i,l,d)?t/2:0,b=de(te([e.x,e.z],l),d)-_,y=Math.atan2(-d[0],d[1])*180/Math.PI,S=[{rotation:y,extent:e.d/2},{rotation:y+90,extent:e.w/2},{rotation:y-90,extent:e.w/2}].reduce((z,x)=>us(e.rotation,x.rotation)<us(e.rotation,z.rotation)?x:z);if(us(e.rotation,S.rotation)>50)return;let A=b-S.extent;Math.abs(A)>r||a&&Math.abs(A)>=Math.abs(a.gap)||(a={x:ed(e.x-d[0]*A),z:ed(e.z-d[1]*A),rotation:(Math.round(S.rotation)%360+360)%360,gap:A})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function mi(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return r}function pi(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 rd(n,e){let t=structuredClone(n);for(let r of t.floors)r.furniture=r.furniture.filter(i=>i.id!==e);return t}function id(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 od(n,e,t,r){return pi(n,e,(i,o)=>{[i.x,i.z]=ds(o,i.x,i.z,t,r)})}function sd(n,e,t,r){let i=n.settings.wall_interior??.12;return mi(n,e,(o,s)=>{[o.x,o.z]=ds(s,o.x,o.z,t,r);let a=nd(s,o,i);a&&Object.assign(o,a)})}var hs=(n,e)=>((n+e)%360+360)%360,ad=n=>Number.parseFloat(n.replace(",",".")),jn=(n,e)=>Math.round(n*10**e)/10**e;function ms(n){let{min:e,max:t,accepts:r=()=>!0}=n,i=o=>{let s=ad(o.target.value);!Number.isFinite(s)||!r(s)||n.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${n.title}
>${n.label} >${n.label}
<input type="number" inputmode="decimal" step=${n.step} min=${e} max=${t??f} .value=${String(Gn(n.value,2))} @change=${i} /> <input type="number" inputmode="decimal" step=${n.step} min=${e} max=${t??f} .value=${String(jn(n.value,2))} @change=${i} />
</label>`}var sd=(n,e)=>p`<button class="nf-chip" @click=${e}>${n.t("height_auto")}</button>`,od=(n,e)=>p`<button class="nf-chip" @click=${()=>e(-n)}>↺ ${n}°</button><button class="nf-chip" @click=${()=>e(n)}>↻ ${n}°</button>`;function lg(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)=>us({label:n.t(a),title:n.t(`size_${s}`),value:r[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>n.editFurniture(e,c=>c[s]=Gn(l,3))}),o=da(r)?p`${us({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=Gn(s,3))})} </label>`}var cd=(n,e)=>p`<button class="nf-chip" @click=${e}>${n.t("height_auto")}</button>`,ld=(n,e)=>p`<button class="nf-chip" @click=${()=>e(-n)}>↺ ${n}°</button><button class="nf-chip" @click=${()=>e(n)}>↻ ${n}°</button>`;function dg(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)=>ms({label:n.t(a),title:n.t(`size_${s}`),value:r[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>n.editFurniture(e,c=>c[s]=jn(l,3))}),o=pa(r)?p`${ms({label:"\u2195",title:n.t("mount_height"),value:r.mount_y??se(t,r),step:.05,min:0,accepts:s=>s>=0,apply:s=>n.editFurniture(e,a=>a.mount_y=jn(s,3))})}
${r.mount_y!=null?sd(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 cg(n,e){let t=n.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),r=t?.placements.find(l=>l.entity_id===e);if(!t||!r)return f;let i=P(e),o=(l,c,u)=>p`<select class="nf-size-select" title=${n.t(l)} @change=${h=>n.editDevice(e,m=>Object.assign(m,{mount:h.target.value,y:null}))}> ${r.mount_y!=null?cd(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 hg(n,e){let t=n.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),r=t?.placements.find(l=>l.entity_id===e);if(!t||!r)return f;let i=P(e),o=(l,c,u)=>p`<select class="nf-size-select" title=${n.t(l)} @change=${h=>n.editDevice(e,m=>Object.assign(m,{mount:h.target.value,y:null}))}>
${c.map(([h,m])=>p`<option value=${h} ?selected=${h===u}>${m}</option>`)} ${c.map(([h,m])=>p`<option value=${h} ?selected=${h===u}>${m}</option>`)}
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,n.t(`lamp_${l}`)]),a=i?Ht(i,xe(t,r.x,r.z),i==="light"?r.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,r.mount??"ceiling"):f} </select>`,s=["ceiling","floor","table","wall"].map(l=>[l,n.t(`lamp_${l}`)]),a=i?It(i,ke(t,r.x,r.z),i==="light"?r.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,r.mount??"ceiling"):f}
${us({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,c=>c.y=Gn(l,3))})} ${ms({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,c=>c.y=jn(l,3))})}
${r.y!==null?sd(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function ad(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`<span>${o?ae(n.hass,o):""}</span> ${r.y!==null?cd(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function ud(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`<span>${o?le(n.hass,o):""}</span>
${lg(n,e)} ${od(45,s=>n.turnFurniture(e,s))} ${dg(n,e)} ${ld(45,s=>n.turnFurniture(e,s))}
<button class="nf-chip" title=${r("furn_mirror_hint")} @click=${()=>n.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${r("furn_mirror")}</button> <button class="nf-chip" title=${r("furn_mirror_hint")} @click=${()=>n.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${r("furn_mirror")}</button>
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeFurniture(e)}>${r("delete")}</button>`}else t?i=p`<span>${O(n.hass,t)}</span> <button class="nf-chip nf-danger-chip" @click=${()=>n.removeFurniture(e)}>${r("delete")}</button>`}else t?i=p`<span>${O(n.hass,t)}</span>
${cg(n,t)} ${od(45,o=>n.turnDevice(t,o))} ${hg(n,t)} ${ld(45,o=>n.turnDevice(t,o))}
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeDevice(t)}>${r("delete")}</button>`:i=p`<span>${r("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>n.finish()}>${r("done")}</button></div>`}var ld=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true"> <button class="nf-chip nf-danger-chip" @click=${()=>n.removeDevice(t)}>${r("delete")}</button>`:i=p`<span>${r("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>n.finish()}>${r("done")}</button></div>`}var dd=re`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/> <polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/> <polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/> <polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/> <polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
<circle cx="256" cy="236" r="16" fill="#ffe08a"/> <circle cx="256" cy="236" r="16" fill="#ffe08a"/>
</svg>`;var me=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),en=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),ds={explode:me("explode",!0),keepRoof:me("roof",!1),solidWalls:me("solid_walls",!1),quality:en("quality",["auto","low","high"],"auto"),stats:me("stats",!1),markers:en("markers",["none","important","all"],"important"),heat:en("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:en("theme",Qr,"neon"),clock:en("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:en("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 cd(n=pi()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function ud(n=pi()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function pi(){try{return localStorage}catch{return null}}var mi=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let r of Object.keys(ds)){let i=ds[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=ds[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var dd=J` </svg>`;var pe=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),nn=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),ps={explode:pe("explode",!0),keepRoof:pe("roof",!1),solidWalls:pe("solid_walls",!1),quality:nn("quality",["auto","low","high"],"auto"),stats:pe("stats",!1),markers:nn("markers",["none","important","all"],"important"),heat:nn("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:nn("theme",ei,"neon"),clock:nn("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:nn("floor_stack",["dim","stacked","single"],"dim"),roomNames:pe("room_names",!0),clean:pe("clean",!1),navWrap:pe("nav_wrap",!1),weather:pe("weather",!0),timeSlider:pe("time_slider",!1),menuOpen:pe("menu_open",!1),keepCamera:pe("keep_camera",!1),readable:pe("readable",!1),plain:pe("plain",!1),rightBack:pe("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:pe("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 hd(n=gi()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function md(n=gi()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function gi(){try{return localStorage}catch{return null}}var fi=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(ps)){let i=ps[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=ps[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var pd=Q`
.nf-dot { .nf-dot {
display: inline-block; display: inline-block;
width: 8px; width: 8px;
@@ -3960,11 +3960,11 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
gap: 12px; gap: 12px;
margin: auto; margin: auto;
} }
`;var hd=new WeakMap,md=new WeakMap;function St(n,e){let t=md.get(n)??n,r=hd.get(t)??new WeakMap;hd.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Be(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let h={...u.attributes,nf_cover_control:!0},m=Pt(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(h.current_position=m);let d=c.tilt?t.states[c.tilt]:u,g=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:c.tilt?Pt(t,c.tilt):null;g!==null&&(h.current_tilt_position=g,h.supported_features=Number(h.supported_features??0)|128);let _=u.state;typeof h.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=h.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:h}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let h=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async d=>{let g=typeof d=="string"?o.get(d):void 0;if(!g)return t.callService(l,c,{...u,entity_id:d});let _={...u,entity_id:d},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let y=b.includes("tilt");y&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return y&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(h.map(m)):m(h[0])}};return md.set(a,t),r.set(e,a),a}var hs=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 Dt(this);store=new mi(pi());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(Rt(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`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):r(t)}</button> `;var fd=new WeakMap,gd=new WeakMap;function Mt(n,e){let t=gd.get(n)??n,r=fd.get(t)??new WeakMap;fd.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Ve(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let h={...u.attributes,nf_cover_control:!0},m=Ct(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(h.current_position=m);let d=c.tilt?t.states[c.tilt]:u,g=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:c.tilt?Ct(t,c.tilt):null;g!==null&&(h.current_tilt_position=g,h.supported_features=Number(h.supported_features??0)|128);let _=u.state;typeof h.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=h.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:h}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let h=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async d=>{let g=typeof d=="string"?o.get(d):void 0;if(!g)return t.callService(l,c,{...u,entity_id:d});let _={...u,entity_id:d},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let y=b.includes("tilt");y&&g.tilt&&(_.entity_id=g.tilt);let $=g.tilt?t.states[g.tilt]:void 0;return y&&g.tilt&&!$?.attributes.symcon_id&&typeof $?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(h.map(m)):m(h[0])}};return gd.set(a,t),r.set(e,a),a}var fs=class extends X{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Pt(this);store=new fi(gi());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:_t(zt(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`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):r(t)}</button>
${t!==null?p`<label class="nf-chip nf-time-slider" ${t!==null?p`<label class="nf-chip nf-time-slider"
><input type="range" min="0" max="23.75" step="0.25" .value=${String(t)} aria-label=${e("time_of_day")} @input=${o=>this._timeDrag=Number(o.target.value)} ><input type="range" min="0" max="23.75" step="0.25" .value=${String(t)} aria-label=${e("time_of_day")} @input=${o=>this._timeDrag=Number(o.target.value)}
@change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))} @change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
/></label>`: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=Fr(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=_n(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=>di(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>hi(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>di(r,e,i=>i.rotation=cs(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>hi(r,e,i=>i.rotation=cs(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>ed(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>td(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&&Mr(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`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}> /></label>`:f}`}t=(e,t)=>M(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Hr(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!=="view"&&!this.isAdmin||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=yn(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=>mi(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>pi(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>mi(r,e,i=>i.rotation=hs(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>pi(r,e,i=>i.rotation=hs(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>rd(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>id(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&&Er(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`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
${t?f:p`${this.renderHeader(e)}${this.renderNotices()}`} ${t?f:p`${this.renderHeader(e)}${this.renderNotices()}`}
${this.data.error&&!e?p`<p class="nf-message">${this.t("load_error")}: ${this.data.error}</p>`:f} ${this.data.error&&!e?p`<p class="nf-message">${this.t("load_error")}: ${this.data.error}</p>`:f}
${!e&&!this.data.error?p`<p class="nf-message">${this.t("loading")}</p>`:f} ${!e&&!this.data.error?p`<p class="nf-message">${this.t("loading")}</p>`:f}
@@ -3977,7 +3977,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</label>`}renderViewOptions(){let e=this._prefs;return p`<button class="nf-opts-btn" aria-expanded=${this._optsOpen} title=${this.t("view_options")} aria-label=${this.t("view_options")} @click=${()=>this._optsOpen=!this._optsOpen}>⚙</button> </label>`}renderViewOptions(){let e=this._prefs;return p`<button class="nf-opts-btn" aria-expanded=${this._optsOpen} title=${this.t("view_options")} aria-label=${this.t("view_options")} @click=${()=>this._optsOpen=!this._optsOpen}>⚙</button>
<div class="nf-view-opts ${this._optsOpen?"nf-opts-open":""}"> <div class="nf-view-opts ${this._optsOpen?"nf-opts-open":""}">
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))} ${this.choiceRow("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("theme",ei,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))} ${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
<label class="nf-seg nf-clock-pick" title=${this.t("clock")} <label class="nf-seg nf-clock-pick" title=${this.t("clock")}
>🕒 >🕒
@@ -3993,7 +3993,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
>${this.t("glass_walls")} >${this.t("glass_walls")}
<input type="range" min="0" max="100" step="5" .value=${String(e.glassWalls)} aria-label=${this.t("glass_walls")} @input=${t=>this.setPref("glassWalls",Number(t.target.value))} /> <input type="range" min="0" max="100" step="5" .value=${String(e.glassWalls)} aria-label=${this.t("glass_walls")} @input=${t=>this.setPref("glassWalls",Number(t.target.value))} />
</label> </label>
${V(this.hass)?f:p`<details class="nf-seg nf-screen-pick"> ${B(this.hass)?f:p`<details class="nf-seg nf-screen-pick">
<summary title=${this.t(e.announceMuted?"announce_muted":"announce_on")} aria-label=${this.t(e.announceMuted?"announce_muted":"announce_on")}>${e.announceMuted?"\u{1F507}":"\u{1F4E2}"}</summary> <summary title=${this.t(e.announceMuted?"announce_muted":"announce_on")} aria-label=${this.t(e.announceMuted?"announce_muted":"announce_on")}>${e.announceMuted?"\u{1F507}":"\u{1F4E2}"}</summary>
<div class="nf-screen-menu"> <div class="nf-screen-menu">
<label class="nf-check"><input type="checkbox" .checked=${!e.announceMuted} @change=${t=>this.setPref("announceMuted",!t.target.checked)} /> ${this.t("announce_on")}</label> <label class="nf-check"><input type="checkbox" .checked=${!e.announceMuted} @change=${t=>this.setPref("announceMuted",!t.target.checked)} /> ${this.t("announce_on")}</label>
@@ -4016,7 +4016,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</div> </div>
</div>`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",r=this.data.saveState,i=(s,a,l="")=>p`<button role="tab" class=${l} aria-pressed=${this._mode===s} @click=${()=>this.setMode(s)}>${a}</button>`,o=r==="saving"?"saving":r==="saved"?"saved":"save_error";return p`<header class="nf-header"> </div>`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",r=this.data.saveState,i=(s,a,l="")=>p`<button role="tab" class=${l} aria-pressed=${this._mode===s} @click=${()=>this.setMode(s)}>${a}</button>`,o=r==="saving"?"saving":r==="saved"?"saved":"save_error";return p`<header class="nf-header">
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button> <ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
<h1 title=${t}>${ld}<span class="nf-view-title">${t}</span></h1> <h1 title=${t}>${dd}<span class="nf-view-title">${t}</span></h1>
${this.isAdmin?p`<div class="nf-seg" role="tablist">${i("view",this.t("view"))}${i("editor",this.t("editor"))}${i("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f} ${this.isAdmin?p`<div class="nf-seg" role="tablist">${i("view",this.t("view"))}${i("editor",this.t("editor"))}${i("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
<span class="nf-grow"></span> <span class="nf-grow"></span>
${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?p`<button class="nf-chip nf-room-names-toggle" aria-pressed=${this._prefs.roomNames} title=${this.t("room_names_toggle_hint")} @click=${()=>this.setPref("roomNames",!this._prefs.roomNames)}>${this.t("room_names_short")}</button>`:f} ${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?p`<button class="nf-chip nf-room-names-toggle" aria-pressed=${this._prefs.roomNames} title=${this.t("room_names_toggle_hint")} @click=${()=>this.setPref("roomNames",!this._prefs.roomNames)}>${this.t("room_names_short")}</button>`:f}
@@ -4031,7 +4031,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<span>${this.t("draft_found",{time:r})}</span> <span>${this.t("draft_found",{time:r})}</span>
<button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button> <button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button>
<button class="nf-btn" @click=${()=>e.discardDraft()}>${this.t("draft_discard")}</button> <button class="nf-btn" @click=${()=>e.discardDraft()}>${this.t("draft_discard")}</button>
</div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(Yu().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]} </div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(Xu().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
@packs-changed=${()=>{this.data.reloadPacks()}} @packs-changed=${()=>{this.data.reloadPacks()}}
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}></nf-extensions>`)}renderEditor(e){return this.whenEditorLoaded(()=>p`<nf-editor @plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}></nf-extensions>`)}renderEditor(e){return this.whenEditorLoaded(()=>p`<nf-editor
class="nf-body" class="nf-body"
@@ -4041,10 +4041,10 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.roomLabels=${this._prefs.roomNames} .roomLabels=${this._prefs.roomNames}
@room-names-change=${t=>this.setPref("roomNames",t.detail.value)} @room-names-change=${t=>this.setPref("roomNames",t.detail.value)}
.packs=${this.data.packs} .packs=${this.data.packs}
.loadCardEditor=${Jn} .loadCardEditor=${Xn}
@packs-changed=${()=>{this.data.reloadPacks()}} @packs-changed=${()=>{this.data.reloadPacks()}}
@building-changed=${t=>this.data.edit(t.detail.building)} @building-changed=${t=>this.data.edit(t.detail.building)}
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let r=En(mc(t).map(i=>this.hass.states[i]));return r.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:r.count})} @click=${()=>{for(let i of r.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=r.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${r.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),r=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=r?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button> ></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(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`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let r=Tn(gc(t).map(i=>this.hass.states[i]));return r.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:r.count})} @click=${()=>{for(let i of r.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=r.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${r.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),r=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=r?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
${[...e.floors].reverse().map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._floorId} @click=${()=>this.openFloor(c.id)}>${c.name}</button>`)} ${[...e.floors].reverse().map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._floorId} @click=${()=>this.openFloor(c.id)}>${c.name}</button>`)}
${o} ${this.allOffChip(e)} ${o} ${this.allOffChip(e)}
<span class="nf-sep"></span>`:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?p`<span class="nf-nav-floor">${c.name}</span>`:f,...c.rooms.map(u=>p`<button <span class="nf-sep"></span>`:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?p`<span class="nf-nav-floor">${c.name}</span>`:f,...c.rooms.map(u=>p`<button
@@ -4085,7 +4085,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}"> <div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}">
<nf-view3d <nf-view3d
class="nf-body" class="nf-body"
.hass=${ui(St(this.hass,e.floors),e.settings)} .hass=${hi(Mt(this.hass,e.floors),e.settings)}
.building=${e} .building=${e}
.packs=${this.data.packs} .packs=${this.data.packs}
.floorStack=${t.floorStack} .floorStack=${t.floorStack}
@@ -4104,10 +4104,10 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.keepRoof=${t.keepRoof} .keepRoof=${t.keepRoof}
.markerMode=${t.markers} .markerMode=${t.markers}
.heatMode=${t.heat} .heatMode=${t.heat}
.theme=${Xr(t.theme,this.sunState())} .theme=${ti(t.theme,this.sunState())}
.timeOfDay=${this._timeOfDay} .timeOfDay=${this._timeOfDay}
.clock=${t.clock==="none"?null:t.clock} .clock=${t.clock==="none"?null:t.clock}
.announcements=${!V(this.hass)&&!t.announceMuted} .announcements=${!B(this.hass)&&!t.announceMuted}
.glassWalls=${t.glassWalls} .glassWalls=${t.glassWalls}
.screenName=${t.screenName||null} .screenName=${t.screenName||null}
.lockButton=${!0} .lockButton=${!0}
@@ -4123,9 +4123,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
?furnish=${this._furnish} ?furnish=${this._furnish}
.selectedFurniture=${this._selFurniture} .selectedFurniture=${this._selFurniture}
@furniture-select=${i=>this._selFurniture=i.detail.id} @furniture-select=${i=>this._selFurniture=i.detail.id}
@furniture-move=${i=>this.applyEdit(o=>rd(o,i.detail.id,i.detail.x,i.detail.z))} @furniture-move=${i=>this.applyEdit(o=>sd(o,i.detail.id,i.detail.x,i.detail.z))}
@device-select=${i=>this._selDevice=i.detail.id} @device-select=${i=>this._selDevice=i.detail.id}
@device-move=${i=>this.applyEdit(o=>nd(o,i.detail.id,i.detail.x,i.detail.z))} @device-move=${i=>this.applyEdit(o=>od(o,i.detail.id,i.detail.x,i.detail.z))}
.quality=${t.quality} .quality=${t.quality}
?showStats=${t.stats} ?showStats=${t.stats}
@room-tap=${this.onRoomTap} @room-tap=${this.onRoomTap}
@@ -4135,10 +4135,10 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${r?p`<nf-room-panel ${r?p`<nf-room-panel
.building=${this.data.building??null} .building=${this.data.building??null}
class="nf-room-panel" class="nf-room-panel"
.hass=${St(this.hass,e.floors)} .hass=${Mt(this.hass,e.floors)}
.room=${r} .room=${r}
.floor=${e.floors.find(i=>i.rooms.some(o=>o.id===this._roomId))??null} .floor=${e.floors.find(i=>i.rooms.some(o=>o.id===this._roomId))??null}
.confirmEntities=${bt(this.hass,e.floors)} .confirmEntities=${vt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null} .phrases=${e.settings.announce_phrases??null}
.rooms=${e.floors.flatMap(i=>i.rooms)} .rooms=${e.floors.flatMap(i=>i.rooms)}
@mood-change=${i=>this.saveMoods(i.detail.roomId,i.detail.moods)} @mood-change=${i=>this.saveMoods(i.detail.roomId,i.detail.moods)}
@@ -4146,17 +4146,17 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
></nf-room-panel>`:this._outside?p`<nf-room-panel ></nf-room-panel>`:this._outside?p`<nf-room-panel
.building=${this.data.building??null} .building=${this.data.building??null}
class="nf-room-panel" class="nf-room-panel"
.hass=${St(this.hass,e.floors)} .hass=${Mt(this.hass,e.floors)}
.room=${null} .room=${null}
.outside=${this.outsideIds(e)} .outside=${this.outsideIds(e)}
.confirmEntities=${bt(this.hass,e.floors)} .confirmEntities=${vt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null} .phrases=${e.settings.announce_phrases??null}
@close=${()=>this._outside=!1} @close=${()=>this._outside=!1}
></nf-room-panel>`:f} ></nf-room-panel>`:f}
${t.clean?f:this.renderOverlay(e)} ${t.clean?f:this.renderOverlay(e)}
${this._furnish?ad(this.furnishHost,this._selFurniture,this._selDevice):f} ${this._furnish?ud(this.furnishHost,this._selFurniture,this._selDevice):f}
</div> </div>
`}static styles=[ye,He,dd,Tr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",hs);var ug=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,pd=(n,e)=>Number(n)*60+Number(e);function Un(n,e,t=new Date){if(!n||n==="off")return!1;if(n==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let r=ug.exec(n.trim());if(!r)return!1;let i=pd(r[1],r[2]),o=pd(r[3],r[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var fi=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(Un(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function fd(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 gd=J` `}static styles=[ve,Pe,pd,Dr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",fs);var mg=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,_d=(n,e)=>Number(n)*60+Number(e);function qn(n,e,t=new Date){if(!n||n==="off")return!1;if(n==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let r=mg.exec(n.trim());if(!r)return!1;let i=_d(r[1],r[2]),o=_d(r[3],r[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var _i=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(qn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function bd(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 yd=Q`
ha-card { ha-card {
overflow: hidden; overflow: hidden;
background: var(--nf-bg); background: var(--nf-bg);
@@ -4280,26 +4280,26 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
justify-content: flex-end; justify-content: flex-end;
} }
} }
`;function ms(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 _d(n,e){let t=new Set(e),r=[];for(let o of n.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));r.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...n.settings.roof,type:"none",sections:[],solar:[]};return{...n,floors:r,settings:{...n.settings,roof:i}}}var tn="nf-outside",ps=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 Dt(this);kiosk=new fi({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 Jn(),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=ms(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=Un(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=ms(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Fr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let r=Un(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:_d(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`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>p`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return p`<div class="nf-card-controls"> `;function gs(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 vd(n,e){let t=new Set(e),r=[];for(let o of n.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));r.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...n.settings.roof,type:"none",sections:[],solar:[]};return{...n,floors:r,settings:{...n.settings,roof:i}}}var rn="nf-outside",_s=class extends X{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 Pt(this);kiosk=new _i({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._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 Xn(),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=gs(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=qn(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=gs(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Hr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let r=qn(this._config?.night,this.hass);r!==this._night&&(this._night=r)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}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:vd(e,t)}),this.roomsMemo.result}t=e=>M(this.hass,e);stage(){let e=this.plan(),t=this._config,r=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.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`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>p`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return p`<div class="nf-card-controls">
${e.canGoBack?p`<button class="nf-chip" @click=${()=>this.back()}>${r("back")}</button>`:f} ${e.canGoBack?p`<button class="nf-chip" @click=${()=>this.back()}>${r("back")}</button>`:f}
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",r("walls_auto")],[e.walls==="cut",()=>this._walls="cut",r("walls_cut")],[e.walls==="slope",()=>this._walls="slope",r("walls_slope")]]):f} ${this.shows("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} ${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} ${i.length>0?o(r("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,r(s==="none"?"heat_off":`heat_short_${s}`)])):f}
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let r=fd(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=_n(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===tn?null:tn};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}> </div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let r=bd(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=yn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===rn?null:rn};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
${r.map(l=>p`${i?p`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._roomId} @click=${()=>o(l.floorId,c.id)}>${c.name}</button>`)}`)} ${r.map(l=>p`${i?p`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._roomId} @click=${()=>o(l.floorId,c.id)}>${c.name}</button>`)}`)}
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===tn} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f} ${s?p`<button class="nf-chip" aria-pressed=${this._roomId===rn} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
</div>`}renderCorners(){let e=this._config,t=this.t,r=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!r?p`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}> </div>`}renderCorners(){let e=this._config,t=this.t,r=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!r?p`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
${this._fullscreen?"\u2715":"\u26F6"} ${this._fullscreen?"\u2715":"\u26F6"}
</button>`:f} </button>`:f}
${e?.dashboard&&!r?p`<button class="nf-card-full nf-card-dash ${e.fullscreen_button?"nf-card-dash-2":""}" title=${e.dashboard_label||e.dashboard} aria-label=${e.dashboard_label||e.dashboard} @click=${()=>this.openDashboard(e.dashboard)}> ${e?.dashboard&&!r?p`<button class="nf-card-full nf-card-dash ${e.fullscreen_button?"nf-card-dash-2":""}" title=${e.dashboard_label||e.dashboard} aria-label=${e.dashboard_label||e.dashboard} @click=${()=>this.openDashboard(e.dashboard)}>
${e.dashboard_label?p`<span>${e.dashboard_label}</span>`:"\u2302"} ${e.dashboard_label?p`<span>${e.dashboard_label}</span>`:"\u2302"}
</button>`:f}`}renderStage(e){let t=this.plan(),r=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=r?.controls_hidden!==void 0||(r?.controls_hide_after??0)>0;return p`<nf-view3d </button>`:f}`}renderStage(e){let t=this.plan(),r=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=r?.controls_hidden!==void 0||(r?.controls_hide_after??0)>0;return p`<nf-view3d
.hass=${ui(St(this.hass,t.floors),t.settings)} .hass=${hi(Mt(this.hass,t.floors),t.settings)}
.building=${t} .building=${t}
.packs=${this.data.packs} .packs=${this.data.packs}
.floorId=${e.floorId} .floorId=${e.floorId}
.roomId=${this._roomId===tn?null:this._roomId} .roomId=${this._roomId===rn?null:this._roomId}
.outsideOpen=${this._roomId===tn} .outsideOpen=${this._roomId===rn}
.wallMode=${e.walls} .wallMode=${e.walls}
.solidWalls=${r?.solid_walls===!0} .solidWalls=${r?.solid_walls===!0}
.explode=${e.explode} .explode=${e.explode}
@@ -4322,7 +4322,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.zoom=${typeof r?.zoom=="number"?r.zoom:1} .zoom=${typeof r?.zoom=="number"?r.zoom:1}
.buttons=${r?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null} .buttons=${r?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
.heatMode=${e.heat} .heatMode=${e.heat}
.theme=${Xr(r?.theme,this.hass?.states["sun.sun"]?.state)} .theme=${ti(r?.theme,this.hass?.states["sun.sun"]?.state)}
.clock=${r?.clock&&r.clock!=="none"?r.clock:null} .clock=${r?.clock&&r.clock!=="none"?r.clock:null}
.lockButton=${r?.lock_button!==!1} .lockButton=${r?.lock_button!==!1}
.walkButton=${r?.walk_button!==!1} .walkButton=${r?.walk_button!==!1}
@@ -4340,10 +4340,10 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.panelOpen=${!!this._roomId&&r?.room_panel!==!1} .panelOpen=${!!this._roomId&&r?.room_panel!==!1}
.alerts=${r?.alerts!==!1} .alerts=${r?.alerts!==!1}
.alertJump=${!!r?.alert_jump} .alertJump=${!!r?.alert_jump}
.announcements=${!V(this.hass)&&r?.announcements!==!1&&!ud()} .announcements=${!B(this.hass)&&r?.announcements!==!1&&!md()}
.sensorBar=${r?.sensor_bar!==!1} .sensorBar=${r?.sensor_bar!==!1}
.glassWalls=${typeof r?.glass_walls=="number"?Math.min(100,Math.max(0,r.glass_walls)):null} .glassWalls=${typeof r?.glass_walls=="number"?Math.min(100,Math.max(0,r.glass_walls)):null}
.screenName=${r?.screen_name??cd()} .screenName=${r?.screen_name??hd()}
.scenes=${r?.scenes!==!1} .scenes=${r?.scenes!==!1}
.clean=${this._clean} .clean=${this._clean}
.cleanButton=${o} .cleanButton=${o}
@@ -4361,22 +4361,22 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
></nf-view3d>`}renderRoomPanel(){let e=this.plan();return p`<nf-room-panel ></nf-view3d>`}renderRoomPanel(){let e=this.plan();return p`<nf-room-panel
.building=${this.plan()??null} .building=${this.plan()??null}
class="nf-card-panel" class="nf-card-panel"
.hass=${St(this.hass,e.floors)} .hass=${Mt(this.hass,e.floors)}
.room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null} .room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null}
.floor=${e.floors.find(t=>t.rooms.some(r=>r.id===this._roomId))??null} .floor=${e.floors.find(t=>t.rooms.some(r=>r.id===this._roomId))??null}
.outside=${this._roomId===tn?_n(this.hass,e.floors):null} .outside=${this._roomId===rn?yn(this.hass,e.floors):null}
.confirmEntities=${bt(this.hass,e.floors)} .confirmEntities=${vt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null} .phrases=${e.settings.announce_phrases??null}
@close=${()=>this._roomId=null} @close=${()=>this._roomId=null}
></nf-room-panel>`}render(){if(this.hass&&Mr(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`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}> ></nf-room-panel>`}render(){if(this.hass&&Er(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`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
<div class="nf-card-body" style="height:${i}"> <div class="nf-card-body" style="height:${i}">
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(r):p`<p class="nf-card-msg">${this.data.error??(e?$(this.hass,"no_building"):$(this.hass,"loading"))}</p>`} ${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(r):p`<p class="nf-card-msg">${this.data.error??(e?M(this.hass,"no_building"):M(this.hass,"loading"))}</p>`}
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f} ${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
${this.renderRoomButtons(r)} ${this.renderRoomButtons(r)}
${r.showBar&&e?this.renderBar(r):f} ${r.showBar&&e?this.renderBar(r):f}
${this.renderCorners()} ${this.renderCorners()}
</div> </div>
</ha-card>`}static styles=[ye,He,gd,Tr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",ps);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})}Pi();var dg="nextfloor-chunks-v1";async function fs(n,e,t){let r=await fetch(`${n.endpoint}/api?token=${encodeURIComponent(n.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:dg})}),i=await r.text(),o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${r.status}).`)}if(!r.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${r.status}`;throw new Error(String(s))}return o}async function nn(n,e,t={}){let r=await fs(n,e,t);if(!("_nextfloor_transfer"in r))return r;let i=r._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>67108864||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<i.chunks;a++){let l=await fs(n,"transport/read",{transfer_id:i.id,index:a});if(l.index!==a||typeof l.data!="string")throw new Error("Ein Symcon-Datenpaket fehlt oder ist ung\xFCltig.");let c=Uint8Array.from(atob(l.data),u=>u.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await fs(n,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function hg(){let n=window.__NEXTFLOOR_SYMCON__;if(!n?.endpoint||!n.token)throw new Error("NextFloor Symcon host configuration is missing");return n}var gi=class{settings=hg();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let r=i=>e({revision:i});return this.buildingListeners.add(r),async()=>{this.buildingListeners.delete(r)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,r)=>this.callService(e,t,r),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await nn(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(()=>{})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await nn(this.settings,"bootstrap"):await nn(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let r of this.changeListeners)r()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let r of this.buildingListeners)r(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,state:t.state,attributes:{...t.attributes,friendly_name:t.name,symcon_path:t.path}}])),this.entities=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,name:t.name,area_id:t.area_id??null,device_id:t.device_id??null}]));for(let t of Object.values(this.states))for(let r of["light","cover"]){let i=ka(t,r);!i||i.entity_id===t.entity_id||this.states[i.entity_id]||(this.staLine truncated </ha-card>`}static styles=[ve,Pe,yd,Dr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",_s);let n=window;n.customCards=n.customCards??[],n.customCards.push({type:"nextfloor-card",name:M(void 0,"card_name"),description:M(void 0,"card_description"),preview:!1})}Ni();var ut=class extends Error{},pg="nextfloor-chunks-v1",fg=64*1024*1024;async function bs(n,e,t){let r=await fetch(`${n.endpoint}/api${n.csrf?"":n.token?`?token=${encodeURIComponent(n.token)}`:""}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...n.csrf?{"X-NextFloor-CSRF":n.csrf}:{}},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:pg})}),i=await r.text();if(r.status===401)throw new ut("Die Anmeldung ist abgelaufen. Bitte erneut anmelden.");let o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${r.status}).`)}if(!r.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${r.status}`;throw s==="csrf_invalid"?new ut("Die Anmeldung hat sich ge\xE4ndert. Bitte erneut laden."):new Error(String(s))}return o}async function on(n,e,t={}){let r=await bs(n,e,t);if(!("_nextfloor_transfer"in r))return r;let i=r._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>fg||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<i.chunks;a++){let l=await bs(n,"transport/read",{transfer_id:i.id,index:a});if(l.index!==a||typeof l.data!="string")throw new Error("Ein Symcon-Datenpaket fehlt oder ist ung\xFCltig.");let c=Uint8Array.from(atob(l.data),u=>u.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await bs(n,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function gg(){let n=window.__NEXTFLOOR_SYMCON__;if(!n?.endpoint||!n.csrf&&!n.token)throw new Error("NextFloor Symcon host configuration is missing");return n}var bi=class{onExpired;settings=gg();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:this.settings.user??{is_admin:!1,name:"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let r=i=>e({revision:i});return this.buildingListeners.add(r),async()=>{this.buildingListeners.delete(r)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,r)=>this.callService(e,t,r),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await on(this.settings,"bootstrap");return e.access&&(this.facade.user=e.access),this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(t=>{t instanceof ut&&(this.stop(),this.states={},this.entities={},this.onExpired?.())})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await on(this.settings,"bootstrap"):await on(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let r of this.changeListeners)r()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let r of this.buildingListeners)r(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{enLine truncated
/*! Bundled license information: /*! Bundled license information:
@lit/reactive-element/css-tag.js: @lit/reactive-element/css-tag.js:
+11 -2
View File
@@ -1,7 +1,7 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */ /*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var Hi=globalThis,Li=Hi.ShadowRoot&&(Hi.ShadyCSS===void 0||Hi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$s=Symbol(),Rc=new WeakMap,xr=class{constructor(e,n,r){if(this._$cssResult$=!0,r!==$s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o,n=this.t;if(Li&&e===void 0){let r=n!==void 0&&n.length===1;r&&(e=Rc.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Rc.set(n,e))}return e}toString(){return this.cssText}},Ec=t=>new xr(typeof t=="string"?t:t+"",void 0,$s),ee=(t,...e)=>{let n=t.length===1?t[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1],t[0]);return new xr(n,t,$s)},Ac=(t,e)=>{if(Li)t.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of e){let r=document.createElement("style"),i=Hi.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=n.cssText,t.appendChild(r)}},Ss=Li?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(let r of e.cssRules)n+=r.cssText;return Ec(n)})(t):t;var{is:gb,defineProperty:_b,getOwnPropertyDescriptor:bb,getOwnPropertyNames:yb,getOwnPropertySymbols:vb,getPrototypeOf:wb}=Object,Ci=globalThis,Fc=Ci.trustedTypes,kb=Fc?Fc.emptyScript:"",xb=Ci.reactiveElementPolyfillSupport,$r=(t,e)=>t,Ms={toAttribute(t,e){switch(e){case Boolean:t=t?kb:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},zc=(t,e)=>!gb(t,e),Tc={attribute:!0,type:String,converter:Ms,reflect:!1,useDefault:!1,hasChanged:zc};Symbol.metadata??=Symbol("metadata"),Ci.litPropertyMetadata??=new WeakMap;var yt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,n=Tc){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,n);i!==void 0&&_b(this.prototype,e,i)}}static getPropertyDescriptor(e,n,r){let{get:i,set:o}=bb(this.prototype,e)??{get(){return this[n]},set(s){this[n]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Tc}static _$Ei(){if(this.hasOwnProperty($r("elementProperties")))return;let e=wb(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty($r("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty($r("properties"))){let n=this.properties,r=[...yb(n),...vb(n)];for(let i of r)this.createProperty(i,n[i])}let e=this[Symbol.metadata];if(e!==null){let n=litPropertyMetadata.get(e);if(n!==void 0)for(let[r,i]of n)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[n,r]of this.elementProperties){let i=this._$Eu(n,r);i!==void 0&&this._$Eh.set(i,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let n=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)n.unshift(Ss(i))}else e!==void 0&&n.push(Ss(e));return n}static _$Eu(e,n){let r=n.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,n=this.constructor.elementProperties;for(let r of n.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ac(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.Line truncated var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var Hi=globalThis,Li=Hi.ShadowRoot&&(Hi.ShadyCSS===void 0||Hi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$s=Symbol(),Rc=new WeakMap,xr=class{constructor(e,n,r){if(this._$cssResult$=!0,r!==$s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o,n=this.t;if(Li&&e===void 0){let r=n!==void 0&&n.length===1;r&&(e=Rc.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Rc.set(n,e))}return e}toString(){return this.cssText}},Ec=t=>new xr(typeof t=="string"?t:t+"",void 0,$s),ee=(t,...e)=>{let n=t.length===1?t[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1],t[0]);return new xr(n,t,$s)},Ac=(t,e)=>{if(Li)t.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of e){let r=document.createElement("style"),i=Hi.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=n.cssText,t.appendChild(r)}},Ss=Li?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(let r of e.cssRules)n+=r.cssText;return Ec(n)})(t):t;var{is:gb,defineProperty:_b,getOwnPropertyDescriptor:bb,getOwnPropertyNames:yb,getOwnPropertySymbols:vb,getPrototypeOf:wb}=Object,Ci=globalThis,Fc=Ci.trustedTypes,kb=Fc?Fc.emptyScript:"",xb=Ci.reactiveElementPolyfillSupport,$r=(t,e)=>t,Ms={toAttribute(t,e){switch(e){case Boolean:t=t?kb:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},zc=(t,e)=>!gb(t,e),Tc={attribute:!0,type:String,converter:Ms,reflect:!1,useDefault:!1,hasChanged:zc};Symbol.metadata??=Symbol("metadata"),Ci.litPropertyMetadata??=new WeakMap;var yt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,n=Tc){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,n);i!==void 0&&_b(this.prototype,e,i)}}static getPropertyDescriptor(e,n,r){let{get:i,set:o}=bb(this.prototype,e)??{get(){return this[n]},set(s){this[n]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Tc}static _$Ei(){if(this.hasOwnProperty($r("elementProperties")))return;let e=wb(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty($r("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty($r("properties"))){let n=this.properties,r=[...yb(n),...vb(n)];for(let i of r)this.createProperty(i,n[i])}let e=this[Symbol.metadata];if(e!==null){let n=litPropertyMetadata.get(e);if(n!==void 0)for(let[r,i]of n)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[n,r]of this.elementProperties){let i=this._$Eu(n,r);i!==void 0&&this._$Eh.set(i,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let n=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)n.unshift(Ss(i))}else e!==void 0&&n.push(Ss(e));return n}static _$Eu(e,n){let r=n.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,n=this.constructor.elementProperties;for(let r of n.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ac(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.Line truncated
\f\r]`,Sr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ic=/-->/g,Oc=/>/g,Qt=RegExp(`>|${Rs}(?:([^\\s"'>=/]+)(${Rs}*=${Rs}*(?:[^ \f\r]`,Sr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ic=/-->/g,Oc=/>/g,Qt=RegExp(`>|${Rs}(?:([^\\s"'>=/]+)(${Rs}*=${Rs}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Hc=/'/g,Lc=/"/g,Bc=/^(?:script|style|textarea|title)$/i,zs=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),m=zs(1),R=zs(2),s1=zs(3),tt=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Cc=new WeakMap,en=tn.createTreeWalker(tn,129);function Vc(t,e){if(!Ts(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Dc!==void 0?Dc.createHTML(e):e}var Wc=(t,e)=>{let n=t.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=Sr;for(let a=0;a<n;a++){let l=t[a],c,u,d=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===Sr?u[1]==="!--"?s=Ic:u[1]!==void 0?s=Oc:u[2]!==void 0?(Bc.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=Qt):u[3]!==void 0&&(s=Qt):s===Qt?u[0]===">"?(s=i??Sr,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Qt:u[3]==='"'?Lc:Hc):s===Lc||s===Hc?s=Qt:s===Ic||s===Oc?s=Sr:(s=Qt,i=void 0);let h=s===Qt&&t[a+1].startsWith("/>")?" ":"";o+=s===Sr?l+$b:d>=0?(r.push(c),l.slice(0,d)+As+l.slice(d)+vt+h):l+vt+(d===-2?a:h)}return[Vc(t,o+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},Er=class t{constructor({strings:e,_$litType$:n},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=Wc(e,n);if(this.el=t.createElement(c,r),en.currentNode=this.el.content,n===2||n===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=en.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(As)){let p=u[s++],h=i.getAttribute(d).split(vt),f=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:f[2],strings:h,ctor:f[1]==="."?Vi:f[1]==="?"?Wi:f[1]==="@"?Ki:rn}),i.removeAttribute(d)}else d.startsWith(vt)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(Bc.test(i.tagName)){let d=i.textContent.split(vt),p=d.length-1;if(p>0){i.textContent=Ni?Ni.emptyScript:"";for(let h=0;h<p;h++)i.append(d[h],Mr()),en.nextNode(),l.push({type:2,index:++o});i.append(d[p],Mr())}}}else if(i.nodeType===8)if(i.data===Fs)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(vt,d+1))!==-1;)l.push({type:7,index:o}),d+=vt.length-1}o++}}static createElement(e,n){let r=tn.createElement("template");return r.innerHTML=e,r}};function nn(t,e,n=t,r){if(e===tt)return e;let i=r!==void 0?n._$Co?.[r]:n._$Cl,o=Rr(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(t),i._$AT(t,n,r)),r!==void 0?(n._$Co??=[])[r]=i:n._$Cl=i),i!==void 0&&(e=nn(t,i._$AS(t,e.values),i,r)),e}var Bi=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:n},parts:r}=this._$AD,i=(e?.creationScope??tn).importNode(n,!0);en.currentNode=i;let o=en.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new An(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new ji(o,this,e)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=en.nextNode(),s++)}return en.currentNode=tn,i}p(e){let n=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,n),n+=r.strings.length-2):r._$AI(e[n])),n++}},An=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,r,i){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=nn(this,e,n),Rr(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==tt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Nc(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==_&&Rr(this._$AH)?this._$AA.nextSibling.data=e:this.T(tn.createTextNode(e)),this._$AH=e}$(e){let{values:n,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Er.createElement(Vc(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(n);else{let o=new Bi(i,this),s=o.u(this.options);o.p(n),this.T(s),this._$AH=o}}_$AC(e){let n=Cc.get(e.strings);return n===void 0&&Cc.set(e.strings,n=new Er(e)),n}k(e){Ts(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let o of e)i===n.length?n.push(r=new t(this.O(Mr()),this.O(Mr()),this,this.options)):r=n[i],r._$AI(o),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){let r=Pc(e).nextSibling;Pc(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},rn=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,r,i,o){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=n,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._Line truncated \f\r"'\`<>=]|("|')|))|$)`,"g"),Hc=/'/g,Lc=/"/g,Bc=/^(?:script|style|textarea|title)$/i,zs=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),m=zs(1),R=zs(2),s1=zs(3),tt=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Cc=new WeakMap,en=tn.createTreeWalker(tn,129);function Vc(t,e){if(!Ts(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Dc!==void 0?Dc.createHTML(e):e}var Wc=(t,e)=>{let n=t.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=Sr;for(let a=0;a<n;a++){let l=t[a],c,u,d=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===Sr?u[1]==="!--"?s=Ic:u[1]!==void 0?s=Oc:u[2]!==void 0?(Bc.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=Qt):u[3]!==void 0&&(s=Qt):s===Qt?u[0]===">"?(s=i??Sr,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Qt:u[3]==='"'?Lc:Hc):s===Lc||s===Hc?s=Qt:s===Ic||s===Oc?s=Sr:(s=Qt,i=void 0);let h=s===Qt&&t[a+1].startsWith("/>")?" ":"";o+=s===Sr?l+$b:d>=0?(r.push(c),l.slice(0,d)+As+l.slice(d)+vt+h):l+vt+(d===-2?a:h)}return[Vc(t,o+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},Er=class t{constructor({strings:e,_$litType$:n},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=Wc(e,n);if(this.el=t.createElement(c,r),en.currentNode=this.el.content,n===2||n===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=en.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(As)){let p=u[s++],h=i.getAttribute(d).split(vt),f=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:f[2],strings:h,ctor:f[1]==="."?Vi:f[1]==="?"?Wi:f[1]==="@"?Ki:rn}),i.removeAttribute(d)}else d.startsWith(vt)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(Bc.test(i.tagName)){let d=i.textContent.split(vt),p=d.length-1;if(p>0){i.textContent=Ni?Ni.emptyScript:"";for(let h=0;h<p;h++)i.append(d[h],Mr()),en.nextNode(),l.push({type:2,index:++o});i.append(d[p],Mr())}}}else if(i.nodeType===8)if(i.data===Fs)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(vt,d+1))!==-1;)l.push({type:7,index:o}),d+=vt.length-1}o++}}static createElement(e,n){let r=tn.createElement("template");return r.innerHTML=e,r}};function nn(t,e,n=t,r){if(e===tt)return e;let i=r!==void 0?n._$Co?.[r]:n._$Cl,o=Rr(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(t),i._$AT(t,n,r)),r!==void 0?(n._$Co??=[])[r]=i:n._$Cl=i),i!==void 0&&(e=nn(t,i._$AS(t,e.values),i,r)),e}var Bi=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:n},parts:r}=this._$AD,i=(e?.creationScope??tn).importNode(n,!0);en.currentNode=i;let o=en.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new An(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new ji(o,this,e)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=en.nextNode(),s++)}return en.currentNode=tn,i}p(e){let n=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,n),n+=r.strings.length-2):r._$AI(e[n])),n++}},An=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,r,i){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=nn(this,e,n),Rr(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==tt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Nc(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==_&&Rr(this._$AH)?this._$AA.nextSibling.data=e:this.T(tn.createTextNode(e)),this._$AH=e}$(e){let{values:n,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Er.createElement(Vc(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(n);else{let o=new Bi(i,this),s=o.u(this.options);o.p(n),this.T(s),this._$AH=o}}_$AC(e){let n=Cc.get(e.strings);return n===void 0&&Cc.set(e.strings,n=new Er(e)),n}k(e){Ts(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let o of e)i===n.length?n.push(r=new t(this.O(Mr()),this.O(Mr()),this,this.options)):r=n[i],r._$AI(o),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){let r=Pc(e).nextSibling;Pc(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},rn=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,r,i,o){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=n,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._Line truncated
:host { :host {
--nf-text: var(--primary-text-color, #e1e1e1); --nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b); --nf-muted: var(--secondary-text-color, #9b9b9b);
@@ -1223,7 +1223,7 @@ ${o}`}else i=dp(s)}}catch(s){let a=s.message,l={not_json:"import_error_not_json"
<div class="nf-actions"> <div class="nf-actions">
<button class="nf-btn" @click=${()=>{this.loadDevices()}}>${e("ble_refresh")}</button> <button class="nf-btn" @click=${()=>{this.loadDevices()}}>${e("ble_refresh")}</button>
<button class="nf-btn nf-primary" ?disabled=${!this._pick||n.length>=10} @click=${()=>this.addTag()}>${e("ble_add_button")}</button> <button class="nf-btn nf-primary" ?disabled=${!this._pick||n.length>=10} @click=${()=>this.addTag()}>${e("ble_add_button")}</button>
</div>`}};customElements.get("nf-ble-locate")||customElements.define("nf-ble-locate",Fl);var d0=new URL(import.meta.url),h0=new URL("./nextfloor-3d.js?v=3c3ea11cac21",d0).href,om;function $n(){return om??=import(h0),om}var sm=["lights","seating","tables","storage","beds","kitchen","appliances","bath","media","office","tech","climate","energy","garden","plants","kids","fitness","pets","workshop","music","season","pictures","vehicles","building","decor"],p0={sofa:"seating",armchair:"seating",stool:"seating",chair:"seating",bench:"seating",corner_bench:"seating",bar_stool:"seating",office_chair:"office",coffee_table:"tables",table:"tables",table_round:"tables",desk:"office",worktop:"kitchen",tv_board:"media",tv_wall:"media",sideboard:"storage",shelf:"storage",tall_cabinet:"storage",wardrobe:"storage",dresser:"storage",nightstand:"beds",coat_rack:"storage",plant:"plants",rug:"decor",kitchen:"kitchen",kitchen_wall:"kitchen",kitchen_tall:"kitchen",island:"kitchen",sink:"kitchen",stove:"kitchen",dishwasher:"appliances",fridge:"appliances",washer:"appliances",dryer:"appliances",robot_vacuum:"appliances",bed:"beds",bunk_bed:"beds",bathtub:"bath",shower:"bath",wc:"bath",washbasin:"bath",radiator:"climate",stairs:"building",parking:"vehicles",ceiling_fan:"lights"},f0=[[/xmas|advent|window_star|candle_arch|reindeer|pumpkin|easter|snowman|gift_pile|lights_outdoor/,"season"],[/^frame_|^canvas$|^poster$|picture_ledge/,"pictures"],[/piano|drum_kit|guitar|synth|mic_stand|vinyl|easel|studio_monitor|mixing_desk/,"music"],[/lamp|pendant|light_pillar|light_bars|mood_spot|ceiling_panel|garden_spots|wall_light|light_cove|niche_led|shelf_led|monitor_light|workshop_light|painting_light|cabinet_light|moon_light|torch|lantern|ceiling_fan_light/,"lights"],[/cat_|dog_|pet_|litter|scratch|hamster|rabbit|bird_cage|small_animal|aquarium|terrarium/,"pets"],[/stairs|steps|landing|rail_|column|pilaster|beam|chimney|glass_wall|sliding_wall|half_wall|platform|niche_shelf|window_seat|divider_slats|gallery/,"building"],[/tree|shrub|conifer|hedge|brush|monstera|plant|herb_garden|herb_planter|flower|raised_bed|greenhouse|ficus|cactus|bonsai|living_wall|vertical_garden/,"plants"],[/kids|toy|teepee|(^|_)play_|rocking_horse|ball_pit|house_bed|cot\b|^cot|crib|changing_table|baby|loft_bed|star_projector|moon_light/,"kids"],[/treadmill|fitness|power_rack|rowing|rower|spin_bike|dumbbell|punching|yoga|elliptical|gym|exercise|wall_bars|bike_trainer|kettlebell|weight_bench|massage_chair/,"fitness"],[/heat_pump|boiler|buffer_tank|manifold|ventilation|radiator|towel_heater|thermostat|air_purifier|humidifier|dehumidifier|tower_fan|ceiling_fan|hot_water|water_softener|water_pump|fireplace|wood_stove|patio_heater|sauna|oil_|expansion_vessel|water_tank|infrared|cold_bath/,"climate"],[/wallbox|inverter|battery|solar|meter|fuse_box|grid/,"energy"],[/workbench|tool_|compressor|drill|tyre|paint_cabinet|heavy_shelf|shelf_rack|garage_opener|workshop|bike_stand|bike_holder|bike_rack|lawn_mower|mower|welder|ev_bike_charger|tool_chest|parts_cabinet/,"workshop"],[/speaker|subwoofer|soundbar|receiver|turntable|record|game_console|multiroom|hifi|cinema|acoustic|bass_trap|popcorn|projector|projection|screen|display_|smart_display|media|tv|arcade|star_ceiling|av_/,"media"],[/desk|office|filing|whiteboard|monitor|bookcase|phone_booth|sim_cockpit|chair_gaming|gaming/,"office"],[/server|nas|router|wifi|access_point|network|printer|filament|tower_pc|smoke_detector|siren|baby_monitor|sunrise_clock|light_switch|socket|co_detector|presence_|water_leak|air_quality|doorbell/,"tech"],[/grill|lounge|lounger|parasol|pergola|hot_tub|fire_bowl|torch|lantern|play_tower|garden|trampoline|sprinkler|valve|rain_barrel|outdoor|hammock|(^|_)pool|swing|bin_box|^bin_|mailbox|rotary_line|kamado|pizza_oven|fire_pit|sandbox|wood_pile|bird_house|cistern|pond|water_feature|beach_chair/,"garden"],[/vanity_\d|vanity_double|double_vanity|basin|bath|shower|toilet|bidet|towel|mirror_cabinet|mirror_round|mirror_80|mirror_led|whirlpool|washer_under|laundry|urinal|wt_\d|handtuch|seife|wc/,"bath"],[/fridge|freezer|dishwasher|washer|dryer|microwave|coffee_machine|kettle|toaster|mixer|oven|steam|vacuum|ironing|drying_rack|trash|water_cooler|drip_tray|espresso|air_fryer|water_bar|thermo_cooker/,"appliances"],[/base_|drawer_|sink|hob|cooker|hood|pantry|kitchen|island|breakfast_bar|wall_\d|wall_glass|wall_corner|row_|spice|cabinet_light|trolley|bar_cart|utility_sink/,"kitchen"],[/bed|boxspring|futon|nightstand|canopy|mattress/,"beds"],[/sofa|chair|armchair|stool|bench|pouf|bean_bag|recliner|wingback|chaise|seat|ektorp|poang|cosy_corner|swing_bench|hanging_chair|nook|floor_cushion|tatami/,"seating"],[/table|dining|coffee_|side_round|lack_|^console$|bekant|alex/,"tables"],[/wardrobe|closet|clothes_rail|chest|dresser|shelf|cabinet|sideboard|lowboard|highboard|kallax|billy|ivar|pax|besta|cube_|coat_stand|shoe_bench|divider|display_cabinet|wall_unit|malm_chest|locker/,"storage"]];function m0(t){if(t.vehicle)return"vLine truncated </div>`}};customElements.get("nf-ble-locate")||customElements.define("nf-ble-locate",Fl);var d0=new URL(import.meta.url),h0=new URL("./nextfloor-3d.js?v=d63a1d893eb1",d0).href,om;function $n(){return om??=import(h0),om}var sm=["lights","seating","tables","storage","beds","kitchen","appliances","bath","media","office","tech","climate","energy","garden","plants","kids","fitness","pets","workshop","music","season","pictures","vehicles","building","decor"],p0={sofa:"seating",armchair:"seating",stool:"seating",chair:"seating",bench:"seating",corner_bench:"seating",bar_stool:"seating",office_chair:"office",coffee_table:"tables",table:"tables",table_round:"tables",desk:"office",worktop:"kitchen",tv_board:"media",tv_wall:"media",sideboard:"storage",shelf:"storage",tall_cabinet:"storage",wardrobe:"storage",dresser:"storage",nightstand:"beds",coat_rack:"storage",plant:"plants",rug:"decor",kitchen:"kitchen",kitchen_wall:"kitchen",kitchen_tall:"kitchen",island:"kitchen",sink:"kitchen",stove:"kitchen",dishwasher:"appliances",fridge:"appliances",washer:"appliances",dryer:"appliances",robot_vacuum:"appliances",bed:"beds",bunk_bed:"beds",bathtub:"bath",shower:"bath",wc:"bath",washbasin:"bath",radiator:"climate",stairs:"building",parking:"vehicles",ceiling_fan:"lights"},f0=[[/xmas|advent|window_star|candle_arch|reindeer|pumpkin|easter|snowman|gift_pile|lights_outdoor/,"season"],[/^frame_|^canvas$|^poster$|picture_ledge/,"pictures"],[/piano|drum_kit|guitar|synth|mic_stand|vinyl|easel|studio_monitor|mixing_desk/,"music"],[/lamp|pendant|light_pillar|light_bars|mood_spot|ceiling_panel|garden_spots|wall_light|light_cove|niche_led|shelf_led|monitor_light|workshop_light|painting_light|cabinet_light|moon_light|torch|lantern|ceiling_fan_light/,"lights"],[/cat_|dog_|pet_|litter|scratch|hamster|rabbit|bird_cage|small_animal|aquarium|terrarium/,"pets"],[/stairs|steps|landing|rail_|column|pilaster|beam|chimney|glass_wall|sliding_wall|half_wall|platform|niche_shelf|window_seat|divider_slats|gallery/,"building"],[/tree|shrub|conifer|hedge|brush|monstera|plant|herb_garden|herb_planter|flower|raised_bed|greenhouse|ficus|cactus|bonsai|living_wall|vertical_garden/,"plants"],[/kids|toy|teepee|(^|_)play_|rocking_horse|ball_pit|house_bed|cot\b|^cot|crib|changing_table|baby|loft_bed|star_projector|moon_light/,"kids"],[/treadmill|fitness|power_rack|rowing|rower|spin_bike|dumbbell|punching|yoga|elliptical|gym|exercise|wall_bars|bike_trainer|kettlebell|weight_bench|massage_chair/,"fitness"],[/heat_pump|boiler|buffer_tank|manifold|ventilation|radiator|towel_heater|thermostat|air_purifier|humidifier|dehumidifier|tower_fan|ceiling_fan|hot_water|water_softener|water_pump|fireplace|wood_stove|patio_heater|sauna|oil_|expansion_vessel|water_tank|infrared|cold_bath/,"climate"],[/wallbox|inverter|battery|solar|meter|fuse_box|grid/,"energy"],[/workbench|tool_|compressor|drill|tyre|paint_cabinet|heavy_shelf|shelf_rack|garage_opener|workshop|bike_stand|bike_holder|bike_rack|lawn_mower|mower|welder|ev_bike_charger|tool_chest|parts_cabinet/,"workshop"],[/speaker|subwoofer|soundbar|receiver|turntable|record|game_console|multiroom|hifi|cinema|acoustic|bass_trap|popcorn|projector|projection|screen|display_|smart_display|media|tv|arcade|star_ceiling|av_/,"media"],[/desk|office|filing|whiteboard|monitor|bookcase|phone_booth|sim_cockpit|chair_gaming|gaming/,"office"],[/server|nas|router|wifi|access_point|network|printer|filament|tower_pc|smoke_detector|siren|baby_monitor|sunrise_clock|light_switch|socket|co_detector|presence_|water_leak|air_quality|doorbell/,"tech"],[/grill|lounge|lounger|parasol|pergola|hot_tub|fire_bowl|torch|lantern|play_tower|garden|trampoline|sprinkler|valve|rain_barrel|outdoor|hammock|(^|_)pool|swing|bin_box|^bin_|mailbox|rotary_line|kamado|pizza_oven|fire_pit|sandbox|wood_pile|bird_house|cistern|pond|water_feature|beach_chair/,"garden"],[/vanity_\d|vanity_double|double_vanity|basin|bath|shower|toilet|bidet|towel|mirror_cabinet|mirror_round|mirror_80|mirror_led|whirlpool|washer_under|laundry|urinal|wt_\d|handtuch|seife|wc/,"bath"],[/fridge|freezer|dishwasher|washer|dryer|microwave|coffee_machine|kettle|toaster|mixer|oven|steam|vacuum|ironing|drying_rack|trash|water_cooler|drip_tray|espresso|air_fryer|water_bar|thermo_cooker/,"appliances"],[/base_|drawer_|sink|hob|cooker|hood|pantry|kitchen|island|breakfast_bar|wall_\d|wall_glass|wall_corner|row_|spice|cabinet_light|trolley|bar_cart|utility_sink/,"kitchen"],[/bed|boxspring|futon|nightstand|canopy|mattress/,"beds"],[/sofa|chair|armchair|stool|bench|pouf|bean_bag|recliner|wingback|chaise|seat|ektorp|poang|cosy_corner|swing_bench|hanging_chair|nook|floor_cushion|tatami/,"seating"],[/table|dining|coffee_|side_round|lack_|^console$|bekant|alex/,"tables"],[/wardrobe|closet|clothes_rail|chest|dresser|shelf|cabinet|sideboard|lowboard|highboard|kallax|billy|ivar|pax|besta|cube_|coat_stand|shoe_bench|divider|display_cabinet|wall_unit|malm_chest|locker/,"storage"]];function m0(t){if(t.vehicle)return"vLine truncated
:host { :host {
display: block; display: block;
aspect-ratio: 4 / 3; aspect-ratio: 4 / 3;
@@ -3026,6 +3026,15 @@ ${n.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
fill: rgba(184, 163, 130, 0.24); fill: rgba(184, 163, 130, 0.24);
stroke: rgba(184, 163, 130, 0.65); stroke: rgba(184, 163, 130, 0.65);
} }
.nf-out-pavers polygon,
.nf-out-natural_stone polygon {
fill: rgba(170, 160, 135, 0.22);
stroke: rgba(170, 160, 135, 0.6);
}
.nf-out-stepping_stones polygon {
fill: rgba(130, 170, 110, 0.18);
stroke: rgba(160, 190, 140, 0.55);
}
.nf-free-wall { .nf-free-wall {
cursor: grab; cursor: grab;
} }
+2 -2
View File
@@ -22,10 +22,10 @@
}, },
{ {
"type": "Button", "type": "Button",
"caption": "Neuen Designer-Zugang erzeugen", "caption": "Alle Anmeldungen beenden und Designer öffnen",
"onClick": "echo NFSC_RotateAccessToken($id);", "onClick": "echo NFSC_RotateAccessToken($id);",
"link": true, "link": true,
"confirm": "Alle aktuell offenen Designer- und Kachelansichten dieser Instanz müssen danach neu geladen werden. Fortfahren?" "confirm": "Alle Benutzer dieser Instanz werden abgemeldet. Der Konsolen-Designer wird anschließend neu geöffnet. Fortfahren?"
} }
], ],
"status": [ "status": [
+200
View File
@@ -0,0 +1,200 @@
<?php
declare(strict_types=1);
/** Instance-local accounts and revocable HttpOnly sessions. Console actions are never exposed through the WebHook API. */
trait NextFloorAccess
{
private ?array $requestUser = null;
private ?array $requestScope = null;
private const SESSION_TTL = 43200;
private const SESSION_IDLE = 7200;
private function accessLock(callable $operation): mixed
{
$name = 'NextFloorAccess_' . $this->InstanceID;
$native = function_exists('IPS_SemaphoreEnter');
if ($native && !IPS_SemaphoreEnter($name, 3000)) throw new RuntimeException('access_busy');
try { return $operation(); }
finally { if ($native) IPS_SemaphoreLeave($name); }
}
private function accounts(): array { return $this->jsonAttribute('Accounts', []); }
/** A short-lived, single-use console ticket; no reusable admin credential in browser URLs. */
private function consoleUrl(): string
{
$ticket = $this->newToken();
$this->accessLock(function () use ($ticket): void {
$tickets = array_filter($this->jsonAttribute('ConsoleTickets', []), static fn(array $t): bool => $t['expires'] > time());
$tickets = array_slice($tickets, -19, null, true);
$tickets[hash('sha256', $ticket)] = ['expires' => time() + 90, 'epoch' => $this->ensureAccessToken()];
$this->writeJsonAttribute('ConsoleTickets', $tickets);
});
return '/hook/' . $this->hookPath() . '/designer?mode=designer&ticket=' . rawurlencode($ticket);
}
private function sessionCookie(): string { return 'NFSC_Session_' . $this->InstanceID; }
private function loginCookie(): string { return 'NFSC_Login_' . $this->InstanceID; }
private function accessCookie(string $name, string $value, int $expires = 0): void
{
setcookie($name, $value, ['expires' => $expires, 'path' => '/hook/' . $this->hookPath() . '/',
'secure' => $this->secureRequest(), 'httponly' => true, 'samesite' => 'Strict']);
}
private function secureRequest(): bool
{
// A proxy header can only strengthen cookie protection, never turn native HTTPS off.
return (($_SERVER['HTTPS'] ?? '') !== '' && ($_SERVER['HTTPS'] ?? '') !== 'off') || ($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https';
}
private function createSession(string $accountID, array $account, bool $remember = false): array
{
$token = $this->newToken();
$id = hash('sha256', $token);
$session = ['account' => $accountID, 'epoch' => $account['epoch'], 'csrf' => $this->newToken(),
'expires' => time() + ($remember ? 2592000 : self::SESSION_TTL), 'idle' => $remember ? 604800 : self::SESSION_IDLE, 'seen' => time()];
// Called inside accessLock, including ticket exchange and password login.
$sessions = array_filter($this->jsonAttribute('Sessions', []), static fn(array $s): bool => $s['expires'] > time() && $s['seen'] > time() - ($s['idle'] ?? self::SESSION_IDLE));
if (count($sessions) >= 128) throw new RuntimeException('session_limit');
$sessions[$id] = $session;
$this->writeJsonAttribute('Sessions', $sessions);
$this->accessCookie($this->sessionCookie(), $token, $remember ? $session['expires'] : 0);
return [...$account, 'id' => $accountID, 'session_id' => $id, 'csrf' => $session['csrf']];
}
private function resolveSession(): ?array
{
$token = $_COOKIE[$this->sessionCookie()] ?? '';
if (!is_string($token) || preg_match('/^[a-f0-9]{64}$/D', $token) !== 1) return null;
return $this->accessLock(function () use ($token): ?array {
$id = hash('sha256', $token);
$sessions = $this->jsonAttribute('Sessions', []);
$s = $sessions[$id] ?? null;
if (!$s || $s['expires'] <= time() || $s['seen'] <= time() - ($s['idle'] ?? self::SESSION_IDLE)) return null;
$account = $s['account'] === '__console__' ? ['name' => 'Symcon-Konsole', 'role' => 'admin', 'enabled' => true, 'epoch' => $this->ensureAccessToken()]
: ($this->accounts()[$s['account']] ?? null);
if (!$account || !$account['enabled'] || !hash_equals((string) $account['epoch'], (string) $s['epoch'])) return null;
if ($s['seen'] < time() - 60) {
$sessions[$id]['seen'] = time();
$this->writeJsonAttribute('Sessions', $sessions);
}
return [...$account, 'id' => $s['account'], 'session_id' => $id, 'csrf' => $s['csrf']];
});
}
private function exchangeConsoleTicket(string $ticket): bool
{
if (preg_match('/^[a-f0-9]{64}$/D', $ticket) !== 1) return false;
return $this->accessLock(function () use ($ticket): bool {
$tickets = $this->jsonAttribute('ConsoleTickets', []);
$key = hash('sha256', $ticket);
$grant = $tickets[$key] ?? null;
unset($tickets[$key]);
$this->writeJsonAttribute('ConsoleTickets', $tickets);
if (!$grant || $grant['expires'] <= time() || !hash_equals($this->ensureAccessToken(), $grant['epoch'])) return false;
$this->requestUser = $this->createSession('__console__', ['name' => 'Symcon-Konsole', 'role' => 'admin', 'enabled' => true, 'epoch' => $grant['epoch']]);
return true;
});
}
private function safeMode(): string { return ($_GET['mode'] ?? '') === 'tile' ? 'tile' : 'designer'; }
private function entryUrl(string $tail = 'designer'): string { return '/hook/' . $this->hookPath() . '/' . $tail . '?mode=' . $this->safeMode(); }
private function accessRedirect(string $url): void { header('Location: ' . $url, true, 303); header('Cache-Control: no-store'); }
private function validOrigin(): bool
{
$origin = $_SERVER['HTTP_ORIGIN'] ?? '';
if ($origin === '') return true; // non-browser clients still require the CSRF value and session cookie
$parts = parse_url($origin);
if (!is_array($parts) || ($parts['scheme'] ?? '') !== ($this->secureRequest() ? 'https' : 'http')) return false;
$authority = strtolower((string) ($parts['host'] ?? '') . (isset($parts['port']) ? ':' . $parts['port'] : ''));
return $authority !== '' && hash_equals(strtolower((string) ($_SERVER['HTTP_HOST'] ?? '')), $authority);
}
private function validCsrf(): bool
{
$value = $_SERVER['HTTP_X_NEXTFLOOR_CSRF'] ?? $_POST['csrf'] ?? '';
return $this->requestUser !== null && is_string($value) && $value !== '' && $this->validOrigin()
&& hash_equals($this->requestUser['csrf'], $value);
}
/** Login stays a regular HTML form, including with JavaScript disabled and on small touch screens. */
private function loginPage(string $error = '', int $status = 200): void
{
$csrf = $this->newToken();
$this->accessCookie($this->loginCookie(), $csrf);
$escape = static fn(string $s): string => htmlspecialchars($s, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
http_response_code($status);
header('Content-Type: text/html; charset=utf-8');
header('Cache-Control: no-store');
$configured = count(array_filter($this->accounts(), static fn(array $a): bool => $a['enabled'])) > 0;
echo '<!doctype html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">'
. '<title>Anmelden · ' . $escape($this->viewTitle()) . '</title><style>html{color-scheme:dark}body{margin:0;min-height:100dvh;display:grid;place-items:center;background:#0c1320;color:#e6edf5;font:16px/1.5 system-ui}main{box-sizing:border-box;width:min(420px,calc(100% - 32px));padding:32px;background:#1b2432;border:1px solid #344255;border-radius:18px;box-shadow:0 16px 60px #0005}h1{margin:0 0 4px;font-size:25px}p{color:#aebdce}label{display:block;margin:18px 0 6px}input,button{box-sizing:border-box;width:100%;padding:12px 14px;border-radius:9px;border:1px solid #465872;font:inherit}input{background:#101a28;color:inherit}button{margin-top:24px;background:#1bb8e8;color:#061624;font-weight:700;cursor:pointer}input:focus,button:focus{outline:2px solid #45d0ff;outline-offset:3px}[role=alert]{padding:10px;background:#82353555;border-radius:8px;color:#ffc4c4}.note{font-size:13px}</style></head><body><main><h1>'
. $escape($this->viewTitle()) . '</h1><p>Mit deinem NextFloor-Konto anmelden.</p>'
. ($error !== '' ? '<p role="alert">' . $escape($error) . '</p>' : '')
. ($configured ? '<form method="post" action="' . $escape($this->entryUrl('login')) . '"><input type="hidden" name="csrf" value="' . $csrf . '">'
. '<label for="username">Benutzername</label><input id="username" name="username" autocomplete="username" required maxlength="64" autofocus>'
. '<label for="password">Passwort</label><input id="password" name="password" type="password" autocomplete="current-password" required maxlength="72">'
. '<label style="display:flex;gap:9px;align-items:center;font-size:14px"><input style="width:auto" type="checkbox" name="remember" value="1">Angemeldet bleiben (30 Tage)</label><button type="submit">Anmelden</button></form><p class="note">Passwort vergessen? Der Symcon-Administrator kann es in der NextFloor-Instanz zurücksetzen.</p>'
: '<p role="status">Noch kein Benutzer eingerichtet. Lege in der Symcon-Konfiguration der NextFloor-Instanz zuerst einen Benutzer mit Passwort an.</p>')
. '</main></body></html>';
}
private function passwordLogin(): void
{
$csrf = $_POST['csrf'] ?? '';
$nonce = $_COOKIE[$this->loginCookie()] ?? '';
if (!$this->validOrigin() || !is_string($csrf) || !is_string($nonce) || strlen($nonce) !== 64 || !hash_equals($nonce, $csrf)) {
$this->loginPage('Die Anmeldung ist abgelaufen. Bitte erneut versuchen.', 403);
return;
}
$name = is_string($_POST['username'] ?? null) ? mb_strtolower(trim($_POST['username'])) : '';
$password = is_string($_POST['password'] ?? null) ? $_POST['password'] : '';
$result = $this->accessLock(function () use ($name, $password): string {
$now = time();
$limits = array_filter($this->jsonAttribute('LoginThrottle', []), static fn(array $v): bool => $v['until'] > time());
$ipKey = 'ip:' . hash('sha256', (string) ($_SERVER['REMOTE_ADDR'] ?? 'unknown'));
$nameKey = 'name:' . hash('sha256', $name);
if (($limits[$ipKey]['count'] ?? 0) >= 40 || ($limits[$nameKey]['count'] ?? 0) >= 8) return 'limited';
$found = null;
foreach ($this->accounts() as $id => $a) if (mb_strtolower($a['name']) === $name) { $found = [$id, $a]; break; }
// Use the same platform algorithm/cost for an unknown username as for real accounts.
$hash = $found[1]['password'] ?? $this->ReadAttributeString('LoginDummyHash');
$valid = strlen($password) <= 72 && !str_contains($password, "\0") && password_verify($password, $hash);
if (!$valid || !$found || !$found[1]['enabled']) {
foreach ([$ipKey, $nameKey] as $key) $limits[$key] = ['count' => ($limits[$key]['count'] ?? 0) + 1, 'until' => $limits[$key]['until'] ?? $now + 900];
$this->writeJsonAttribute('LoginThrottle', array_slice($limits, -1024, null, true));
return 'invalid';
}
unset($limits[$nameKey]);
$this->writeJsonAttribute('LoginThrottle', $limits);
$this->requestUser = $this->createSession($found[0], $found[1], ($_POST['remember'] ?? '') === '1');
return 'ok';
});
if ($result !== 'ok') { $this->loginPage($result === 'limited' ? 'Zu viele Anmeldeversuche. Bitte in 15 Minuten erneut versuchen.' : 'Benutzername oder Passwort ist ungültig.', $result === 'limited' ? 429 : 401); return; }
$this->accessCookie($this->loginCookie(), '', time() - 3600);
$this->accessRedirect($this->entryUrl());
}
private function logoutSession(): void
{
$id = $this->requestUser['session_id'] ?? '';
$this->accessLock(function () use ($id): void {
$sessions = $this->jsonAttribute('Sessions', []); unset($sessions[$id]); $this->writeJsonAttribute('Sessions', $sessions);
});
$this->accessCookie($this->sessionCookie(), '', time() - 3600);
$this->requestUser = null;
$this->accessRedirect($this->entryUrl('login'));
}
private function publicAccess(): array
{
$admin = $this->requestUser['role'] === 'admin';
$canControl = $admin || ($this->requestUser['control_all'] ?? false);
foreach (['rooms', 'devices', 'objects'] as $group) foreach ($this->requestUser[$group] ?? [] as $g) if (($g['access'] ?? '') === 'control') $canControl = true;
return ['id' => $this->requestUser['id'], 'name' => $this->requestUser['name'], 'is_admin' => $admin,
'view_all' => $admin || ($this->requestUser['view_all'] ?? false), 'control_all' => $admin || ($this->requestUser['control_all'] ?? false), 'can_control' => $canControl];
}
}
+286
View File
@@ -0,0 +1,286 @@
<?php
declare(strict_types=1);
class NextFloorDenied extends RuntimeException {}
/** Deny by default; project geometry and live data are separate capabilities. */
trait NextFloorPermissions
{
private const REF_FIELDS = ['entity', 'entity_id', 'device', 'tracker', 'power', 'energy', 'temperature', 'humidity', 'co2', 'illuminance',
'supply_vsr', 'extract_vsr', 'supply_temperature', 'extract_temperature', 'reheat', 'status', 'schedules',
'floor_heating', 'clean_entity', 'panel', 'hidden', 'no_state', 'cover', 'cover2', 'cover_tilt', 'cover2_tilt',
'contact', 'contact2', 'tilt', 'tilt2', 'position', 'tilt_angle', 'lock', 'door_left', 'door_right', 'soc', 'charge', 'export',
'gang_entities', 'flow', 'return', 'command', 'feedback', 'circulation_temperature', 'hot_water', 'cold_water',
'start', 'end', 'duration', 'start_time', 'end_time', 'charging_time', 'charged_energy', 'lock_status', 'range', 'charging', 'plugged', 'departure',
'grid', 'solar', 'battery', 'battery_soc', 'consumption', 'tariff', 'meter', 'favorites', 'condition', 'pressure', 'wind_speed', 'wind_gust_speed', 'wind_bearing',
'cloud_coverage', 'precipitation', 'precipitation_total', 'uv_index', 'visibility', 'snow', 'fog', 'lightning'];
private const REF_GROUPS = ['climate', 'hvac', 'utility_meters', 'electricity', 'water', 'gas', 'heating', 'cooling',
'values', 'charging', 'hydronic', 'circuits', 'sensors', 'stations', 'pump', 'valve', 'circulation', 'show_when', 'car', 'gates', 'settings', 'presence', 'weather_variables'];
private function refKey(string $key): bool { return in_array($key, self::REF_FIELDS, true) || preg_match('/_(?:entit(?:y\d*|ies)|sensor\d*)$/D', $key) === 1; }
private function entityRefs(array $node): array
{
$ids = [];
foreach ($node as $key => $value) {
if (!is_int($key) && !$this->refKey($key) && !in_array($key, self::REF_GROUPS, true)) continue;
if (is_string($value) && $this->variableIdForEntity($value) !== null) $ids[] = $this->variableIdForEntity($value);
if (is_array($value)) $ids = [...$ids, ...$this->entityRefs($value)];
}
return array_values(array_unique($ids));
}
private function planKey(string $kind, array $floor, string $id): string { return $kind . ':' . rawurlencode((string) $floor['id']) . ':' . rawurlencode($id); }
private function accessCatalog(): array
{
$rooms = []; $devices = [];
foreach ($this->building()['floors'] ?? [] as $floor) {
$prefix = (string) ($floor['name'] ?? 'Etage') . ' / ';
foreach ($floor['rooms'] ?? [] as $room) $rooms[] = ['caption' => $prefix . ($room['name'] ?? $room['id']), 'value' => $this->planKey('room', $floor, (string) $room['id'])];
foreach (['furniture', 'openings', 'placements'] as $group) foreach ($floor[$group] ?? [] as $item) {
$id = (string) ($item['id'] ?? $item['entity_id'] ?? '');
if ($id === '') continue;
$room = $this->itemRoom($floor, $item);
$label = trim((string) ($item['name'] ?? ''));
if ($label === '' && ($native = $this->variableIdForEntity($id)) !== null && IPS_ObjectExists($native)) {
$parts = []; $at = $native; $seen = [];
while ($at > 0 && IPS_ObjectExists($at) && count($parts) < 3 && !isset($seen[$at])) {
$seen[$at] = true; array_unshift($parts, IPS_GetName($at)); $at = (int) IPS_GetObject($at)['ParentID'];
}
$label = implode(' / ', $parts);
}
if ($label === '') $label = str_replace('_', ' ', (string) ($item['type'] ?? 'Gerät'));
$devices[] = ['caption' => $prefix . ($room ? ($room['name'] ?? '') . ' / ' : '') . $label, 'value' => $this->planKey($group, $floor, $id)];
}
}
return ['rooms' => $rooms, 'devices' => $devices];
}
private function insideRoom(float $x, float $z, array $points): bool
{
$inside = false; $count = count($points);
for ($i = 0, $j = $count - 1; $i < $count; $j = $i++) {
[$xi, $zi] = $points[$i]; [$xj, $zj] = $points[$j];
if (($zi > $z) !== ($zj > $z) && $x < ($xj - $xi) * ($z - $zi) / ($zj - $zi) + $xi) $inside = !$inside;
}
return $inside;
}
private function itemRoom(array $floor, array $item): ?array
{
foreach ($floor['rooms'] ?? [] as $room) {
if (isset($item['room_id']) ? $item['room_id'] === $room['id'] : (isset($item['x'], $item['z']) && $this->insideRoom((float) $item['x'], (float) $item['z'], $room['points'] ?? []))) return $room;
}
return null;
}
private function grantMap(array $grants): array
{
$map = [];
foreach ($grants as $g) if (in_array($g['access'] ?? '', ['view', 'control'], true)) $map[(string) $g['target']] = $g['access'];
return $map;
}
private function isAdministrator(): bool { return ($this->requestUser['role'] ?? '') === 'admin'; }
private function scope(?array $tree = null): array
{
if ($this->requestScope !== null) return $this->requestScope;
if ($this->requestUser === null) throw new NextFloorDenied('authentication_required');
$user = $this->requestUser;
$all = $this->isAdministrator();
$scope = ['view_all' => $all || ($user['view_all'] ?? false) || ($user['control_all'] ?? false), 'control_all' => $all || ($user['control_all'] ?? false),
'read' => [], 'write' => [], 'native_read' => [], 'entities' => [], 'rooms' => $this->grantMap($user['rooms'] ?? []), 'devices' => $this->grantMap($user['devices'] ?? [])];
if ($all) return $this->requestScope = $scope;
$tree ??= $this->objectTree();
$parents = []; $native = [];
foreach ($tree['objects'] as $o) $parents[(int) $o['object_id']] = (int) $o['parent_id'];
foreach ($tree['variables'] as $v) {
$native[(int) $v['attributes']['symcon_id']] = true;
$scope['entities'][(int) $v['attributes']['symcon_id']] = $v['entity_id'];
}
$descendantCache = [];
$descendants = static function (int $root) use ($native, $parents, &$descendantCache): array {
if (isset($descendantCache[$root])) return $descendantCache[$root];
$ids = [];
foreach ($native as $id => $_) {
$at = $id; $seen = [];
while ($at > 0 && !isset($seen[$at])) {
if ($at === $root) { $ids[] = $id; break; }
$seen[$at] = true; $at = $parents[$at] ?? 0;
}
}
return $descendantCache[$root] = $ids;
};
$allow = static function (array $ids, string $level, bool $explicit = false) use (&$scope, $native): void {
foreach ($ids as $id) if (isset($native[$id])) {
$scope['read'][$id] = true;
if ($level === 'control') $scope['write'][$id] = true;
if ($explicit) $scope['native_read'][$id] = true;
}
};
foreach ($user['objects'] ?? [] as $g) {
$target = (int) $g['target']; $seen = [];
while (IPS_ObjectExists($target) && (int) IPS_GetObject($target)['ObjectType'] === 6 && !isset($seen[$target])) {
$seen[$target] = true; $target = (int) IPS_GetLink($target)['TargetID'];
}
$allow($descendants($target), $g['access'], true);
}
foreach ($this->building()['floors'] ?? [] as $floor) {
foreach ($floor['rooms'] ?? [] as $room) {
$key = $this->planKey('room', $floor, (string) $room['id']);
$own = $scope['rooms'][$key] ?? null;
$level = $scope['control_all'] || $own === 'control' ? 'control' : ($scope['view_all'] ? 'view' : $own);
if ($level === null) continue;
$scope['rooms'][$key] = $level;
$allow($this->entityRefs($room), $level);
foreach ([$room['area_id'] ?? '', ...($room['sub_areas'] ?? [])] as $area) if (preg_match('/^symcon-category-(\d+)$/D', (string) $area, $m) === 1) $allow($descendants((int) $m[1]), $level);
}
foreach (['furniture', 'openings', 'placements'] as $group) foreach ($floor[$group] ?? [] as $item) {
$id = (string) ($item['id'] ?? $item['entity_id'] ?? '');
$own = $scope['devices'][$this->planKey($group, $floor, $id)] ?? null;
$room = $this->itemRoom($floor, $item);
$inherited = $room ? ($scope['rooms'][$this->planKey('room', $floor, (string) $room['id'])] ?? null) : null;
$level = $scope['control_all'] || $own === 'control' || $inherited === 'control' ? 'control' : ($own ?? $inherited ?? ($scope['view_all'] ? 'view' : null));
if ($level !== null) { $scope['devices'][$this->planKey($group, $floor, $id)] = $level; $allow($this->entityRefs($item), $level); }
}
if ($scope['view_all']) {
$allow($this->entityRefs($floor), $scope['control_all'] ? 'control' : 'view');
foreach ($floor['outdoor'] ?? [] as $area) $allow($this->entityRefs($area), $scope['control_all'] ? 'control' : 'view');
}
}
if ($scope['view_all']) $allow($this->entityRefs($this->building()), $scope['control_all'] ? 'control' : 'view');
return $this->requestScope = $scope;
}
private function allowedEntity(string $entity, bool $write): bool
{
$id = $this->variableIdForEntity($entity);
if ($id === null) return false;
$s = $this->scope();
return $this->isAdministrator() || ($write ? isset($s['write'][$id]) : isset($s['read'][$id]));
}
/** Authorize every target before the first write: mixed bulk commands cannot partially execute. */
private function authorizeApi(string $action, array $request): void
{
if ($this->requestUser === null) throw new NextFloorDenied('authentication_required');
$read = ['bootstrap', 'variables/snapshot', 'archive/trend', 'building/get', 'image/get', 'packs/list', 'transport/read', 'transport/release'];
if (!$this->isAdministrator() && !in_array($action, [...$read, 'variables/action'], true)) throw new NextFloorDenied('admin_required');
if ($action === 'archive/trend' && (!is_string($request['entity_id'] ?? null) || !$this->allowedEntity($request['entity_id'], false))) throw new NextFloorDenied('read_forbidden');
if ($action === 'variables/action') {
$targets = $request['data']['entity_id'] ?? [];
$targets = is_array($targets) ? $targets : [$targets];
if (!$targets || count($targets) > 256) throw new NextFloorDenied('invalid_targets');
foreach ($targets as $target) {
if (!is_string($target) || !$this->allowedEntity($target, true)) throw new NextFloorDenied('control_forbidden');
$id = $this->variableIdForEntity($target);
if (!$this->isAdministrator() && IPS_VariableExists($id)) {
$v = IPS_GetVariable($id); $actionID = (int) ($v['VariableCustomAction'] ?: $v['VariableAction']);
if ($actionID <= 0) throw new NextFloorDenied('variable_readonly');
}
}
}
if ($action === 'image/get' && !$this->isAdministrator()) {
$id = is_string($request['image_id'] ?? null) ? $request['image_id'] : '';
$images = [];
$visible = $this->visibleBuilding();
array_walk_recursive($visible, static function (mixed $value, mixed $key) use (&$images): void {
if (!is_string($value)) return;
if ($key === 'image_id') $images[] = $value;
elseif (is_string($key) && preg_match('/^(?:picture|image|url|.*_image)$/D', $key) && str_starts_with($value, 'image:')) $images[] = substr($value, 6);
});
if ($id === '' || !in_array($id, $images, true)) throw new NextFloorDenied('image_forbidden');
}
}
private function visibleTree(array $tree): array
{
if ($this->isAdministrator()) return $tree;
$scope = $this->scope($tree);
$variables = [];
foreach ($tree['variables'] as $v) {
$id = (int) $v['attributes']['symcon_id'];
if (!isset($scope['read'][$id])) continue;
$can = isset($scope['write'][$id]) && (($v['attributes']['symcon_schedule'] ?? false) || ($v['attributes']['symcon_has_action'] ?? false));
$v['attributes']['symcon_can_control'] = $can;
if (!$can) $v['attributes']['symcon_has_action'] = false;
$variables[] = $v;
}
$areaIDs = array_fill_keys(array_filter(array_column($variables, 'area_id'), 'is_string'), true);
$areas = array_filter($tree['areas'], static fn(array $a): bool => isset($areaIDs[$a['area_id']]));
// Utility discovery also needs topology (e.g. Büro / Strom / Leistung). Keep only permitted
// variable nodes and their ancestors; never expose unrelated branches or variable values.
$nodes = [];
foreach ($tree['objects'] as $node) $nodes[(int) $node['object_id']] = $node;
$keep = [];
foreach ($variables as $v) {
$at = (int) $v['attributes']['symcon_id'];
while ($at > 0 && isset($nodes[$at]) && !isset($keep[$at])) {
$keep[$at] = true; $at = (int) $nodes[$at]['parent_id'];
}
}
$objects = array_values(array_filter($tree['objects'], static fn(array $node): bool => isset($keep[(int) $node['object_id']])));
return ['variables' => $variables, 'areas' => array_values($areas), 'objects' => $objects];
}
private function maskRefs(array $node, array $allow): array
{
foreach ($node as $key => $v) {
// Strip unknown/legacy binding fields too. Geometry identifiers and captions are not live bindings.
if (in_array($key, ['id', 'name', 'type', 'label', 'icon', 'room_id', 'area_id', 'parent_meter', 'buffer_id'], true)) continue;
if (is_string($v) && ($id = $this->variableIdForEntity($v)) !== null && !isset($allow[$id])) $node[$key] = 'none';
elseif (is_array($v)) $node[$key] = $this->maskRefs($v, $allow);
}
return $node;
}
private function visibleBuilding(): array
{
$building = $this->building();
if ($this->isAdministrator()) return $building;
$s = $this->scope();
// Admin-owned executable UI configuration is never part of a user view.
$building['settings']['plugins'] = []; $building['settings']['buttons'] = [];
foreach (['custom_buttons', 'media_presets', 'announce_phrases'] as $key) unset($building['settings'][$key]);
foreach ($building['floors'] as &$floor) {
$panels = [];
foreach (['furniture', 'openings', 'placements'] as $group) foreach ($floor[$group] ?? [] as $i => $item) {
$id = (string) ($item['id'] ?? $item['entity_id'] ?? '');
$granted = $s['view_all'] || isset($s['devices'][$this->planKey($group, $floor, $id)]);
$filtered = $granted ? $item : $this->maskRefs($item, $s['native_read']);
unset($filtered['tap']);
if (!$granted) {
unset($filtered['show_when'], $filtered['pictures'], $filtered['screen_pictures'], $filtered['picture']);
if (empty($item['entity'])) $filtered['entity'] = 'none';
if (!$this->entityRefs($filtered)) { $filtered['power_card'] = false; $filtered['hydronic']['card'] = false; }
}
$floor[$group][$i] = $filtered;
$room = $this->itemRoom($floor, $item);
if ($room) foreach ($this->entityRefs($filtered) as $native) $panels[$room['id']][$native] = true;
}
foreach ($floor['rooms'] as &$room) {
$key = $this->planKey('room', $floor, (string) $room['id']);
if ($s['view_all'] || isset($s['rooms'][$key])) continue;
$room = $this->maskRefs($room, []);
$room['area_id'] = null; $room['sub_areas'] = []; $room['climate_card'] = false;
$room['symcon_read_room'] = false;
$room['climate'] = ['temperature' => 'none', 'humidity' => 'none', 'co2' => 'none', 'illuminance' => 'none'];
$room['hvac'] = null; $room['utility_meters'] = null; $room['moods'] = []; $room['floor_heating'] = 'none';
$room['panel'] = array_values(array_filter(array_map(static fn(int $id): ?string => $s['entities'][$id] ?? null, array_keys($panels[$room['id']] ?? []))));
}
unset($room);
if (!$s['view_all']) { $floor['power_entity'] = 'none'; $floor['utility_meters'] = null; }
foreach ($floor['outdoor'] ?? [] as $i => $area) if (!$s['view_all']) {
$floor['outdoor'][$i] = $this->maskRefs($area, $s['native_read']); $floor['outdoor'][$i]['area_id'] = null;
}
}
unset($floor);
if (!$s['view_all']) {
$building['presence'] = []; $building['energy'] = []; $building['settings']['weather_variables'] = [];
foreach ($building['settings'] as $key => $value) if (is_string($value) && $this->variableIdForEntity($value) !== null) $building['settings'][$key] = 'none';
}
return $building;
}
}
+159
View File
@@ -0,0 +1,159 @@
<?php
declare(strict_types=1);
/** Native Symcon 9.0 configuration. Password fields are actions, never persistent module properties. */
trait NextFloorUsers
{
public function GetConfigurationForm(): string
{
$form = json_decode((string) file_get_contents(__DIR__ . '/../form.json'), true, 512, JSON_THROW_ON_ERROR);
$id = $this->ReadAttributeString('SelectedAccount');
$account = $this->accounts()[$id] ?? [];
$catalog = $this->accessCatalog();
$level = ['type' => 'Select', 'options' => [['caption' => 'Nur ansehen', 'value' => 'view'], ['caption' => 'Ansehen und bedienen', 'value' => 'control']]];
$grants = static function (string $name, string $caption, array $options, array $values) use ($level): array {
foreach ($values as $v) if (!in_array($v['target'], array_column($options, 'value'), true)) $options[] = ['caption' => '(Nicht mehr im Plan) ' . $v['target'], 'value' => $v['target']];
return ['type' => 'List', 'name' => $name, 'caption' => $caption, 'rowCount' => 5, 'add' => true, 'delete' => true, 'values' => $values,
'columns' => [['name' => 'target', 'caption' => 'Freigabe', 'width' => 'auto', 'add' => '', 'edit' => ['type' => 'Select', 'options' => [['caption' => 'Bitte auswählen', 'value' => ''], ...$options]]],
['name' => 'access', 'caption' => 'Recht', 'width' => '190px', 'add' => 'view', 'edit' => $level]]];
};
$userForm = ['type' => 'ExpansionPanel', 'caption' => 'Benutzer und Zugriffsrechte', 'expanded' => true, 'items' => [
['type' => 'ValidationTextBox', 'caption' => 'Direkter Zugang (an die Symcon-Adresse anhängen)', 'value' => '/hook/' . $this->hookPath() . '/', 'enabled' => false],
['type' => 'Button', 'caption' => 'Anmeldeseite öffnen', 'link' => true, 'onClick' => 'echo NFSC_OpenLogin($id);'],
['type' => 'Select', 'name' => 'AccountSelect', 'caption' => 'Benutzer auswählen', 'value' => $id, 'options' => $this->accountOptions(), 'onChange' => 'NFSC_SelectAccessUser($id, $AccountSelect);'],
['type' => 'ValidationTextBox', 'name' => 'AccountName', 'caption' => 'Benutzername', 'value' => $account['name'] ?? ''],
['type' => 'CheckBox', 'name' => 'AccountEnabled', 'caption' => 'Zugang aktiv', 'value' => $account['enabled'] ?? true],
['type' => 'Select', 'name' => 'AccountRole', 'caption' => 'Rolle', 'value' => $account['role'] ?? 'user', 'options' => [['caption' => 'Benutzer · Ansicht und freigegebene Bedienung', 'value' => 'user'], ['caption' => 'Admin · vollständiger Zugriff und Editor', 'value' => 'admin']]],
['type' => 'CheckBox', 'name' => 'AccountViewAll', 'caption' => 'Alle Zustände ansehen', 'value' => $account['view_all'] ?? false],
['type' => 'CheckBox', 'name' => 'AccountControlAll', 'caption' => 'Alles ansehen und bedienen', 'value' => $account['control_all'] ?? false],
$grants('AccountRooms', 'Einzelne Räume', $catalog['rooms'], $account['rooms'] ?? []),
$grants('AccountDevices', 'Einzelne Geräte im Plan', $catalog['devices'], $account['devices'] ?? []),
['type' => 'List', 'name' => 'AccountObjects', 'caption' => 'Weitere Symcon-Geräte / Datenpunkte (optional)', 'rowCount' => 4, 'add' => true, 'delete' => true, 'values' => $account['objects'] ?? [],
'columns' => [['name' => 'target', 'caption' => 'Objekt aus dem Objektbaum', 'width' => 'auto', 'add' => 0, 'edit' => ['type' => 'SelectObject']],
['name' => 'access', 'caption' => 'Recht', 'width' => '190px', 'add' => 'view', 'edit' => $level]]],
['type' => 'PasswordTextBox', 'name' => 'AccountPassword', 'caption' => 'Neues Passwort (leer = bestehendes behalten)', 'value' => ''],
['type' => 'Button', 'caption' => 'Benutzer speichern', 'onClick' => 'echo NFSC_SaveAccessUser($id, $AccountSelect, $AccountName, $AccountRole, $AccountEnabled, $AccountViewAll, $AccountControlAll, json_encode($AccountRooms), json_encode($AccountDevices), json_encode($AccountObjects), $AccountPassword);'],
['type' => 'Button', 'name' => 'AccountReset', 'caption' => 'Passwort zurücksetzen', 'enabled' => $id !== '', 'onClick' => 'echo NFSC_ResetUserPassword($id, $AccountSelect, $AccountPassword);'],
['type' => 'Button', 'name' => 'AccountRevoke', 'caption' => 'Benutzer abmelden', 'enabled' => $id !== '', 'onClick' => 'echo NFSC_RevokeUserSessions($id, $AccountSelect);'],
['type' => 'Button', 'name' => 'AccountDelete', 'caption' => 'Benutzer löschen', 'enabled' => $id !== '', 'confirm' => 'Diesen NextFloor-Benutzer einschließlich seiner Zugänge löschen?', 'onClick' => 'echo NFSC_DeleteAccessUser($id, $AccountSelect);'],
['type' => 'PopupButton', 'caption' => 'ⓘ Rechte und Passwörter', 'popup' => ['caption' => 'Zugriffsrechte', 'items' => [
['type' => 'Label', 'caption' => 'Admins dürfen den Editor und alle Geräte verwenden. Die Benutzerverwaltung bleibt ausschließlich in der Symcon-Konfiguration.'],
['type' => 'Label', 'caption' => 'Alle Zustände ansehen ohne weitere Bedienfreigabe ist ein Zugang nur zum Lesen. Einzelne Raum- und Gerätefreigaben ergänzen diese Grundrechte. Ohne Freigabe bleibt das Gebäude sichtbar, seine Zustände werden nicht übertragen.'],
['type' => 'Label', 'caption' => 'Eine Raumfreigabe umfasst seine verknüpften Werte, Geräte im Raum und die zugeordneten Bereichskategorien. Gerätefreigaben gelten für deren verknüpfte Datenpunkte. Bei automatischen Gerätezuordnungen die benötigten Symcon-Objekte zusätzlich auswählen oder feste Verknüpfungen im Editor setzen.'],
['type' => 'Label', 'caption' => 'Passwörter: 8–72 Bytes. Leer beim Speichern erhält das bisherige Passwort. Änderungen an Konto oder Rechten beenden bestehende Anmeldungen dieses Benutzers. Die Konsole kann jederzeit Passwörter zurücksetzen.'],
]]],
]];
$form['actions'][] = $userForm;
return json_encode($form, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR);
}
public function OpenLogin(): string { $this->requireWebHook(); return 'link:/hook/' . $this->hookPath() . '/login'; }
private function accountOptions(): array
{
$options = [['caption' => '+ Neuen Benutzer anlegen', 'value' => '']];
foreach ($this->accounts() as $id => $a) $options[] = ['caption' => $a['name'] . ($a['enabled'] ? '' : ' (gesperrt)'), 'value' => $id];
return $options;
}
public function SelectAccessUser(string $UserID): void
{
$a = $this->accounts()[$UserID] ?? [];
if (!$a) $UserID = '';
$this->WriteAttributeString('SelectedAccount', $UserID);
$this->UpdateFormField('AccountSelect', 'options', json_encode($this->accountOptions()));
foreach (['AccountSelect' => $UserID, 'AccountName' => $a['name'] ?? '', 'AccountEnabled' => $a['enabled'] ?? true,
'AccountRole' => $a['role'] ?? 'user', 'AccountViewAll' => $a['view_all'] ?? false, 'AccountControlAll' => $a['control_all'] ?? false, 'AccountPassword' => ''] as $name => $value) $this->UpdateFormField($name, 'value', $value);
foreach (['AccountRooms' => 'rooms', 'AccountDevices' => 'devices', 'AccountObjects' => 'objects'] as $name => $key) $this->UpdateFormField($name, 'values', json_encode($a[$key] ?? []));
foreach (['AccountReset', 'AccountRevoke', 'AccountDelete'] as $name) $this->UpdateFormField($name, 'enabled', $UserID !== '');
}
private function passwordHash(string $password): string
{
if (strlen($password) < 8 || strlen($password) > 72 || str_contains($password, "\0")) throw new InvalidArgumentException('Das Passwort muss 8–72 Bytes lang sein.');
return password_hash($password, defined('PASSWORD_ARGON2ID') ? PASSWORD_ARGON2ID : PASSWORD_DEFAULT);
}
private function parseGrants(string $json, bool $objects = false): array
{
$rows = json_decode($json, true);
if (!is_array($rows) || !array_is_list($rows) || count($rows) > 256) throw new InvalidArgumentException('Ungültige Freigabeliste.');
$result = [];
foreach ($rows as $row) {
if (!is_array($row)) throw new InvalidArgumentException('Ungültige Freigabe.');
$target = $objects ? (int) ($row['target'] ?? 0) : (string) ($row['target'] ?? '');
if ($target === '' || $target === 0) continue;
if (!in_array($row['access'] ?? '', ['view', 'control'], true)) throw new InvalidArgumentException('Bitte für jede Freigabe ein Recht auswählen.');
if ($objects && (!IPS_ObjectExists($target) || !in_array((int) IPS_GetObject($target)['ObjectType'], [0, 1, 2, 4, 6], true))) throw new InvalidArgumentException('Das freigegebene Objekt existiert nicht oder ist kein Gerät, Datenpunkt, Ereignis oder Bereich.');
$key = (string) $target;
$level = $row['access'] === 'control' || ($result[$key]['access'] ?? '') === 'control' ? 'control' : 'view';
$result[$key] = ['target' => $target, 'access' => $level];
}
return array_values($result);
}
public function SaveAccessUser(string $UserID, string $Name, string $Role, bool $Enabled, bool $ViewAll, bool $ControlAll, string $Rooms, string $Devices, string $Objects, string $Password): string
{
try {
$Name = trim($Name);
if (preg_match('/^[\p{L}\p{N}][\p{L}\p{N}_.@ -]{1,63}$/uD', $Name) !== 1) throw new InvalidArgumentException('Benutzername: 2–64 Buchstaben, Zahlen, Leerzeichen oder . _ @ -');
if (!in_array($Role, ['admin', 'user'], true)) throw new InvalidArgumentException('Ungültige Rolle.');
$rooms = $this->parseGrants($Rooms); $devices = $this->parseGrants($Devices); $objects = $this->parseGrants($Objects, true);
$hash = $Password === '' ? null : $this->passwordHash($Password);
$id = $this->accessLock(function () use ($UserID, $Name, $Role, $Enabled, $ViewAll, $ControlAll, $rooms, $devices, $objects, $hash): string {
$accounts = $this->accounts();
if ($UserID !== '' && !isset($accounts[$UserID])) throw new InvalidArgumentException('Benutzer nicht gefunden.');
foreach ($accounts as $id => $a) if ($id !== $UserID && mb_strtolower($a['name']) === mb_strtolower($Name)) throw new InvalidArgumentException('Dieser Benutzername ist bereits vergeben.');
if ($UserID === '' && count($accounts) >= 128) throw new InvalidArgumentException('Maximal 128 Benutzer pro Instanz.');
if ($UserID === '' && $hash === null) throw new InvalidArgumentException('Für neue Benutzer bitte ein Passwort setzen.');
$id = $UserID ?: bin2hex(random_bytes(16));
$accounts[$id] = ['name' => $Name, 'role' => $Role, 'enabled' => $Enabled, 'view_all' => $ViewAll || $ControlAll,
'control_all' => $ControlAll, 'rooms' => $rooms, 'devices' => $devices, 'objects' => $objects,
'password' => $hash ?? $accounts[$id]['password'], 'epoch' => $this->newToken()];
$this->writeJsonAttribute('Accounts', $accounts);
$this->clearUserSessions($id);
return $id;
});
$this->SelectAccessUser($id);
return 'Benutzer gespeichert. Vorherige Anmeldungen dieses Benutzers wurden beendet.';
} catch (InvalidArgumentException $e) { return $e->getMessage(); }
}
private function clearUserSessions(string $id): void
{
$this->writeJsonAttribute('Sessions', array_filter($this->jsonAttribute('Sessions', []), static fn(array $s): bool => $s['account'] !== $id));
}
public function ResetUserPassword(string $UserID, string $Password): string
{
try {
$hash = $this->passwordHash($Password);
$this->accessLock(function () use ($UserID, $hash): void {
$accounts = $this->accounts();
if (!isset($accounts[$UserID])) throw new InvalidArgumentException('Bitte einen bestehenden Benutzer auswählen.');
$accounts[$UserID]['password'] = $hash; $accounts[$UserID]['epoch'] = $this->newToken();
$this->writeJsonAttribute('Accounts', $accounts); $this->clearUserSessions($UserID);
$limits = $this->jsonAttribute('LoginThrottle', []); unset($limits['name:' . hash('sha256', mb_strtolower($accounts[$UserID]['name']))]);
$this->writeJsonAttribute('LoginThrottle', $limits);
});
$this->UpdateFormField('AccountPassword', 'value', '');
return 'Passwort zurückgesetzt. Bestehende Anmeldungen dieses Benutzers sind beendet.';
} catch (InvalidArgumentException $e) { return $e->getMessage(); }
}
public function RevokeUserSessions(string $UserID): string
{
$this->accessLock(fn() => $this->clearUserSessions($UserID));
return 'Bestehende Anmeldungen dieses Benutzers wurden beendet.';
}
public function DeleteAccessUser(string $UserID): string
{
$this->accessLock(function () use ($UserID): void {
$accounts = $this->accounts(); unset($accounts[$UserID]); $this->writeJsonAttribute('Accounts', $accounts); $this->clearUserSessions($UserID);
});
$this->SelectAccessUser('');
return 'Benutzer gelöscht.';
}
}
+1 -1
View File
@@ -7,7 +7,7 @@
"aliases": [ "aliases": [
"NextFloor Designer und 3D-Kachel" "NextFloor Designer und 3D-Kachel"
], ],
"url": "https://git.portal.se-cloud.de/Hannes/NextFloor/src/branch/main/symcon/README.md", "url": "https://git.portal.se-cloud.de/Hannes/NextFloor/src/branch/symcon/README.md",
"parentRequirements": [], "parentRequirements": [],
"childRequirements": [], "childRequirements": [],
"implemented": [], "implemented": [],
+93 -46
View File
@@ -2,15 +2,20 @@
declare(strict_types=1); declare(strict_types=1);
require_once __DIR__ . '/libs/Access.php';
require_once __DIR__ . '/libs/Users.php';
require_once __DIR__ . '/libs/Permissions.php';
/** /**
* NextFloor for IP-Symcon. * NextFloor for IP-Symcon.
* *
* One visualization instance owns a floor-plan project. Its protected WebHook serves the designer as * One visualization instance owns a floor-plan project. Its protected WebHook serves the designer as
* a console tab and the same viewer in an HTML-SDK tile iframe. The frontend receives every variable * a console tab and the same viewer in an HTML-SDK tile iframe. Admins receive the native object tree;
* in the object tree with a friendly path; it never asks an end user to type an object id. * user sessions receive only authorized live bindings. Object selections always use named choices.
*/ */
class NextFloor extends IPSModuleStrict class NextFloor extends IPSModuleStrict
{ {
use NextFloorAccess, NextFloorUsers, NextFloorPermissions;
private const MAX_BUILDING_BYTES = 8_000_000; private const MAX_BUILDING_BYTES = 8_000_000;
private const MAX_IMAGE_BYTES = 8_000_000; private const MAX_IMAGE_BYTES = 8_000_000;
private const MAX_HISTORY = 20; private const MAX_HISTORY = 20;
@@ -31,6 +36,12 @@ class NextFloor extends IPSModuleStrict
$this->RegisterAttributeString('Packs', '[]'); $this->RegisterAttributeString('Packs', '[]');
$this->RegisterAttributeString('History', '[]'); $this->RegisterAttributeString('History', '[]');
$this->RegisterAttributeString('AccessToken', ''); $this->RegisterAttributeString('AccessToken', '');
$this->RegisterAttributeString('Accounts', '{}');
$this->RegisterAttributeString('Sessions', '{}');
$this->RegisterAttributeString('ConsoleTickets', '{}');
$this->RegisterAttributeString('LoginThrottle', '{}');
$this->RegisterAttributeString('LoginDummyHash', '');
$this->RegisterAttributeString('SelectedAccount', '');
$this->RegisterAttributeString('StateHash', ''); $this->RegisterAttributeString('StateHash', '');
$this->RegisterAttributeString('HookError', ''); $this->RegisterAttributeString('HookError', '');
$this->RegisterAttributeInteger('BuildingRevision', 0); $this->RegisterAttributeInteger('BuildingRevision', 0);
@@ -40,6 +51,7 @@ class NextFloor extends IPSModuleStrict
$this->RegisterTimer('WebHookRetry', 0, 'NFSC_RetryWebHook($_IPS[\'TARGET\']);'); $this->RegisterTimer('WebHookRetry', 0, 'NFSC_RetryWebHook($_IPS[\'TARGET\']);');
$this->ensureAccessToken(); $this->ensureAccessToken();
if ($this->ReadAttributeString('LoginDummyHash') === '') $this->WriteAttributeString('LoginDummyHash', $this->passwordHash($this->newToken()));
$this->SetVisualizationType(1); $this->SetVisualizationType(1);
$this->ensureWebHook(true); $this->ensureWebHook(true);
} }
@@ -84,11 +96,13 @@ class NextFloor extends IPSModuleStrict
return 'link:' . $this->designerUrl('designer'); return 'link:' . $this->designerUrl('designer');
} }
/** Invalidates links from copied browser history and returns a fresh designer URL. */ /** Revoke all logins and outstanding console tickets, then issue a fresh one-use designer link. */
public function RotateAccessToken(): string public function RotateAccessToken(): string
{ {
$this->requireWebHook(); $this->requireWebHook();
$this->WriteAttributeString('AccessToken', $this->newToken()); $this->WriteAttributeString('AccessToken', $this->newToken());
$this->WriteAttributeString('Sessions', '{}');
$this->WriteAttributeString('ConsoleTickets', '{}');
return 'link:' . $this->designerUrl('designer'); return 'link:' . $this->designerUrl('designer');
} }
@@ -108,24 +122,52 @@ class NextFloor extends IPSModuleStrict
/** IP-Symcon calls this for /hook/nextfloor/<instance id>/... */ /** IP-Symcon calls this for /hook/nextfloor/<instance id>/... */
protected function ProcessHookData(): void protected function ProcessHookData(): void
{ {
$this->requestUser = null;
$this->requestScope = null;
// Keep a same-origin Origin on native form POSTs; no-referrer can turn it into "null".
header('Referrer-Policy: same-origin');
header('X-Content-Type-Options: nosniff');
header('X-Frame-Options: SAMEORIGIN');
header("Content-Security-Policy: frame-ancestors 'self'; object-src 'none'; base-uri 'none'");
$requestPath = (string) ($_SERVER['REQUEST_URI'] ?? ''); $requestPath = (string) ($_SERVER['REQUEST_URI'] ?? '');
if ($requestPath === '') { if ($requestPath === '') {
$requestPath = (string) ($_SERVER['SCRIPT_NAME'] ?? ''); $requestPath = (string) ($_SERVER['SCRIPT_NAME'] ?? '');
} }
$path = (string) (parse_url($requestPath, PHP_URL_PATH) ?? ''); $path = (string) (parse_url($requestPath, PHP_URL_PATH) ?? '');
$prefix = '/hook/' . $this->hookPath(); $prefix = '/hook/' . $this->hookPath();
if (!str_starts_with($path, $prefix)) { if ($path !== $prefix && !str_starts_with($path, $prefix . '/')) {
$this->sendError(404, 'not_found'); $this->sendError(404, 'not_found');
return; return;
} }
if (!$this->hasValidToken()) {
$this->sendError(403, 'forbidden');
return;
}
$tail = trim(substr($path, strlen($prefix)), '/'); $tail = trim(substr($path, strlen($prefix)), '/');
try { try {
$method = (string) ($_SERVER['REQUEST_METHOD'] ?? 'GET');
$this->requestUser = $this->resolveSession();
if ($tail === 'login') {
if ($method === 'POST') $this->passwordLogin();
elseif ($method !== 'GET') $this->sendError(405, 'method_not_allowed');
elseif ($this->requestUser !== null) $this->accessRedirect($this->entryUrl());
else $this->loginPage();
return;
}
if (($tail === 'designer' || $tail === '') && $method === 'GET' && isset($_GET['ticket'])) {
// Always exchange and remove a ticket, even if another user was already logged in.
if (is_string($_GET['ticket']) && $this->exchangeConsoleTicket($_GET['ticket'])) $this->accessRedirect($this->entryUrl());
else $this->loginPage('Der Konsolen-Link ist abgelaufen oder wurde schon verwendet. Bitte erneut in der Konsole öffnen.', 401);
return;
}
if ($this->requestUser === null) {
if ($tail === '' || $tail === 'designer') $this->accessRedirect($this->entryUrl('login'));
else $this->sendError(401, 'authentication_required');
return;
}
if ($tail === 'logout') {
if ($method !== 'POST' || !$this->validCsrf()) $this->sendError(403, 'csrf_invalid');
else $this->logoutSession();
return;
}
if ($tail === '' || $tail === 'designer') { if ($tail === '' || $tail === 'designer') {
if ($method !== 'GET') { $this->sendError(405, 'method_not_allowed'); return; }
$this->sendDesignerPage(); $this->sendDesignerPage();
return; return;
} }
@@ -134,6 +176,8 @@ class NextFloor extends IPSModuleStrict
return; return;
} }
if (str_starts_with($tail, 'assets/')) { if (str_starts_with($tail, 'assets/')) {
if ($method !== 'GET') { $this->sendError(405, 'method_not_allowed'); return; }
if (!$this->isAdministrator() && preg_match('#^assets/nextfloor-(?:editor|card-editor)\.js$#D', $tail)) { $this->sendError(403, 'admin_required'); return; }
$this->sendAsset(substr($tail, strlen('assets/'))); $this->sendAsset(substr($tail, strlen('assets/')));
return; return;
} }
@@ -216,7 +260,7 @@ class NextFloor extends IPSModuleStrict
private function designerUrl(string $mode): string private function designerUrl(string $mode): string
{ {
return '/hook/' . $this->hookPath() . '/designer?mode=' . rawurlencode($mode) . '&token=' . rawurlencode($this->ensureAccessToken()); return $mode === 'tile' ? '/hook/' . $this->hookPath() . '/designer?mode=tile' : $this->consoleUrl();
} }
private function ensureAccessToken(): string private function ensureAccessToken(): string
@@ -234,46 +278,21 @@ class NextFloor extends IPSModuleStrict
return bin2hex(random_bytes(32)); return bin2hex(random_bytes(32));
} }
private function hasValidToken(): bool
{
// The first HTML request carries the random URL token. It also sets an HttpOnly cookie
// below, so lazy ES-module imports (which cannot inherit a query string) stay protected.
$provided = (string) ($_GET['token'] ?? $_COOKIE[$this->cookieName()] ?? '');
return $provided !== '' && hash_equals($this->ensureAccessToken(), $provided);
}
private function cookieName(): string
{
return 'NFSC_' . $this->InstanceID;
}
private function setAccessCookie(): void
{
setcookie($this->cookieName(), $this->ensureAccessToken(), [
'expires' => 0,
'path' => '/hook/' . $this->hookPath() . '/',
'secure' => (($_SERVER['HTTPS'] ?? '') !== '' && ($_SERVER['HTTPS'] ?? '') !== 'off'),
'httponly' => true,
'samesite' => 'Strict'
]);
}
private function sendDesignerPage(): void private function sendDesignerPage(): void
{ {
$this->setAccessCookie();
$config = [ $config = [
'endpoint' => '/hook/' . $this->hookPath(), 'endpoint' => '/hook/' . $this->hookPath(),
'token' => $this->ensureAccessToken(), 'csrf' => $this->requestUser['csrf'],
'user' => $this->publicAccess(),
'language' => 'de', 'language' => 'de',
'title' => $this->viewTitle() 'title' => $this->viewTitle()
]; ];
$asset = '/hook/' . $this->hookPath() . '/assets/nextfloor-designer.js?v=' . rawurlencode($this->moduleVersion()) $asset = '/hook/' . $this->hookPath() . '/assets/nextfloor-designer.js?v=' . rawurlencode($this->moduleVersion());
. '&token=' . rawurlencode($this->ensureAccessToken());
header('Content-Type: text/html; charset=utf-8'); header('Content-Type: text/html; charset=utf-8');
header('Cache-Control: no-store'); header('Cache-Control: no-store');
echo '<!doctype html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">' echo '<!doctype html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">'
. '<title>' . htmlspecialchars($config['title'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . '</title>' . '<title>' . htmlspecialchars($config['title'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . '</title>'
. '<style>html,body{width:100%;height:100%;margin:0;background:#111;color:#e1e1e1}body>nextfloor-panel,body>nextfloor-card{display:block;width:100%;height:100%}</style>' . '<style>html,body{width:100%;height:100%;margin:0;background:#111;color:#e1e1e1}body{display:flex;flex-direction:column}body>nextfloor-panel,body>nextfloor-card{display:block;flex:1;min-height:0;width:100%}.nf-session-bar{display:flex;align-items:center;gap:10px;padding:5px 12px;font:12px/1.4 system-ui;background:#20252d;border-bottom:1px solid #ffffff15}.nf-session-bar span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nf-session-bar form{margin:0 0 0 auto;flex-shrink:0}.nf-session-bar button{font:inherit;padding:5px 12px;border:1px solid #ffffff25;border-radius:7px;background:#ffffff0a;color:inherit;cursor:pointer}</style>'
. '</head><body><p style="padding:1rem;font-family:system-ui">NextFloor wird geladen …</p>' . '</head><body><p style="padding:1rem;font-family:system-ui">NextFloor wird geladen …</p>'
. '<script>window.__NEXTFLOOR_SYMCON__=' . json_encode($config, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) . ';</script>' . '<script>window.__NEXTFLOOR_SYMCON__=' . json_encode($config, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) . ';</script>'
. '<script type="module" src="' . htmlspecialchars($asset, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . '"></script></body></html>'; . '<script type="module" src="' . htmlspecialchars($asset, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . '"></script></body></html>';
@@ -304,18 +323,23 @@ class NextFloor extends IPSModuleStrict
$this->sendError(405, 'method_not_allowed'); $this->sendError(405, 'method_not_allowed');
return; return;
} }
$request = json_decode((string) file_get_contents('php://input'), true); if (!$this->validCsrf()) { $this->sendError(403, 'csrf_invalid'); return; }
$limit = $this->isAdministrator() ? self::MAX_TRANSFER_BYTES : 65536;
$raw = (string) file_get_contents('php://input', false, null, 0, $limit + 1);
if (strlen($raw) > $limit) { $this->sendError(413, 'request_too_large'); return; }
$request = json_decode($raw, true);
if (!is_array($request) || !is_string($request['action'] ?? null)) { if (!is_array($request) || !is_string($request['action'] ?? null)) {
$this->sendError(400, 'invalid_request'); $this->sendError(400, 'invalid_request');
return; return;
} }
try { try {
$this->authorizeApi($request['action'], $request);
$result = match ($request['action']) { $result = match ($request['action']) {
'bootstrap' => $this->bootstrap(), 'bootstrap' => $this->bootstrap(),
'variables/snapshot' => $this->variablesSnapshot((int) ($request['revision'] ?? -1)), 'variables/snapshot' => $this->variablesSnapshot((int) ($request['revision'] ?? -1)),
'archive/trend' => $this->archiveTrend($request), 'archive/trend' => $this->archiveTrend($request),
'building/get' => ['building' => $this->building(), 'revision' => $this->ReadAttributeInteger('BuildingRevision'), 'version' => $this->moduleVersion()], 'building/get' => ['building' => $this->visibleBuilding(), 'revision' => $this->ReadAttributeInteger('BuildingRevision'), 'version' => $this->moduleVersion()],
'building/save' => ['revision' => $this->saveBuilding($this->arrayValue($request, 'building'))], 'building/save' => ['revision' => $this->saveBuilding($this->arrayValue($request, 'building'))],
'image/get' => $this->imageGet((string) ($request['image_id'] ?? '')), 'image/get' => $this->imageGet((string) ($request['image_id'] ?? '')),
'image/set' => $this->imageSet((string) ($request['image_id'] ?? ''), (string) ($request['data'] ?? '')), 'image/set' => $this->imageSet((string) ($request['image_id'] ?? ''), (string) ($request['data'] ?? '')),
@@ -336,6 +360,8 @@ class NextFloor extends IPSModuleStrict
default => throw new RuntimeException('unknown_action') default => throw new RuntimeException('unknown_action')
}; };
$this->sendApiResult($result, ($request['transport'] ?? '') === 'nextfloor-chunks-v1'); $this->sendApiResult($result, ($request['transport'] ?? '') === 'nextfloor-chunks-v1');
} catch (NextFloorDenied $error) {
$this->sendError(403, $error->getMessage());
} catch (InvalidArgumentException $error) { } catch (InvalidArgumentException $error) {
$this->sendError(400, $error->getMessage()); $this->sendError(400, $error->getMessage());
} catch (RuntimeException $error) { } catch (RuntimeException $error) {
@@ -345,9 +371,10 @@ class NextFloor extends IPSModuleStrict
private function bootstrap(): array private function bootstrap(): array
{ {
$objects = $this->objectTree(); $objects = $this->visibleTree($this->objectTree());
$stateRevision = $this->stateRevision($objects); $stateRevision = $this->stateRevision($objects);
return [ return [
'access' => $this->publicAccess(),
'state_revision' => $stateRevision, 'state_revision' => $stateRevision,
'building_revision' => $this->ReadAttributeInteger('BuildingRevision'), 'building_revision' => $this->ReadAttributeInteger('BuildingRevision'),
'variables' => $objects['variables'], 'variables' => $objects['variables'],
@@ -358,7 +385,7 @@ class NextFloor extends IPSModuleStrict
private function variablesSnapshot(int $knownRevision): array private function variablesSnapshot(int $knownRevision): array
{ {
$objects = $this->objectTree(); $objects = $this->visibleTree($this->objectTree());
$stateRevision = $this->stateRevision($objects); $stateRevision = $this->stateRevision($objects);
$result = [ $result = [
'state_revision' => $stateRevision, 'state_revision' => $stateRevision,
@@ -487,7 +514,7 @@ class NextFloor extends IPSModuleStrict
'symcon_path' => $path, 'symcon_path' => $path,
'symcon_profile' => $profile, 'symcon_profile' => $profile,
'symcon_variable_type' => (int) $variable['VariableType'], 'symcon_variable_type' => (int) $variable['VariableType'],
'symcon_has_action' => ((int) ($variable['VariableCustomAction'] ?: $variable['VariableAction'])) !== 0, 'symcon_has_action' => ((int) ($variable['VariableCustomAction'] ?: $variable['VariableAction'])) > 0,
'symcon_formatted' => GetValueFormatted($variableID), 'symcon_formatted' => GetValueFormatted($variableID),
'symcon_value' => $value, 'symcon_value' => $value,
'device_class' => $this->deviceClassFor($profile, $name, $unit) 'device_class' => $this->deviceClassFor($profile, $name, $unit)
@@ -648,6 +675,8 @@ class NextFloor extends IPSModuleStrict
private function stateRevision(array $objects): int private function stateRevision(array $objects): int
{ {
$hash = hash('sha256', $this->encodeResponse($objects)); $hash = hash('sha256', $this->encodeResponse($objects));
// Distinct user scopes must not invalidate one global revision on every alternating poll.
if ($this->requestUser !== null && !$this->isAdministrator()) return (int) hexdec(substr($hash, 0, 12));
if (!hash_equals($this->ReadAttributeString('StateHash'), $hash)) { if (!hash_equals($this->ReadAttributeString('StateHash'), $hash)) {
$this->WriteAttributeString('StateHash', $hash); $this->WriteAttributeString('StateHash', $hash);
$this->WriteAttributeInteger('StateRevision', $this->ReadAttributeInteger('StateRevision') + 1); $this->WriteAttributeInteger('StateRevision', $this->ReadAttributeInteger('StateRevision') + 1);
@@ -1129,6 +1158,7 @@ class NextFloor extends IPSModuleStrict
if (preg_match('/^[a-f0-9]{32}\.json$/D', basename($file)) !== 1 || is_link($file)) continue; if (preg_match('/^[a-f0-9]{32}\.json$/D', basename($file)) !== 1 || is_link($file)) continue;
if ((int) filemtime($file) < time() - self::TRANSFER_TTL) { if ((int) filemtime($file) < time() - self::TRANSFER_TTL) {
unlink($file); unlink($file);
if (is_file($file . '.owner') && !is_link($file . '.owner')) unlink($file . '.owner');
} else { } else {
$active++; $active++;
} }
@@ -1152,15 +1182,32 @@ class NextFloor extends IPSModuleStrict
throw $error; throw $error;
} }
fclose($handle); fclose($handle);
if (file_put_contents($file . '.owner', $this->transferOwner(), LOCK_EX) === false) {
unlink($file);
throw new RuntimeException('transfer_storage_unavailable');
}
chmod($file . '.owner', 0600);
return ['id' => $id, 'bytes' => $bytes, 'chunk_bytes' => self::TRANSFER_CHUNK_BYTES, 'chunks' => (int) ceil($bytes / self::TRANSFER_CHUNK_BYTES)]; return ['id' => $id, 'bytes' => $bytes, 'chunk_bytes' => self::TRANSFER_CHUNK_BYTES, 'chunks' => (int) ceil($bytes / self::TRANSFER_CHUNK_BYTES)];
} }
private function transferOwner(): string
{
return hash('sha256', (string) ($this->requestUser['session_id'] ?? 'internal') . ':' . (string) ($this->requestUser['epoch'] ?? ''));
}
private function ownsTransfer(string $file): bool
{
$owner = $file . '.owner';
return is_file($owner) && !is_link($owner) && hash_equals($this->transferOwner(), (string) file_get_contents($owner));
}
private function readTransfer(string $id, int $index): array private function readTransfer(string $id, int $index): array
{ {
$file = $this->transferFile($id); $file = $this->transferFile($id);
if (!is_file($file) || is_link($file)) throw new RuntimeException('transfer_not_found'); if (!is_file($file) || is_link($file) || !$this->ownsTransfer($file)) throw new RuntimeException('transfer_not_found');
if ((int) filemtime($file) < time() - self::TRANSFER_TTL) { if ((int) filemtime($file) < time() - self::TRANSFER_TTL) {
unlink($file); unlink($file);
unlink($file . '.owner');
throw new RuntimeException('transfer_expired: Bitte erneut laden.'); throw new RuntimeException('transfer_expired: Bitte erneut laden.');
} }
$bytes = (int) filesize($file); $bytes = (int) filesize($file);
@@ -1183,7 +1230,7 @@ class NextFloor extends IPSModuleStrict
private function releaseTransfer(string $id): array private function releaseTransfer(string $id): array
{ {
$file = $this->transferFile($id); $file = $this->transferFile($id);
if (is_file($file) && !is_link($file)) unlink($file); if (is_file($file) && !is_link($file) && $this->ownsTransfer($file)) { unlink($file); unlink($file . '.owner'); }
return []; return [];
} }
+72 -1
View File
@@ -16,7 +16,7 @@ In **Kerninstanzen → Modules** wird dieses Repository verwendet:
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen. Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek. `main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
Nach der Aktualisierung auf **0.2.30 / Build 33** die Konsole neu laden. Unter Nach der Aktualisierung auf **0.3.0 / Build 34** die Konsole neu laden. Unter
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**. **Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
### Für die Entwicklung ### Für die Entwicklung
@@ -46,6 +46,77 @@ Die Dateien unter `NextFloor/assets/` und `NextFloor/packs/` werden durch
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur. Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen. Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
## Anmeldung und Benutzerrechte ab 0.3.0
1. In der NextFloor-Instanz **Benutzer und Zugriffsrechte** öffnen.
2. Unter **Benutzer auswählen → Neuen Benutzer anlegen** Namen und Passwort setzen.
3. Rolle und Freigaben auswählen, dann **Benutzer speichern**. Diese Aktionen
werden sofort gespeichert; das Passwortfeld wird danach geleert.
4. **Anmeldeseite öffnen** aufrufen und die Adresse als Lesezeichen verwenden.
Sie ist dauerhaft und enthält kein Zugangs-Token. Die Adresse steht außerdem
im Formular: `/hook/nextfloor/<Instanz-ID>/` an der Symcon-Serveradresse.
Die Konten gehören zur jeweiligen NextFloor-Instanz. Die Benutzerverwaltung
bleibt ausschließlich in der Symcon-Konfiguration. **Designer in der Konsole
öffnen** ermöglicht dem Symcon-Administrator weiterhin den vollständigen Zugang,
auch wenn kein NextFloor-Admin mehr angemeldet ist oder alle Konten gesperrt sind.
Der dabei erzeugte Konsolen-Link gilt 90 Sekunden und kann einmal verwendet werden.
Als Lesezeichen wird stattdessen die dauerhafte Anmeldeseite verwendet.
| Einstellung | Zugriff |
| --- | --- |
| Admin | Komplette Visualisierung, Bedienung und Editor |
| Benutzer ohne Freigaben | Komplettes Gebäude als Geometrie, keine Zustände oder Bedienung |
| Alle Zustände ansehen | Alle Daten dieser Visualisierung, ohne Bedienung |
| Alles ansehen und bedienen | Daten und Bedienung dieser Visualisierung, ohne Editor |
| Raumfreigabe „Nur ansehen“ | Zustände des ausgewählten Raums und seiner Geräte |
| Raumfreigabe „Ansehen und bedienen“ | Zusätzlich Bedienung dieser Geräte |
| Gerätefreigabe | Nur das gewählte Gerät und seine verknüpften Werte, ohne den ganzen Raum freizugeben |
Einzelfreigaben ergänzen die Grundrechte. So kann ein Benutzer alles ansehen,
aber ausschließlich Büro 2 bedienen. „Alle“ bezieht sich auf die Visualisierung;
unverknüpfte Symcon-Variablen werden Benutzern nicht pauschal übertragen.
Ein Raum umfasst seine verknüpften Werte, die Geräte im Raum und die zugeordneten
Bereichskategorien einschließlich Unterkategorien. Freigaben für Geräte im Plan
verwenden deren feste Datenpunkt-Verknüpfungen. Automatisch zugeordnete Geräte
können über **Weitere Symcon-Geräte / Datenpunkte** ergänzt oder im Editor fest
verknüpft werden. Die Auswahl erfolgt aus dem Objektbaum; es müssen keine IDs
eingetippt werden. Eine hier ausgewählte Instanz oder Kategorie umfasst ihre
untergeordneten Datenpunkte. Ein ausgewählter Link gilt für sein Ziel.
Außerhalb freigegebener Räume bleiben die Gebäudegeometrie und Möbel sichtbar;
ihre Live-Verknüpfungen werden entfernt. Einzeln freigegebene Geräte bleiben
im jeweiligen Raum erreichbar, ohne dessen Raumklima freizugeben. Die Prüfung
gilt auch für direkte API-Aufrufe, native Rollen-Aliase, Trends und Datenübertragungen.
Benutzer erhalten weder den kompletten Objektbaum noch Projekt-Historie,
Backups, Uploads oder Editor-Funktionen. Schaltbefehle mit nicht freigegebenen
Zielen werden vor der ersten Aktion abgewiesen. Passive Variablen ohne native
Schaltaktion bleiben für Benutzer schreibgeschützt.
**Passwort zurücksetzen**, Sperren, Löschen und **Benutzer abmelden** funktionieren
in der Konsole. Änderungen an Konto oder Rechten beenden dessen bisherige
Anmeldungen sofort. Passwörter werden gehasht gespeichert. Anmeldungen verwenden
HttpOnly-Cookies und CSRF-Schutz; es gibt keine wiederverwendbaren Admin-Token
im Viewer-Link oder in der Kachel. Der normale Zugang gilt bis zu zwölf Stunden
mit maximal zwei Stunden Inaktivität. **Angemeldet bleiben** gilt bis zu 30 Tage
mit maximal sieben Tagen Inaktivität. Ein Passwort-Reset oder eine Sperre hebt
auch diese Anmeldungen auf. Für den Zugriff über das Internet die HTTPS-Adresse
des Symcon-Servers bzw. des eigenen HTTPS-Proxys verwenden.
Nach dem Update erfordert die Kachel-Visualisierung eine Anmeldung. Vorherige
Links mit `token=...` gelten nicht mehr als Admin-Zugang; der aktualisierte
Konsolen-Knopf und die neue Anmeldeseite bleiben verfügbar. Unsichere lokale
Browser-Entwürfe werden im Symcon-Zugang nicht zwischen Konten gespeichert.
## Änderungen in 0.3.0
- Passwort-Anmeldung und vollständige Benutzerverwaltung mit Raum- und
Gerätefreigaben in der Symcon-Konfiguration (siehe oben).
- **Pflastersteine**, **Trittplatten** und **Natursteinweg** als weitere
Außenflächenarten: strukturierte Pflastersteine, einzelne Gartenplatten mit
grünen Zwischenräumen und unregelmäßige Natursteinplatten. Texturmaßstab und
Drehung sind wie bei den vorhandenen Arten pro Fläche einstellbar.
## Änderungen in 0.2.30 ## Änderungen in 0.2.30
- Jede Außenfläche erhält **Texturmaßstab (%)** und **Texturdrehung (°)** direkt - Jede Außenfläche erhält **Texturmaßstab (%)** und **Texturdrehung (°)** direkt
+2 -2
View File
@@ -6,7 +6,7 @@
"compatibility": { "compatibility": {
"version": "9.0" "version": "9.0"
}, },
"version": "0.2.30", "version": "0.3.0",
"build": 33, "build": 34,
"date": 1794787200 "date": 1794787200
} }
+119
View File
@@ -0,0 +1,119 @@
<?php
declare(strict_types=1);
require __DIR__ . '/support/access-runtime.php';
$module = new AccessFixtureModule(); initializeAccessFixture($module);
$method = static fn(string $name, mixed ...$args): mixed => (new ReflectionMethod($module, $name))->invoke($module, ...$args);
$accounts = $method('accounts');
$as = static function (string $name) use ($module, $accounts): void {
foreach ($accounts as $id => $a) if ($a['name'] === $name) {
(new ReflectionProperty(NextFloor::class, 'requestUser'))->setValue($module, [...$a, 'id' => $id, 'session_id' => 'fixture-' . $name, 'csrf' => 'fixture']);
(new ReflectionProperty(NextFloor::class, 'requestScope'))->setValue($module, null); return;
}
throw new RuntimeException('Unknown fixture account');
};
$denied = static function (callable $call, string $reason): void {
try { $call(); throw new LogicException('Unexpected permission grant: ' . $reason); }
catch (NextFloorDenied $e) { check($e->getMessage() === $reason, 'Expected ' . $reason . ', got ' . $e->getMessage()); }
};
foreach ($accounts as $a) check($a['password'] !== $a['name'] . '-test-password' && password_verify($a['name'] . '-test-password', $a['password']), 'Passwords are hashed');
$form = $module->GetConfigurationForm();
check(!str_contains($form, 'password_hash') && !str_contains($form, '$2y$') && !str_contains($form, '$argon2'), 'Configuration never exposes password hashes');
check(str_contains($form, 'SelectObject') && str_contains($form, 'Büro 2'), 'Rights use actual plan and native object choices');
$as('empty');
check($method('visibleTree', $method('objectTree'))['variables'] === [], 'An empty user sees no values');
$building = $method('visibleBuilding');
check(count($building['floors'][0]['rooms']) === 2 && count($building['floors'][0]['furniture']) === 1, 'All building geometry remains');
check($building['floors'][0]['rooms'][0]['climate_card'] === false && $building['floors'][0]['rooms'][1]['area_id'] === null, 'No live room binding leaks');
$denied(fn() => $method('authorizeApi', 'building/save', ['building' => fixtureBuilding()]), 'admin_required');
$denied(fn() => $method('authorizeApi', 'archive/trend', ['entity_id' => 'sensor.204']), 'read_forbidden');
$as('reader');
$tree = $method('visibleTree', $method('objectTree'));
check(count($tree['variables']) === 9, 'Global readers see every variable and the schedule');
check(!in_array(888, array_column(array_column($tree['variables'], 'attributes'), 'symcon_id'), true), 'All means the visualization, never unrelated Symcon variables');
check(!in_array(888, array_column($tree['objects'], 'object_id'), true), 'Users never receive unrelated native object branches');
foreach ($tree['variables'] as $v) check($v['attributes']['symcon_can_control'] === false, 'Every reader value is marked readonly');
$denied(fn() => $method('authorizeApi', 'variables/action', ['data' => ['entity_id' => 'light.101']]), 'control_forbidden');
$as('office');
$tree = $method('visibleTree', $method('objectTree'));
$ids = array_column(array_column($tree['variables'], 'attributes'), 'symcon_id'); sort($ids);
check($ids === [101, 102, 103, 104, 105], 'Room control exposes its own native category and schedule only; links do not pull in private targets');
$method('authorizeApi', 'variables/action', ['data' => ['entity_id' => 'cover.101']]); // alias uses the same native capability
$denied(fn() => $method('authorizeApi', 'variables/action', ['data' => ['entity_id' => ['light.101', 'light.201']]]), 'control_forbidden');
$denied(fn() => $method('authorizeApi', 'variables/action', ['data' => ['entity_id' => 'sensor.103']]), 'variable_readonly');
$method('authorizeApi', 'archive/trend', ['entity_id' => 'sensor.104']);
$denied(fn() => $method('authorizeApi', 'archive/trend', ['entity_id' => 'sensor.204']), 'read_forbidden');
$building = $method('visibleBuilding');
check($building['floors'][0]['rooms'][1]['climate']['temperature'] === 'none', 'Foreign room climate is removed');
check($building['floors'][0]['placements'][1]['entity_id'] === 'none', 'Foreign placement link is removed even while its geometry stays');
$topology = $method('objectTree');
foreach ($topology['objects'] as &$node) if ($node['object_id'] === 103) $node['parent_id'] = 11;
unset($node);
$topology['objects'][] = ['object_id' => 11, 'parent_id' => 10, 'name' => 'Strom', 'path' => 'Gebäude / Büro 2 / Strom', 'object_type' => 0];
$as('office');
$withTopology = $method('visibleTree', $topology);
check(in_array(11, array_column($withTopology['objects'], 'object_id'), true), 'Utility discovery retains an authorized meter category');
check(!in_array(900, array_column($withTopology['objects'], 'object_id'), true), 'Unrelated instance branches remain private');
$as('device');
$tree = $method('visibleTree', $method('objectTree'));
$ids = array_column(array_column($tree['variables'], 'attributes'), 'symcon_id'); sort($ids);
check($ids === [102, 103], 'Single-device grant does not grant its whole room or native area');
$building = $method('visibleBuilding');
check($building['floors'][0]['rooms'][0]['climate_card'] === false, 'Device grant does not reveal room climate');
check(in_array('switch.102', $building['floors'][0]['rooms'][0]['panel'], true), 'Approved device is still reachable in its room under its actual native entity');
$denied(fn() => $method('authorizeApi', 'variables/action', ['data' => ['entity_id' => 'light.101']]), 'control_forbidden');
// Shared variables and legacy bindings on a different item must not reappear outside the granted room.
$extended = fixtureBuilding();
$extended['floors'][0]['furniture'][] = ['id' => 'private', 'type' => 'wallbox', 'x' => 7, 'z' => 2, 'temp_entity2' => 'sensor.104', 'legacy_binding' => 'sensor.104', 'picture' => 'https://camera.invalid/live'];
$fixture['attributes']['Building'] = json_encode($extended);
$as('office'); $projected = $method('visibleBuilding')['floors'][0]['furniture'][1];
check($projected['temp_entity2'] === 'none' && $projected['legacy_binding'] === 'none' && !isset($projected['picture']), 'Unauthorized items never reuse otherwise approved values or live pictures');
$extended['floors'][0]['furniture'][0]['temp_entity2'] = 'sensor.104';
$fixture['attributes']['Building'] = json_encode($extended);
$as('device');
check($method('allowedEntity', 'sensor.104', false), 'Additional temperature bindings belong to an explicitly granted device');
$fixture['attributes']['Building'] = json_encode(fixtureBuilding());
$as('operator');
$method('authorizeApi', 'variables/action', ['data' => ['entity_id' => 'light.201']]);
$denied(fn() => $method('authorizeApi', 'archive/trend', ['entity_id' => 'sensor.888']), 'read_forbidden');
$denied(fn() => $method('authorizeApi', 'variables/action', ['data' => ['entity_id' => 'sensor.888']]), 'control_forbidden');
$as('native');
$tree = $method('visibleTree', $method('objectTree'));
$ids = array_column(array_column($tree['variables'], 'attributes'), 'symcon_id'); sort($ids);
check($ids === [201, 203], 'An explicit native instance grant follows its descendants, not its whole area');
$as('admin');
$method('authorizeApi', 'building/save', ['building' => fixtureBuilding()]);
check(count($method('visibleTree', $method('objectTree'))['objects']) > 0, 'Admin retains the native editor tree');
check($method('visibleBuilding') === fixtureBuilding(), 'Admin project is unmodified');
ob_start(); $method('sendApiResult', ['payload' => str_repeat('x', 300000)], true); $manifest = json_decode((string) ob_get_clean(), true)['_nextfloor_transfer'];
$as('reader');
try { $method('readTransfer', $manifest['id'], 0); throw new LogicException('Cross-session transport read was accepted'); }
catch (RuntimeException $e) { check($e->getMessage() === 'transfer_not_found', 'Transfer ownership is enforced'); }
$method('releaseTransfer', $manifest['id']);
$as('admin');
check(strlen($method('readTransfer', $manifest['id'], 0)['data']) > 0, 'Another session cannot remove this snapshot');
$method('releaseTransfer', $manifest['id']);
$url = $module->OpenDesigner(); parse_str((string) parse_url(substr($url, 5), PHP_URL_QUERY), $query);
check(isset($query['ticket']) && !isset($query['token']), 'Console links use tickets, never a reusable admin token');
check($method('exchangeConsoleTicket', $query['ticket']), 'Console recovers admin access without an account');
check(!$method('exchangeConsoleTicket', $query['ticket']), 'Console tickets cannot be replayed');
check(!str_contains($module->GetVisualizationTile(), 'ticket=') && !str_contains($module->GetVisualizationTile(), 'token='), 'Tiles never embed admin capabilities');
// A saved rights/enable change and a native delete revoke a previously valid cookie.
$accountID = array_key_first(array_filter($accounts, static fn(array $a): bool => $a['name'] === 'officeview'));
$browserToken = str_repeat('b', 64);
$fixture['attributes']['Sessions'] = json_encode([hash('sha256', $browserToken) => ['account' => $accountID, 'epoch' => $accounts[$accountID]['epoch'], 'csrf' => 'test', 'seen' => time(), 'expires' => time() + 3600]]);
$_COOKIE['NFSC_Session_12345'] = $browserToken;
check($method('resolveSession') !== null, 'Cookie starts valid');
$module->SaveAccessUser($accountID, 'officeview', 'user', false, false, false, '[]', '[]', '[]', '');
check($method('resolveSession') === null, 'Disabling or editing rights revokes the old cookie');
$module->DeleteAccessUser($accountID);
check(!isset($method('accounts')[$accountID]) && $method('resolveSession') === null, 'Deletion removes the account and its access');
echo "OK: hashed accounts, console recovery, one-use tickets, admin/reader/room/device scopes, alias-resistant access, private state and geometry separation, bulk preauthorization, archive guards and native readonly variables\n";
+18
View File
@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
if (!getenv('NEXTFLOOR_TEST_STATE')) { echo "Local authentication browser-test fixture; NEXTFLOOR_TEST_STATE required.\n"; exit; }
require __DIR__ . '/support/access-runtime.php';
$module = new AccessFixtureModule(); initializeAccessFixture($module);
$path = parse_url((string) $_SERVER['REQUEST_URI'], PHP_URL_PATH);
if ($path === '/__test/console') { header('Content-Type: application/json'); echo json_encode(['url' => substr($module->OpenDesigner(), 5)]); return; }
if ($path === '/__test/state') {
header('Content-Type: application/json');
echo json_encode(['writes' => $fixture['writes'], 'accounts' => array_map(static fn(array $a): array => ['name' => $a['name'], 'enabled' => $a['enabled']], json_decode($fixture['attributes']['Accounts'], true))]); return;
}
if ($path === '/__test/reset' && $_SERVER['REQUEST_METHOD'] === 'POST') {
$data = json_decode((string) file_get_contents('php://input'), true);
$accounts = json_decode($fixture['attributes']['Accounts'], true);
foreach ($accounts as $id => $a) if ($a['name'] === ($data['name'] ?? '')) { echo $module->ResetUserPassword($id, (string) ($data['password'] ?? '')); return; }
}
$module->hook();
+105
View File
@@ -0,0 +1,105 @@
<?php
declare(strict_types=1);
// Deliberately small local Symcon fixture. No connection to a user's actual kernel or variables.
const KR_READY = 10103;
const IPS_KERNELSTARTED = 10001;
const KL_ERROR = 10205;
$fixtureFile = getenv('NEXTFLOOR_TEST_STATE') ?: '';
$fixture = $fixtureFile !== '' && is_file($fixtureFile) ? json_decode((string) file_get_contents($fixtureFile), true) : [];
$fixture += ['attributes' => [], 'properties' => [], 'writes' => [], 'initialized' => false];
function persistFixture(): void { global $fixture, $fixtureFile; if ($fixtureFile !== '') file_put_contents($fixtureFile, json_encode($fixture, JSON_THROW_ON_ERROR), LOCK_EX); }
function check(bool $condition, string $message): void { if (!$condition) throw new RuntimeException($message); }
class IPSModuleStrict
{
protected int $InstanceID;
public array $fields = [];
public function __construct(int $id = 12345) { $this->InstanceID = $id; }
public function Create(): void {}
public function ApplyChanges(): void {}
public function MessageSink(int $t, int $s, int $m, array $d): void {}
protected function RegisterPropertyString(string $name, string $value): void { global $fixture; $fixture['properties'][$name] ??= $value; persistFixture(); }
protected function RegisterAttributeString(string $name, string $value): void { global $fixture; $fixture['attributes'][$name] ??= $value; persistFixture(); }
protected function RegisterAttributeInteger(string $name, int $value): void { global $fixture; $fixture['attributes'][$name] ??= $value; persistFixture(); }
protected function ReadAttributeString(string $name): string { global $fixture; return (string) ($fixture['attributes'][$name] ?? ''); }
protected function ReadAttributeInteger(string $name): int { global $fixture; return (int) ($fixture['attributes'][$name] ?? 0); }
protected function WriteAttributeString(string $name, string $value): void { global $fixture; $fixture['attributes'][$name] = $value; persistFixture(); }
protected function WriteAttributeInteger(string $name, int $value): void { global $fixture; $fixture['attributes'][$name] = $value; persistFixture(); }
protected function ReadPropertyString(string $name): string { global $fixture; return (string) ($fixture['properties'][$name] ?? ''); }
protected function RegisterMessage(int $sender, int $message): void {}
protected function RegisterTimer(string $name, int $interval, string $script): void {}
protected function SetTimerInterval(string $name, int $interval): void {}
protected function SetVisualizationType(int $type): void {}
protected function SetStatus(int $status): void {}
protected function LogMessage(string $message, int $type): void { throw new RuntimeException('Unexpected module log: ' . $message); }
protected function RegisterHook(string $path): bool { return true; }
protected function UpdateFormField(string $name, string $key, mixed $value): void { $this->fields[$name][$key] = $value; }
protected function UpdateVisualizationValue(string $value): void {}
}
function IPS_GetKernelRunlevel(): int { return KR_READY; }
function IPS_GetInstanceListByModuleID(string $module): array { return $module === '{43192F0B-135B-4CE7-A0A7-1475603F3060}' ? [700] : []; }
function fixtureObjects(): array
{
return [1 => [0, 0, 'Gebäude'], 10 => [1, 0, 'Büro 2'], 20 => [1, 0, 'Büro 3'], 900 => [20, 1, 'Privates Gerät'],
101 => [10, 2, 'Licht'], 102 => [10, 2, 'Wallbox schalten'], 103 => [10, 2, 'Wallbox Leistung'], 104 => [10, 2, 'Raumtemperatur'],
105 => [10, 4, 'Schaltuhr'], 201 => [900, 2, 'Licht privat'], 203 => [900, 2, 'Leistung privat'], 204 => [20, 2, 'Temperatur privat'],
999 => [1, 2, 'Gesamtleistung'], 888 => [1, 2, 'Nicht mit NextFloor verknüpftes Geheimnis'], 109 => [10, 6, 'Link auf privaten Datenpunkt']];
}
function IPS_ObjectExists(int $id): bool { return isset(fixtureObjects()[$id]); }
function IPS_VariableExists(int $id): bool { return (fixtureObjects()[$id][1] ?? -1) === 2; }
function IPS_EventExists(int $id): bool { return $id === 105; }
function IPS_GetName(int $id): string { return fixtureObjects()[$id][2]; }
function IPS_GetObject(int $id): array { $o = fixtureObjects()[$id]; return ['ParentID' => $o[0], 'ObjectType' => $o[1], 'ObjectPosition' => $id, 'ObjectIsHidden' => false, 'ObjectIcon' => '']; }
function IPS_GetChildrenIDs(int $id): array { return array_keys(array_filter(fixtureObjects(), static fn(array $o): bool => $o[0] === $id)); }
function IPS_GetLink(int $id): array { return ['TargetID' => 201]; }
function IPS_GetInstance(int $id): array { return ['ModuleInfo' => ['ModuleType' => 3, 'ModuleID' => '{00000000-0000-0000-0000-000000000001}']]; }
function IPS_GetVariable(int $id): array { return ['VariableType' => in_array($id, [101, 102, 201], true) ? 0 : 2, 'VariableCustomAction' => 0, 'VariableAction' => in_array($id, [101, 102, 201], true) ? 1 : 0, 'VariableCustomProfile' => '', 'VariableProfile' => '']; }
function IPS_GetVariablePresentation(int $id): array { return ['SUFFIX' => in_array($id, [104, 204], true) ? '°C' : (in_array($id, [103, 203, 999], true) ? 'W' : ''), 'MIN' => 0, 'MAX' => 100]; }
function IPS_VariableProfileExists(string $name): bool { return false; }
function GetValue(int $id): mixed { global $fixture; return $fixture['values'][$id] ?? match ($id) { 101, 102 => true, 201 => false, 104 => 22.3, 204 => 26.7, 103 => 7400.0, 203 => 531.0, default => 7931.0 }; }
function GetValueFormatted(int $id): string { $v = GetValue($id); return is_bool($v) ? ($v ? 'An' : 'Aus') : (string) $v; }
function RequestAction(int $id, mixed $value): void { global $fixture; $fixture['writes'][] = [$id, $value]; $fixture['values'][$id] = $value; persistFixture(); }
function SetValue(int $id, mixed $value): void { RequestAction($id, $value); }
function IPS_GetEvent(int $id): array { global $fixture; return ['EventType' => 2, 'EventActive' => $fixture['values'][105] ?? true, 'ScheduleActions' => [], 'ScheduleGroups' => []]; }
function IPS_SetEventActive(int $id, bool $active): bool { RequestAction($id, $active); return true; }
function AC_GetAggregationVariables(int $id, bool $all): array { return array_map(static fn(int $v): array => ['VariableID' => $v, 'AggregationActive' => true, 'AggregationType' => 0], [104, 204]); }
function AC_GetLoggedValues(int $a, int $id, int $start, int $end, int $limit): array { return $start === 0 ? [] : [['TimeStamp' => $start, 'Value' => GetValue($id), 'Duration' => 60], ['TimeStamp' => $end, 'Value' => GetValue($id), 'Duration' => 0]]; }
function AC_GetAggregatedValues(int $a, int $id, int $level, int $start, int $end, int $limit): array { return []; }
require_once __DIR__ . '/../../NextFloor/module.php';
class AccessFixtureModule extends NextFloor { public function hook(): void { $this->ProcessHookData(); } }
function fixtureBuilding(): array
{
$room = static fn(string $id, string $name, int $x, int $category, string $temperature): array => ['id' => $id, 'name' => $name, 'area_id' => 'symcon-category-' . $category, 'points' => [[$x, 0], [$x + 4, 0], [$x + 4, 3], [$x, 3]], 'floor_material' => 'wood', 'climate_card' => true, 'climate' => ['temperature' => $temperature]];
return ['version' => 1, 'settings' => ['grid' => 0.1, 'north' => 0, 'wall_exterior' => 0.24, 'wall_interior' => 0.12, 'roof' => ['type' => 'none'], 'plugins' => []],
'energy' => ['consumption' => 'sensor.999'], 'presence' => [], 'floors' => [['id' => 'eg', 'name' => 'Erdgeschoss', 'elevation' => 0, 'height' => 2.7, 'cut_height' => 1.2,
'rooms' => [$room('office2', 'Büro 2', 0, 10, 'sensor.104'), $room('office3', 'Büro 3', 5, 20, 'sensor.204')],
'openings' => [], 'walls' => [], 'outdoor' => [], 'background' => null,
'placements' => [['entity_id' => 'light.101', 'x' => 2, 'z' => 1, 'y' => null], ['entity_id' => 'light.201', 'x' => 7, 'z' => 1, 'y' => null]],
'furniture' => [['id' => 'wallbox', 'type' => 'wallbox', 'name' => 'Wallbox Büro 2', 'x' => 3, 'z' => 2, 'w' => 0.3, 'd' => 0.3, 'h' => 0.4, 'rotation' => 0, 'entity' => 'light.102', 'power' => 'sensor.103', 'power_card' => true]]]]];
}
function initializeAccessFixture(AccessFixtureModule $module): void
{
global $fixture;
$module->Create();
if ($fixture['initialized']) return;
$fixture['properties']['Title'] = 'Bürogebäude';
$fixture['attributes']['Building'] = json_encode(fixtureBuilding(), JSON_THROW_ON_ERROR);
$fixture['attributes']['BuildingRevision'] = 1;
$make = static function (string $name, string $role, bool $viewAll, bool $controlAll, array $rooms = [], array $devices = [], array $objects = []) use ($module): void {
$result = $module->SaveAccessUser('', $name, $role, true, $viewAll, $controlAll, json_encode($rooms), json_encode($devices), json_encode($objects), $name . '-test-password');
check(str_starts_with($result, 'Benutzer gespeichert'), $result);
};
$make('admin', 'admin', true, true);
$make('reader', 'user', true, false);
$make('office', 'user', false, false, [['target' => 'room:eg:office2', 'access' => 'control']]);
$make('officeview', 'user', false, false, [['target' => 'room:eg:office2', 'access' => 'view']]);
$make('device', 'user', false, false, [], [['target' => 'furniture:eg:wallbox', 'access' => 'control']]);
$make('empty', 'user', false, false);
$make('operator', 'user', true, true);
$make('native', 'user', false, false, [], [], [['target' => 900, 'access' => 'view']]);
$fixture['initialized'] = true; persistFixture();
}
+3
View File
@@ -56,6 +56,9 @@ export function validateSymconPackage(root = fileURLToPath(new URL("../", import
ids.add(module.id); ids.add(module.id);
assert.equal(entry.name, module.name.replaceAll(" ", ""), "Module directory must match its PHP class name"); assert.equal(entry.name, module.name.replaceAll(" ", ""), "Module directory must match its PHP class name");
const php = readFileSync(join(directory, "module.php"), "utf8"); const php = readFileSync(join(directory, "module.php"), "utf8");
for (const helper of ["Access.php", "Users.php", "Permissions.php"]) {
assert.ok(readFileSync(join(directory, "libs", helper)).length > 0, `Missing server access helper: ${helper}`);
}
assert.match(php, new RegExp(`class\\s+${entry.name}\\s+extends\\s+IPSModuleStrict\\b`), "Module PHP class is missing or mismatched"); assert.match(php, new RegExp(`class\\s+${entry.name}\\s+extends\\s+IPSModuleStrict\\b`), "Module PHP class is missing or mismatched");
const form = readJson(join(directory, "form.json")); const form = readJson(join(directory, "form.json"));
assert.ok(Array.isArray(form.elements) && Array.isArray(form.actions), "Module form must contain elements and actions"); assert.ok(Array.isArray(form.elements) && Array.isArray(form.actions), "Module form must contain elements and actions");
+7 -2
View File
@@ -144,7 +144,10 @@ $earlyFailure->RetryWebHook();
check(isset($nativeHooks['/hook/nextfloor/34567']) && $earlyFailure->status === 102, 'Unavailable early WebHook Control must recover automatically'); check(isset($nativeHooks['/hook/nextfloor/34567']) && $earlyFailure->status === 102, 'Unavailable early WebHook Control must recover automatically');
// Verify that returned URLs reach the real dispatcher, including Symcon's SCRIPT_NAME fallback. // Verify that returned URLs reach the real dispatcher, including Symcon's SCRIPT_NAME fallback.
parse_str((string) parse_url(substr($link, 5), PHP_URL_QUERY), $_GET); $_GET = [];
$browserToken = str_repeat('a', 64);
$_COOKIE = ['NFSC_Session_12345' => $browserToken];
$module->attributes['Sessions'] = json_encode([hash('sha256', $browserToken) => ['account' => '__console__', 'epoch' => $token, 'csrf' => 'fixture', 'expires' => time() + 3600, 'seen' => time()]]);
$_SERVER['REQUEST_URI'] = $hook . '/designer'; $_SERVER['REQUEST_URI'] = $hook . '/designer';
$process = new ReflectionMethod($module, 'ProcessHookData'); $process = new ReflectionMethod($module, 'ProcessHookData');
ob_start(); ob_start();
@@ -163,9 +166,11 @@ $process->invoke($module);
$fallback = ob_get_clean(); $fallback = ob_get_clean();
check(str_contains($fallback, 'window.__NEXTFLOOR_SYMCON__='), 'Dispatcher must accept SCRIPT_NAME when REQUEST_URI is absent'); check(str_contains($fallback, 'window.__NEXTFLOOR_SYMCON__='), 'Dispatcher must accept SCRIPT_NAME when REQUEST_URI is absent');
$_GET['token'] = 'wrong-token'; $_GET['token'] = 'wrong-token';
$_COOKIE = [];
$_SERVER['SCRIPT_NAME'] = $hook . '/api';
ob_start(); ob_start();
$process->invoke($module); $process->invoke($module);
$unauthorized = ob_get_clean(); $unauthorized = ob_get_clean();
check(http_response_code() === 403 && str_contains($unauthorized, 'forbidden'), 'Recovery must not bypass hook authentication'); check(http_response_code() === 401 && str_contains($unauthorized, 'authentication_required'), 'Recovery and legacy URL tokens must not bypass session authentication');
echo "OK: early registration, startup/update and delayed reset recovery, ongoing maintenance, titles, data preservation, routing and authentication\n"; echo "OK: early registration, startup/update and delayed reset recovery, ongoing maintenance, titles, data preservation, routing and authentication\n";