1var Fn=Object.defineProperty;var Ln=(t,r,s)=>r in t?Fn(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s;var Zt=(t,r,s)=>Ln(t,typeof r!="symbol"?r+"":r,s);import{r as m,j as e}from"./react-jxH75lBa.js";import{u as de,a as Ie,c as mn,H as te,L as V,o as Nn,q as Zn,n as On,X as Hn,m as Dn,w as Gn,K as Bn,r as $n,j as Un,s as Yn,b as Xn}from"./r3f-vendor-BsXfCMQr.js";import{D as we,bg as ce,af as ke,c as he,g as H,E as xn,s as ee,t as At,ak as Q,C as Ve,ah as Kn,J as gn,a5 as Ot,bf as ct,w as Vn,az as qn,bA as Qn,bB as Jn,bC as es,bD as ts,z as wn,ar as fe,aB as ns,aT as ss,bm as os,b3 as rs,a6 as as}from"./three-cbYJ5cDI.js";import{p as cs,j as y,k as Z,l as _,m as bn,n as is,q as ls,r as ds,t as Ae,M as hs,v as O,w as us,x as fs,z as Ee,B as ps,D as pe,L as St,E as Ht,F as ms,X as qe,G as We,H as se,I as Qe,J as xs,K as gs,N as ws,O as bs,Q as Ms,U as ks,V as js,W as Ss,Y as Rs,Z as ys}from"./index-DWEGEl4F.js";const Es=new Map([["bold",m.createElement(m.Fragment,null,m.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",m.createElement(m.Fragment,null,m.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),m.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",m.createElement(m.Fragment,null,m.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",m.createElement(m.Fragment,null,m.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",m.createElement(m.Fragment,null,m.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",m.createElement(m.Fragment,null,m.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),_t=m.forwardRef((t,r)=>m.createElement(cs,{ref:r,...t,weights:Es}));_t.displayName="InfoIcon";const vs={bg:"#150a2a",floor:"#dde0e7",ceiling:"#0c071b",backWall:"#6b6488",frontWall:"#6b6488",sideWall:"#6b6488",ambient:"#eef1f7",hemiSky:"#f7f9ff",hemiGround:"#4a2d63",dirKey:"#ffffff",panel:"#f6f8ff",fill:"#e9ecf4",backFill:"#e5e8f2"},Cs={bg:"#22082a",floor:"#d6cdd6",ceiling:"#170719",backWall:"#261538",frontWall:"#87648a",sideWall:"#87648a",ambient:"#e09afb",hemiSky:"#f3c6f5",hemiGround:"#5e2d63",dirKey:"#fbe6fb",panel:"#f6cffb",fill:"#e8b1f5",backFill:"#dfa3f5"},Dt=.6;function Ps(){const r=document.createElement("canvas");r.width=r.height=256;const s=r.getContext("2d");s.fillStyle="#e9ebf0",s.fillRect(0,0,256,256),s.strokeStyle="rgba(46,48,56,0.85)",s.lineWidth=1.8,s.strokeRect(0,0,256,256);const n=new ce(r);
1return n.wrapS=n.wrapT=ke,n.colorSpace=he,n.anisotropy=8,n}function As(){const r=document.createElement("canvas");r.width=r.height=128;const s=r.getContext("2d"),n=s.createImageData(128,128);for(let o=0;o<n.data.length;o+=4){const l=118+Math.floor(Math.random()*20);n.data[o]=n.data[o+1]=n.data[o+2]=l,n.data[o+3]=255}s.putImageData(n,0,0);const a=new ce(r);return a.wrapS=a.wrapT=ke,a.anisotropy=4,a}function _s({hallWidth:t,zFront:r,zBack:s,layout:n}){const l=y(k=>k.inputs.system??"SN50")==="SN40"?Cs:vs,p=de(k=>k.camera),x=m.useRef(null),d=m.useRef(null);Ie(()=>{const k=p.position.z;x.current&&(x.current.visible=k<r-.5),d.current&&(d.current.visible=k>s+.5)});const u=r-s,c=(r+s)/2,f=Math.max(120,Math.max(u,t)*1.8),i=m.useMemo(()=>Ps(),[]),h=m.useMemo(()=>{const k=As();return k.repeat.set(16,8),k},[]),g=f/Dt,w=k=>k-Math.floor(k);i.repeat.set(g,g),i.offset.set(-w(.5*g),-w((c-n.frontRowZ)/Dt+.5*g));const j=m.useMemo(()=>{const k=Math.min(1.6,u*.18),C=Math.max(u-k*2,1),T=Math.max(3,Math.ceil(C/2.2)),I=3,W=t*.6,D=[],v=c-C/2+C/T/2;for(let N=0;N<T;N++)for(let G=0;G<I;G++){const U=G/(I-1)-.5;D.push([U*W,4.2-.02,v+N*C/T])}return D},[u,t,c]),M=m.useMemo(()=>n.rows.map(k=>({x:k.xCenter,z:k.z,width:k.width})),[n.rows]),b=l.bg,S=t/2;return e.jsxs("group",{children:[e.jsx("color",{attach:"background",args:[b]}),e.jsx("fog",{attach:"fog",args:[b,Math.max(16,u*1.1),Math.max(48,u*2.8)]}),e.jsx("ambientLight",{intensity:1.35,color:l.ambient}),e.jsx("hemisphereLight",{intensity:1.7,color:l.hemiSky,groundColor:l.hemiGround}),e.jsx("directionalLight",{position:[4.5,9,c+u*.3],intensity:1.6,color:l.dirKey}),e.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,c],children:[e.jsx("planeGeometry",{args:[f,f]}),e.jsx("meshStandardMaterial",{map:i,color:l.floor,roughness:.46,metalness:.06,envMapIntensity:.6})]}),e.jsxs("mesh",{rotation:[Math.PI/2,0,0],position:[0,4.2,c],children:[e.jsx("planeGeometry",{args:[f,f]}),e.jsx("meshStandardMaterial",{color:l.ceiling,roughness:.95,metalness:0})]}),e.jsxs("mesh",{ref:d,position:[0,4.2/2,s],children:[e.jsx("planeGeometry",{args:[t+1,4.2]}),e.jsx("meshStandardMaterial",{color:l.backWall,roughness:.92,metalness:.08,bumpMap:h,bumpScale:.045,side:we})]}),e.jsxs("mesh",{ref:x,position:[0,4.2/2,r],rotation:[0,Math.PI,0],children:[e.jsx("planeGeometry",{args:[t+1,4.2]}),e.jsx("meshStandardMaterial",{color:l.frontWall,roughness:.9,metalness:.1,bumpMap:h,bumpScale:.045,side:we})]}),e.jsxs("mesh",{position:[-S,4.2/2,c],rotation:[0,Math.PI/2,0],children:[e.jsx("planeGeometry",{args:[u,4.2]}),e.jsx("meshStandardMaterial",{color:l.sideWall,roughness:.88,metalness:.1,bumpMap:h,bumpScale:.045,side:we})]}),e.jsxs("mesh",{position:[S,4.2/2,c],rotation:[0,-Math.PI/2,0],children:[e.jsx("planeGeometry",{args:[u,4.2]}),e.jsx("meshStandardMaterial",{color:l.sideWall,roughness:.88,metalness:.1,bumpMap:h,bumpScale:.045,side:we})]}),j.map((k,C)=>e.jsxs("mesh",{position:k,rotation:[Math.PI/2,0,0],children:[e.jsx("planeGeometry",{args:[.5,1.4]}),e.jsx("meshBasicMaterial",{color:l.panel,toneMapped:!1})]},`light-${C}`)),M.map((k,C)=>e.jsxs("group",{position:[k.x,4.2-.7,k.z],children:[e.jsxs("mesh",{children:[e.jsx("boxGeometry",{args:[k.width,.12,.18]}),e.jsx("meshStandardMaterial",{color:"#15101c",roughness:.8,metalness:.5})]}),e.jsxs("mesh",{position:[0,-.07,0],children:[e.jsx("boxGeometry",{args:[k.width,.02,.04]}),e.jsx("meshBasicMaterial",{color:"#cfdcf2",toneMapped:!1})]})]},`bus-${C}`)),e.jsx("pointLight",{position:[0,2.6,r-3],distance:16,decay:1.4,intensity:2,color:l.fill}),e.jsx("pointLight",{position:[0,3,s+.8],distance:18,decay:1.3,intensity:1.7,color:l.backFill})]})}const be=55,it=64,tt=.6,ue=Z,zs=Ae.racksPerPod*ue,Ts=4*tt,Is=5*tt,Ws=2,Gt=2;function Fs(t,r){const s=r?t==="SN40"?[6]:[0,9]:[],n=t==="SN40"?12:8,a=n+s.length,o=(a-1)/2,l=Array.from({length:a},(p,x)=>x).filter(p=>!s.includes(p)).sort((p,x)=>Math.abs(p-o)-Math.abs(x-o));return{computePerPod:n,totalSlots:a,csrSlots:s,computeFillOrder:l}}const Ls={slots:[],rows:[],pods:0,contentWidth:zs,contentCenterZ:0,frontRowZ:.6,backRowZ:-.6,sizeZFront:14,sizeZBack:-4,walkZFront:3,w
1alkZBack:-3,zFront:14,zBack:-4,hallWidth:12},Bt=2.8,$t=1.4,lt=2*tt,Ns=3*tt;function Zs(t,r="aisle",s=Ws,n=!0,a="SN50"){const o=Math.max(0,Math.floor(t));if(o===0)return Ls;const l=Fs(a,n),p=l.totalSlots*ue,x=p+Ts,d=Math.ceil(o/l.computePerPod),u=Math.min(d,hs);if(u===1){const P=Math.min(l.computePerPod,o),E=[...l.csrSlots,...l.computeFillOrder.slice(0,P)].sort((xe,rt)=>xe-rt),R=Math.ceil(E.length/2),z=_/2+lt/2,F=[],K=(xe,rt,zn)=>(xe.forEach((Tn,at)=>{const In=(at-(xe.length-1)/2)*ue,Wn=l.csrSlots.includes(Tn)?"csr":"compute",Nt=xe.length===1?"both":at===0?"left":at===xe.length-1?"right":void 0;F.push({x:In,z:rt,kind:Wn,rotY:zn,...Nt?{exposedSide:Nt}:{}})}),xe.length*ue-(ue-Z)),$=K(E.slice(0,R),z,0),q=K(E.slice(R),-z,Math.PI),ie=[{z,rotY:0,width:$,xCenter:0,kind:"front",segments:[{xCenter:0,width:$}]},{z:-z,rotY:Math.PI,width:q,xCenter:0,kind:"rear",segments:[{xCenter:0,width:q}]}],me=Math.max($,q),st=z+_/2,ot=-z-_/2,An=Math.tan(be*Math.PI/180/2)*1.6,_n=(me/2+1.6)/An,Ft=st+Math.max(Ae.frontClearanceM+2,_n),Lt=ot-Ae.rearClearanceM-1;return{slots:F,rows:ie,pods:1,contentWidth:me,contentCenterZ:0,frontRowZ:st,backRowZ:ot,sizeZFront:Ft,sizeZBack:Lt,walkZFront:st+Bt,walkZBack:ot-$t,zFront:Ft,zBack:Lt,hallWidth:Math.max(10,me+Gt*2)}}const c=r==="backToback"&&u===2?1:Math.min(u,Math.max(1,Math.floor(s)));let f=Math.ceil(u/c);r==="backToback"&&f%2===1&&(f+=1);const i=[];if(c===1)i.push(0);else for(let P=0;P<c;P++){const E=Math.floor(P/2),R=x/2+E*x;i.push(P%2===0?-R:R)}const h=(f-1)/2,g=[],w=[];if(r==="backToback"){const P=_*2+lt+Ns,E=_/2+lt/2;for(let z=0;z<f;z++){const F=Math.floor(z/2),K=z%2;g.push(F*P+(K===0?E:-E)),w.push(K===0?0:Math.PI)}const R=g.reduce((z,F)=>z+F,0)/g.length;for(let z=0;z<f;z++)g[z]-=R}else for(let P=0;P<f;P++)g.push((P-h)*Is),w.push(0);const j=[],M=new Array(f).fill(1/0),b=new Array(f).fill(-1/0),S=Array.from({length:f},()=>[]),k=(P,E,R,z,F)=>{P.forEach((K,$)=>{const q=E+($-(P.length-1)/2)*ue,ie=l.csrSlots.includes(K)?"csr":"compute",me=P.length===1?"both":$===0?"left":$===P.length-1?"right":void 0;j.push({x:q,z:R,kind:ie,rotY:z,...me?{exposedSide:me}:{}}),q<M[F]&&(M[F]=q),q>b[F]&&(b[F]=q)}),S[F].push({xCenter:E,width:P.length*ue-(ue-Z)})},C=(P,E)=>E>=0&&E<c&&P>=0&&P<f&&P*c+E<u;let T=o;for(let P=0;P<u;P++){const E=Math.floor(P/c),R=P%c,z=i[R],F=Math.min(l.computePerPod,T);T-=F;const K=[...l.csrSlots,...l.computeFillOrder.slice(0,F)].sort(($,q)=>$-q);if(r==="backToback"&&w[E]===0&&E+1<f&&!C(E+1,R)){const $=Math.ceil(K.length/2);k(K.slice(0,$),z,g[E],w[E],E),k(K.slice($),z,g[E+1],w[E+1],E+1)}else k(K,z,g[E],w[E],E)}for(const P of S)P.sort((E,R)=>E.xCenter-R.xCenter);const I=g.map((P,E)=>({z:P,rotY:w[E],width:b[E]-M[E]+Z,xCenter:(M[E]+b[E])/2,kind:w[E]===0?"front":"rear",segments:S[E]})),W=Math.max(...i)-Math.min(...i)+p,D=j.map(P=>P.z),v=Math.max(...D)+_/2,N=Math.min(...D)-_/2,G=0,A=Math.tan(be*Math.PI/180/2)*1.6,B=(W/2+1.6)/A,Y=v+Math.max(Ae.frontClearanceM+2,B),X=N-Ae.rearClearanceM-1,ne=v+Bt,L=N-$t,J=Math.max(10,W+Gt*2);return{slots:j,rows:I,pods:u,contentWidth:W,contentCenterZ:G,frontRowZ:v,backRowZ:N,sizeZFront:Y,sizeZBack:X,walkZFront:ne,walkZBack:L,zFront:Y,zBack:X,hallWidth:J}}const Os=O/2,Ut=_/2+.006,Yt=Z/2+.006,ve={body:new ee,front:new ee().makeTranslation(0,0,Ut),rear:new ee().makeTranslation(0,0,-Ut).multiply(new ee().makeRotationY(Math.PI)),left:new ee().makeTranslation(-Yt,0,0).multiply(new ee().makeRotationY(-Math.PI/2)),right:new ee().makeTranslation(Yt,0,0).multiply(new ee().makeRotationY(Math.PI/2))};function Fe(t){const r=new H,s=new At,n=new H(1,1,1),a=new xn,o={body:[],front:[],rear:[],left:[],right:[]};for(const l of t){a.set(0,l.rotY,0);const p=new ee().compose(r.set(l.x,Os,l.z),s.setFromEuler(a),n);o.body.push(p.clone().multiply(ve.body)),o.front.push(p.clone().multiply(ve.front)),o.rear.push(p.clone().multiply(ve.rear)),(l.exposedSide==="left"||l.exposedSide==="both")&&o.left.push(p.clone().multiply(ve.left)),(l.exposedSide==="right"||l.exposedSide==="both")&&o.right.push(p.clone().multiply(ve.right))}return o}function Ce({geo:t,mat:r,mats:s}){const n=m.useRef(null);return m.useLayoutEffect(()=>{const a=n.current;if(a){for(let o=0;o<s.length;o++)a.setMatrixAt(o,s[o]);a.count=s.length,a.instanceMatrix.needsUpdate=!0}},[s]),s.length===0?null:e.jsx("instancedMesh",{ref:n,args:[t,r,s.length],frustumCulled:!1},s.length)}function Le({assets:t,mats:r}){return e.jsxs(e.Fragment,{children:[e.jsx(Ce,{geo:t.bodyGeo,mat:t.bodyMat,mats:r.body}),e.jsx(Ce,{geo:t.frontGeo,mat:t.frontMat,mats:r.front}),e.jsx(Ce,{geo:t.frontGeo,mat:t.rearMat,mats:r.rear}),e.jsx(Ce,{geo:t.sideGeo,mat:t.sideMat,mats:r.left}),e.jsx(Ce,{geo:t.sideGeo,mat:t.sideMat,mats:r.right})]})}function Hs({layout:t,skip:r}){const s=bn(),n=is(),a=m.useMemo(()=>Fe(t.slots.filter(u=>u.kind==="compute"&&!(r&&Math.abs(u.x-r.x)<.01&&Math.abs(u.z-r.z)<.01))),[t.slots,r]),o=m.useMemo(()=>Fe(t.slots.filter(u=>u.kind==="csr")),[t.slots]),l=ls(),p=ds(),x=m.useMemo(()=>Fe(t.slots.filter(u=>u.kind==="network")),[t.slots]),d=m.useMemo(()=>Fe(t.slots.filter(u=>u.kind==="gpu")),[t.slots]);return e.jsxs("group",{children:[e.jsx(Le,{assets:s,mats:a}),e.jsx(Le,{assets:n,mats:o}),e.jsx(Le,{assets:l,mats:x}),e.jsx(Le,{assets:p,mats:d})]})}const Rt=.6,Ds=.006,Gs=0,Bs=32,$s=16,Us=8,Xt=4.2;function Ys(){const s=document.createElement("canvas");s.width=256,s.height=8;const n=s.getContext("2d");n.fillStyle="#dcebff",n.fillRect(0,0,256,8),n.strokeStyle="rgba(120,150,195,0.9)",n.lineWidth=1.5;const a=16;for(let l=0;l<=a;l++){const p=l/a*256;n.beginPath(),n.moveTo(p,0),n.lineTo(p,8),n.stroke()}const o=new ce(s);
1return o.colorSpace=he,o.wrapS=ke,o.wrapT=ke,o.repeat.set(12,1),o.anisotropy=4,o}function Xs(){const r=document.createElement("canvas");r.width=128,r.height=128;const s=r.getContext("2d");s.fillStyle="#221a33",s.fillRect(0,0,128,128),s.strokeStyle="#171128",s.lineWidth=4,s.strokeRect(0,0,128,128),s.fillStyle="#0f0a1d";const n=10;for(let o=n;o<128-n/2;o+=n)for(let l=n;l<128-n/2;l+=n)s.beginPath(),s.arc(l,o,2.4,0,Math.PI*2),s.fill();const a=new ce(r);return a.colorSpace=he,a.wrapS=ke,a.wrapT=ke,a.anisotropy=8,a}function Ks({z:t,xCenter:r,width:s,base:n}){const a=Math.max(1,Math.round(s/Rt)),o=m.useMemo(()=>{const l=n.clone();return l.repeat.set(a,1),l.needsUpdate=!0,l},[n,a]);return m.useEffect(()=>()=>o.dispose(),[o]),e.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[r,Ds,t],children:[e.jsx("planeGeometry",{args:[s,Rt]}),e.jsx("meshStandardMaterial",{map:o,roughness:.85,metalness:.15})]})}function Kt({layout:t}){const r=m.useMemo(Xs,[]);m.useEffect(()=>()=>r.dispose(),[r]);const s=t.rows.slice(Math.max(0,t.rows.length-Bs));return e.jsx("group",{children:s.flatMap((n,a)=>{const o=n.kind==="rear"?-1:1,l=n.z+o*(_/2+Gs+Rt/2);return n.segments.map((p,x)=>e.jsx(Ks,{z:l,xCenter:p.xCenter,width:p.width,base:r},`vent-${a}-${x}`))})})}const je=.06,Ne=.06,dt=.12,ht=.012;function Vs({x:t,z:r,depth:s,side:n,frame:a,glaze:o}){const p=O-Ne-dt-ht,x=(s-2*je)/2+.02;return e.jsxs("group",{position:[t,0,r],rotation:[0,n*Math.PI/2,0],children:[[-1,1].map(d=>e.jsx("mesh",{position:[d*(s-je)/2,O/2,0],material:a,children:e.jsx("boxGeometry",{args:[je,O,je]})},`post${d}`)),e.jsx("mesh",{position:[0,O-Ne/2,0],material:a,children:e.jsx("boxGeometry",{args:[s,Ne,je]})}),e.jsx("mesh",{position:[0,O-Ne-dt/2,0],material:a,children:e.jsx("boxGeometry",{args:[s-2*je,dt,.1]})}),[-1,1].map(d=>e.jsx("mesh",{position:[d*x/2,ht+p/2,d*-.01],renderOrder:2,material:o,children:e.jsx("planeGeometry",{args:[x,p]})},`leaf${d}`)),e.jsx("mesh",{position:[0,ht+p/2,0],material:a,children:e.jsx("boxGeometry",{args:[.03,p,.05]})}),[-1,1].map(d=>e.jsx("mesh",{position:[d*.055,1.05,.03],material:a,children:e.jsx("boxGeometry",{args:[.018,.45,.018]})},`handle${d}`))]})}function qs({layout:t,doors:r=!0}){const s=m.useMemo(()=>{const d=t.rows,u=[];for(let f=0;f+1<d.length;f+=2){const i=d[f],h=d[f+1];if(i.kind!=="front"||h.kind!=="rear")continue;const g=(i.z+h.z)/2,w=i.z-h.z-_,j=[],M=Math.min(i.segments.length,h.segments.length);for(let b=0;b<M;b++){const S=i.segments[b],k=h.segments[b],C=Math.min(S.xCenter-S.width/2,k.xCenter-k.width/2),T=Math.max(S.xCenter+S.width/2,k.xCenter+k.width/2);j.push({z:g,depth:w,xCenter:(C+T)/2,width:T-C,doors:!1})}j.length&&u.push({z:g,entries:j})}u.sort((f,i)=>i.z-f.z);const c=u.slice(0,$s);return c.slice(0,r?Us:0).forEach(f=>f.entries.forEach(i=>{i.doors=!0})),c.flatMap(f=>f.entries)},[t,r]),n=m.useMemo(()=>new Q({color:"#2a1418",transparent:!0,opacity:.18,roughness:.4,metalness:.05,emissive:new Ve("#421d15"),emissiveIntensity:.1,side:we,depthWrite:!1}),[]);m.useEffect(()=>()=>n.dispose(),[n]);const a=m.useMemo(Ys,[]),o=m.useMemo(()=>new Q({map:a,color:"#eaf3ff",transparent:!0,opacity:.24,roughness:.15,metalness:0,side:we,depthWrite:!1}),[a]);m.useEffect(()=>()=>{o.dispose(),a.dispose()},[o,a]);const l=Xt-O,p=(Xt+O)/2,x=m.useMemo(()=>({frame:new Q({color:"#2e2a3a",metalness:.6,roughness:.4}),glaze:new Q({color:"#3a262c",transparent:!0,opacity:.22,roughness:.3,metalness:.05,emissive:new Ve("#46241c"),emissiveIntensity:.08,side:we,depthWrite:!1})}),[]);return m.useEffect(()=>{if(x)return()=>{x.frame.dispose(),x.glaze.dispose()}},[x]),e.jsx("group",{children:s.map((d,u)=>e.jsxs("group",{children:[[-1,1].map(c=>e.jsxs("mesh",{position:[d.xCenter,O+.03,d.z+c*d.depth/2],children:[e.jsx("boxGeometry",{args:[d.width,.06,.06]}),e.jsx("meshStandardMaterial",{color:"#262230",roughness:.6,metalness:.5})]},`rail${c}`)),[-1,1].map(c=>e.jsx("mesh",{position:[d.xCenter,p,d.z+c*d.depth/2],renderOrder:3,material:o,children:e.jsx("planeGeometry",{args:[d.width,l]})},`curtain-long${c}`)),[-1,1].map(c=>e.jsx("mesh",{rotation:[0,Math.PI/2,0],position:[d.xCenter+c*d.width/2,p,d.z],renderOrder:3,material:o,children:e.jsx("planeGeometry",{args:[d.depth,l]})},`curtain-end${c}`)),d.doors&&[-1,1].map(c=>x?e.jsx(Vs,{x:d.xCenter+c*d.width/2,z:d.z,depth:d.depth,side:c,frame:x.frame,glaze:x.glaze},c):e.jsx("mesh",{rotation:[0,Math.PI/2,0],position:[d.xCenter+c*d.width/2,O/2,d.z],renderOrder:2,material:n,children:e.jsx("planeGeometry",{args:[d.depth,O]})},c))]},`aisle-${u}`))})}function Mn({layout:t,style:r,doors:s=!0}){return r==="aisle"?e.jsx(Kt,{layout:t}):e.jsxs(e.Fragment,{children:[e.jsx(Kt,{layout:t}),e.jsx(qs,{layout:t,doors:s})]})}
1const Qs="#6cc5ff",Js="#ff8a5c",eo=.45,to=.32,no=.38,so=1.4,ut=70,Vt=.2,oo=.4,qt=5,ro=9,ao=O+.02;function re(t){const r=Math.sin(t*127.1+311.7)*43758.5453;return r-Math.floor(r)}function co(){const s=document.createElement("canvas");s.width=32,s.height=256;const n=s.getContext("2d");n.clearRect(0,0,32,256);const a=n.createImageData(32,256);for(let l=0;l<256;l++){const p=l/256,x=.5+.5*Math.sin(p*Math.PI*2*4-Math.PI/2);for(let d=0;d<32;d++){const u=d/31,c=Math.max(0,1-Math.abs(u-.5)/.5),i=Math.pow(c,1.3)*(.55+.45*x),h=(l*32+d)*4;a.data[h]=255,a.data[h+1]=255,a.data[h+2]=255,a.data[h+3]=Math.round(Math.min(1,i)*255)}}n.putImageData(a,0,0);const o=new ce(s);return o.colorSpace=he,o.wrapS=Kn,o.wrapT=ke,o}function Qt(t,r){if(t.length<=r)return t;const s=[],n=t.length/r;for(let a=0;a<r;a++)s.push(t[Math.floor(a*n)]);return s}let oe=0;function io(t,r){const s=[],n=[];oe=t.slots.length*7349+(r==="aisle"?11:97);const a=l=>{const p=Vt+re(oe++)*(oo-Vt),x=re(oe++);return{dur:l/p,phase:x}};for(const l of t.rows){const p=l.kind==="rear"?-1:1,x=l.z+p*(_/2);for(const d of l.segments)for(let u=0;u<qt;u++){const c=(re(oe++)-.5)*.8,f=d.xCenter+d.width*((u+.5)/qt-.5)+c,i=x+p*(.12+re(oe++)*.32),h=1.7,g=.1;s.push({x:f,z:i,y0:g,y1:h,dx:(re(oe++)-.5)*.2,dz:(x-i)*.6,dir:1,...a(h-g)})}}if(r==="backToback"){const l=t.rows;for(let p=0;p+1<l.length;p+=2){const x=l[p],d=l[p+1];if(x.kind!=="front"||d.kind!=="rear")continue;const u=(x.z+d.z)/2,c=x.z-d.z-_,f=Math.min(x.segments.length,d.segments.length);for(let i=0;i<f;i++){const h=x.segments[i],g=d.segments[i],w=Math.min(h.xCenter-h.width/2,g.xCenter-g.width/2),j=Math.max(h.xCenter+h.width/2,g.xCenter+g.width/2);for(let M=0;M<ro;M++){const b=w+.4+re(oe++)*Math.max(.2,j-w-.8),S=ao+.15+re(oe++)*.5;n.push({x:b,z:u+(re(oe++)-.5)*c*.6,y0:.3,y1:S,dx:(re(oe++)-.5)*.18,dz:(re(oe++)-.5)*.12,dir:1,...a(Math.max(.6,S-.3))})}}}}const o=s.length+n.length;if(o>ut){const l=Math.round(ut*s.length/o);return{cool:Qt(s,l),warm:Qt(n,ut-l)}}return{cool:s,warm:n}}const Ze=new H,Oe=new H,Jt=new H,en=new At,tn=new xn(0,0,0,"YXZ"),nn=new ee;function sn({streaks:t,tint:r,baseAlpha:s,texture:n}){const a=m.useRef(null),o=t.length,l=m.useMemo(()=>{const x=new gn(no,so),d=new Ot(new Float32Array(o),1);d.setUsage(ct),x.setAttribute("aAlpha",d);const u=new Ot(new Float32Array(o),1);return u.setUsage(ct),x.setAttribute("aScroll",u),x},[o]);m.useEffect(()=>()=>l.dispose(),[l]);const p=m.useMemo(()=>{const x=new Vn({map:n,color:new Ve(r),transparent:!0,depthWrite:!1,blending:Qn,side:qn});return x.onBeforeCompile=d=>{d.vertexShader=d.vertexShader.replace("#include <common>",`#include <common> 2attribute float aAlpha; 3attribute float aScroll; 4varying float vAlpha; 5varying vec2 vEnvUv;`).replace("#include <begin_vertex>",`vAlpha = aAlpha; 6#include <begin_vertex>`).replace("#include <uv_vertex>",`#include <uv_vertex> 7vEnvUv = uv; 8#ifdef USE_MAP 9vMapUv.y += aScroll; 10#endif`),d.fragmentShader=d.fragmentShader.replace("#include <common>",`#include <common> 11varying float vAlpha; 12varying vec2 vEnvUv;`).replace("vec4 diffuseColor = vec4( diffuse, opacity );",["float lenEnv = pow(max(sin(vEnvUv.y * 3.14159265), 0.0), 1.4);","float taper = 0.35 + 0.65 * lenEnv;","float widthEnv = clamp(1.0 - abs(vEnvUv.x - 0.5) / (0.5 * taper), 0.0, 1.0);","widthEnv *= widthEnv;","float env = lenEnv * widthEnv;","vec4 diffuseColor = vec4( diffuse, opacity * vAlpha * env );"].join(` 13`))},x.customProgramCacheKey=()=>"samba-airflow-streak",x},[n,r]);return m.useEffect(()=>()=>p.dispose(),[p]),m.useEffect(()=>{var x;(x=a.current)==null||x.instanceMatrix.setUsage(ct)},[l]),Ie(({clock:x,camera:d})=>{var h;const u=a.current;if(!u)return;const c=l.getAttribute("aAlpha"),f=l.getAttribute("aScroll"),i=x.elapsedTime;Oe.copy(d.position),(h=u.parent)==null||h.worldToLocal(Oe);for(let g=0;g<o;g++){const w=t[g],j=(i/w.dur+w.phase)%1;Ze.set(w.x+w.dx*j,w.y0+(w.y1-w.y0)*j,w.z+w.dz*j);const M=Math.atan2(Oe.x-Ze.x,Oe.z-Ze.z);tn.set(0,M,0),en.setFromEuler(tn),Jt.set(1,1,1),nn.compose(Ze,en,Jt),u.setMatrixAt(g,nn),f.setX(g,-w.dir*i*.6%1);const b=j<.15?j/.15:j>.7?(1-j)/.3:1;c.setX(g,s*b)}u.instanceMatrix.needsUpdate=!0,c.needsUpdate=!0,f.needsUpdate=!0}),e.jsx("instancedMesh",{ref:a,args:[l,p,o],frustumCulled:!1,renderOrder:3})}function kn({layout:t,style:r}){const s=m.useMemo(co,[]);m.useEffect(()=>()=>s.dispose(),[s]);const{cool:n,warm:a}=m.useMemo(()=>io(t,r),[t,r]);return e.jsxs("group",{children:[n.length>0&&e.jsx(sn,{streaks:n,tint:Qs,baseAlpha:eo,texture:s}),a.length>0&&e.jsx(sn,{streaks:a,tint:Js,baseAlpha:to,texture:s})]})}const yt=3.05,ge=.3,Xe=.3,_e=.05,lo=.5,ho=.04,on=.02,ft="#262230",uo=4.2,He=3.27,De=.24,Ge=.03,fo=.22,pt="#3a3546",po=3.43,mo=.07,xo=.12,go="#c6d0e0",wo=2.2,Be=.015,rn=Xe/2+_e/2+.015,an=uo,cn=yt-.05,bo=.014,Mo=2.06,ko="#161221",jo=[[-.075,.05,.065,"#1b1622"],[.035,.04,.055,"#241c28"],[.105,.034,.045,"#141019"]];function $e({items:t,color:r,roughness:s,metalness:n}){const a=m.useRef(null);return m.useLayoutEffect(()=>{const o=a.current;if(!o)return;const l=new ee;t.forEach((p,x)=>{l.makeScale(p[3],p[4],p[5]),l.setPosition(p[0],p[1],p[2]),o.setMatrixAt(
13x,l)}),o.instanceMatrix.needsUpdate=!0},[t]),t.length===0?null:e.jsxs("instancedMesh",{ref:a,args:[void 0,void 0,t.length],frustumCulled:!1,children:[e.jsx("boxGeometry",{args:[1,1,1]}),e.jsx("meshStandardMaterial",{color:r,roughness:s,metalness:n})]},`boxes-${t.length}`)}function jn({layout:t,hangers:r=!0}){const s=m.useMemo(()=>t.rows.map(f=>({x:f.xCenter,z:f.z+(f.rotY===0?-ge:ge),width:f.width})),[t.rows]),n=m.useMemo(()=>{const f=[];for(const i of s){const h=Math.max(2,Math.round(i.width/lo)+1),g=i.width/(h-1);for(let w=0;w<h;w++)f.push([i.x-i.width/2+w*g,yt-on/2,i.z])}return f},[s]),a=m.useRef(null);m.useLayoutEffect(()=>{const f=a.current;if(!f)return;const i=new ee;n.forEach((h,g)=>{i.makeTranslation(h[0],h[1],h[2]),f.setMatrixAt(g,i)}),f.instanceMatrix.needsUpdate=!0},[n]);const o=m.useMemo(()=>{const f=[];for(const i of t.rows){const h=i.z+(i.rotY===0?-ge:ge);for(const g of i.segments)f.push({x:g.xCenter,z:h,width:g.width})}return f},[t.rows]),l=m.useMemo(()=>{const f=[];for(const i of o)f.push([i.x,He,i.z-De/2,i.width,Ge,Ge]),f.push([i.x,He,i.z+De/2,i.width,Ge,Ge]);return f},[o]),p=m.useMemo(()=>{const f=[];for(const i of o){const h=Math.max(2,Math.round(i.width/fo)+1),g=i.width/(h-1);for(let w=0;w<h;w++)f.push([i.x-i.width/2+w*g,He,i.z,.018,.012,De])}return f},[o]),x=m.useMemo(()=>o.map(f=>[f.x,po,f.z,f.width*.985,mo,xo]),[o]),d=m.useMemo(()=>{const f=new Set([...t.rows].sort((h,g)=>g.z-h.z).slice(0,14)),i=[];for(const h of t.rows){if(!f.has(h))continue;const g=h.z+(h.rotY===0?-ge:ge);for(const w of h.segments)i.push({x:w.xCenter,z:g,width:w.width})}return i},[t.rows]),u=m.useMemo(()=>{if(!r)return[];const f=[],i=an-cn,h=(an+cn)/2;for(const g of d){const w=Math.max(2,Math.round(g.width/wo)+1),j=g.width/(w-1);for(let M=0;M<w;M++){const b=g.x-g.width/2+M*j;f.push([b,h,g.z-rn,Be,i,Be]),f.push([b,h,g.z+rn,Be,i,Be])}}return f},[d,r]),c=m.useMemo(()=>{let f=[];if(t.rows.forEach((w,j)=>{const M=w.rotY===0?-1:1,b=t.slots.filter(S=>S.z===w.z&&S.rotY===w.rotY).map(S=>S.x).sort((S,k)=>S-k);for(let S=j%2;S<b.length;S+=2)f.push({x:b[S],z:w.z,dir:M})}),f.length===0)return null;const i=60;if(f.length>i){const w=Math.ceil(f.length/i);f=f.filter((j,M)=>M%w===0)}const h=f.map(({x:w,z:j,dir:M})=>{const b=j+M*ge,S=new Jn(new H(w,He-.02,b+M*(De/2-.02)),new H(w,3.2,j+M*.58),new H(w,Mo,j+M*.5));return new es(S,12,bo,5,!1)}),g=ts(h);return h.forEach(w=>w.dispose()),g},[t.rows,t.slots]);return m.useEffect(()=>()=>c==null?void 0:c.dispose(),[c]),s.length===0?null:e.jsxs("group",{children:[s.map((f,i)=>e.jsxs("group",{position:[f.x,yt,f.z],children:[e.jsxs("mesh",{position:[0,0,-Xe/2],children:[e.jsx("boxGeometry",{args:[f.width,_e,_e]}),e.jsx("meshStandardMaterial",{color:ft,roughness:.6,metalness:.5})]}),e.jsxs("mesh",{position:[0,0,Xe/2],children:[e.jsx("boxGeometry",{args:[f.width,_e,_e]}),e.jsx("meshStandardMaterial",{color:ft,roughness:.6,metalness:.5})]}),jo.slice(0,i%2===0?3:2).map(([h,g,w,j],M)=>e.jsxs("mesh",{position:[0,g/2+.004,h],children:[e.jsx("boxGeometry",{args:[f.width*(.99-M*.04),g,w]}),e.jsx("meshStandardMaterial",{color:j,roughness:.85,metalness:.1})]},`bundle-${M}`))]},`tray-${i}`)),e.jsxs("instancedMesh",{ref:a,args:[void 0,void 0,n.length],frustumCulled:!1,children:[e.jsx("boxGeometry",{args:[ho,on,Xe]}),e.jsx("meshStandardMaterial",{color:ft,roughness:.6,metalness:.5})]},`rungs-${n.length}`),e.jsxs("group",{children:[e.jsx($e,{items:l,color:pt,roughness:.55,metalness:.6}),e.jsx($e,{items:p,color:pt,roughness:.55,metalness:.6}),e.jsx($e,{items:x,color:go,roughness:.55,metalness:.05}),e.jsx($e,{items:u,color:pt,roughness:.5,metalness:.65}),c&&e.jsx("mesh",{geometry:c,frustumCulled:!1,children:e.jsx("meshStandardMaterial",{color:ko,roughness:.85,metalness:.15})})]})]})}const zt=[0,Math.PI/2,0],So=4,Ro=8,yo=4,Eo=2;function Tt(t){return m.useMemo(()=>t.clusterTops.map(r=>us(r)),[t.clusterTops])}function vo({layout:t}){const r=Tt(t);return e.jsx("group",{rotation:zt,children:r.map((s,n)=>e.jsx(jn,{layout:s,hangers:n<So},`trays-${n}`))})}function Co({layout:t,style:r}){const s=Tt(t);return e.jsx("group",{rotation:zt,children:s.slice(0,Ro).map((n,a)=>e.jsx(Mn,{layout:n,style:r,doors:a<yo},`cool-${a}`))})}function Po({layout:t,style:r}){const s=Tt(t),n=m.useMemo(()=>{const a=s.slice(0,Eo);return{rows:a.flatMap(o=>o.rows),slots:a.flatMap(o=>o.slots)}},[s]);return e.jsx("group",{rotation:zt,children:e.jsx(kn,{layout:n,style:r})})}const Ao=.03,_o=.006,zo=6;function Sn(t){const r=y(a=>a.walkTurn),s=y(a=>a.walkTilt),n=m.useRef({id:-1,x0:0,y0:0,x:0,y:0,moved:!1,tapped:!1,pointerSeen:!1});return{onPointerDown:a=>{var l,p;a.stopPropagation();const o=n.current;o.id=a.pointerId,o.x0=o.x=a.clientX,o.y0=o.y=a.clientY,o.moved=!1,o.pointerSeen=!0,(p=(l=a.currentTarget).setPointerCapture)==null||p.call(l,a.pointerId)},onPointerMove:a=>{const o=n.current;if(o.id!==a.pointerId)return;const l=a.clientX-o.x,p=a.clientY-o.y;o.x=a.clientX,o.y=a.clientY,!(!o.moved&&Math.hypot(a.clientX-o.x0,a.clientY-o.y0)<zo)&&(o.moved=!0,r(l*Ao),s(-p*_o))},onPointerUp:a=>{const o=n.current;o.id===a.pointerId&&(o.id=-1,o.moved||(o.tapped=!0,t()))},onPointerCancel:()=>{n.current.id=-1},onClick:a=>{a.stopPropagation();const o=n.current;if(o.pointerSeen){o.pointerSeen=!1,o.tapped=!1;return}t()}}}const ln=new Map,mt=8;function nt(t,r=!0,s,n=!1){const a=m.useRef(null);return m.useEffect(()=>{if(!r)return;const o=a.current;let l=0,p=0,x=0;const d=s?ln.get(s)??new Map:null;s&&d&&ln.set(s,d);const u=()=>{const c=a.current;if(c){const f=c.getBoundingClientRect();
13let i=f.left,h=f.right,g=f.top,w=f.bottom,j=f.top,M=f.bottom;for(const T of c.children){const I=T.getBoundingClientRect();I.width>0&&(i=Math.min(i,I.left),h=Math.max(h,I.right),j=Math.min(j,I.top),M=Math.max(M,I.bottom))}n||(g=j,w=M),i-=p,h-=p,g-=x,w-=x;const[b,S]=t({top:j-x,bottom:M-x});let k=0,C=0;if(h-i>S-b||i<b?k=b-i:h>S&&(k=S-h),d){const T=[];for(const[W,D]of d){if(W===c)break;if(!W.isConnected){d.delete(W);continue}D.right-D.left>=1&&T.push(D)}const I=(W,D,v,N)=>T.filter(G=>!(G.top>=N||G.bottom<=v||G.left>=D||G.right<=W));if(I(i+k,h+k,g,w).length){const W=[];for(const v of T)W.push(v.right+mt-i,v.left-mt-h);W.sort((v,N)=>Math.abs(v-k)-Math.abs(N-k));let D=!1;for(const v of W)if(!(i+v<b||h+v>S)&&I(i+v,h+v,g,w).length===0){k=v,D=!0;break}if(!D){let v=-1/0;for(const N of I(i+k,h+k,g,w))v=Math.max(v,N.bottom);C=v+mt-g}}d.set(c,{left:i+k,right:h+k,top:g+C,bottom:w+C})}(Math.abs(k-p)>.5||Math.abs(C-x)>.5)&&(p=k,x=C,c.style.transform=p||x?`translate(${p.toFixed(1)}px, ${x.toFixed(1)}px)`:"")}l=requestAnimationFrame(u)};return l=requestAnimationFrame(u),()=>{cancelAnimationFrame(l),o&&(o.style.transform="",d==null||d.delete(o))}},[t,r,s]),a}const Rn="/sambanova/sn50-chip.glb";mn.preload(Rn);const ye=.55,ze=.135,Te=.95,ae=.012,Pe=.014,Se=.06,Je=.022,xt=Te-Je,gt=-Je/2,Ue=fe.smoothstep;let Ye=null;function To(){if(Ye)return Ye;const t=1024,r=256,s=document.createElement("canvas");s.width=t,s.height=r;const n=s.getContext("2d"),a=document.createElement("canvas");a.width=t,a.height=r;const o=a.getContext("2d");o.fillStyle="#000000",o.fillRect(0,0,t,r);const l=n.createLinearGradient(0,0,0,r);l.addColorStop(0,"#f1eef3"),l.addColorStop(1,"#dcd8e0"),n.fillStyle=l,n.fillRect(0,0,t,r);const p=(i,h)=>{n.fillStyle="#d4d0d9",n.fillRect(120,i,t-240,h-i),n.fillStyle="#6b6874";for(let g=i+8;g<h-4;g+=11)for(let w=128;w<t-124;w+=11)n.beginPath(),n.arc(w,g,3,0,Math.PI*2),n.fill()};p(16,74),p(182,240);const x=n.createLinearGradient(0,84,0,172);x.addColorStop(0,"#221a2a"),x.addColorStop(.45,"#17111b"),x.addColorStop(1,"#0f0b12"),n.fillStyle=x,n.fillRect(120,84,t-240,88),n.fillStyle="rgba(255,255,255,0.06)",n.fillRect(120,84,t-240,18);const d=i=>{const h=n.createLinearGradient(i,0,i+112,0);h.addColorStop(0,"#8b72c6"),h.addColorStop(1,"#7259ad"),n.fillStyle=h,n.fillRect(i,0,112,r),n.fillStyle="rgba(0,0,0,0.18)",n.fillRect(i,r-14,112,14)};d(0),d(t-112),["#7ee787","#7ee787","#ffb347","#3a3344"].forEach((i,h)=>{n.fillStyle=i,n.beginPath(),n.arc(56,60+h*42,7,0,Math.PI*2),n.fill(),h<3&&(o.fillStyle=i,o.beginPath(),o.arc(56,60+h*42,7,0,Math.PI*2),o.fill())}),n.fillStyle="#2a2233",n.fillRect(t-68,88,22,80),n.fillStyle="#c5b8e0",n.fillRect(t-66,96,18,8);const c=new ce(s);
13c.colorSpace=he,c.anisotropy=8;const f=new ce(a);return f.colorSpace=he,fs().then(i=>{const g=52*(i.width/i.height);n.drawImage(i,300,128-52/2,g,52),o.save(),o.globalAlpha=.35,o.drawImage(i,300,128-52/2,g,52),o.restore(),c.needsUpdate=!0,f.needsUpdate=!0}).catch(()=>{n.fillStyle="#eef0ff",n.font="600 44px Inter, system-ui, sans-serif",n.textBaseline="middle",n.fillText("sambanova",330,128),c.needsUpdate=!0}),Ye={albedo:c,emissive:f},Ye}function Io(t){const n=document.createElement("canvas");n.width=1024,n.height=1761;const a=n.getContext("2d");a.fillStyle="#08070c",a.fillRect(0,0,1024,1761);for(let u=0;u<2600;u++)a.fillStyle=`rgba(255,255,255,${(Math.random()*.03).toFixed(3)})`,a.fillRect(Math.random()*1024,Math.random()*1761,3,3);const o=t.map(([u,c])=>({x:u*1024,y:(1-c)*1761})),l=(u,c,f=0)=>o.some(i=>Math.abs(u-i.x)<200+f&&Math.abs(c-i.y)<200+f);for(let u=40;u<1501;u+=36)for(let c=40;c<984;c+=36)l(c,u,30)||(c/36|0)%2!==(u/36|0)%2&&(a.fillStyle=Math.random()<.85?"#141219":"#1c1a22",a.fillRect(c,u,26,26));const p=[150,200,250,300,874,824,774,724];for(const u of p){a.fillStyle="#050408",a.fillRect(u-8,380,16,420),a.fillStyle="#d0d0d8";for(let c=392;c<790;c+=12)a.fillRect(u-2,c,4,4)}a.fillStyle="#08070b";for(const u of[140,420,700])a.fillRect(u,8,180,60);a.fillStyle="#2a2833";for(const u of[140,420,700])for(let c=0;c<6;c++)a.fillRect(u+12+c*28,22,16,30);a.fillStyle="#b8b8c0";const x=[[90,1e3],[930,1e3],[90,1200],[930,1200],[512,300],[512,1550],[200,1550],[820,1550],[512,900]];for(const[u,c]of x)a.beginPath(),a.arc(u,c,8,0,Math.PI*2),a.fill();for(const u of o)a.fillStyle="#0e0c14",a.fillRect(u.x-175,u.y-175,350,350),a.strokeStyle="#2b2437",a.lineWidth=6,a.strokeRect(u.x-175,u.y-175,350,350);const d=new ce(n);return d.colorSpace=he,d.anisotropy=8,d}function Wo(){const t=document.createElement("canvas");t.width=64,t.height=16;const r=t.getContext("2d");r.fillStyle="#050507",r.fillRect(0,0,64,16),r.fillStyle="#2b2b31";for(let n=0;n<8;n++)r.fillRect(n*8+2,0,3,16);const s=new ce(t);
13return s.colorSpace=he,s}let wt=null;function Fo(){const t=To(),r=new Q({map:t.albedo,emissiveMap:t.emissive,emissive:new Ve("#ffffff"),emissiveIntensity:.9,roughness:.55,metalness:.15}),s=new Q({color:"#d9d5de",roughness:.6,metalness:.15}),n=new Q({color:"#1a1a20",roughness:.55,metalness:.6}),a=new Q({color:"#b9b7bd",roughness:.42,metalness:.8}),o=new Q({color:"#070609",roughness:.7,metalness:.35}),l=new Q({map:Wo(),roughness:.6,metalness:.55}),p=new Q({color:"#8f8f98",roughness:.5,metalness:.6});return{bezelFace:r,bezelSide:s,graphite:n,rail:a,black:o,fin:l,cap:p}}function It(){return wt||(wt=Fo()),wt}const et=.105,Et=.1,vt=.5,Ct=.86,Pt=-.03,Lo=[[.5-et/vt,.5+(Et-Pt)/Ct],[.5+et/vt,.5+(Et-Pt)/Ct]],dn=new Map;function No(t){const r=t.name||"default",s=dn.get(r);if(s)return s;const n=t.clone();return n.normalMap=null,n.envMapIntensity=.9,n.color.set("#aeb4c2"),n.metalness=.7,n.roughness=1,r.startsWith("Cube.029")&&(n.color.set("#6f7685"),n.metalness=.35,n.roughnessMap=null,n.roughness=.55),n.vertexColors=!1,n.needsUpdate=!0,dn.set(r,n),n}const yn=.014,En=.004,Zo=.2,Oo=Math.PI/2-.34;function hn({x:t,liftRef:r}){const s=It(),n=mn(Rn),a=m.useMemo(()=>{const o=n.scene.clone(!0);o.traverse(x=>{const d=x;d.isMesh&&(d.material=No(d.material))}),o.rotation.y=-Math.PI/2,o.updateMatrixWorld(!0);const l=new ns().setFromObject(o),p=l.getCenter(new H);return o.position.set(-p.x,-p.y,-p.z),l.getSize(new H),o},[n]);return e.jsxs("group",{position:[t,ae+.004,Et],children:[e.jsx("mesh",{material:s.black,position:[0,.007,0],children:e.jsx("boxGeometry",{args:[.2,.014,.19]})}),e.jsx("mesh",{material:s.fin,position:[-.116,.016,0],children:e.jsx("boxGeometry",{args:[.03,.032,.17]})}),e.jsx("mesh",{material:s.fin,position:[.116,.016,0],children:e.jsx("boxGeometry",{args:[.03,.032,.17]})}),e.jsx("group",{ref:r,position:[0,yn+En,0],children:e.jsx("primitive",{object:a})})]})}function Ho({progress:t,slide:r=0}){const s=m.useRef(null),n=m.useRef(null),a=m.useRef(null),o=It(),l=m.useMemo(()=>new Q({map:Io(Lo),roughness:.7,metalness:.2}),[]),p=u=>{const c=Ue(u,.36,.66);s.current&&(s.current.position.z=c*r);const f=Ue(u,.66,.86),i=Ue(u,.78,1);for(const h of[n.current,a.current])h&&(h.position.y=yn+En+f*Zo,h.rotation.x=i*Oo)};Ie(()=>p(t.current));const x=Ue(t.current,.36,.66)*r,d=[o.bezelSide,o.bezelSide,o.bezelSide,o.bezelSide,o.bezelFace,o.bezelSide];return e.jsxs("group",{ref:s,position:[0,0,x],children:[e.jsx("mesh",{material:o.graphite,position:[0,ae/2,gt],children:e.jsx("boxGeometry",{args:[ye-2*Pe,ae,xt]})}),e.jsx("mesh",{material:o.rail,position:[-.268,Se/2,gt],children:e.jsx("boxGeometry",{args:[Pe,Se,xt]})}),e.jsx("mesh",{material:o.rail,position:[ye/2-Pe/2,Se/2,gt],children:e.jsx("boxGeometry",{args:[Pe,Se,xt]})}),e.jsx("mesh",{material:o.graphite,position:[0,ae+(Se-ae)/2,-Te/2+.007],children:e.jsx("boxGeometry",{args:[ye-2*Pe,Se-ae,.012]})}),e.jsx("mesh",{material:d,position:[0,ze/2,Te/2-Je/2],children:e.jsx("boxGeometry",{args:[ye,ze,Je]})}),e.jsx("mesh",{material:l,position:[0,ae+.002,Pt],rotation:[-Math.PI/2,0,0],children:e.jsx("planeGeometry",{args:[vt,Ct]})}),e.jsx(hn,{x:-et,liftRef:n}),e.jsx(hn,{x:et,liftRef:a}),[-.19,-.215,.19,.215].map(u=>e.jsx("mesh",{material:o.black,position:[u,ae+.01,-.2],children:e.jsx("boxGeometry",{args:[.011,.016,.2]})},u)),[[-.21,.02],[.21,.02],[-.21,.24],[.21,.24],[0,-.32]].map(([u,c])=>e.jsx("mesh",{material:o.cap,position:[u,ae+.0065,c],children:e.jsx("cylinderGeometry",{args:[.0045,.0045,.009,12]})},`${u}|${c}`)),[-.17,0,.17].map(u=>e.jsx("mesh",{material:o.black,position:[u,ae+.018,-.43],children:e.jsx("boxGeometry",{args:[.075,.036,.05]})},u))]})}function Do({positions:t,scale:r=1}){const s=It(),n=m.useRef(null),a=m.useRef(null),o=m.useMemo(()=>{const l=new wn(ye,ze*.96,Te-.004),p=new gn(ye,ze);return{body:l,face:p}},[]);return m.useLayoutEffect(()=>{const l=new ee,p=new At,x=new H(r,r,r);t.forEach((d,u)=>{var f,i;const c=d[1]+ze/2*r;(f=n.current)==null||f.setMatrixAt(u,l.compose(new H(d[0],c,d[2]-.002*r),p,x)),(i=a.current)==null||i.setMatrixAt(u,l.compose(new H(d[0],c,d[2]+Te/2*r+.001),p,x))});for(const d of[n.current,a.current])d&&(d.instanceMatrix.needsUpdate=!0,d.computeBoundingSphere())},[t,r]),e.jsxs(e.Fragment,{children:[e.jsx("instancedMesh",{ref:n,args:[o.body,s.graphite,t.length]}),e.jsx("instancedMesh",{ref:a,args:[o.face,s.bezelFace,t.length]})]})}const un=fe.smoothstep,vn=[.58,.43,.28,.13],Go=[-.34,-.48,-.62,-.87],Bo=[...vn,...Go],Ke=vn[2],Cn=t=>t-.07,$o=Bo.filter(t=>t!==Ke).map(t=>[0,Cn(t),.02]);function Wt(t){const r=t.slots.filter(o=>o.kind==="compute"&&Math.abs(Math.abs(o.rotY)-Math.PI/2)<.01);if(r.length){const o=r.filter(l=>l.rotY>0);return(o.length?o:r).slice().sort((l,p)=>p.z-l.z)[0]}const s=t.slots.filter(o=>o.kind==="compute"&&Math.abs(o.rotY)<.1);if(s.length===0)return null;const n=Math.max(...s.map(o=>o.z));return s.filter(o=>o.z>n-.01).sort((o,l)=>Math.abs(o.x)-Math.abs(l.x))[0]}function Uo({layout:t,mode:r}){const s=typeof window<"u"&&new URLSearchParams(window.location.search).get("xrdu")==="open",n=!1,a=bn(),o=m.useMemo(()=>Wt(t),[t]),l=y(R=>R.setWalkFocus),p=y(R=>R.clearWalkFocus),x=y(R=>R.trayOpen),d=y(R=>{var z;return((z=R.walkFocus)==null?void 0:z.kind)==="callout"}),u=y(R=>R.setTrayOpen),c=y(R=>R.setMode),f=y(R=>R.walkSettled),i=m.useMemo(()=>
13{if(!o)return null;const R=Math.sin(o.rotY),z=Math.cos(o.rotY),F=.96*1.05,K=o.x+R*F,$=o.z+.02+z*F,q=O/2+(Ke-.07),ie=.9;return{kind:"tray",id:"xrdu",pos:[K+R*ie,q+.46,$+z*ie],look:[K,q+.18,$-.02]}},[o]),h=x,g=Ee(),w=ps(),j=m.useCallback(()=>g?[12,window.innerWidth-12]:[340,window.innerWidth-16],[g]),M=nt(j,!h),[b,S]=m.useState(!1),k=m.useRef(!1),C=pe(t)?St:1/0,T=m.useRef(!1),[I,W]=m.useState(!1);m.useEffect(()=>{const R=window;let z=0,F=0;return R.requestIdleCallback?z=R.requestIdleCallback(()=>W(!0),{timeout:1500}):F=window.setTimeout(()=>W(!0),900),()=>{z&&R.cancelIdleCallback&&R.cancelIdleCallback(z),F&&clearTimeout(F)}},[]);const D=I||f||h||s||n;m.useLayoutEffect(()=>{s&&i&&!T.current&&(T.current=!0,l(i),u(!0))},[s,i,l,u]);const v=m.useRef(s?1:0),N=m.useRef(h);N.current=h;const G=m.useRef(r);G.current=r;const U=m.useRef(null),A=m.useRef(null),B=m.useRef(null);Ie((R,z)=>{const F=G.current==="walk"&&Math.abs(R.camera.position.x)>C+.5;if(F!==k.current&&(k.current=F,S(F)),G.current!=="walk"){v.current=0,A.current&&(A.current.visible=!1);return}const K=N.current?1:0;if(v.current!==K){const q=N.current?2.6:1.6,ie=Math.min(.05,z)/q;v.current=N.current?Math.min(1,v.current+ie):Math.max(0,v.current-ie)}const $=v.current;U.current&&(U.current.rotation.y=-un($,0,.25)*1.62),A.current&&(A.current.visible=$>.001),B.current&&(B.current.visible=$<.02)});const Y=m.useMemo(()=>new Q({color:"#0a0810",roughness:.95,metalness:.1,side:ss}),[]),X=m.useMemo(()=>new Q({color:"#191721",roughness:.7,metalness:.55}),[]),ne=m.useMemo(()=>new Q({color:"#24252c",roughness:.5,metalness:.6}),[]);if(m.useEffect(()=>{},[o]),!o)return null;const L=_/2,J=Z*.95,P=Ke,E=r==="walk";return e.jsxs("group",{position:[o.x,O/2,o.z+.02],rotation:[0,o.rotY,0],children:[E&&e.jsxs(e.Fragment,{children:[e.jsx("mesh",{ref:B,geometry:a.bodyGeo,material:a.bodyMat,position:[0,0,-.02]}),e.jsx("mesh",{material:Y,position:[0,0,.03],children:e.jsx("boxGeometry",{args:[Z*.99,O*.99,_*.97]})}),e.jsx("mesh",{geometry:a.sideGeo,material:a.sideMat,rotation:[0,-Math.PI/2,0],position:[-Z/2-.006,0,0]}),e.jsx("mesh",{geometry:a.sideGeo,material:a.sideMat,rotation:[0,Math.PI/2,0],position:[Z/2+.006,0,0]}),e.jsx("mesh",{geometry:a.frontGeo,material:a.rearMat,rotation:[0,Math.PI,0],position:[0,0,-_/2-.006]})]}),D&&e.jsxs("group",{ref:A,visible:s,children:[e.jsx("pointLight",{position:[0,P+.5,1.34],intensity:1.1,distance:1.6,decay:2,color:"#eef0ff"}),e.jsx("pointLight",{position:[0,.1,L-.2],intensity:.5,distance:2,decay:2,color:"#9a8fc0"}),e.jsx("pointLight",{position:[0,0,1.05],intensity:2.4,distance:4.6,decay:2,color:"#e6e8ff"}),e.jsx(Do,{positions:$o,scale:.96}),e.jsx("mesh",{material:ne,position:[0,-.08,0],children:e.jsx("boxGeometry",{args:[Z*.93,.34,_*.85]})}),e.jsxs("mesh",{position:[0,.06,L-.09],children:[e.jsx("boxGeometry",{args:[Z*.78,.016,.012]}),e.jsx("meshBasicMaterial",{color:"#5fd0ff",toneMapped:!1})]}),e.jsx("mesh",{material:ne,position:[0,.76,0],children:e.jsx("boxGeometry",{args:[Z*.93,.14,_*.85]})}),e.jsx("mesh",{material:ne,position:[0,-.73,0],children:e.jsx("boxGeometry",{args:[Z*.93,.11,_*.85]})})]}),D&&e.jsx("group",{position:[0,Cn(Ke),.02],scale:.96,children:e.jsx(Ho,{progress:v,slide:1.05})}),E&&n,E&&!n&&e.jsxs("group",{ref:U,position:[-J/2,0,L+.02],rotation:[0,-un(v.current,0,.25)*1.62,0],children:[e.jsx("mesh",{geometry:a.frontGeo,material:a.frontMat,position:[J/2,0,0]}),e.jsx("mesh",{geometry:a.frontGeo,material:X,rotation:[0,Math.PI,0],position:[J/2,0,-.01]})]}),r==="walk"&&(h||!b&&!d)&&e.jsx(te,{position:[0,h?.5:.05,h?.72:L+.12],center:!0,distanceFactor:h?g?2.4:w?3.3:4.6:g?void 0:6,zIndexRange:[20,0],style:{pointerEvents:"none"},children:h?e.jsxs("div",{className:`pointer-events-none flex items-center gap-2 ${g?"flex-col":"flex-row"}`,style:w&&!g?{transform:"translateX(-30%)"}:void 0,children:[e.jsxs("div",{className:"whitespace-nowrap rounded-md border border-purple-300/40 bg-black/80 px-2.5 py-1.5 text-center backdrop-blur-md",children:[e.jsx("div",{className:"text-[11px] font-semibold leading-tight text-white",children:"SambaRack SN50 · XRDU"}),e.jsx("div",{className:"text-[10px] leading-tight text-purple-200/80",children:"2 RDUs"})]}),e.jsxs("div",{className:"pointer-events-auto flex items-center gap-1.5",children:[e.jsxs("button",{onClick:R=>{R.stopPropagation(),u(!1),p(),c("inspect")},onPointerDown:R=>R.stopPropagation(),"aria-label":"Inspect this rack",className:"flex items-center gap-1 whitespace-nowrap rounded-full border border-cyan-200/70 bg-cyan-500/25 px-2.5 py-0.5 text-[10px] font-medium text-cyan-50 backdrop-blur-sm transition-transform hover:scale-105 active:scale-95",children:[e.jsx(Ht,{size:11,weight:"bold"})," Inspect"]}),e.jsx("button",{onClick:R=>{R.stopPropagation(),u(!1),p()},onPointerDown:R=>R.stopPropagation(),"aria-label":"Close XRDU",className:"flex h-6 w-6 items-center justify-center rounded-full border border-white/25 bg-black/60 text-white/70 backdrop-blur-md transition-colors hover:text-white",children:e.jsx(ms,{size:12,weight:"bold"})})]})]}):e.jsxs("button",{ref:M,onClick:R=>{R.stopPropagation(),i&&(l(i),u(!0))},onPointerDown:R=>R.stopPropagation(),"aria-label":"Open this XRDU",className:"pointer-events-auto flex items-center gap-1 whitespace-nowrap rounded-full border border-purple-200/90 bg-purple-500/70 px-2.5 py-0.5 text-[10px] font-medium text-white shadow-[0_0_12px_rgba(168,85,247,0.7)] backdrop-blur-sm transition-transform hover:scale-105 active:scale-95 sn-pulse",children:[e.jsx(Ht,{size:13,weight:"bold"})," Open XRDU"]})})]})}const Yo=3.28084,Me=t=>`${t.toFixed(1)} m · ${(t*Yo).toFixed(1)} ft`;function Xo({layout:t}){const r=y(n=>n.mode),s=y(n=>n.showMeasurements);return r!=="walk"?null:e.jsxs("group",{children:[e.jsx(Ko,{layout:t}),s&&e.jsx(qo,{layout:t})]})}function Ko({layout:t}){const r=y(c=>c.layoutStyle),s=y(c=>c.setWalkFocus),n=y(c=>c.clearWalkFocus),a=y(c=>c.walkFocus),o=y(c=>c.trayOpen),l=y(c=>c.setTrayOpen),p=Ee(),x=(a==null?void 0:a.kind)==="callout"?a.id:null;if((a==null?void 0:a.kind)==="tray"||o)return null;const d=Wt(t);if(!d)return null;let u;if(pe(t)&&t.rows.length===0){const c=O*.9,f=t.slots.filter(g=>g.kind==="csr").sort((g,w)=>w.z-g.z)[0],i=(g,w)=>({pos:[0,w,g[2]+2.2],look:[g[0],g[1],g[2]]}),h=p?[qe-_/2,O+.15,d.z-5*Z]:[qe+_/2,O+.4,d.z-2*Z];u=[{id:"tray",pos:[d.x+_/2+.2,1.9,d.z-4*Z],title:"Overhead trays",body:"Power ladder, data basket and fiber raceway routed above every row, with drops onto each rack.",below:!0,focus:i([d.x+_/2+.2,1.9,d.z-4*Z],1.7)},r==="backToback"?{id:"cool",pos:h,title:"Hot-aisle containment",body:"Each SN50 row exhausts rear-to-rear with the GPU row behind it into a contained hot aisle, curtained from the rack tops to the ceiling with doors at both ends, while this lane stays the open cold aisle.",below:!0,focus:i(h,1.7)}
13:{id:"cool",pos:[St*.5,.4,d.z-Z],title:"Under-floor power & cooling",body:"Power busways and chilled supply air run beneath the raised floor; cold air rises through the vented tiles of this aisle into the rack fronts on both sides (~21°C, in ASHRAEâs recommended range).",focus:{pos:[0,1.4,d.z+1.6],look:[St*.5,.4,d.z-Z]}}],f&&u.unshift({id:"csr",pos:[f.x+Math.sin(f.rotY)*(_/2+.18),c,f.z],title:"FSR â Core Services Rack",body:"Network, management & uplinks that tie the cluster together â one per cluster, at the end of the row beside the SUNW / SONW switches (FSR is the old name for CSR).",focus:i([f.x+Math.sin(f.rotY)*(_/2+.18),c,f.z],1.6)})}else{const c=t.rows.find(k=>k.kind==="front"&&Math.abs(k.z-d.z)<.05)??[...t.rows].filter(k=>k.kind==="front").sort((k,C)=>C.z-k.z)[0];if(!c)return null;const f=c.z+_/2,i=O*.9,h=[...c.segments].sort((k,C)=>k.xCenter-C.xCenter),g=h.length<2,w=g?c.xCenter-c.width*.3:h[0].xCenter,j=g?c.xCenter+c.width*.3:h[h.length-1].xCenter,M=t.slots.filter(k=>k.kind==="csr"&&Math.abs(k.z-c.z)<.05),b=(M.length?M:t.slots.filter(k=>k.kind==="csr")).sort((k,C)=>Math.abs(k.x-c.xCenter)-Math.abs(C.x-c.xCenter))[0],S=r==="backToback"?{id:"cool",pos:[j,O+.85,f+.2],title:"Hot-aisle containment",body:"Rack exhaust is captured and returned overhead, keeping the cold aisle cold."}:{id:"cool",pos:[j,.4,f+.3],title:"Under-floor power & cooling",body:"Power busways and chilled supply air run beneath the raised floor; cold air rises through these vented tiles into the rack fronts (~21°C, in ASHRAEâs recommended range)."};u=[{id:"tray",pos:[w,2.55,c.z],title:"Overhead trays",body:"Power (ladder) and data (basket + fiber) routed above every row, dropped to each rack.",below:!0},S],b&&u.unshift({id:"csr",pos:[b.x,i,b.z+_/2+.18],title:"CSR â Core Services Rack",body:"Network, management & uplinks that tie the pod together (2 per pod)."})}return e.jsx("group",{children:u.filter(c=>!x||c.id===x).map(c=>e.jsx(te,{position:c.pos,center:!0,zIndexRange:[9,0],style:{pointerEvents:"none"},children:e.jsx(Vo,{title:c.title,body:c.body,below:c.below,open:x===c.id,onToggle:()=>{if(x===c.id){n();return}if(l(!1),c.focus){s({kind:"callout",id:c.id,pos:c.focus.pos,look:c.focus.look});return}const[f,i,h]=c.pos,g=i>2.5,w=g?1.7:Math.min(2.3,Math.max(1.3,i*.5+1.4)),j=g?i-1.1:i,M=g?3.6:2.6;s({kind:"callout",id:c.id,pos:[f,w,h+M],look:[f,j,h]})},onClose:()=>n()})},c.id))})}function Vo({title:t,body:r,below:s,open:n,onToggle:a,onClose:o}){const l=Sn(a),p=y(j=>j.panelExpanded),x=Ee(),d=m.useCallback(j=>x?[8,window.innerWidth-8]:[340,window.innerWidth-(p||j.bottom>window.innerHeight-380?410:16)],[x,p]),u=nt(d,!0,"zone",!0),c=m.useRef(null),f=m.useRef(null),[i,h]=m.useState(0),[g,w]=m.useState(!1);return m.useEffect(()=>{if(!n){h(0),w(!1);return}let j=!1,M=0,b=0;const S=Array.from(document.querySelectorAll("[data-hud]")),k=()=>{const C=c.current,T=f.current;if(C&&T){let I=8,W=window.innerHeight-8;for(const L of S){const J=L.getBoundingClientRect();J.height<=0||(L.dataset.hud==="top"?I=Math.max(I,J.bottom+8):W=Math.min(W,J.top-8))}const D=C.getBoundingClientRect(),v=D.height,N=D.top-b,G=T.getBoundingClientRect(),U=G.bottom+10,A=G.top-10-v,B=L=>L>=I&&L+v<=W,Y=B(U)||B(A);Y===j&&(j=!Y,w(j));let X;v>W-I?X=(I+W)/2-v/2:s?X=B(U)?U:B(A)?A:Math.min(Math.max(N,I),W-v):X=B(A)?A:B(U)?U:Math.min(Math.max(N,I),W-v);const ne=X-N;Math.abs(ne-b)>.5&&(b=ne,h(ne))}M=requestAnimationFrame(k)};return M=requestAnimationFrame(k),()=>cancelAnimationFrame(M)},[n,s]),e.jsxs("div",{ref:u,className:"relative",style:{pointerEvents:"none"},children:[n&&e.jsxs("div",{ref:c,style:{pointerEvents:"auto",marginTop:i},className:["absolute left-1/2 w-[23rem] -translate-x-1/2 rounded-xl border border-white/25 bg-black/85 px-5 py-4 text-left shadow-xl backdrop-blur-md",s?"top-[170%]":"bottom-[170%]"].join(" "),onPointerDown:j=>j.stopPropagation(),children:[e.jsx("div",{className:"pr-6 text-[20px] font-semibold leading-tight text-white",children:t}),e.jsx("div",{className:"mt-1.5 text-[16px] leading-snug text-white/85",children:r}),e.jsx("button",{onClick:j=>{j.stopPropagation(),o()},onPointerDown:j=>j.stopPropagation(),"aria-label":"Close",className:"absolute right-2 top-2 flex h-7 w-7 items-center justify-center rounded-full text-white/55 hover:text-white",children:e.jsx("span",{className:"text-[22px] leading-none",children:"Ã"})})]}),e.jsx("button",{ref:f,...l,"aria-label":`Explain: ${t}`,style:{touchAction:"none",pointerEvents:n&&g?"none":"auto",opacity:n&&g?0:1},className:["flex h-11 w-11 items-center justify-center rounded-full border-2 backdrop-blur-sm transition-transform hover:scale-110 active:scale-95",n?"border-cyan-100 bg-cyan-300/55 text-white shadow-[0_0_28px_rgba(125,224,255,1)]":"border-cyan-100/90 bg-cyan-400/45 text-white shadow-[0_0_22px_rgba(125,224,255,0.95)] sn-pulse-info"].join(" "),children:e.jsx(_t,{size:24,weight:"bold"})})]})}function qo({layout:t}){return pe(t)&&t.rows.length===0?e.jsx(Qo,{layout:t}):e.jsx(Jo,{layout:t})}function Qo({layout:t}){const r=t.clusterTops[0],s=y(M=>M.layoutStyle)==="backToback",n=y(M=>M.outputs),a=n.weightKg,o=a>=1e6?`${(a/1e6).toFixed(1)}
13 kt`:`${Math.round(a/1e3).toLocaleString()} t`,l="#7ee0ff",p=1.55,x=r-Z*1.5,d=xs+_/2,u=qe-_/2,c=qe+_/2,f=gs-_/2,i=ws+.5,h=t.hallWidth/2,g=t.backRowZ-.35,w=se.sn50NodeRacks+se.spareRacks+se.scaleUpRacks+se.scaleOutRacks+se.csrRacks,j=(M,b,S)=>S==="x"?e.jsx(V,{points:[[M,p-.18,b],[M,p+.18,b]],color:l,lineWidth:2}):e.jsx(V,{points:[[M-.18,p,b],[M+.18,p,b]],color:l,lineWidth:2});return e.jsxs("group",{children:[e.jsx(V,{points:[[d,p,x],[u,p,x]],color:l,lineWidth:2}),j(d,x,"x"),j(u,x,"x"),e.jsx(te,{position:[0,p+.3,x],center:!0,zIndexRange:[8,0],style:{pointerEvents:"none"},children:e.jsx(le,{clamp:!0,label:`${s?"Cold aisle":"Intake aisle"} · ${Me(u-d)}`,info:s?"Contained cold aisle between the two facing SN50 rows â supply air is drawn into both rows of rack fronts here.":"Intake aisle between the two facing SN50 rows â cool supply air rises from the floor vents into both rows of rack fronts."})}),e.jsx(V,{points:[[c,p,x],[f,p,x]],color:l,lineWidth:2}),j(c,x,"x"),j(f,x,"x"),e.jsx(te,{position:[(c+f)/2,p+.3,x],center:!0,zIndexRange:[8,0],style:{pointerEvents:"none"},children:e.jsx(le,{clamp:!0,label:`${s?"Hot aisle":"Exhaust aisle"} · ${Me(f-c)}`,info:s?"Hot aisle â the SN50 row and the GPU row exhaust rear-to-rear here; the hot air is captured and returned.":"Rear exhaust aisle â the SN50 row and the GPU row exhaust rear-to-rear into this walkway."})}),e.jsx(V,{points:[[i,p,r],[i,p,r-We]],color:l,lineWidth:2}),j(i,r,"z"),j(i,r-We,"z"),e.jsx(te,{position:[i,p-.45,r-We],center:!0,zIndexRange:[8,0],style:{pointerEvents:"none"},children:e.jsx(le,{clamp:!0,label:`Cluster · ${Me(We)} · ${w} racks`,info:`One 256-socket cluster: two rows of ${Math.ceil((se.sn50NodeRacks+se.spareRacks)/2)} + ${Math.floor((se.sn50NodeRacks+se.spareRacks)/2)} SN50-16 with ${se.scaleUpRacks} SUNW at the row ends; the ${se.b300Racks} B300 racks run alongside. Clusters repeat down the hall.`})}),e.jsx(V,{points:[[-h,2.6,g],[h,2.6,g]],color:l,lineWidth:2}),e.jsx(V,{points:[[-h,2.42,g],[-h,2.78,g]],color:l,lineWidth:2}),e.jsx(V,{points:[[h,2.42,g],[h,2.78,g]],color:l,lineWidth:2}),e.jsx(te,{position:[-4.8,2.9,g],center:!0,zIndexRange:[8,0],style:{pointerEvents:"none"},children:e.jsx(le,{clamp:!0,label:`Hall width · ${Me(t.hallWidth)}`,info:"Interior width of the data hall, wall to wall: two GPU rows, two SN50 rows, the cold lane, two hot aisles and the outer aisles."})}),e.jsx(te,{position:[0,1.15,r+1.6],center:!0,zIndexRange:[8,0],style:{pointerEvents:"none"},children:e.jsx(le,{label:`Weight · ~${o}`,info:`${Qe[n.system].rack} kg/rack à ${n.rackCount.toLocaleString()} compute racks${n.csrCount?` · CSR racks ~${Qe[n.system].csr} kg each`:""}. Light, air-cooled racks â floor-standing on a slab, no raised floor.`})})]})}function Jo({layout:t}){var T;const r=t.frontRowZ,s=t.walkZFront,n=s-r,a=pe(t),o=a?(T=t.zoneGeoms.find(I=>I.id==="networking"))==null?void 0:T.frontZ:void 0,l=t.backRowZ,p=o??t.walkZBack,x=l-p,d=t.hallWidth/2,u=t.contentWidth/2-.5-3*Z,c=-u,f=u,i=1.9,h=a?t.backRowZ-.35:t.walkZBack+.03,g=2.6,w="#7ee0ff",j=y(I=>I.outputs),M=j.weightKg,b=M>=1e6?`${(M/1e6).toFixed(1)} kt`:`${Math.round(M/1e3).toLocaleString()} t`,S=y(I=>I.layoutStyle)==="backToback",k={label:S?"Cold aisle":"Intake aisle",info:S?"Cold aisle â chilled supply air is drawn into the rack fronts here.":"Front intake aisle â cool supply air rises from the floor vents into the rack fronts here."},C=o!==void 0?{label:"Zone corridor",info:"Service corridor between the SN50 decode block and the networking racks â the walkway the zone buttons fly you through. Rear exhaust leaves the SN50 racks here."}:{label:S?"Hot aisle":"Exhaust aisle",info:S?"Hot aisle â hot exhaust leaves the rack rears here and is captured for return.":"Rear exhaust aisle â hot air leaves the rack rears here."};return e.jsxs("group",{children:[e.jsx(V,{points:[[c,i,r],[c,i,s]],color:w,lineWidth:2}),e.jsx(V,{points:[[c,i-.18,r],[c,i+.18,r]],color:w,lineWidth:2}),e.jsx(V,{points:[[c,i-.18,s],[c,i+.18,s]],color:w,lineWidth:2}),e.jsx(te,{position:[c,i+.3,(r+s)/2],center:!0,zIndexRange:[8,0],style:{pointerEvents:"none"},children:e.jsx(le,{label:`${k.label} · ${Me(n)}`,info:k.info})}),e.jsx(V,{points:[[f,i,l],[f,i,p]],color:w,lineWidth:2}),e.jsx(V,{points:[[f,i-.18,l],[f,i+.18,l]],color:w,lineWidth:2}
13),e.jsx(V,{points:[[f,i-.18,p],[f,i+.18,p]],color:w,lineWidth:2}),e.jsx(te,{position:[f,i+.3,(l+p)/2],center:!0,zIndexRange:[8,0],style:{pointerEvents:"none"},children:e.jsx(le,{label:`${C.label} · ${Me(x)}`,info:C.info})}),e.jsx(V,{points:[[-d,g,h],[d,g,h]],color:w,lineWidth:2}),e.jsx(V,{points:[[-d,g-.18,h],[-d,g+.18,h]],color:w,lineWidth:2}),e.jsx(V,{points:[[d,g-.18,h],[d,g+.18,h]],color:w,lineWidth:2}),e.jsx(te,{position:[-3,g+.3,h],center:!0,zIndexRange:[8,0],style:{pointerEvents:"none"},children:e.jsx(le,{label:`Hall width · ${Me(t.hallWidth)}`,info:"Interior width of the data hall, wall to wall."})}),e.jsx(te,{position:[0,.62,s-.6],center:!0,zIndexRange:[8,0],style:{pointerEvents:"none"},children:e.jsx(le,{label:`Weight · ~${b}`,info:`${Qe[j.system].rack} kg/rack à ${j.rackCount.toLocaleString()} compute racks${j.csrCount?` · CSR racks ~${Qe[j.system].csr} kg each`:""}. Light, air-cooled racks â floor-standing on a slab, no raised floor.`})})]})}function le({label:t,info:r,clamp:s=!0}){const n=y(d=>d.panelExpanded),a=Ee(),o=m.useCallback(d=>a?[8,window.innerWidth-8]:[340,window.innerWidth-(n||d.bottom>window.innerHeight-380?410:16)],[a,n]),l=nt(o,s,"zone"),[p,x]=m.useState(!1);return e.jsxs("div",{ref:l,className:"relative flex items-center gap-1.5 whitespace-nowrap rounded-md border border-cyan-300/45 bg-black/75 px-2.5 py-1.5 text-[13px] font-medium text-cyan-100 backdrop-blur-sm",children:[e.jsx("span",{children:t}),e.jsx("button",{onClick:d=>{d.stopPropagation(),x(u=>!u)},onPointerDown:d=>d.stopPropagation(),"aria-label":`About ${t}`,style:{pointerEvents:"auto"},className:"flex h-5 w-5 items-center justify-center rounded-full text-cyan-200/70 hover:text-white",children:e.jsx(_t,{size:14,weight:"bold"})}),p&&e.jsx("div",{className:"absolute left-1/2 top-[135%] z-10 w-64 -translate-x-1/2 whitespace-normal rounded-md border border-white/15 bg-black/85 px-3 py-2 text-left text-[12px] font-normal leading-snug text-white/85 backdrop-blur-md",onPointerDown:d=>d.stopPropagation(),children:r})]})}const fn=3.2,er=2.2,tr=.4,nr=.7,pn=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function sr({layout:t,mode:r}){const s=de(A=>A.camera),n=y(A=>A.walkX),a=y(A=>A.walkZ),o=y(A=>A.walkYaw),l=y(A=>A.walkPitch),p=y(A=>A.walkEyeHeight),x=y(A=>A.walkFocus),d=y(A=>A.walkFallPending),u=y(A=>A.consumeWalkFall),c=y(A=>A.setWalkSpawn),f=y(A=>A.setWalkSettled),i=m.useRef(new H(0,3.4,14)),h=m.useRef(new H(0,1,0)),g=m.useRef(new H(0,1,0)),w=m.useRef(!1),j=m.useRef(Number.NaN),M=m.useRef(1),b=m.useRef(new H),S=m.useRef(new H),k=m.useRef(new H),C=m.useRef(new H),T=m.useRef(new H),I=m.useRef(Number.NaN),W=m.useRef(!0),D=m.useRef(r),v=m.useRef(1),N=m.useRef(new H),G=m.useRef(new H),U=m.useMemo(()=>{const A=t.slots;if(!A.length)return{cx:0,halfW:t.contentWidth/2};let B=1/0,Y=-1/0;for(const X of A)X.x<B&&(B=X.x),X.x>Y&&(Y=X.x);return{cx:(B+Y)/2,halfW:(Y-B)/2+.6}},[t]);return Ie((A,B)=>{const Y=Math.min(B,.03333333333333333),X=D.current;if(D.current=r,r==="walk"){if(d&&(u(),w.current=!1,j.current=t.slots.length,x||(b.current.copy(s.position),S.current.copy(h.current),M.current=0,c(s.position.x,s.position.z))),x)i.current.set(fe.clamp(x.pos[0],-t.hallWidth/2+.6,t.hallWidth/2-.6),x.pos[1],fe.clamp(x.pos[2],t.walkZBack+.6,t.sizeZFront-.6)),g.current.set(x.look[0],x.look[1],x.look[2]);else{i.current.set(n,p,a);const P=Math.cos(l),E=new H(Math.sin(o)*P,Math.sin(l)-.05,-Math.cos(o)*P);g.current.copy(i.current).add(E)}if(M.current<1&&!x){const P=Math.max(.001,b.current.y-p),E=fe.clamp(tr+P*.4,.5,1);M.current=Math.min(1,M.current+Y/E);const R=pn(M.current);s.fov=fe.lerp(be,it,R),s.updateProjectionMatrix(),s.position.set(b.current.x,fe.lerp(b.current.y,p,R),b.current.z),h.current.lerpVectors(S.current,g.current,R),s.lookAt(h.current);return}Math.abs(s.fov-it)>.01&&(s.fov=it,s.updateProjectionMatrix()),!x&&!w.current&&(w.current=!0,f(!0)),t.slots.length!==j.current&&(j.current=t.slots.length,x||(s.position.copy(i.current),h.current.copy(g.current)));const J=1-Math.exp(-6*Y);s.position.lerp(i.current,J),h.current.lerp(g.current,J),s.lookAt(h.current);return}if(M.current=1,Math.abs(s.fov-be)>.01&&(s.fov=be,s.updateProjectionMatrix()),W.current){const L=Math.tan(be*Math.PI/180/2)*s.aspect,J=U.halfW/(.74*L),P=Math.max(J,t.frontRowZ+2.4),E=t.frontRowZ-t.backRowZ,R=fe.clamp((E-10)/70,0,1),z=fn-R*(fn-er),F=t.contentCenterZ+Math.min(E*.28,P*.55);C.current.set(U.cx,z,t.contentCenterZ+P),T.current.set(U.cx,1.05,F),t.sizePose&&s.aspect>=1&&(C.current.set(...t.sizePose.pos),T.current.set(...t.sizePose.look)),X!=="walk"&&(s.position.copy(C.current),h.current.copy(T.current),s.lookAt(h.current),i.current.copy(C.current),g.current.copy(T.current)),W.current=!1,I.current=t.frontRowZ}else if(t.frontRowZ!==I.current){const L=t.frontRowZ-I.current;C.current.z+=L,T.current.z+=L,C.current.x=U.cx,T.current.x=U.cx,s.position.z+=L,h.
13current.z+=L,I.current=t.frontRowZ}if(i.current.copy(C.current),g.current.copy(T.current),X==="walk"&&(N.current.copy(s.position),G.current.copy(h.current),v.current=0,k.current.set(0,0,0)),v.current<1){v.current=Math.min(1,v.current+Y/nr);const L=pn(v.current);s.position.lerpVectors(N.current,i.current,L),h.current.lerpVectors(G.current,g.current,L),s.lookAt(h.current);return}s.position.sub(k.current);const ne=1-Math.exp(-6*Y);s.position.lerp(i.current,ne),h.current.lerp(g.current,ne);{const L=A.clock.elapsedTime;k.current.set(Math.sin(L*.25)*.06,Math.sin(L*.18)*.03,0),s.position.add(k.current)}s.lookAt(h.current)}),null}const or=O/2,bt=Z,rr=_+.3,ar=2,cr=1.4;let Mt=null,kt=null;function ir(){return Mt||(Mt=new wn(Z,O,_)),kt||(kt=new Q({color:"#b7b0c6",roughness:.95,metalness:.03})),{geo:Mt,mat:kt}}let Re=null;function lr(){if(Re)return Re;const t=512,r=128,s=document.createElement("canvas");s.width=t,s.height=r;const n=s.getContext("2d");return n.clearRect(0,0,t,r),n.fillStyle="#2e1a4d",n.font="800 56px Inter, system-ui, sans-serif",n.textBaseline="middle",n.textAlign="center",n.fillText("SPARES · COLD STANDBY",t/2,r/2),Re=new ce(s),Re.colorSpace=he,Re.anisotropy=4,Re}function dr({layout:t}){const{mats:r,labelPos:s,labelW:n}=m.useMemo(()=>{const p=Math.min(bs*Math.max(0,t.pods),Ms),x=Math.max(2,Math.floor(t.contentWidth/2/bt)-1),d=t.frontRowZ+ar+_/2,u=[],c=[0,0];for(let i=0;i<p;i++){const h=i%2,g=c[h]++,w=g%x,j=Math.floor(g/x),M=(h===0?-1:1)*(cr+(w+.5)*bt),b=d+j*rr;u.push(new ee().makeTranslation(M,or,b))}const f=Math.min(x,Math.ceil(p/2))*bt;return{mats:u,labelPos:[0,.02,d-_/2-.4],labelW:f}},[t]),a=m.useRef(null);if(m.useLayoutEffect(()=>{const p=a.current;if(p){for(let x=0;x<r.length;x++)p.setMatrixAt(x,r[x]);p.count=r.length,p.instanceMatrix.needsUpdate=!0}},[r]),r.length===0)return null;const{geo:o,mat:l}=ir();return e.jsxs("group",{children:[e.jsx("instancedMesh",{ref:a,args:[o,l,r.length],frustumCulled:!1},r.length),e.jsxs("mesh",{position:s,rotation:[-Math.PI/2,0,0],children:[e.jsx("planeGeometry",{args:[Math.min(n,9),Math.min(n,9)*.25]}),e.jsx("meshBasicMaterial",{map:lr(),transparent:!0,toneMapped:!1})]})]})}const Pn={prefill:{hex:"#c9c9d3",ring:"border-zinc-200/70",fill:"bg-zinc-300/25",text:"text-zinc-100"},networking:{hex:"#f1e9ff",ring:"border-violet-100/70",fill:"bg-violet-200/20",text:"text-violet-50"},decode:{hex:"#c9a4ff",ring:"border-purple-300/80",fill:"bg-purple-500/35",text:"text-purple-50"}},hr=O+.22,jt=O+.1;function ur({layout:t}){return pe(t)?e.jsx(fr,{layout:t}):null}function fr({layout:t}){const r=y(b=>b.mode),s=y(b=>b.walkFocus),n=y(b=>b.setWalkFocus),a=y(b=>b.clearWalkFocus),o=y(b=>b.trayOpen),l=y(b=>b.setTrayOpen),p=y(b=>b.walkEyeHeight),x=y(b=>b.setZoneAnchors),d=y(b=>b.setMode),u=Ee(),c=r==="walk",f=m.useMemo(()=>"",[]),i=(s==null?void 0:s.kind)==="callout"&&s.id.startsWith("zone-")?s.id.slice(5):null;m.useEffect(()=>(x(t.zoneGeoms.map(b=>({id:b.id,stand:b.stand,look:b.look}))),()=>x(null)),[t,x]);const h=c&&((s==null?void 0:s.kind)==="tray"||o),g=de(b=>b.size.width),w=!u&&!f.includes("pins")&&!h&&(c||g-340-410>=240),j=!f.includes("lines"),M=c&&!u&&!h&&!f.includes("labels");return e.jsxs("group",{children:[j&&t.zoneGeoms.flatMap(b=>b.marks.map((S,k)=>{const C=Math.max(.3,S.z0-S.z1),T=Pn[b.id].hex;return e.jsxs("group",{children:[e.jsxs("mesh",{position:[S.x,jt,(S.z0+S.z1)/2],children:[e.jsx("boxGeometry",{args:[.03,.012,C]}),e.jsx("meshBasicMaterial",{color:T,toneMapped:!1})]}),e.jsxs("mesh",{position:[S.x,jt-.13,S.z0-.015],children:[e.jsx("boxGeometry",{args:[.03,.26,.012]}),e.jsx("meshBasicMaterial",{color:T,toneMapped:!1})]}),e.jsxs("mesh",{position:[S.x,jt-.13,S.z1+.015],children:[e.jsx("boxGeometry",{args:[.03,.26,.012]}),e.jsx("meshBasicMaterial",{color:T,toneMapped:!1})]})]},`line-${b.id}-${k}`)})),M&&e.jsx(pr,{layout:t}),w&&t.zoneGeoms.filter(b=>!i||b.id===i).map(b=>{const S=t.hetero.zones.find(k=>k.id===b.id);return e.jsx(te,{position:[b.pin[0],hr,b.pin[1]],center:!0,zIndexRange:[9,0],style:{transform:"translate3d(-50%, -50%, 0)",pointerEvents:"none"},children:e.jsx(mr,{zone:S,geom:b,interactive:!0,open:i===b.id,onToggle:()=>{if(!c)d("walk");else if(i===b.id){a();return}l(!1),n(ks(b.id,b,p))},onClose:()=>a()})},`pin-${b.id}`)})]})}function pr({layout:t}){const r=de(o=>o.camera),[s,n]=m.useState([]),a=m.useMemo(()=>t.slots.map((o,l)=>({s:o,i:l})).filter(({s:o})=>o.label),[t.slots]);return m.useEffect(()=>{const o=()=>{const p=r.position.x,x=r.position.z,d=a.map(({s:u,i:c})=>({i:c,d:(u.x-p)**2+(u.z-x)**2})).filter(u=>u.d<7*7).sort((u,c)=>u.d-c.d).slice(0,10).map(u=>u.i).sort((u,c)=>u-c);n(u=>u.length===d.length&&u.every((c,f)=>c===d[f])?u:d)};o();const l=setInterval(o,400);return()=>clearInterval(l)},[r,a]),e.jsx(e.Fragment,{children:s.map(o=>{const l=t.slots[o];if(!l||!l.label)return null;const p=Math.sin(l.rotY),x=Math.cos(l.rotY);return e.jsx(te,{position:[l.x+p*(_/2+.03),O-.3,l.z+x*(_/2+.03)],center:!0,distanceFactor:3.2,zIndexRange:[6,0],style:{pointerEvents:"none",transform:"translate3d(-50%, -50%, 0)"},children:e.jsxs("div",{className:"whitespace-nowrap rounded-[3px] border border-white/25 bg-black/80 px-1.5 py-0.5 text-center leading-tight",children:[e.jsx("div",{className:"text-[9px] font-semibold tracking-[0.12em] text-white",children:l.label}),e.jsx("div",{className:"text-[8px] text-white/70",children:l.sub})]})},`np-${o}`)})})}
13function mr({zone:t,geom:r,interactive:s,open:n,onToggle:a,onClose:o}){const l=Sn(a),p=Pn[t.id],x=r.racks<t.racks,d=y(h=>h.panelExpanded),u=y(h=>h.mode),c=Ee(),f=m.useCallback(h=>c?[8,window.innerWidth-8]:[340,window.innerWidth-(d||u==="size"||h.bottom>window.innerHeight-380?410:16)],[c,d,u]),i=nt(f,!0,"zone");return e.jsxs("div",{ref:i,className:"relative flex flex-col items-center",style:{pointerEvents:"none"},children:[n&&e.jsxs("div",{className:"absolute left-1/2 top-[135%] w-[24rem] -translate-x-1/2 rounded-xl border border-white/25 bg-black/90 px-5 py-4 text-left shadow-xl",style:{pointerEvents:"auto"},onPointerDown:h=>h.stopPropagation(),children:[e.jsx("div",{className:`text-[11px] uppercase tracking-[0.2em] ${p.text}`,children:t.label}),e.jsx("div",{className:"mt-0.5 pr-6 text-[20px] font-semibold leading-tight text-white",children:t.headline}),e.jsx("div",{className:"mt-1 text-[14px] italic text-white/70",children:t.caption}),e.jsx("div",{className:"mt-2 text-[15px] leading-snug text-white/85",children:t.detail}),x&&e.jsxs("div",{className:"mt-2 text-[11px] text-white/45",children:["3D shows a representative ",r.racks," of ",t.racks.toLocaleString()," racks."]}),e.jsx("button",{onClick:h=>{h.stopPropagation(),o()},onPointerDown:h=>h.stopPropagation(),"aria-label":"Close",className:"absolute right-2 top-2 flex h-7 w-7 items-center justify-center rounded-full text-white/55 hover:text-white",children:e.jsx("span",{className:"text-[22px] leading-none",children:"Ã"})})]}),e.jsxs("button",{...l,"aria-label":`Zone: ${t.label}`,style:{touchAction:"none",pointerEvents:s?"auto":"none"},disabled:!s,className:["flex items-center gap-2 whitespace-nowrap rounded-full border px-3 py-1.5 text-left transition-transform",p.ring,n?"bg-black/85":"bg-black/75",s?"pointer-events-auto hover:scale-105 active:scale-95":"pointer-events-none"].join(" "),children:[e.jsx("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${p.fill} border ${p.ring}`,style:{backgroundColor:p.hex}}),e.jsx("span",{className:`text-[11px] font-semibold uppercase tracking-[0.18em] ${p.text}`,children:t.label}),e.jsx("span",{className:"h-3 w-px bg-white/20"}),e.jsxs("span",{className:"text-[12px] text-white/85",children:[t.racks.toLocaleString()," racks · ",js(t.kW)]})]})]})}class xr extends m.Component{constructor(){super(...arguments);Zt(this,"state",{failed:!1,retries:0})}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(s){console.error("[SambaNovaScene] render error â re-mounting the 3D",s),this.state.retries<2&&setTimeout(()=>this.setState(n=>({failed:!1,retries:n.retries+1})),300)}componentDidUpdate(s){s.resetKey!==this.props.resetKey&&(this.state.failed||this.state.retries)&&this.setState({failed:!1,retries:0})}render(){return this.state.failed?null:this.props.children}}function gr({url:t}){const r=Xn(as,t),s=de(a=>a.gl),n=de(a=>a.scene);return m.useEffect(()=>{const a=new os(s);a.compileEquirectangularShader(),r.mapping=rs;const o=a.fromEquirectangular(r).texture;return n.environment=o,n.environmentIntensity=1.2,()=>{n.environment===o&&(n.environment=null),o.dispose(),a.dispose()}},[r,s,n]),null}function wr({active:t}){const r=de(a=>a.gl),s=de(a=>a.scene),n=de(a=>a.camera);return m.useEffect(()=>{if(!t)return;const a=requestAnimationFrame(()=>{var o;(o=r.compileAsync)==null||o.call(r,s,n)});return()=>cancelAnimationFrame(a)},[t,r,s,n]),null}function Rr(){const t=y(M=>M.outputs),r=y(M=>M.mode),s=y(M=>M.view),n=y(M=>M.layoutStyle),a=y(M=>M.sizingMode),o=y(M=>M.spaceWidthM),l=y(M=>M.inputs.includeCsr!==!1),p=y(M=>M.inputs.system??"SN50"),x=a==="space"?Math.max(1,ys(o)):void 0,d=m.useMemo(()=>Zs(t.rackCount,n,x,l,p),[t.rackCount,n,x,l,p]),u=y(M=>M.hetero),c=m.useMemo(()=>u?Ss(d,t.rackCount):d,[u,d,t.rackCount]),f=c.sizeZFront,i=c.sizeZBack,h=Wt(c),g=m.useMemo(()=>typeof window<"u"&&new URLSearchParams(window.location.search).get("stats")==="1",[]),w=m.useMemo(()=>typeof window<"u"&&new URLSearchParams(window.location.search).get("spares")==="1",[]),j=y(M=>M.configureWalk);return m.useEffect(()=>{if(r!=="walk")return;const M=c.slots.map(S=>S.x),b=M.length?(Math.min(...M)+Math.max(...M))/2:0;j({minX:-c.hallWidth/2+.6,maxX:c.hallWidth/2-.6,minZ:c.walkZBack+.6,maxZ:c.sizeZFront-.6,startX:Math.max(-c.hallWidth/2+.6,Math.min(c.hallWidth/2-.6,b)),startZ:c.walkStartZ??c.sizeZFront-1.2,count:c.slots.length,frontRowZ:c.frontRowZ,colliders:c.slots.map(S=>{const k=Math.abs(Math.sin(S.rotY))>.5;return{x:S.x,z:S.z,hw:(k?_:Z)/2,hd:(k?Z:_)/2}})})},[r,c,j]),e.jsx(xr,{resetKey:`${r}:${c.slots.length}:${n}`,children:e.jsx(Nn,{dpr:[1,1.5],frameloop:s!=="sizer"||r==="inspect"?"never":"always",gl:{antialias:!1,alpha:!1,powerPreference:"high-performance"}
13,camera:{position:[0,3.5,14],fov:be,near:.1,far:600},shadows:!1,children:e.jsxs(m.Suspense,{fallback:null,children:[e.jsx(gr,{url:Rs.splatPano}),e.jsx(_s,{hallWidth:c.hallWidth,zFront:f,zBack:i,mode:r,layout:c}),e.jsx(Hs,{layout:c,skip:r==="walk"?h:null}),w&&e.jsx(dr,{layout:c}),u&&e.jsx(ur,{layout:c}),pe(c)?e.jsx(Co,{layout:c,style:n}):e.jsx(Mn,{layout:c,style:n}),pe(c)?e.jsx(Po,{layout:c,style:n}):e.jsx(kn,{layout:c,style:n}),pe(c)?e.jsx(vo,{layout:c}):e.jsx(jn,{layout:c}),e.jsx(Xo,{layout:c}),e.jsx(m.Suspense,{fallback:null,children:e.jsx(Uo,{layout:c,mode:r})}),e.jsx(sr,{layout:c,mode:r}),!1,e.jsx(wr,{active:r==="walk"}),g&&e.jsx(Zn,{}),e.jsxs(On,{multisampling:0,children:[e.jsx(Hn,{mode:Dn.ACES_FILMIC}),e.jsx(Gn,{intensity:.4,luminanceThreshold:.9,luminanceSmoothing:.9,kernelSize:Bn.SMALL,mipmapBlur:!0}),e.jsx($n,{eskil:!1,offset:.3,darkness:.3,blendFunction:Un.NORMAL}),e.jsx(Yn,{})]})]})})})}export{Rr as SambaNovaScene};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.