+ `,se=1e3;function oe(t){return t&&Array.isArray(t.spaces)?t.spaces.map(t=>{const e=se/t.aspect;return{id:t.id,title:t.title,vb:[t.view_box[0]*se,t.view_box[1]*e,t.view_box[2]*se,t.view_box[3]*e],bg:t.plan_url?{href:t.plan_url,x:0,y:0,w:se,h:e}:null,rooms:(t.rooms||[]).map(t=>({id:t.id,name:t.name,area:t.area??null,x:null!=t.x?t.x*se:void 0,y:null!=t.y?t.y*e:void 0,w:null!=t.w?t.w*se:void 0,h:null!=t.h?t.h*e:void 0,poly:t.poly?t.poly.map(t=>[t[0]*se,t[1]*e]):void 0}))}}):[]}function ae(t){if(t.poly&&t.poly.length){const e=t.poly.map(t=>t[0]),i=t.poly.map(t=>t[1]),s=Math.min(...e),o=Math.min(...i);return{x:s,y:o,w:Math.max(...e)-s,h:Math.max(...i)-o}}return{x:t.x??0,y:t.y??0,w:t.w??0,h:t.h??0}}function re(t){if(t.poly){const e=t.poly.length;return[t.poly.reduce((t,e)=>t+e[0],0)/e,t.poly.reduce((t,e)=>t+e[1],0)/e]}return[t.x+t.w/2,t.y+.1*Math.min(t.w,t.h)]}function ne(t){const e=oe(t.cfg),i=e.find(e=>e.id===t.spaceId);if(!i)return null;const s=i.vb,o=It(t.cfg.spaces.find(e=>e.id===t.spaceId)),a=t.iconSize??2.5,r=a>8?2.5:a,n={};for(const e of t.cfg.spaces||[])for(const t of e.rooms||[])t.area&&(n[t.area]=e.id);const l=t.cfg.settings?.exclude_integrations?new Set(t.cfg.settings.exclude_integrations):ht,c=pt(t.cfg.settings?.icon_rules?.length?t.cfg.settings.icon_rules:dt),h=Kt({hass:t.hass,areaToSpace:n,markers:t.cfg.markers||[],settings:t.cfg.settings||{},excluded:l,showAll:!!t.cfg.settings?.show_all,firstSpaceId:e[0]?.id||"",loc:e=>te(t.lang,e),iconRules:c}),d=h.filter(e=>e.space===t.spaceId),p=function(t,e,i){const s={},o=i/100*se*1.3;for(const i of e.rooms){if(!i.area)continue;const e=t.filter(t=>t.area===i.area);if(!e.length)continue;const a=ae(i),r=.1*Math.min(a.w,a.h),n=a.w-2*r,l=a.h-2*r,c=Math.max(1,Math.round(Math.sqrt(e.length*n/Math.max(l,1)))),h=n/c,d=l/Math.max(Math.ceil(e.length/c),1),p=e.map((t,e)=>({x:a.x+r+h*(e%c+.5),y:a.y+r+d*(Math.floor(e/c)+.5)}));Pt(p,a,o,.5*r),e.forEach((t,e)=>s[t.id]=p[e])}return s}(d,i,r),u=i.rooms.filter(t=>t.area||o.showBorders).map(e=>{let s="room "+(i.bg?"overlay":"yard"),a="";if(o.showBorders||"none"!==o.fill){s+=" styled";const i=[`--room-stroke:${o.color}`,`--room-stroke-op:${o.showBorders?o.opacity:0}`],r=e.area?qt(o.fill,"lqi"===o.fill?function(t,e,i){const s=[];for(const o of e){if(o.area!==i||o.virtual)continue;const e=Ft(t,o.entities);null!=e&&s.push(e)}return Dt(s)}(t.hass,d,e.area):null,"light"===o.fill?Yt(t.hass,d,e.area):"none","temp"===o.fill?Jt(t.hass,d,e.area):null,o.tempMin,o.tempMax):null;r?(s+=" filled",i.push(`--room-fill:${r}`,`--room-fill-op:${(.3*o.opacity).toFixed(3)}`)):i.push("--room-fill:transparent","--room-fill-op:0"),a=i.join(";")}const r=!i.bg&&!o.showNames,n=re(e),l=e.poly?B`
`:B`
`;return B`${l}${r?B`
${e.name}`:V}`}),_=d.map(e=>{const o=function(t,e,i,s,o){const a=e[t.id];if(a&&a.s===t.space){const e=i.spaces.find(e=>e.id===t.space)?.aspect||1;return{x:a.x*se,y:a.y*(se/e)}}if(s[t.id])return s[t.id];const r=o.vb;return{x:r[0]+r[2]/2,y:r[1]+r[3]/2}}(e,t.layout,t.cfg,p,i),a=(o.x-s[0])/s[2]*100,r=(o.y-s[1])/s[3]*100;return j`
-
`}),m=a.showNames?i.rooms.filter(t=>t.name).map(e=>{const o=function(t,e,i,s){const a=i["rl_"+(t.id||"")];if(a&&a.s===e){const t=s.spaces.find(t=>t.id===e)?.aspect||1;return{x:a.x*Yt,y:a.y*(Yt/t)}}const o=Gt(t);return{x:o[0],y:o[1]}}(e,i.id,t.layout,t.cfg),r=(o.x-s[0])/s[2]*100,n=(o.y-s[1])/s[3]*100,l=Math.min(1,a.opacity+.25);return j`
${e.name}
`}):[];return j`
+
`}),m=o.showNames?i.rooms.filter(t=>t.name).map(e=>{const a=function(t,e,i,s){const o=i["rl_"+(t.id||"")];if(o&&o.s===e){const t=s.spaces.find(t=>t.id===e)?.aspect||1;return{x:o.x*se,y:o.y*(se/t)}}const a=re(t);return{x:a[0],y:a[1]}}(e,i.id,t.layout,t.cfg),r=(a.x-s[0])/s[2]*100,n=(a.y-s[1])/s[3]*100,l=Math.min(1,o.opacity+.25);return j`