mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
Полные бенчмарки производительности / Бенчмарки рендера и геометрии (blend) (push) Waiting to run
Полные бенчмарки производительности / Бенчмарки рендера и геометрии (interaction) (push) Waiting to run
Полные бенчмарки производительности / Бенчмарки рендера и геометрии (isometric) (push) Waiting to run
Полные бенчмарки производительности / Бенчмарки рендера и геометрии (isometric-stage3) (push) Waiting to run
Полные бенчмарки производительности / Бенчмарки рендера и геометрии (large-house) (push) Waiting to run
Полные бенчмарки производительности / Бенчмарки рендера и геометрии (overlay) (push) Waiting to run
Полные бенчмарки производительности / Бенчмарки рендера и геометрии (plan-snap) (push) Waiting to run
Полные бенчмарки производительности / Бенчмарки рендера и геометрии (space-default) (push) Waiting to run
Полные бенчмарки производительности / Бенчмарки рендера и геометрии (space-glow) (push) Waiting to run
Проверка (CI) / Предполёт: документация, провенанс, процесс (push) Canceled after 0s
Проверка (CI) / Классификация изменённых файлов (push) Canceled after 0s
Проверка (CI) / Переиспользование: это дерево уже проверено (push) Canceled after 0s
Проверка (CI) / HACS: валидация репозитория (push) Canceled after 0s
Проверка (CI) / Hassfest: манифест интеграции (push) Canceled after 0s
Проверка (CI) / Мутанты по диффу (1/6): затронутые свидетели краснеют (push) Canceled after 0s
Проверка (CI) / Мутанты по диффу (2/6): затронутые свидетели краснеют (push) Canceled after 0s
Проверка (CI) / Мутанты по диффу (3/6): затронутые свидетели краснеют (push) Canceled after 0s
Проверка (CI) / Мутанты по диффу (4/6): затронутые свидетели краснеют (push) Canceled after 0s
Проверка (CI) / Мутанты по диффу (5/6): затронутые свидетели краснеют (push) Canceled after 0s
Проверка (CI) / Мутанты по диффу (6/6): затронутые свидетели краснеют (push) Canceled after 0s
Проверка (CI) / Фронтенд: типы, юниты, мутанты, синхрон бандла (push) Canceled after 0s
Проверка (CI) / Бандл головы dev для стенда (push) Canceled after 0s
Проверка (CI) / Смоки в браузере (шард 1 из 3) (push) Canceled after 0s
Проверка (CI) / Смоки в браузере (шард 2 из 3) (push) Canceled after 0s
Проверка (CI) / Смоки в браузере (шард 3 из 3) (push) Canceled after 0s
Проверка (CI) / Смоки: все шарды зелёные (push) Canceled after 0s
Проверка (CI) / Golden-кадры против принятых эталонов (push) Canceled after 0s
Проверка (CI) / Перф-смок: бюджет времени кадра (push) Canceled after 0s
Проверка (CI) / Геометрия: TS/Python parity исполнена (push) Canceled after 0s
Проверка (CI) / Бэкенд: pytest в Home Assistant (push) Canceled after 0s
Проверка (CI) / Доказательство выполненных проверок (push) Canceled after 0s
Issue: #616 Issue: #649 Issue: #651 Issue: #654 Issue: #660 Issue: #663 Issue: #676 Issue: #683 Issue: #688 Issue: #691 User-Visible: yes Release: v1.78.0
70 lines
52 KiB
JavaScript
70 lines
52 KiB
JavaScript
globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="a7aa4b718d3f5657591f9cf866d227c415e1f5f46fbc0b11ddce80a6845cf34e";import{d$ as e,e0 as t,e1 as n,e2 as o,e3 as i,c9 as a,A as r,aw as s,aR as l,e4 as c,e5 as f,bP as d,e6 as u,e7 as h,e8 as p,aB as m,e9 as g,ea as w,eb as y,ec as M,ed as b,b1 as x,ee as v,Y as S,cE as $,cD as k,ef as z,Z as P,N as I,eg as C,dq as j,eh as O,ei as T,ej as B,ek as H,el as N,em as F}from"./houseplan-card-BYwTiVnu.js";const A=Object.freeze({base:408/218.8,min:215/218.8,max:910/218.8}),R=14/218.8,V=Object.freeze({inset:4/218.8,width:4/218.8,reach:.85}),G=Object.freeze({width:16/218.8,blur:5/218.8,opacity:.6}),L=Object.freeze([[0,"#ffe9b4",.62],[.3,"#fff0cb",.38],[.65,"#fff6e0",.12],[1,"#fff8e8",0]]),D=Object.freeze([[0,"#e2b95e",.46],[.3,"#e9c97e",.3],[.65,"#f0dcaa",.1],[1,"#f4e6c4",0]]),W=Object.freeze([[0,"#ecc46a",.8],[.55,"#f1d48f",.35],[1,"#f7e6bf",0]]);function E(e,t){try{const n=e=>[[...e.map(e=>[e[0],e[1]]),[e[0][0],e[0][1]]]];return l(n(e),n(t)).map(e=>e[0]).filter(e=>Array.isArray(e)&&e.length>=4).map(e=>e.slice(0,-1).map(e=>[e[0],e[1]]))}catch{return[]}}function q(r){if(!(r.elevation>0&&r.wallHeight>0))return[];const s=e(r.azimuth,r.northDeg),l=[-s[0],-s[1]],c=function(e,t){const n=Math.min(90,Math.max(0,e)),o=A.base*(.55+1.4*Math.pow(1-n/90,1.6));return t*Math.min(A.max,Math.max(A.min,o))}(r.elevation,r.wallHeight),f=[];for(const e of r.windows){if(!(e.length>0))continue;const d=t(e,r.rooms);if(!d||!n(d.normal,s,r.elevation))continue;const u=r.rooms.find(e=>e.id===d.roomId);if(!u)continue;const h=r.innerByRoom?.[d.roomId]||u.poly,p=[-d.normal[0],-d.normal[1]],m=l[0]*p[0]+l[1]*p[1];if(!(m>0))continue;const g=e.angle*Math.PI/180,w=Math.cos(g)*e.length/2,y=Math.sin(g)*e.length/2,M=Math.max(0,r.wallDepthByOpening?.[e.id]||0)/2,b=e.x+p[0]*M,x=e.y+p[1]*M,v=[b-w,x-y],S=[b+w,x+y],$=c/m,k=[l[0]*$,l[1]*$];let z=E([v,S,[S[0]+k[0],S[1]+k[1]],[v[0]+k[0],v[1]+k[1]]],h);if(z.length&&r.occluders?.length){const e=o(r.occluders,l,$);z=z.flatMap(t=>i(a(t,e)))}z.length&&f.push({openingId:e.id,roomId:d.roomId,lightFloor:!!r.lightFloorRooms?.has(d.roomId),a:v,b:S,shift:k,normal:p,depth:c,clip:h,polys:z})}return f}const _=e=>e.map(e=>`${e[0]},${e[1]}`).join(" "),U=e=>e.map(([e,t,n])=>s`<stop
|
|
offset="${e}" stop-color="${t}" stop-opacity="${n}"></stop>`);function Z(e,t,n,o){if(!e.length)return r;const i=R*t,a=G.blur*t,l=V.inset*t;return s`<defs>
|
|
<filter id="hp-iso-sun-blur" x="-50%" y="-50%" width="200%" height="200%" color-interpolation-filters="sRGB">
|
|
<feGaussianBlur stdDeviation="${i}"></feGaussianBlur></filter>
|
|
<filter id="hp-iso-sill-blur" x="-50%" y="-200%" width="200%" height="500%" color-interpolation-filters="sRGB">
|
|
<feGaussianBlur stdDeviation="${a}"></feGaussianBlur></filter>
|
|
${e.map((e,t)=>{const n=(e.a[0]+e.b[0])/2,o=(e.a[1]+e.b[1])/2,i=n+e.normal[0]*e.depth,a=o+e.normal[1]*e.depth;return s`<linearGradient id="hp-iso-sun-${t}" gradientUnits="userSpaceOnUse"
|
|
x1="${n}" y1="${o}" x2="${i}" y2="${a}">
|
|
${U(e.lightFloor?D:L)}</linearGradient>
|
|
${e.lightFloor?s`<linearGradient id="hp-iso-sun-edge-${t}" gradientUnits="userSpaceOnUse"
|
|
x1="${n}" y1="${o}" x2="${n+(i-n)*V.reach}" y2="${o+(a-o)*V.reach}">
|
|
${U(W)}</linearGradient>`:r}
|
|
<clipPath id="hp-iso-sun-clip-${t}"><polygon points="${_(e.clip)}"></polygon></clipPath>`})}
|
|
</defs>
|
|
<g class="sunlayer iso-sunwash hp-view-only-layer ${n?"out":""}" opacity="${o}">
|
|
${e.map((e,n)=>{const o=Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])||1,i=e.lightFloor?[l/o,1-l/o]:[];return s`<g class="iso-sunbeam" data-opening=${e.openingId} data-floor=${e.lightFloor?"light":"dark"}
|
|
clip-path="url(#hp-iso-sun-clip-${n})">
|
|
${e.polys.map(e=>s`<polygon class="iso-sun-fill" points="${_(e)}"
|
|
fill="url(#hp-iso-sun-${n})" filter="url(#hp-iso-sun-blur)"></polygon>`)}
|
|
${i.map(o=>{const i=e.a[0]+(e.b[0]-e.a[0])*o,a=e.a[1]+(e.b[1]-e.a[1])*o;return s`<line class="iso-sun-streak" x1="${i}" y1="${a}"
|
|
x2="${i+e.shift[0]*V.reach}" y2="${a+e.shift[1]*V.reach}"
|
|
stroke="url(#hp-iso-sun-edge-${n})" stroke-width="${V.width*t}"
|
|
stroke-linecap="round"></line>`})}
|
|
<line class="iso-sun-sill" x1="${e.a[0]}" y1="${e.a[1]}" x2="${e.b[0]}" y2="${e.b[1]}"
|
|
stroke="${e.lightFloor?"#efd493":"#fff3cf"}" stroke-width="${G.width*t}"
|
|
opacity="${G.opacity}" filter="url(#hp-iso-sill-blur)"></line>
|
|
</g>`})}
|
|
</g>`}const K=e=>`${Number(e[0].toFixed(4))} ${Number(e[1].toFixed(4))}`;function Y(e){let t=0;for(let n=0;n<e.length;n++){const o=e[n],i=e[(n+1)%e.length];t+=o[0]*i[1]-i[0]*o[1]}return t/2}function J(e,t){const n=function(e){const t=(Array.isArray(e)?e:[]).filter(e=>Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])).map(e=>[Number(e[0]),Number(e[1])]),n=t[t.length-1];return t.length>1&&t[0][0]===n[0]&&t[0][1]===n[1]&&t.pop(),t}(e);if(n.length<3)return[];const o=!t;return Y(n)>0===o?n:[...n].reverse()}function Q(e,t,n){return e.length?`M ${e.map(e=>K(d(e,n,t))).join(" L ")} Z`:""}function X(e,t,n){const o=t[1]-e[1],i=-(t[0]-e[0]),a=n.rotDeg*Math.PI/180;return o*Math.sin(a)+i*Math.cos(a)}function ee(e,t,n=c){if(!Number.isFinite(t)||t<0)throw new Error("invalid floor edge height");const o=(e||[]).map(e=>(e||[]).map((e,t)=>function(e,t){const n=J(e,t);if(!n.length)return n;let o=0;for(let e=1;e<n.length;e++)(n[e][0]<n[o][0]||n[e][0]===n[o][0]&&n[e][1]<n[o][1])&&(o=e);return[...n.slice(o),...n.slice(0,o)]}(e,t>0)).filter(e=>e.length>=3&&Math.abs(Y(e))>=1e-9)).filter(e=>e.length&&Y(e[0])>0);o.sort((e,t)=>{const n=e[0][0],o=t[0][0];return n[0]-o[0]||n[1]-o[1]||Math.abs(Y(t[0]))-Math.abs(Y(e[0]))});const i=[],a=[];let r=0;for(let e=0;e<o.length;e++){const s=o[e];for(const e of s)i.push(Q(e,n,0));const l=s[0];r+=l.length;for(let o=0;o<l.length;o++){const i=l[o],r=l[(o+1)%l.length];if(X(i,r,n)<=1e-9)continue;const s=d(i,0,n),c=d(r,0,n),f=d(r,-t,n),u=d(i,-t,n);a.push({d:`M ${K(s)} L ${K(c)} L ${K(f)} L ${K(u)} Z`,depth:Math.max(u[1],f[1]),component:e,edge:o,planEdge:[i,r]})}}return a.sort((e,t)=>e.depth-t.depth||e.component-t.component||e.edge-t.edge),{footprintPath:i.join(" "),sides:a,componentCount:o.length,edgeCount:r}}function te(e,t){return e^=Math.round(64*(Number.isFinite(t)?t:0)),Math.imul(e,16777619)>>>0}const ne=Object.freeze({revision:3,leafThicknessRatio:.04,frameThicknessRatio:.05,doorTurnDeg:50,windowTurnDeg:65,gateTurnDeg:10,gateTopRatio:.88,windowFrameBottomRatio:.38,windowFrameTopRatio:1,windowSashBottomRatio:.4,windowSashTopRatio:.98,windowGlassBottomRatio:.45,windowGlassTopRatio:.93,doorTopRatio:.92});ne.leafThicknessRatio,ne.frameThicknessRatio;const oe=e=>e.every(Number.isFinite);function ie(e,t){return Object.freeze([Object.is(e,-0)?0:e,Object.is(t,-0)?0:t])}function ae(e,t){return[e[0]+t[0],e[1]+t[1]]}function re(e,t){return[e[0]-t[0],e[1]-t[1]]}function se(e,t){return[e[0]*t,e[1]*t]}function le(e,t,n,o){const i=e[0]*n,a=e[1]*o,r=t*Math.PI/180;return[i*Math.cos(r)-a*Math.sin(r),i*Math.sin(r)+a*Math.cos(r)]}function ce(e,t,n,o,i,a,r){const s=e.flipH?-1:1,l="gate"===e.type?1:e.flipV?-1:1,c="door"===e.type||"gate"===e.type?e.face:u(e.type,e.flipV,e.angle,e.face);return{leaf:t,hinge:ae([e.x+c.ox,e.y+c.oy],le(n,e.angle,s,l)),closedVector:le(o,e.angle,s,l),quarterVector:le([-o[1],o[0]],e.angle,s,l),turnDeg:i,bottom:a,top:r}}const fe=e=>`${Number(e[0].toFixed(4))} ${Number(e[1].toFixed(4))}`;function de(e,t,n,o,i={}){const a=n.map(e=>d(e.point,e.z,o)),r=o.rotDeg*Math.PI/180,s=o.tiltDeg*Math.PI/180,l=n.reduce((e,t)=>e+(t.point[0]*Math.sin(r)+t.point[1]*Math.cos(r))*Math.sin(s)+t.z*Math.cos(s),0)/n.length;return Object.freeze({kind:e,material:t,d:`M ${a.map(fe).join(" L ")} Z`,cameraDepth:l,depth:Math.max(...a.map(e=>e[1])),...i})}function ue(e,t,n,o,i,a,r,s={}){return de(e,t,[{point:n,z:i},{point:o,z:i},{point:o,z:a},{point:n,z:a}],r,s)}function he(e,t,n=c){const o=Math.max(0,Math.min(1,Number.isFinite(t)?t:0));return e.leaves.map(t=>{const i=function(e,t){const n=e.turnDeg*t*Math.PI/180;return[e.hinge[0]+e.closedVector[0]*Math.cos(n)+e.quarterVector[0]*Math.sin(n),e.hinge[1]+e.closedVector[1]*Math.cos(n)+e.quarterVector[1]*Math.sin(n)]}(t,o),a=d(t.hinge,t.bottom,n),r=d(i,t.bottom,n),s=d(i,t.top,n),l=d(t.hinge,t.top,n),c="window"===e.type?"light-window":"matte-leaf",f="window"===e.type?function(e,t,n,o){const i=e.windowProfile;if(!i)throw new Error("missing isometric window profile");const a=re(n,t.hinge),r=Math.hypot(a[0],a[1]);if(!(r>1e-9))return Object.freeze([]);const s=ie(a[0]/r,a[1]/r),l=Math.min(i.member,r/4,(i.sashTop-i.sashBottom)/4),c=ae(t.hinge,se(s,l)),f=re(n,se(s,l)),d=Math.min(.35*e.frameThickness,.02*r),u=ie(-s[1]*d/2,s[0]*d/2),h=ae(c,u),p=ae(f,u),m=re(c,u),g=re(f,u),w=[ue("window-sash-side","light-frame",t.hinge,c,i.sashBottom,i.sashTop,o,{edge:"hinge"}),ue("window-sash-side","light-frame",f,n,i.sashBottom,i.sashTop,o,{edge:"tip"}),ue("window-sash-bottom","light-frame",t.hinge,n,i.sashBottom,i.sashBottom+l,o),ue("window-sash-top","light-frame",t.hinge,n,i.sashTop-l,i.sashTop,o),ue("window-glass","glass-side",h,p,i.glassBottom,i.glassTop,o),ue("window-glass","glass-side",g,m,i.glassBottom,i.glassTop,o),de("window-glass-top","glass-top",[{point:h,z:i.glassTop},{point:p,z:i.glassTop},{point:g,z:i.glassTop},{point:m,z:i.glassTop}],o)];return Object.freeze(w.sort((e,t)=>e.depth-t.depth||e.kind.localeCompare(t.kind)||String(e.edge||"").localeCompare(String(t.edge||""))))}(e,t,i,n):function(e,t,n,o){const i=re(t,e.hinge),a=Math.hypot(i[0],i[1]);if(!(a>1e-9&&n>0))return Object.freeze([]);const r=ie(-i[1]*n/(2*a),i[0]*n/(2*a)),s=ae(e.hinge,r),l=ae(t,r),c=re(e.hinge,r),f=re(t,r),d=[ue("leaf-back","matte-leaf",f,c,e.bottom,e.top,o),ue("leaf-front","matte-leaf",s,l,e.bottom,e.top,o),ue("leaf-edge","matte-leaf",c,s,e.bottom,e.top,o,{edge:"hinge"}),ue("leaf-edge","matte-leaf",l,f,e.bottom,e.top,o,{edge:"tip"}),de("leaf-top","matte-leaf",[{point:s,z:e.top},{point:c,z:e.top},{point:f,z:e.top},{point:l,z:e.top}],o)];return Object.freeze(d.sort((e,t)=>e.depth-t.depth||e.kind.localeCompare(t.kind)||String(e.edge||"").localeCompare(String(t.edge||""))))}(t,i,e.leafThickness,n);return Object.freeze({id:e.id,sourceIndex:e.sourceIndex,type:e.type,leaf:t.leaf,d:`M ${fe(a)} L ${fe(r)} L ${fe(s)} L ${fe(l)} Z`,shadowD:`M ${fe(d(t.hinge,0,n))} L ${fe(d(i,0,n))}`,depth:Math.max(a[1],r[1]),material:c,thickness:"window"===e.type?0:e.leafThickness,surfaces:f})})}const pe=1e-9,me=(e,t)=>`${e}\0${t}`,ge=e=>e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function we(e){let t=0;for(let n=0;n<e.length;n++){const o=e[n],i=e[(n+1)%e.length];t+=o[0]*i[1]-i[0]*o[1]}return t/2}function ye(e){return e.length>=3&&e.every(ge)&&Math.abs(we(e))>pe}function Me(e,t,n){const o=n[0]-t[0],i=n[1]-t[1],a=o*o+i*i,r=a?Math.max(0,Math.min(1,((e[0]-t[0])*o+(e[1]-t[1])*i)/a)):0;return Math.hypot(e[0]-t[0]-r*o,e[1]-t[1]-r*i)}function be(e,t,n=1e-7){for(let o=0;o<t.length;o++)if(Me(e,t[o],t[(o+1)%t.length])<=n)return!0;return!1}function xe(e,t){let n=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const a=t[o],r=t[i];a[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-a[0])*(e[1]-a[1])/(r[1]-a[1])+a[0]&&(n=!n)}return n}function ve(e){return Math.max(0,Math.abs(we(e.outer))-(e.holes||[]).reduce((e,t)=>e+Math.abs(we(t)),0))}function Se(e){return!!e.id&&ye(e.outer)&&(e.holes||[]).every(ye)&&ve(e)>pe}function $e(e,t){if(be(e,t.outer)||!xe(e,t.outer))return!1;for(const n of t.holes||[])if(be(e,n)||xe(e,n))return!1;return!0}function ke(e,t){return Se(t)&&$e(e,t)}function ze(e){if(!Se(e))return null;if(e.safePoint&&ke(e.safePoint,e))return[e.safePoint[0],e.safePoint[1]];const t=e.outer.map(e=>e[0]),n=e.outer.map(e=>e[1]),o=Math.min(...t),i=Math.max(...t),a=Math.min(...n),r=Math.max(...n),s=[[(o+i)/2,(a+r)/2],[t.reduce((e,t)=>e+t,0)/t.length,n.reduce((e,t)=>e+t,0)/n.length]];for(let t=0;t<e.outer.length;t++){const n=e.outer[(t+e.outer.length-1)%e.outer.length],o=e.outer[t],i=e.outer[(t+1)%e.outer.length];s.push([(n[0]+o[0]+i[0])/3,(n[1]+o[1]+i[1])/3])}let l=null,c=-1/0;const f=t=>{if(!ke(t,e))return;const n=function(e,t){let n=1/0;for(const o of[t.outer,...t.holes||[]])for(let t=0;t<o.length;t++)n=Math.min(n,Me(e,o[t],o[(t+1)%o.length]));return n}(t,e);n>c+pe&&(l=t,c=n)};s.forEach(f);for(let e=1;e<16;e++)for(let t=1;t<16;t++)f([o+(i-o)*e/16,a+(r-a)*t/16]);return l}function Pe(e){if(!ge(e.floorAnchor))return null;const t=e.roomsValidated?e.rooms:e.rooms.filter(Se),n=e.preferredRoomId&&t.find(t=>t.id===e.preferredRoomId)||null;let o=null;return"device"===e.kind?(n&&ke(e.floorAnchor,n)&&(o=n),o||(o=t.filter(t=>ke(e.floorAnchor,t)).sort((e,t)=>ve(e)-ve(t)||((e,t)=>e<t?-1:e>t?1:0)(e.id,t.id))[0]||null)):o=n,o?{id:o.id,area:ve(o),safePoint:e.roomsValidated&&o.safePoint?[o.safePoint[0],o.safePoint[1]]:ze(o)}:null}function Ie(e,t,n,o=c,i=[0,0]){if(!ge(e)||!ge(t)||t[0]<0||t[1]<0||!Number.isFinite(n)||!ge(i))throw new Error("invalid isometric overlay footprint");return[[e[0]-t[0],e[1]-t[1]],[e[0]+t[0],e[1]-t[1]],[e[0]+t[0],e[1]+t[1]],[e[0]-t[0],e[1]+t[1]]].map(e=>{const t=d(e,n,o);return[t[0]+i[0],t[1]+i[1]]})}function Ce(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}function je(e,t,n,o){const i=Ce(e,t,n),a=Ce(e,t,o),r=Ce(n,o,e),s=Ce(n,o,t);return(i>pe&&a<-pe||i<-pe&&a>pe)&&(r>pe&&s<-pe||r<-pe&&s>pe)||(Math.abs(i)<=pe&&Me(n,e,t)<=pe||Math.abs(a)<=pe&&Me(o,e,t)<=pe||Math.abs(r)<=pe&&Me(e,n,o)<=pe||Math.abs(s)<=pe&&Me(t,n,o)<=pe)}function Oe(e,t,n,o){return je(e,t,n,o)?0:Math.min(Me(e,n,o),Me(t,n,o),Me(n,e,t),Me(o,e,t))}const Te=new WeakMap;function Be(e){if(!e.length)return null;let t=1/0,n=1/0,o=-1/0,i=-1/0;for(const a of e){if(!ge(a))return null;t=Math.min(t,a[0]),n=Math.min(n,a[1]),o=Math.max(o,a[0]),i=Math.max(i,a[1])}return[t,n,o,i]}function He(e,t){if(!t)return Be(e.outer);if(Te.has(e))return Te.get(e)??null;const n=Be(e.outer);return Te.set(e,n),n}function Ne(e,t,n){return e[0]<=t[2]+n&&e[2]>=t[0]-n&&e[1]<=t[3]+n&&e[3]>=t[1]-n}function Fe(e,t,n,o){return Math.min(t[0],n[0])<=e[2]+o&&Math.max(t[0],n[0])>=e[0]-o&&Math.min(t[1],n[1])<=e[3]+o&&Math.max(t[1],n[1])>=e[1]-o}function Ae(e,t,n,o,i){const a=He(n,i);if(!a||!Ne(t,a,o))return!1;if(e.some(e=>function(e,t){return!!xe(e,t.outer)&&!(t.holes||[]).some(t=>xe(e,t))}(e,n)))return!0;if(n.outer.some(n=>n[0]>=t[0]&&n[0]<=t[2]&&n[1]>=t[1]&&n[1]<=t[3]&&xe(n,e)))return!0;for(const i of[n.outer,...n.holes||[]])for(let n=0;n<e.length;n++){const a=(n+1)%e.length;for(let r=0;r<i.length;r++){const s=(r+1)%i.length;if(Fe(t,i[r],i[s],o)&&Oe(e[n],e[a],i[r],i[s])<=o+pe)return!0}}return!1}function Re(e){return ye(e.outer)&&(e.holes||[]).every(ye)}function Ve(e,t,n){return!(!ke(e,n)||!ke(t,n))&&Ge(e,t,n)}function Ge(e,t,n){for(const o of[n.outer,...n.holes||[]])for(let n=0;n<o.length;n++)if(je(e,t,o[n],o[(n+1)%o.length]))return!1;return!0}function Le(e,t,n){const o=t[0]-e[0],i=t[1]-e[1];return{from:e,to:t,visible:n,length:Math.hypot(o,i),angleDeg:180*Math.atan2(i,o)/Math.PI}}function De(){return{points:new Map,pending:[]}}function We(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=-32768&&e<=32767&&t>=-32768&&t<=32767?65536*(e+32768)+t+32768:`${e}:${t}`}function Ee(e,t,n){const o=e=>{const t=Math.floor(e),n=Math.ceil(e);return t===n?[t-1,t,t+1]:[t,n]},i=o(t[0]),a=o(t[1]);for(const t of a)for(const o of i){if(o*o+t*t>n*n+pe)continue;const i=We(o,t);if(!e.points.has(i)){const n=[o,t];e.points.set(i,n),e.pending.push(n)}}}function qe(e,t,n){const o=t[0]-e[0],i=t[1]-e[1];let a=0,r=1;const s=(e,t)=>{if(Math.abs(e)<=pe)return t>=0;const n=t/e;if(e<0){if(n>r)return!1;n>a&&(a=n)}else{if(n<a)return!1;n<r&&(r=n)}return!0};return s(-o,e[0]+n)&&s(o,n-e[0])&&s(-i,e[1]+n)&&s(i,n-e[1])?[[e[0]+o*a,e[1]+i*a],[e[0]+o*r,e[1]+i*r]]:null}function _e(e,t,n,o){const i=qe(t,n,o+2);if(!i)return;const a=i[1][0]-i[0][0],r=i[1][1]-i[0][1],s=a*a+r*r,l=s>pe?Math.max(0,Math.min(1,-(i[0][0]*a+i[0][1]*r)/s)):0;Ee(e,i[0],o),Ee(e,i[1],o),Ee(e,[i[0][0]+a*l,i[0][1]+r*l],o)}function Ue(e,t,n){const o=[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]]];for(let t=0;t<o.length;t++)_e(e,o[t],o[(t+1)%o.length],n)}function Ze(e,t,n,o){const[i,a]=t,r=a[0]-i[0],s=a[1]-i[1];if(Math.abs(r)>pe)for(const t of[n[0],n[2]]){const a=(t-i[0])/r;if(a<-pe||a>1+pe)continue;const l=i[1]+s*a;l>=n[1]-pe&&l<=n[3]+pe&&Ee(e,[t,l],o)}if(Math.abs(s)>pe)for(const t of[n[1],n[3]]){const a=(t-i[1])/s;if(a<-pe||a>1+pe)continue;const l=i[0]+r*a;l>=n[0]-pe&&l<=n[2]+pe&&Ee(e,[l,t],o)}}function Ke(e,t,n,o){for(const i of n)Ze(e,t,i,o)}const Ye=new WeakMap;function Je(e,t,n,o,i,a,r,s){for(const s of function(e){const t=Ye.get(e);if(t)return t;const n=[];for(const t of[e.outer,...e.holes||[]])for(let e=0;e<t.length;e++){const o=t[e],i=t[(e+1)%t.length],a=i[0]-o[0],r=i[1]-o[1],s=Math.hypot(a,r);if(s<=pe)continue;const l=[a/s,r/s],c=[-l[1],l[0]],f=o[0]*l[0]+o[1]*l[1],d=i[0]*l[0]+i[1]*l[1];n.push({tangent:l,normal:c,tangentMin:Math.min(f,d),tangentMax:Math.max(f,d),normalOffset:o[0]*c[0]+o[1]*c[1]})}return Ye.set(e,n),n}(t)){const{tangent:t,normal:l}=s,c=(e,t)=>e[0]*t[0]+e[1]*t[1];let f=1/0,d=-1/0,u=1/0,h=-1/0;for(const e of n){const n=c(e,t),o=c(e,l);f=Math.min(f,n),d=Math.max(d,n),u=Math.min(u,o),h=Math.max(h,o)}const p=s.tangentMin-d-o,m=s.tangentMax-f+o,g=[s.normalOffset-o-h,s.normalOffset+o-u];for(const n of g){const o=e=>[(t[0]*e+l[0]*n)/i,(t[1]*e+l[1]*n)/i],s=qe(o(p),o(m),a+2);s&&(_e(e,s[0],s[1],a),Ke(e,s,r,a))}}}function Qe(e,t){if(t<=pe)Ee(e,[0,0],t);else for(let n=Math.ceil(-t);n<=Math.floor(t);n++){const o=Math.sqrt(Math.max(0,t*t-n*n));Ee(e,[n,o],t),Ee(e,[n,-o],t)}}function Xe(e){return[...e.points.values()].map(e=>({offset:e,distance:Math.hypot(e[0],e[1])})).sort((e,t)=>e.distance-t.distance||e.offset[1]-t.offset[1]||e.offset[0]-t.offset[0])}function et(e,t,n=4){const o=[];for(let i=Math.floor(e[1]-n);i<=Math.ceil(e[1]+n);i++)for(let a=Math.floor(e[0]-n);a<=Math.ceil(e[0]+n);a++){const e=Math.hypot(a,i);e<=t+pe&&o.push({offset:[a,i],distance:e})}return o.sort((e,t)=>e.distance-t.distance||e.offset[1]-t.offset[1]||e.offset[0]-t.offset[0]),o}function tt(e,t){return[t[0]-e.screenHalfSize[0],t[1]-e.screenHalfSize[1],t[0]+e.screenHalfSize[0],t[1]+e.screenHalfSize[1]]}function nt(e,t){return[e[0]-t,e[1]-t,e[2]+t,e[3]+t]}function ot(e,t,n){const o=Math.min(e[2],t[2])-Math.max(e[0],t[0])+n,i=Math.min(e[3],t[3])-Math.max(e[1],t[1])+n;return o>pe&&i>pe?o*i:0}function it(e,t,n){const o=n.tiltDeg*Math.PI/180;return p([e[0],e[1]+t*n.zScale*Math.sin(o)],n)}function at(e,t,n,o){const i=[t[0]*n,t[1]*n];if(!o&&Math.abs(i[0]-e.nudgeScene[0])<=pe&&Math.abs(i[1]-e.nudgeScene[1])<=pe)return e;const a=[i[0]-e.nudgeScene[0],i[1]-e.nudgeScene[1]],r=[e.raisedScene[0]+i[0],e.raisedScene[1]+i[1]],s=Math.hypot(t[0],t[1]);return{...e,visualScene:r,footprint:e.footprint.map(e=>[e[0]+a[0],e[1]+a[1]]),nudgeScene:i,nudgeCss:t,nudgeDistanceCss:s,nudged:s>pe,capped:e.capped||o,status:o?"degraded":e.status,reason:o?"overlay-collision":e.reason,tether:Le(e.floorScene,r,!1)}}function rt(e,t){return Math.hypot(e[0],e[1])-Math.hypot(t[0],t[1])||Math.abs(e[1])-Math.abs(t[1])||Math.abs(e[0])-Math.abs(t[0])||e[0]-t[0]||e[1]-t[1]}function st(e,t){return e.roomViolations-t.roomViolations||e.wallViolations-t.wallViolations||e.overlapPenalty-t.overlapPenalty||rt(e.offset,t.offset)}function lt(e,t){return e[0]<=t[2]+pe&&e[2]>=t[0]-pe&&e[1]<=t[3]+pe&&e[3]>=t[1]-pe}function ct(e){const t=e.sceneUnitsPerCssPixel,n=e.maxNudgeCssPx??48,o=e.safetyGapCssPx??4,i=e.groupGapCssPx??12,a=e.visualOffset??h,r=e.camera||c;if(!(t>0&&Number.isFinite(t)&&n>=0&&Number.isFinite(n)&&o>=0&&Number.isFinite(o)&&i>=0&&Number.isFinite(i)))throw new Error("invalid isometric rigid overlay input");const s=new Map(e.rooms.filter(Se).map(e=>[e.id,e])),l=e.wallSilhouettes.every(Re),f=o*t,u=e.wallSilhouettes.map(e=>({wall:e,bounds:He(e,!0)})),p=[],m=new Map,g=[];for(const o of function(e,t,n){const o=[...e].sort((e,t)=>me(e.kind,e.id).localeCompare(me(t.kind,t.id))),i=o.map((e,t)=>t),a=e=>{let t=e;for(;i[t]!==t;)t=i[t];for(;i[e]!==e;){const n=i[e];i[e]=t,e=n}return t},r=(e,t)=>{const n=a(e),o=a(t);n!==o&&(i[Math.max(n,o)]=Math.min(n,o))},s=n*t,l=o.map(e=>nt(tt(e,e.placement.raisedScene),s));for(let e=0;e<o.length;e++){const t=o[e].placement.owner?.id;if(t)for(let n=e+1;n<o.length;n++)o[n].placement.owner?.id===t&<(l[e],l[n])&&r(e,n)}const c=new Map;return o.forEach((e,t)=>{const n=a(t),o=c.get(n)||[];o.push(e),c.set(n,o)}),Object.freeze([...c.values()].map(e=>{const t=Object.freeze([...e].sort((e,t)=>me(e.kind,e.id).localeCompare(me(t.kind,t.id))));return{key:me(t[0].kind,t[0].id),items:t,requiredShift:Math.max(...t.map(e=>e.placement.nudgeDistanceCss))}}).sort((e,t)=>t.items.length-e.items.length||e.requiredShift-t.requiredShift||e.key.localeCompare(t.key)))}(e.items,t,i)){const e=De(),i=[[0,0]];Ee(e,[0,0],n),Qe(e,n);for(const c of o.items){i.push(c.placement.nudgeCss),c.nudgeHintCss&&i.push(c.nudgeHintCss),Ee(e,c.placement.nudgeCss,n),c.nudgeHintCss&&Ee(e,c.nudgeHintCss,n);const o=c.placement.footprint.map(e=>[e[0]-c.placement.nudgeScene[0],e[1]-c.placement.nudgeScene[1]]),h=Be(o);if(h&&l){const i=n*t;for(const{wall:a,bounds:r}of u)r&&Ne(nt(h,i),r,f)&&Je(e,a,o,f,t,n,[])}const m=c.placement.owner&&s.get(c.placement.owner.id)||null;if(m)for(const o of[m.outer,...m.holes||[]])for(let i=0;i<o.length;i++){const s=d(o[i],a,r),l=d(o[(i+1)%o.length],a,r);_e(e,[(s[0]-c.placement.raisedScene[0])/t,(s[1]-c.placement.raisedScene[1])/t],[(l[0]-c.placement.raisedScene[0])/t,(l[1]-c.placement.raisedScene[1])/t],n)}for(const o of p){const i=c.screenHalfSize;Ue(e,[(o.bounds[0]-i[0]-f-c.placement.raisedScene[0])/t,(o.bounds[1]-i[1]-f-c.placement.raisedScene[1])/t,(o.bounds[2]+i[0]+f-c.placement.raisedScene[0])/t,(o.bounds[3]+i[1]+f-c.placement.raisedScene[1])/t],n)}}const c=[],h=new Set,w=e=>{if(!ge(e)||Math.hypot(e[0],e[1])>n+pe)return;const t=`${e[0].toFixed(8)}:${e[1].toFixed(8)}`;h.has(t)||(h.add(t),c.push(e))};for(const e of i){w(e);for(const t of et(e,n,2))w(t.offset)}for(const t of Xe(e))w(t.offset);c.sort(rt);const y=e=>{const n=Math.hypot(e[0],e[1]),i=[e[0]*t,e[1]*t];let c=0,d=l?0:o.items.length,h=0;const m=[];for(const e of o.items){const t=e.placement,o=[t.raisedScene[0]+i[0],t.raisedScene[1]+i[1]],g=t.owner&&s.get(t.owner.id)||null;let w=!1;if(n>pe)if(g){const e=it(o,a,r);w=!$e(e,g)||$e(t.floorAnchor,g)&&!Ge(t.floorAnchor,e,g)}else w=!0;w&&(c+=1);const y=t.footprint.map(e=>[e[0]-t.nudgeScene[0],e[1]-t.nudgeScene[1]]).map(e=>[e[0]+i[0],e[1]+i[1]]),M=Be(y),b=l&&!!M&&u.some(({wall:e,bounds:t})=>!!t&&Ne(M,t,f)&&Ae(y,M,e,f,!0));b&&(d+=1);const x=tt(e,o),v=[];for(let e=0;e<p.length;e++){const t=ot(x,p[e].bounds,f);t>pe&&(v.push(e),h+=t)}m.push({item:e,bounds:x,roomInvalid:w,wallNear:b,conflicts:v})}return{offset:e,distance:n,roomViolations:c,wallViolations:d,overlapPenalty:h,details:m}};let M=null,b=null;for(const e of c){const t=y(e);if((!b||st(t,b)<0)&&(b=t),!t.roomViolations&&!t.wallViolations&&t.overlapPenalty<=pe){M=t;break}}M||=b||y([0,0]);const x=!!M.roomViolations||!!M.wallViolations||M.overlapPenalty>pe;for(const e of M.details){const n=e.item,o=me(n.kind,n.id);let i=at(n.placement,M.offset,t,x);i={...i,nearWallAfter:e.wallNear,cleared:!e.wallNear,capped:x,status:x?"degraded":"ok",reason:x?l?n.placement.owner||"missing-owner"!==n.placement.reason?e.roomInvalid?"owner-boundary":e.wallNear?"nudge-cap":"overlay-collision":"missing-owner":"invalid-wall-geometry":null},m.set(o,i);for(const t of e.conflicts)ot(e.bounds,p[t].bounds,f)>pe&&g.push(Object.freeze([p[t].key,o]))}for(const e of M.details)p.push({key:me(e.item.kind,e.item.id),bounds:e.bounds})}return{placements:m,residualPairs:Object.freeze(g)}}const ft="a7aa4b718d3f5657591f9cf866d227c415e1f5f46fbc0b11ddce80a6845cf34e",dt=e=>"wall-side"===e.layer?0:"wall-top"===e.layer?1:2,ut=e=>{if("wall-side"===e.layer)return`${e.face.polygon}:${e.face.ring}:${e.face.edge}`;if("wall-top"===e.layer)return String(e.face.component);const t=e.surface;return`${t.sourceIndex}:${t.leaf??-1}:${t.kind}:${t.jamb??-1}:${t.edge??""}:${t.id}:${t.material}`};function ht(e,t){const n=[...e.sides.map(e=>({layer:"wall-side",depth:e.depth,face:e})),...e.topFaces.map(e=>({layer:"wall-top",depth:e.depth,face:e})),...t.map(e=>({layer:"opening",depth:e.depth,surface:e}))];n.sort((e,t)=>e.depth-t.depth||dt(e)-dt(t)||ut(e).localeCompare(ut(t)));const o=new Map;for(const e of n){if("opening"!==e.layer)continue;const t=`${e.surface.type}\0${e.surface.id}`,n=o.get(t)||[];n.push(e),o.set(t,n)}for(const e of o.values())e.sort((e,t)=>{const n="opening"===e.layer?e.surface:null,o="opening"===t.layer?t.surface:null;return(n?.cameraDepth??n?.depth??0)-(o?.cameraDepth??o?.depth??0)||ut(e).localeCompare(ut(t))});const i=new Map;return Object.freeze(n.map(e=>{if("opening"!==e.layer)return e;const t=`${e.surface.type}\0${e.surface.id}`,n=i.get(t)||0;return i.set(t,n+1),o.get(t)?.[n]||e}))}const pt=Object.freeze({textLatinAdvance:.72,textWideAsciiAdvance:1,textWideAdvance:1.1,textSpaceAdvance:.4,textWidthSafety:1.08,deviceShellInset:.134375,deviceShellGap:.1,deviceSectionGap:.08,deviceBadgeMinWidth:.7875,deviceBadgeHeight:.7875,deviceBadgeInlinePadding:.28,deviceValueInlinePadding:.32,deviceAuxiliaryExtent:.7,deviceLqiFontSize:.38,deviceLqiTop:.734375,deviceLqiBelowBottomBadgeTop:1.571875,devicePadding:.08,roomNameLineHeight:1.25,roomAreaLinkWidth:1.1,roomMetricsTopGap:.15,roomMetricFontSize:.75,roomMetricLineHeight:1.25,roomMetricIconWidth:1.05,roomMetricInnerGap:.12,roomMetricRowGap:.55,roomMetricMinWidth:11,roomPadding:.4,openingLockHalfSize:.62,roomMetricTextCharacters:Object.freeze({temperature:10,humidity:8,lqi:6,light:24})});function mt(e){return[...String(e)].reduce((e,t)=>/\s/.test(t)?e+pt.textSpaceAdvance:/[MW@#%&]/.test(t)?e+pt.textWideAsciiAdvance:e+(t.codePointAt(0)>255?pt.textWideAdvance:pt.textLatinAdvance),0)*pt.textWidthSafety}function gt(e,t){return mt(e)*N(t||e)}function wt(e,t){return[Math.max(Math.abs(e.left),Math.abs(e.right))+t,Math.max(Math.abs(e.top),Math.abs(e.bottom))+t]}function yt(e){if("opening-lock"===e.kind){const t=(Number.isFinite(e.size)&&e.size>0?e.size:0)*pt.openingLockHalfSize;return[t,t]}if("room-label"===e.kind){const t=Number.isFinite(e.font)&&e.font>0?e.font:0,n=j(e.room.settings?.name_scale),o=j(e.room.settings?.label_scale),i=(mt(e.room.name||"")+(e.room.area?pt.roomAreaLinkWidth:0))*n,a=pt.roomNameLineHeight*n,r=[e.display.labelTemp?pt.roomMetricTextCharacters.temperature:0,e.display.labelHum?pt.roomMetricTextCharacters.humidity:0,e.display.labelLqi&&e.room.area?pt.roomMetricTextCharacters.lqi:0,e.display.labelLight?pt.roomMetricTextCharacters.light:0].filter(e=>e>0),s=pt.roomMetricFontSize*o,l=r.length?Math.max(pt.roomMetricMinWidth,r.reduce((e,t)=>e+pt.roomMetricIconWidth+pt.roomMetricInnerGap+t*pt.textLatinAdvance*pt.textWidthSafety,0)+(r.length-1)*pt.roomMetricRowGap)*s:0,c=r.length?s*pt.roomMetricLineHeight:0,f=wt({left:-Math.max(i,l)/2,right:Math.max(i,l)/2,top:-a/2,bottom:r.length?a/2+pt.roomMetricsTopGap+c:a/2},pt.roomPadding);return[f[0]*t,f[1]*t]}const t=Number.isFinite(e.core)&&e.core>0?e.core:0,n=e.presentation,o=null==n.valueText?1:Math.max(1,gt(n.valueText,n.valueFullText||n.valueText)+pt.deviceValueInlinePadding),i=[];n.valueBadge&&i.push(Math.max(pt.deviceBadgeMinWidth,gt(n.valueBadge.text,n.valueBadge.fullText||n.valueBadge.text)+pt.deviceBadgeInlinePadding));for(const e of O(n)){const t=e.text+e.suffix;i.push(Math.max(pt.deviceBadgeMinWidth,gt(t,t)+pt.deviceBadgeInlinePadding))}const a=n.valueBadge?.position||"right";let r;if(!i.length||"left"!==a&&"right"!==a)if(i.length){const e=i.reduce((e,t)=>e+t,0)+(i.length-1)*pt.deviceSectionGap,t=Math.max(o,e),n=1+pt.deviceShellGap+pt.deviceBadgeHeight;r="bottom"===a?{left:-t/2-pt.deviceShellInset,right:t/2+pt.deviceShellInset,top:-.5-pt.deviceShellInset,bottom:-.5+n+pt.deviceShellInset}:{left:-t/2-pt.deviceShellInset,right:t/2+pt.deviceShellInset,top:.5-n-pt.deviceShellInset,bottom:.5+pt.deviceShellInset}}else r={left:-.5-pt.deviceShellInset,right:-.5+o+pt.deviceShellInset,top:-.5-pt.deviceShellInset,bottom:.5+pt.deviceShellInset};else{const e=Math.max(...i),t=i.length*pt.deviceBadgeHeight+(i.length-1)*pt.deviceSectionGap,n=o+pt.deviceShellGap+e,s=Math.max(1,t);r="right"===a?{left:-.5-pt.deviceShellInset,right:-.5+n+pt.deviceShellInset,top:-s/2-pt.deviceShellInset,bottom:s/2+pt.deviceShellInset}:{left:.5-n-pt.deviceShellInset,right:.5+pt.deviceShellInset,top:-s/2-pt.deviceShellInset,bottom:s/2+pt.deviceShellInset}}const s=pt.deviceAuxiliaryExtent;if(r.left=Math.min(r.left,-s),r.right=Math.max(r.right,s),r.top=Math.min(r.top,-s),r.bottom=Math.max(r.bottom,s),n.pulse.animated){const e=Math.max(1,n.pulse.diameterScale)/2;r.left=Math.min(r.left,-e),r.right=Math.max(r.right,e),r.top=Math.min(r.top,-e),r.bottom=Math.max(r.bottom,e)}if(null!=n.lqiText){const e="bottom"===n.valueBadge?.position?pt.deviceLqiBelowBottomBadgeTop:pt.deviceLqiTop,t=mt(n.lqiText)*pt.deviceLqiFontSize/2;r.left=Math.min(r.left,-t),r.right=Math.max(r.right,t),r.bottom=Math.max(r.bottom,e+pt.deviceLqiFontSize)}const l=wt(r,pt.devicePadding);return[l[0]*t,l[1]*t]}function Mt(e,t){return e.flatMap((e,n)=>e.orphanReason?[]:[{id:String(e.id||n),sourceIndex:n,type:e.type,x:e.rx,y:e.ry,angle:Number(e.angle)||0,length:e.rlen>0?e.rlen:.9*t,flipH:!!e.flip_h,flipV:!!e.flip_v}])}function bt(e){return{id:e.id,x:e.x,y:e.y,w:e.w,h:e.h,poly:e.poly,wall_ids:e.wall_ids}}function xt(e,t){const n=e?.partitionHost;if(!n)return null;const o="gate"===t.type?!t.flipV:t.flipV;return{sourceIndex:t.sourceIndex,hostId:n.host.id,t:n.t,depth:n.depth,face:k(n,o)}}function vt(e,t=ne){const n=Mt(e.openings,e.coordinateScale),o=n.map(t=>xt(e.openings[t.sourceIndex],t)),i=m(f,e.cellCm),a=m(y,e.cellCm),r=m(M,e.cellCm);return{key:`${e.space.id}|${function(e){let t=2166136261;const n=e=>{if("number"!=typeof e)if("string"!=typeof e)if("boolean"!=typeof e)if(Array.isArray(e)){t=te(t,e.length);for(const t of e)n(t)}else{if(e&&"object"==typeof e){const t=e;for(const e of Object.keys(t).sort())n(e),n(t[e]);return}t=te(t,-1)}else t=te(t,e?1:0);else for(const n of e)t=te(t,n.codePointAt(0)||0);else t=te(t,e)};return n(e),t.toString(36)}({rooms:e.space.rooms.map(bt),walls:e.walls,openCuts:e.openCuts,openings:n,openingHosts:o,openingGeometryPolicy:t,partitions:e.space.partitions,columns:e.space.wall_columns,cellCm:e.cellCm,gridPitch:e.gridPitch,wallKeyPitch:e.wallKeyPitch,camera:c,wallHeight:i,raisedHeight:r,floorEdgeHeight:a,algorithm:5})}`,build:()=>{e.onBuild();const a=b(e.space,e.cellCm,e.gridPitch,2e-4*e.gridPitch,e.partitionCuts()).all,r=e.roomOpenings(),s=e.walls.length||a.length?x(e.space.rooms,e.walls,e.openCuts,r,e.wallKeyPitch,e.cellCm,e.gridPitch,e.coordinateScale,a):null;if(s&&("failed-core"===s.status||"not-applicable"===s.status))throw new Error("wall boolean geometry failed");const l=s?.paperGeom??v(e.space.rooms,e.walls,e.openCuts,e.wallKeyPitch,e.cellCm,e.gridPitch,e.coordinateScale);if(!l)throw new Error("floor boolean geometry failed");const d=s?.openingIndex||S(e.space.rooms,e.walls,e.openCuts,e.wallKeyPitch,e.cellCm,e.gridPitch,e.coordinateScale),u=n.map((n,a)=>{const r=o[a],s="gate"===n.type?!n.flipV:n.flipV,l=r?r.face:e.walls.length||"gate"===n.type?$(d,{x:n.x,y:n.y,angle:n.angle,length:n.length,flip_v:s}):{ox:0,oy:0,cm:0,side:-1};return function(e,t=f,n=ne){const o=e.face.cm??0;if(!oe([e.x,e.y,e.angle,e.length,e.face.ox,e.face.oy,o,t])||!(e.length>0)||!(t>0)||-1!==e.face.side&&1!==e.face.side||o<0)throw new Error("invalid isometric opening input");const i=e.length/2,a=e.angle*Math.PI/180,r=ie(Math.cos(a),Math.sin(a)),s=ie(-Math.sin(a),Math.cos(a)),l=ie(e.x,e.y),c=ie(e.x-r[0]*i,e.y-r[1]*i),d=ie(e.x+r[0]*i,e.y+r[1]*i),u=ie(e.face.ox,e.face.oy),h=ie(c[0]+u[0],c[1]+u[1]),p=ie(d[0]+u[0],d[1]+u[1]),m=ie(c[0]-u[0],c[1]-u[1]),g=ie(d[0]-u[0],d[1]-u[1]),w=Object.freeze({center:l,tangent:r,normal:s,start:c,end:d}),y=Object.freeze({side:e.face.side,cm:o,depth:2*Math.hypot(e.face.ox,e.face.oy),offset:u,selectedStart:h,selectedEnd:p,oppositeStart:m,oppositeEnd:g}),M="passage"===e.type?[]:[Object.freeze({jamb:0,center:c,selected:h,opposite:m}),Object.freeze({jamb:1,center:d,selected:p,opposite:g})];let b;if("passage"===e.type)b=[];else if("gate"===e.type){const o=e.face.side*n.gateTurnDeg;b=[ce(e,0,[-i,0],[i,0],o,0,t*n.gateTopRatio),ce(e,1,[i,0],[-i,0],-o,0,t*n.gateTopRatio)]}else b="window"===e.type?[ce(e,0,[-i,0],[i,0],-n.windowTurnDeg,t*n.windowSashBottomRatio,t*n.windowSashTopRatio),ce(e,1,[i,0],[-i,0],n.windowTurnDeg,t*n.windowSashBottomRatio,t*n.windowSashTopRatio)]:[ce(e,0,[-i,0],[e.length,0],-n.doorTurnDeg,0,t*n.doorTopRatio)];const x="window"===e.type?Object.freeze({frameBottom:t*n.windowFrameBottomRatio,frameTop:t*n.windowFrameTopRatio,sashBottom:t*n.windowSashBottomRatio,sashTop:t*n.windowSashTopRatio,glassBottom:t*n.windowGlassBottomRatio,glassTop:t*n.windowGlassTopRatio,member:t*n.frameThicknessRatio}):null;return Object.freeze({id:e.id,sourceIndex:e.sourceIndex,type:e.type,wallHeight:t,leafThickness:t*n.leafThicknessRatio,frameThickness:t*n.frameThicknessRatio,windowProfile:x,axis:w,face:y,reveals:Object.freeze(M),leaves:Object.freeze(b.map(e=>Object.freeze({...e,hinge:ie(e.hinge[0],e.hinge[1]),closedVector:ie(e.closedVector[0],e.closedVector[1]),quarterVector:ie(e.quarterVector[0],e.quarterVector[1])})))})}({...n,face:l},i,t)}),h=Object.freeze(u);return{walls:s?.components.flatMap(e=>e.geom)||[],floor:l,openings:h,openingSurfaces:Object.freeze(h.flatMap(e=>function(e,t=c){if("passage"===e.type)return Object.freeze([]);const n=[];if(e.face.depth>1e-9)for(const o of e.reveals)n.push(ue("jamb-reveal","reveal",o.selected,o.opposite,0,e.wallHeight,t,{jamb:o.jamb}));if("window"!==e.type||!e.leaves.length)return Object.freeze(n.sort((e,t)=>e.depth-t.depth||e.kind.localeCompare(t.kind)||(e.jamb??0)-(t.jamb??0)));const o=e.windowProfile;if(!o)throw new Error("missing isometric window profile");const i=o.frameBottom,a=o.frameTop,r=Math.min(e.frameThickness,Math.hypot(e.axis.end[0]-e.axis.start[0],e.axis.end[1]-e.axis.start[1])/4,(a-i)/4),s=ae(e.axis.start,se(e.axis.tangent,r)),l=re(e.axis.end,se(e.axis.tangent,r)),f=e.face.depth>1e-9?[e.face.offset,ie(-e.face.offset[0],-e.face.offset[1])]:[e.face.offset];for(const o of f){const c=ae(e.axis.start,o),f=ae(e.axis.end,o),d=ae(s,o),u=ae(l,o);n.push(ue("window-frame-side","light-frame",c,d,i,a,t,{jamb:0}),ue("window-frame-side","light-frame",u,f,i,a,t,{jamb:1}),ue("window-frame-top","light-frame",d,u,Math.max(i,a-r),a,t))}return e.face.depth>1e-9&&n.push(de("window-sill","light-sill",[{point:e.face.selectedStart,z:i},{point:e.face.selectedEnd,z:i},{point:e.face.oppositeEnd,z:i},{point:e.face.oppositeStart,z:i}],t)),Object.freeze(n.sort((e,t)=>e.depth-t.depth||e.kind.localeCompare(t.kind)||(e.jamb??0)-(t.jamb??0)))}(e).map(t=>Object.freeze({...t,id:e.id,sourceIndex:e.sourceIndex,type:e.type}))))}}}}const St=e=>Array.isArray(e)?e:[];function $t(e,t){const n=e=>St(e).flatMap(e=>Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])?[d([Number(e[0]),Number(e[1])],t)]:[]);return St(e).flatMap(e=>{const t=St(e);if(!t.length)return[];const o=n(t[0]);if(o.length<3)return[];return[{outer:o,holes:t.slice(1).map(n).filter(e=>e.length>=3)}]})}function kt(e){const t=m(f,e.cellCm),n=m(y,e.cellCm),o=m(M,e.cellCm),i=T(e.cache,e.source.key);let a=i.hit?i.value:void 0;if(!a){const o=e.source.build(),i=function(e,t=c,n=f){if(!Number.isFinite(n)||n<0)throw new Error("invalid wall height");const o=[],i=[],a=[],r=[];let s=0;for(let l=0;l<(e||[]).length;l++){const c=e[l],f=[];let u=-1/0;for(let e=0;e<(c||[]).length;e++){const i=J(c[e],e>0);if(i.length<3||Math.abs(Y(i))<1e-9)continue;const h=Q(i,t,n);o.push(h),f.push(h),u=Math.max(u,...i.map(e=>d(e,n,t)[1])),s+=i.length;for(let o=0;o<i.length;o++){const s=i[o],c=i[(o+1)%i.length],f=d(s,0,t),u=d(c,0,t);if(r.push(`M ${K(f)} L ${K(u)}`),X(s,c,t)<=1e-9)continue;const h=d(c,n,t),p=d(s,n,t),m=Object.freeze([f,u,h,p]);a.push({d:`M ${m.map(K).join(" L ")} Z`,points:m,depth:Math.max(f[1],u[1]),polygon:l,ring:e,edge:o})}}f.length&&i.push({d:f.join(" "),depth:u,component:l})}return a.sort((e,t)=>e.depth-t.depth||e.polygon-t.polygon||e.ring-t.ring||e.edge-t.edge),i.sort((e,t)=>e.depth-t.depth||e.component-t.component),{topPath:o.join(" "),topFaces:i,sides:a,contactPath:r.join(" "),edgeCount:s}}(o.walls,c,t),r=$t(o.walls,t);a={geometry:i,floor:ee(o.floor,n),wallSilhouettes:Object.freeze([...r,...i.sides.map(e=>({outer:e.points}))]),openings:o.openings,openingSurfaces:o.openingSurfaces},B(e.cache,e.source.key,a,8)}const r=function(e){let t=1/0,n=1/0,o=-1/0,i=-1/0;const a=(e,a=0)=>{t=Math.min(t,e[0]-a),n=Math.min(n,e[1]-a),o=Math.max(o,e[0]+a),i=Math.max(i,e[1]+a)};for(const t of e)if("passage"!==t.type){a(t.axis.start),a(t.axis.end),a(t.face.selectedStart),a(t.face.selectedEnd),a(t.face.oppositeStart),a(t.face.oppositeEnd);for(const e of t.leaves){const n=Math.hypot(e.closedVector[0],e.closedVector[1])+t.leafThickness/2;a(e.hinge,n)}}return oe([t,n,o,i])?{x:t,y:n,w:o-t,h:i-n}:null}(a.openings),s=r?zt(e.liveFrame,r):e.liveFrame,l=H({rect:s,wallHeight:t,openingHeight:t,floorDepth:n,raisedHeight:o});return{key:e.source.key,...a,frame:l}}const zt=(e,t)=>{const n=Math.min(e.x,t.x),o=Math.min(e.y,t.y);return{x:n,y:o,w:Math.max(e.x+e.w,t.x+t.w)-n,h:Math.max(e.y+e.h,t.y+t.h)-o}},Pt=e=>{if(!e.length||!e.every(e=>Number.isFinite(e[0])&&Number.isFinite(e[1])))return null;const t=e.map(e=>e[0]),n=e.map(e=>e[1]),o=Math.min(...t),i=Math.min(...n);return{x:o,y:i,w:Math.max(...t)-o,h:Math.max(...n)-i}},It=(e,t)=>{const n=e.placement,o=t?n.visualScene:n.raisedScene,[i,a]=e.screenHalfSize,r=t?n.footprint:n.footprint.map(e=>[e[0]-n.nudgeScene[0],e[1]-n.nudgeScene[1]]);return[n.floorScene,...r,[o[0]-i,o[1]-a],[o[0]+i,o[1]-a],[o[0]+i,o[1]+a],[o[0]-i,o[1]+a]]},Ct=(e,t)=>void 0===t?e:e.filter(e=>e.placement.owner?.id===t);function jt(e,t){return e?Pt(Ct(e.entries,t).flatMap(e=>It(e,!0))):null}function Ot(e){const t=Ct(e.entries,e.ownerId),n=Pt(t.flatMap(e=>It(e,!1))),o=n?zt(e.baseBounds,n):e.baseBounds,i=e.targetView(o);if(!(i&&i.w>0&&i.h>0&&[i.x,i.y,i.w,i.h].every(Number.isFinite)))return null;const a=e.stageSize;if(!(n&&a&&a.width>0&&a.height>0))return{bounds:o,view:i};const r=e=>Math.max(e.w/a.width,e.h/a.height),s=t=>{const o=48*t,i={x:n.x-o,y:n.y-o,w:n.w+2*o,h:n.h+2*o},a=zt(e.baseBounds,i),r=e.targetView(a);return r&&[r.x,r.y,r.w,r.h].every(Number.isFinite)&&r.w>0&&r.h>0?{bounds:a,view:r}:null};let l=0,c=Math.max(r(i),Number.EPSILON),f=s(c);for(let e=0;f&&r(f.view)>c*(1+1e-10)&&e<24;e++)l=c,c*=2,f=s(c);if(!f)return null;for(let e=0;e<40;e++){const e=(l+c)/2,t=s(e);if(!t)return null;r(t.view)<=e?(c=e,f=t):l=e}return f}const Tt=new WeakMap,Bt=2048,Ht=new WeakMap,Nt=new WeakMap,Ft=new WeakMap;function At(e,t){if(e.size!==t.size)return!1;for(const[n,o]of t)if(e.get(n)!==o)return!1;return!0}function Rt(e){const t=Tt.get(e.rooms);if(t)return t;const n=e.rooms.flatMap((e,t)=>{const n=I(e);return n&&n.length>=3?[{room:e,index:t,poly:n}]:[]}),o=Object.freeze(n.map(({room:e,index:t,poly:o})=>{const i=C(o,n.filter(e=>e.index!==t).map(e=>e.poly)),a={id:e.id||`room-index-${t}`,outer:o.map(e=>[e[0],e[1]]),holes:i.map(e=>e.map(e=>[e[0],e[1]]))};return{room:e,overlayRoom:{...a,safePoint:ze(a)||void 0}}}));return Tt.set(e.rooms,o),o}function Vt(e){const t=e.referenceView||e.view,n=e.stageSize&&e.stageSize.width>0&&e.stageSize.height>0?Math.max(t.w/e.stageSize.width,t.h/e.stageSize.height):Math.max(t.w,t.h)/1e3,o=Rt(e.space),i=o.map(e=>e.overlayRoom),a=m(f,e.cellCm),r=m(h,e.cellCm),s=new Map,l=new Map,u=new Map,p=[];let y=Ht.get(e.wallSilhouettes);y||(y=new Map,Ht.set(e.wallSilhouettes,y));let M=Nt.get(o);M||(M=new Map,Nt.set(o,M));const b=e.iconPct*g(e.space)*e.kioskIconScale/100,x=e.deviceBasePct*g(e.space)*e.kioskIconScale/100,v=(t,o,s,l,u)=>{const p=`${!1===e.resolveCollisions?"fit":"live"}\0${t}\0${o}`,m=[s[0],s[1],l[0],l[1],u||"",a,r].join("|"),g=`${m}|${n}`,w=T(y,p);if(w.hit&&w.value.signature===g)return w.value.placement;if(w.hit&&w.value.shapeSignature===m&&n<=w.value.unitsPerPixel){const e=w.value.placement,t=e.nudgeDistanceCss*w.value.unitsPerPixel/n;if(!e.nearWallBefore||e.cleared&&t<=48)return e}const b=`${t}\0${o}`,x=[s[0],s[1],u||""].join("|"),v=T(M,b),S=v.hit&&v.value.signature===x?v.value.owner:Pe({kind:t,floorAnchor:s,rooms:i,roomsValidated:!0,preferredRoomId:u});v.hit&&v.value.signature===x||B(M,b,{signature:x,owner:S},Bt);const $=function(e){const t=e.camera||c,n=e.wallHeight??f,o=e.visualOffset??h,i=e.sceneUnitsPerCssPixel??1,a=e.safetyGapCssPx??4,r=e.maxNudgeCssPx??48;if(!ge(e.floorAnchor)||!ge(e.footprintHalfSize)||e.footprintHalfSize[0]<0||e.footprintHalfSize[1]<0||!Number.isFinite(n)||n<0||!Number.isFinite(o)||o<0||!Number.isFinite(i)||i<=0||!Number.isFinite(a)||a<0||!Number.isFinite(r)||r<0)throw new Error("invalid isometric overlay input");const s=[e.floorAnchor[0],e.floorAnchor[1]],l=d(s,0,t),u=(p=e.kind,!e.showBorders||"device"!==p&&"room-label"!==p&&"opening-lock"!==p?"floor":"raised");var p;if("floor"===u)return{plane:u,owner:null,floorAnchor:s,floorScene:l,raisedScene:l,visualScene:l,footprint:[],nudgeScene:[0,0],nudgeCss:[0,0],nudgeDistanceCss:0,nudged:!1,nearWallBefore:!1,nearWallAfter:!1,cleared:!0,capped:!1,grounding:{center:l,visible:!1},tether:Le(l,l,!1),status:"ok",reason:null};const m=o,g=d(s,m,t),w=e.ownerAlreadyResolved?e.resolvedOwner??null:Pe(e),y=e.wallGeometryValidated??e.wallSilhouettes.every(Re),M=a*i,b=Ie(s,e.footprintHalfSize,m,t),x=t=>{const n=Be(t);return!!n&&e.wallSilhouettes.some(o=>Ae(t,n,o,M,!0===e.wallGeometryValidated))},v=!y||x(b);let S=0,$=[0,0],k=null,z=!1,P=y?"ok":"degraded",I=y?null:"invalid-wall-geometry";if(y&&v)if(w)if(w.safePoint){const n=e.rooms.find(e=>e.id===w.id)||null,o=d(w.safePoint,m,t),a=o[0]-g[0],l=o[1]-g[1],c=Math.hypot(a,l);if(c<=pe)P="degraded",I="invalid-safe-point";else{const t=a/c,o=l/c,f=Math.min(r,c/i),d=f*i/c,u=[s[0]+(w.safePoint[0]-s[0])*d,s[1]+(w.safePoint[1]-s[1])*d],h=[t*f*i,o*f*i],p=Be([...b,...b.map(e=>[e[0]+h[0],e[1]+h[1]])]),m=p?e.wallSilhouettes.filter(t=>{const n=He(t,!0===e.wallGeometryValidated);return!!n&&Ne(p,n,M)}):e.wallSilhouettes,g=!!n&&Ve(s,u,n),y=n=>{const a=[t*n*i,o*n*i],r=b.map(e=>[e[0]+a[0],e[1]+a[1]]),s=Be(r);return!!s&&m.some(t=>Ae(r,s,t,M,!0===e.wallGeometryValidated))},x=e.nudgeHintCss;if(Number.isFinite(x)&&x>=0&&x<=f){const e=x*i/c,t=[s[0]+(w.safePoint[0]-s[0])*e,s[1]+(w.safePoint[1]-s[1])*e];(g||n&&Ve(s,t,n))&&!y(x)&&(S=x,k=!1)}if(null===k){let e=null,t=0,o=!1;const a=Math.ceil(f);for(let r=1;r<=a;r++){const a=Math.min(f,r),l=a*i/c,d=[s[0]+(w.safePoint[0]-s[0])*l,s[1]+(w.safePoint[1]-s[1])*l];if(!(g||n&&Ve(s,d,n))){o=!0;break}if(!y(a)){e=a;break}t=a}if(null!==e){let n=t,o=e;for(let e=0;e<14;e++){const e=(n+o)/2;y(e)?n=e:o=e}S=o}else S=t,z=!0,P="degraded",I=o?"owner-boundary":"nudge-cap"}$=[t*S*i,o*S*i]}}else P="degraded",I="invalid-safe-point";else P="degraded",I="missing-owner";const C=[g[0]+$[0],g[1]+$[1]],j=Ie(s,e.footprintHalfSize,m,t,$),O=!y||(k??x(j)),T=S>pe;return{plane:u,owner:w,floorAnchor:s,floorScene:l,raisedScene:g,visualScene:C,footprint:j,nudgeScene:$,nudgeCss:[$[0]/i,$[1]/i],nudgeDistanceCss:S,nudged:T,nearWallBefore:v,nearWallAfter:O,cleared:!O,capped:z,grounding:{center:l,visible:!1},tether:Le(l,C,!1),status:P,reason:I}}({kind:t,floorAnchor:s,rooms:i,roomsValidated:!0,preferredRoomId:u,ownerAlreadyResolved:!0,resolvedOwner:S,nudgeHintCss:w.hit&&w.value.shapeSignature===m?w.value.placement.nudgeDistanceCss*w.value.unitsPerPixel/n:void 0,showBorders:!0,wallSilhouettes:!1===e.resolveCollisions?[]:e.wallSilhouettes,wallGeometryValidated:!0,footprintHalfSize:l,wallHeight:a,visualOffset:r,sceneUnitsPerCssPixel:n});return B(y,p,{signature:g,shapeSignature:m,unitsPerPixel:n,placement:$},Bt),$};for(const t of e.devices){const n=e.positionOf(t),i=e.presentationOf(t,e.showLqi),a=x*i.scale*w,r=yt({kind:"device",core:a,presentation:i}),l=t.marker?.room_id||o.find(e=>!!t.area&&e.room.area===t.area)?.overlayRoom.id||null,c=v("device",t.id,[n.x,n.y],r,l);s.set(t.id,c),p.push({id:t.id,kind:"device",placement:c,groundRadius:Math.max(.32*a,2),screenHalfSize:r})}for(const{room:t,overlayRoom:n}of o){if(!e.display.showNames||!t.name)continue;const o=e.labelPositionOf(t,e.space.id),i=.5*b*(e.labelScaleOf(t)*e.kioskFontScale*e.display.cardFontScale),a=yt({kind:"room-label",font:i,room:t,display:e.display}),r=v("room-label",n.id,[o.x,o.y],a,n.id);l.set(t,r),p.push({id:n.id,kind:"room-label",placement:r,groundRadius:Math.max(.75*i,2),screenHalfSize:a})}const S=e.openings.filter(t=>!t.orphanReason&&("door"===t.type||"gate"===t.type)&&"string"==typeof t.lock&&!!t.lock&&e.openingEntityAvailable(t.lock));if(S.length){const t=e.openingWallIndex();for(const n of S){const o=Lt(n,t,e.cellCm),i=o.floorAnchor,a=.62*b*w,r=yt({kind:"opening-lock",size:a}),s=v("opening-lock",String(n.id),i,r,o.preferredRoomId);u.set(String(n.id),s),p.push({id:String(n.id),kind:"opening-lock",placement:s,groundRadius:Math.max(.28*a,2),screenHalfSize:r})}}const $=!1===e.resolveCollisions?"fit":"live";let k=Ft.get(e.wallSilhouettes);k||(k=new Map,Ft.set(e.wallSilhouettes,k));const z=k.get($),P=p.map(e=>{const t=e.placement;return[e.kind,e.id,t.floorAnchor[0],t.floorAnchor[1],t.raisedScene[0],t.raisedScene[1],t.nudgeScene[0],t.nudgeScene[1],t.owner?.id||"",t.status,t.reason||"",e.screenHalfSize[0],e.screenHalfSize[1],n].join("|")}).sort().join("");if(z?.collisionSignature===P&&At(z.rooms,l))return z;const I=new Map(z?.entries.map(e=>[`${e.kind}\0${e.id}`,e])||[]),C="live"===$?ct({items:p.flatMap(e=>{if("room-label"===e.kind)return[];const t=I.get(`${e.kind}\0${e.id}`),o=!!t&&t.screenHalfSize[0]===e.screenHalfSize[0]&&t.screenHalfSize[1]===e.screenHalfSize[1]&&t.placement.floorAnchor[0]===e.placement.floorAnchor[0]&&t.placement.floorAnchor[1]===e.placement.floorAnchor[1]&&(t.placement.owner?.id||"")===(e.placement.owner?.id||"");return[{id:e.id,kind:e.kind,placement:e.placement,screenHalfSize:e.screenHalfSize,...o?{nudgeHintCss:[t.placement.nudgeScene[0]/n,t.placement.nudgeScene[1]/n]}:{}}]}),rooms:i,wallSilhouettes:e.wallSilhouettes,sceneUnitsPerCssPixel:n,visualOffset:r}):{placements:new Map,residualPairs:[]},j=Object.freeze(p.map(e=>{if("room-label"===e.kind)return e;const t=C.placements.get(me(e.kind,e.id))||e.placement;return t===e.placement?e:{...e,placement:t}})),O=new Map,H=new Map;for(const e of j)"device"===e.kind?O.set(e.id,e.placement):"opening-lock"===e.kind&&H.set(e.id,e.placement);const N={devices:O,rooms:l,locks:H,entries:j,collisionSignature:P,residualPairs:Object.freeze([...C.residualPairs])};return z&&function(e,t){return e.length===t.length&&t.every((t,n)=>{const o=e[n];return o.id===t.id&&o.kind===t.kind&&o.placement===t.placement&&o.groundRadius===t.groundRadius&&o.screenHalfSize[0]===t.screenHalfSize[0]&&o.screenHalfSize[1]===t.screenHalfSize[1]})}(z.entries,N.entries)&&At(z.devices,N.devices)&&At(z.rooms,N.rooms)&&At(z.locks,N.locks)?z:(k.set($,N),N)}function Gt(e,t,n){return Lt(e,t,n).floorAnchor}function Lt(e,t,n){const o=!e.flip_v,i="gate"===e.type?e.partitionHost?k(e.partitionHost,o):$(t,{x:e.rx,y:e.ry,angle:e.angle,length:e.rlen,flip_v:o}):null,[a,r]=z({x:e.rx,y:e.ry,angle:e.angle,flipV:!!e.flip_v,gateFace:i},n);if(e.partitionHost)return{floorAnchor:a,preferredRoomId:null};const s=P(t,{x:e.rx,y:e.ry,angle:e.angle,length:e.rlen},!0),l=r?"negative":"positive";return{floorAnchor:a,preferredRoomId:s[l]?.roomId||null}}function Dt(e){let t=!1;try{t="undefined"!=typeof CSS&&"function"==typeof CSS.supports&&CSS.supports("filter","blur(1px)")}catch{t=!1}let n=!1;try{n="function"==typeof matchMedia&&matchMedia("(forced-colors: active)").matches}catch{n=!0}return function(e){const t=!!e.showBorders;return{structural:t,panels:t&&!e.hideOpenings,shadows:t&&e.filtersSupported&&!e.forcedColors,materialNuance:t&&e.filtersSupported&&!e.forcedColors,floorSymbols:!e.hideOpenings&&!t}}({showBorders:e.showBorders,hideOpenings:e.hideOpenings,filtersSupported:t,forcedColors:n})}function Wt(e,t,n,o){if(!e.panels||!t)return[];return t.openings.flatMap(e=>{const t=n[e.sourceIndex];return t?he(e,o(t)):[]}).sort((e,t)=>e.depth-t.depth||e.sourceIndex-t.sourceIndex||e.leaf-t.leaf)}function Et(e){const t=Dt(e.display),n=t.panels?Wt(t,e.scene,e.openings,e.amountOf):[],o=e.overlays(t),i=t=>({layers:t,panels:n,overlays:o,underlay:Yt(t,e.scene?.floor,e.cellCm),shadows:Jt(t,n,e.scene?.geometry,e.cellCm),walls:Qt(e.projection,t,e.scene,n,e.cellCm),grounds:Zt(o,t,e.cellCm),raised:Kt()});try{return i(t)}catch(e){if(!t.shadows&&!t.materialNuance)throw e;return i({...t,shadows:!1,materialNuance:!1})}}const qt=()=>s``;function _t(e){return`translate(${m(4,e)} ${m(8,e)})`}function Ut(e,t,n){const o=F(n);return s`<defs>
|
|
${"walls"===t&&e.materialNuance?s`
|
|
<linearGradient id="hp-iso-wall-side" data-hp-iso-material-def x1="0" y1="0" x2="0" y2="1">
|
|
<stop offset="0" class="iso-side-hi"></stop><stop offset="0.58" class="iso-side-mid"></stop><stop offset="1" class="iso-side-lo"></stop>
|
|
</linearGradient>
|
|
<linearGradient id="hp-iso-wall-top" data-hp-iso-material-def x1="0" y1="0" x2="1" y2="1">
|
|
<stop offset="0" class="iso-top-hi"></stop><stop offset="1" class="iso-top-lo"></stop>
|
|
</linearGradient>
|
|
<pattern id="hp-iso-wall-texture" data-hp-iso-material-def patternUnits="userSpaceOnUse"
|
|
width="${12*o}" height="${12*o}">
|
|
<circle class="iso-texture-mark" cx="${2*o}" cy="${2*o}"
|
|
r="${.55*o}"></circle>
|
|
<path class="iso-texture-line" d="M ${5*o} ${10*o}
|
|
l ${5*o} ${-5*o}"></path>
|
|
</pattern>`:r}
|
|
${"underlay"===t&&e.materialNuance?s`
|
|
<pattern id="hp-iso-floor-texture" data-hp-iso-material-def patternUnits="userSpaceOnUse"
|
|
width="${14*o}" height="${14*o}">
|
|
<circle class="iso-texture-mark" cx="${3*o}" cy="${3*o}"
|
|
r="${.5*o}"></circle>
|
|
</pattern>`:r}
|
|
${"underlay"===t&&e.shadows?s`
|
|
<filter id="hp-iso-ambient-shadow" data-hp-iso-material-def x="-12%" y="-12%" width="124%" height="130%">
|
|
<feGaussianBlur stdDeviation="${7*o}"></feGaussianBlur>
|
|
</filter>`:r}
|
|
</defs>`}function Zt(e,t,n){return qt()}function Kt(e){return qt()}function Yt(e,t,n){return e.structural&&t?s`<g class="iso-underlay" data-hp="iso-underlay" aria-hidden="true" pointer-events="none">
|
|
${Ut(e,"underlay",n)}
|
|
${e.shadows&&t.footprintPath?s`<path class="iso-ambient-shadow" d=${t.footprintPath}
|
|
transform=${_t(n)}></path>`:r}
|
|
<g class="iso-floor-edge">${t.sides.map(t=>s`<path class="iso-floor-side" d=${t.d} data-component=${t.component}
|
|
data-edge=${t.edge}></path>${e.materialNuance?s`<path class="iso-material-texture iso-floor-texture" d=${t.d}></path>`:r}`)}</g>
|
|
</g>`:qt()}function Jt(e,t,n,o){return qt()}function Qt(e,t,n,o,i){if("iso"!==e||!t.structural||!n)return qt();const a=t.panels?[...n.openingSurfaces,...o.flatMap(e=>e.surfaces.map(t=>({...t,id:e.id,sourceIndex:e.sourceIndex,type:e.type,leaf:e.leaf})))]:[],l=ht(n.geometry,a);return s`<g class="iso-walls" data-hp="iso-walls" data-fingerprint=${n.key}>
|
|
${Ut(t,"walls",i)}
|
|
<g class=${t.panels?"iso-wall-depth-queue iso-openings":"iso-wall-depth-queue"}
|
|
data-hp=${t.panels?"iso-openings":r}
|
|
aria-hidden="true" pointer-events="none">${l.map(e=>{if("wall-side"===e.layer){const n=e.face;return s`<path class="iso-wall-side" d=${n.d} data-edge=${n.edge}></path>${t.materialNuance?s`<path class="iso-material-texture iso-wall-texture" d=${n.d}></path>`:r}`}if("wall-top"===e.layer){const n=e.face;return s`<path class="iso-wall-top" d=${n.d} data-component=${n.component}
|
|
fill-rule="evenodd"></path>${t.materialNuance?s`<path class="iso-material-texture iso-wall-texture" d=${n.d}
|
|
fill-rule="evenodd"></path>`:r}`}const n=e.surface;return s`<path class="iso-opening-panel iso-${n.type} iso-opening-${n.kind} iso-material-${n.material}"
|
|
d=${n.d} data-id=${n.id} data-kind=${n.type}
|
|
data-surface=${n.kind} data-leaf=${n.leaf??r}></path>${t.materialNuance?s`<path class="iso-material-texture iso-wall-texture iso-opening-texture"
|
|
d=${n.d}></path>`:r}`})}</g>
|
|
</g>`}export{Bt as ISO_OVERLAY_PLACEMENT_CACHE_LIMIT,pt as ISO_RAISED_FOOTPRINT,ft as ISO_SCENE_RUNTIME_FINGERPRINT,Vt as buildIsoOverlayRenderScene,ht as buildIsoWallDepthQueue,q as computeIsoSunBeams,vt as createIsoStructuralSource,_t as isoFixedLightTransform,Gt as isoOpeningLockAnchor,Lt as isoOpeningLockPlacement,Rt as isoOverlayRooms,jt as isoOverlaySceneBounds,yt as isoRaisedOverlayHalfSize,Mt as isoSourceOpenings,xt as isoStructuralOpeningHost,bt as isoStructuralRoomGeometry,$t as isoWallSilhouettesOf,Zt as renderIsoOverlayGrounds,Kt as renderIsoRaisedOverlays,Jt as renderIsoShadows,Z as renderIsoSunWash,Yt as renderIsoUnderlay,Qt as renderIsoWalls,Dt as resolveIsoDecorationLayers,Et as resolveIsoFramePresentation,Wt as resolveIsoOpeningPanels,Ot as resolveIsoOverlayFitEnvelope,kt as resolveIsoScene};
|