@seatlayer/core 0.110.1 → 0.112.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/ar-IOQUWTKM.js +1 -0
  2. package/dist/be-XLR5WTXS.js +1 -0
  3. package/dist/bg-AVCWLASZ.js +1 -0
  4. package/dist/ca-TKG35ICB.js +1 -0
  5. package/dist/{chunk-5IADCFUU.js → chunk-5FIX35HN.js} +1 -1
  6. package/dist/{chunk-6CBJBESS.js → chunk-5GHPGPWE.js} +1 -1
  7. package/dist/{chunk-GWGWNBGU.js → chunk-AZWAP4OE.js} +1 -1
  8. package/dist/chunk-BXQQKDIX.js +1 -0
  9. package/dist/{chunk-NVAF2E7Q.js → chunk-FZ74MVKY.js} +1 -1
  10. package/dist/{chunk-GVVZR3YS.js → chunk-MN4M5QZ4.js} +1 -1
  11. package/dist/chunk-N6K5NQYG.js +1 -0
  12. package/dist/{chunk-2VYFNNYC.js → chunk-NQLQNJV2.js} +1 -1
  13. package/dist/{chunk-ZY6WTPTI.js → chunk-NXS6JFBI.js} +1 -1
  14. package/dist/{chunk-DLHW3UDD.js → chunk-XWTAFHYQ.js} +1 -1
  15. package/dist/{chunk-YRDOE3N7.js → chunk-Z6YGWTT3.js} +1 -1
  16. package/dist/core/chart-ops/index.cjs +1 -1
  17. package/dist/core/chart-ops/index.d.cts +1 -1
  18. package/dist/core/chart-ops/index.d.ts +1 -1
  19. package/dist/core/chart-ops/index.js +1 -1
  20. package/dist/core/inventory/index.cjs +1 -1
  21. package/dist/core/inventory/index.d.cts +2 -2
  22. package/dist/core/inventory/index.d.ts +2 -2
  23. package/dist/core/inventory/index.js +1 -1
  24. package/dist/core/layout/index.cjs +1 -1
  25. package/dist/core/layout/index.d.cts +2 -2
  26. package/dist/core/layout/index.d.ts +2 -2
  27. package/dist/core/layout/index.js +1 -1
  28. package/dist/core/quality/index.d.cts +2 -2
  29. package/dist/core/quality/index.d.ts +2 -2
  30. package/dist/core/sections/index.d.cts +1 -1
  31. package/dist/core/sections/index.d.ts +1 -1
  32. package/dist/core/sections/index.js +1 -1
  33. package/dist/cs-JRLKXXM5.js +1 -0
  34. package/dist/cy-W3CYXTOV.js +1 -0
  35. package/dist/da-HG4PFYWH.js +1 -0
  36. package/dist/de-KOM2AXXJ.js +1 -0
  37. package/dist/el-NBRQ66EQ.js +1 -0
  38. package/dist/es-AVEG4ZNM.js +1 -0
  39. package/dist/et-33PIOTI4.js +1 -0
  40. package/dist/fa-CDV2VTXV.js +1 -0
  41. package/dist/fi-TKATIOE6.js +1 -0
  42. package/dist/fr-TMDNSR5N.js +1 -0
  43. package/dist/he-4G7OVLJX.js +1 -0
  44. package/dist/hi-XKXNYPYF.js +1 -0
  45. package/dist/hr-BX444QNM.js +1 -0
  46. package/dist/hu-FM46JMDP.js +1 -0
  47. package/dist/id-CBVTYGFP.js +1 -0
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.d.cts +42 -31
  50. package/dist/index.d.ts +42 -31
  51. package/dist/index.js +1 -1
  52. package/dist/it-ZOFOAG6E.js +1 -0
  53. package/dist/ja-NKEBMXTO.js +1 -0
  54. package/dist/ko-RUCELYV7.js +1 -0
  55. package/dist/ku-KKYBDVSA.js +1 -0
  56. package/dist/localeLoaders-YQXZZVNH.js +1 -0
  57. package/dist/lt-3CJ37W7A.js +1 -0
  58. package/dist/lv-H37RDMRX.js +1 -0
  59. package/dist/ms-E5RVBRE6.js +1 -0
  60. package/dist/nl-QHEOTQ7U.js +1 -0
  61. package/dist/no-43HJQ5MK.js +1 -0
  62. package/dist/pl-4LKJHMFJ.js +1 -0
  63. package/dist/pt-LSSE5QHE.js +1 -0
  64. package/dist/{renderedQuality-Frgw6jdx.d.cts → renderedQuality-BDc6pV7R.d.cts} +1 -1
  65. package/dist/{renderedQuality-Dzo2_8f4.d.ts → renderedQuality-OWT2aLPO.d.ts} +1 -1
  66. package/dist/{renderer-DuieD7jP.d.ts → renderer-D-duCvfP.d.ts} +1 -1
  67. package/dist/{renderer-DM2sv1un.d.cts → renderer-DCqApkrq.d.cts} +1 -1
  68. package/dist/ro-U2QASPIY.js +1 -0
  69. package/dist/ru-PTMWREXY.js +1 -0
  70. package/dist/sk-AY2N2ORA.js +1 -0
  71. package/dist/sl-5MQJVNB7.js +1 -0
  72. package/dist/sr-25FTJPUA.js +1 -0
  73. package/dist/{stage-CKb7aNoH.d.cts → stage-BtqKu5aX.d.cts} +1 -1
  74. package/dist/{stage-CKb7aNoH.d.ts → stage-BtqKu5aX.d.ts} +1 -1
  75. package/dist/sv-7VQX4BFH.js +1 -0
  76. package/dist/{tableSizing-C6EjKNnk.d.cts → tableSizing-BhVtwdmX.d.cts} +1 -1
  77. package/dist/{tableSizing-BDePQyPD.d.ts → tableSizing-CYuKHCfd.d.ts} +1 -1
  78. package/dist/th-E53HQMDC.js +1 -0
  79. package/dist/{ticketRestrictions-D5wgOq4P.d.ts → ticketRestrictions-CbFX7kwu.d.ts} +1 -1
  80. package/dist/{ticketRestrictions-CgYwHQOf.d.cts → ticketRestrictions-DgyhuPyA.d.cts} +1 -1
  81. package/dist/tr-IIR6E7OD.js +1 -0
  82. package/dist/uk-HBINQ4XE.js +1 -0
  83. package/dist/vi-TX6I5RWN.js +1 -0
  84. package/dist/view3d/index.cjs +195 -77
  85. package/dist/view3d/index.d.cts +260 -79
  86. package/dist/view3d/index.d.ts +260 -79
  87. package/dist/view3d/index.js +193 -75
  88. package/dist/view3d/scene/scene.worker.cjs +1 -1
  89. package/dist/view3d/scene/scene.worker.js +1 -1
  90. package/dist/zh-Hans-7QNBTEYC.js +1 -0
  91. package/dist/zh-Hant-6KK3D42X.js +1 -0
  92. package/package.json +1 -1
  93. package/dist/ar-C5PA2DVE.js +0 -1
  94. package/dist/be-TMKSMYPN.js +0 -1
  95. package/dist/bg-V6HTEDUB.js +0 -1
  96. package/dist/ca-CTZMHWW4.js +0 -1
  97. package/dist/chunk-3V32MDJI.js +0 -1
  98. package/dist/chunk-4AGC7B64.js +0 -1
  99. package/dist/cs-FUDGOUFL.js +0 -1
  100. package/dist/cy-5RRARIAP.js +0 -1
  101. package/dist/da-PONPPWKY.js +0 -1
  102. package/dist/de-PKG7AAB5.js +0 -1
  103. package/dist/el-H7OFU4QQ.js +0 -1
  104. package/dist/es-QSW5IZ6U.js +0 -1
  105. package/dist/et-GTMPSS72.js +0 -1
  106. package/dist/fa-SGLTFGJF.js +0 -1
  107. package/dist/fi-7YTEAVDM.js +0 -1
  108. package/dist/fr-ECCQ24MZ.js +0 -1
  109. package/dist/he-YHMMDOX7.js +0 -1
  110. package/dist/hi-GRAQX2E6.js +0 -1
  111. package/dist/hr-MN33LRIJ.js +0 -1
  112. package/dist/hu-NW3SMQVM.js +0 -1
  113. package/dist/id-3OPRAUF7.js +0 -1
  114. package/dist/it-RYM74YWO.js +0 -1
  115. package/dist/ja-4NI6DG5D.js +0 -1
  116. package/dist/ko-C4F6UEMK.js +0 -1
  117. package/dist/ku-DMSBMWTC.js +0 -1
  118. package/dist/localeLoaders-G3GCGLPW.js +0 -1
  119. package/dist/lt-3EXKKZFG.js +0 -1
  120. package/dist/lv-4EWNRDCG.js +0 -1
  121. package/dist/ms-7LJBSAEJ.js +0 -1
  122. package/dist/nl-GWTIWXRW.js +0 -1
  123. package/dist/no-T3FW2WLX.js +0 -1
  124. package/dist/pl-OG5OBRHR.js +0 -1
  125. package/dist/pt-YQ6VES5R.js +0 -1
  126. package/dist/ro-VK5MASYF.js +0 -1
  127. package/dist/ru-YU5CYR6T.js +0 -1
  128. package/dist/sk-CE7PXAYL.js +0 -1
  129. package/dist/sl-EYUPV4BG.js +0 -1
  130. package/dist/sr-PPXCN4IK.js +0 -1
  131. package/dist/sv-WR2BJBCJ.js +0 -1
  132. package/dist/th-JUB2DODR.js +0 -1
  133. package/dist/tr-GFHA7FT6.js +0 -1
  134. package/dist/uk-3FTS2SRK.js +0 -1
  135. package/dist/vi-7OTXPOQV.js +0 -1
  136. package/dist/zh-Hans-FD4XNYUA.js +0 -1
  137. package/dist/zh-Hant-7TXVJKJQ.js +0 -1
@@ -1,18 +1,18 @@
1
- import{A as Mo,B as Da,C as Ao,D as Po,E as Eo,F as Co,G as Te,H as To,I as Ro,J as _o,K as Fo,L as Io,M as ct,N as un,O as Do,P as ut,Q as dn,R as ko,S as Lo,a as it,b as ke,c as Ne,d as an,e as co,f as Et,g as uo,h as ho,i as mo,j as po,k as fo,l as sn,m as vo,n as bo,o as ln,p as st,q as go,r as Se,s as yo,t as xo,u as wo,v as Ct,w as qe,x as lt,y as So,z as cn}from"../chunk-4AGC7B64.js";import"../chunk-DLHW3UDD.js";import"../chunk-6CBJBESS.js";import{d as Pt}from"../chunk-YPVYZYMH.js";import"../chunk-PBXGWYB4.js";import"../chunk-2VYFNNYC.js";import"../chunk-NVAF2E7Q.js";import"../chunk-YRDOE3N7.js";import"../chunk-ZY6WTPTI.js";import"../chunk-JQBJZMLG.js";import{b as io,c as rn,d as so,n as lo}from"../chunk-GUNNA5LB.js";import"../chunk-M4NGX5NM.js";import"../chunk-EE2CVYFJ.js";import"../chunk-URW7MSCJ.js";import"../chunk-GVVZR3YS.js";import{fb as oo}from"../chunk-3V32MDJI.js";import"../chunk-S3VH7IDA.js";import{d as ro,l as ao}from"../chunk-JBOTRSMY.js";import"../chunk-CRCGO52K.js";function Vo(t,e,n){let r=Math.floor(e.length/3),a=n.center[0],o=n.center[2];if(r>0){let l=Math.max(1,Math.floor(r/4e3)),c=0,f=0,m=0;for(let u=0;u<r;u+=l)c+=e[u*3],f+=e[u*3+2],m++;a=c/m,o=f/m}let i=t[0]-a,s=t[2]-o;return Math.hypot(i,s)>n.radius*.12?Math.atan2(i,s):void 0}import{Mat4 as bl}from"ogl";function zo(t,e,n="#ffffff"){let{iPosition:r,count:a}=e.seats;if(a<2||typeof document>"u")return null;let o=1/0,i=-1/0,s=1/0,l=-1/0;for(let S=0;S<a;S++){let _=r[S*3],V=r[S*3+2];_<o&&(o=_),_>i&&(i=_),V<s&&(s=V),V>l&&(l=V)}for(let S of e.stages)o=Math.min(o,S.cx-S.halfX),i=Math.max(i,S.cx+S.halfX),s=Math.min(s,S.cz-S.halfZ),l=Math.max(l,S.cz+S.halfZ);let c=Math.min(130/Math.max(.001,i-o),86/Math.max(.001,l-s)),f=(148-(i-o)*c)/2,m=(104-(l-s)*c)/2,u=S=>f+(S-o)*c,d=S=>m+(S-s)*c,h=Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),y=document.createElement("canvas");y.width=Math.round(148*h),y.height=Math.round(104*h),y.setAttribute("aria-hidden","true"),y.setAttribute("data-seat-locator","");let v=y.style;v.position="absolute",v.left="12px",v.bottom="12px",v.width="148px",v.height="104px",v.borderRadius="10px",v.background="rgba(10,14,22,.72)",v.border="1px solid rgba(255,255,255,.14)",v.boxShadow="0 4px 14px rgba(0,0,0,.35)",v.pointerEvents="none",v.zIndex="3",v.display="none",t.appendChild(y);let x=document.createElement("canvas");x.width=y.width,x.height=y.height;let T=x.getContext("2d");if(T){T.scale(h,h),T.fillStyle="rgba(214,222,234,.28)";let S=Math.max(1,Math.ceil(a/6e3));for(let _=0;_<a;_+=S)T.fillRect(u(r[_*3])-.6,d(r[_*3+2])-.6,1.2,1.2);T.fillStyle="rgba(236,240,246,.16)",T.strokeStyle="rgba(236,240,246,.55)",T.lineWidth=1;for(let _ of e.stages){let V=u(_.cx-_.halfX),g=d(_.cz-_.halfZ),D=_.halfX*2*c,w=_.halfZ*2*c;T.fillRect(V,g,D,w),T.strokeRect(V+.5,g+.5,Math.max(0,D-1),Math.max(0,w-1))}}let A=y.getContext("2d"),F="";return{el:y,update(S,_){if(!S||!A||t.clientWidth>0&&t.clientWidth<560){v.display!=="none"&&(v.display="none"),F="";return}let V=u(S[0]),g=d(S[2]),D=_?Math.atan2(_[2],_[0]):0,w=`${V.toFixed(1)},${g.toFixed(1)},${D.toFixed(2)}`;if(w!==F){if(F=w,v.display="block",A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,y.width,y.height),A.drawImage(x,0,0),A.setTransform(h,0,0,h,0,0),_){let I=A.createRadialGradient(V,g,0,V,g,26);I.addColorStop(0,"rgba(255,255,255,.55)"),I.addColorStop(1,"rgba(255,255,255,0)"),A.fillStyle=I,A.beginPath(),A.moveTo(V,g),A.arc(V,g,26,D-.5,D+.5),A.closePath(),A.fill()}A.fillStyle=n,A.strokeStyle="rgba(10,14,22,.9)",A.lineWidth=1.5,A.beginPath(),A.arc(V,g,3.6,0,Math.PI*2),A.fill(),A.stroke()}},dispose(){y.remove()}}}var hn=78,Oo=18;function No(){let t=[],e=[],n=[],r=[],a=[],o=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];for(let s of[{part:1,min:[-1,.36,-.95],max:[1,.45,1]},{part:2,min:[-1,ke,-1],max:[1,Ne,-.72]}])for(let l of o){let c=t.length/3,f=l.n[1]+(s.part===2?Math.abs(l.n[0])*(1-an)/(Ne-ke):0),m=Math.hypot(l.n[0],f,l.n[2]),u=[l.n[0]/m,f/m,l.n[2]/m];for(let[d,h]of l.c.entries()){let y=h.map((v,x)=>s.min[x]+v*(s.max[x]-s.min[x]));s.part===2&&(y[0]*=1-h[1]*(1-an)),t.push(...y),e.push(...u),n.push(s.part),r.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][d])}a.push(c,c+1,c+2,c,c+2,c+3)}let i=t.length/3;for(let[s,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])t.push(s,l,0),e.push(0,1,0),n.push(0),r.push(s,l);return a.push(i,i+1,i+2,i,i+2,i+3),a.push(...a.slice(12,18),...a.slice(60,66),...a.slice(72,78)),{position:new Float32Array(t),normal:new Float32Array(e),surface:new Float32Array(n),uv:new Float32Array(r),index:new Uint16Array(a)}}import{Renderer as ka}from"ogl";function La(){let t=typeof window<"u"&&window.devicePixelRatio||1,e=navigator.deviceMemory,n=typeof e=="number"&&e<=4?1.5:2;return Math.min(t,n)}var Ho=1e4;function Va(t){if(typeof navigator<"u"){let e=navigator.deviceMemory;if(typeof e=="number"&&e<=4)return 0}return t>=1.5?2:4}var Tt=class{constructor(e,n){this.clearRgb=[0,0,0];this.container=e,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom.");let r=La();this.smoothingSamples=Va(r),this.renderer=new ka({canvas:this.canvas,dpr:r,alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ct.top[0],Ct.top[1],Ct.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),e.appendChild(this.canvas),this.lostHandler=a=>{a.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(e){this.clearRgb=[e[0],e[1],e[2]],this.gl.clearColor(e[0],e[1],e[2],1)}get clearColor(){return this.clearRgb}resize(){let e=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(e,n),{width:e,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let e=this.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let e=this.gl.getExtension("WEBGL_lose_context");e&&(e.loseContext(),setTimeout(()=>{e.restoreContext&&e.restoreContext()},300))}};import{Mesh as za,Program as Oa,RenderTarget as Na,Triangle as Ha}from"ogl";var Ga=`#version 300 es
1
+ import{A as er,B as Pn,C as tr,D as nr,E as or,F as rr,G as Wa,H as ir,I as ar,J as sr,K as lr,L as Re,M as cr,N as ur,O as hr,P as dr,Q as mr,R as yt,S as En,T as pr,U as xt,V as Cn,W as fr,X as vr,a as vt,b as Le,c as We,d as Sn,e as Go,f as Ot,g as Bo,h as Wo,i as Uo,j as Yo,k as $o,l as Mn,m as Xo,n as jo,o as An,p as bt,q as Ko,r as Te,s as qo,t as Zo,u as Qo,v as zt,w as De,x as gt,y as Jo,z as Tn}from"../chunk-N6K5NQYG.js";import"../chunk-XWTAFHYQ.js";import"../chunk-5GHPGPWE.js";import{d as Vt}from"../chunk-YPVYZYMH.js";import"../chunk-PBXGWYB4.js";import"../chunk-NQLQNJV2.js";import"../chunk-FZ74MVKY.js";import{f as ft}from"../chunk-Z6YGWTT3.js";import"../chunk-NXS6JFBI.js";import"../chunk-JQBJZMLG.js";import{b as zo,c as wn,d as No,n as Ho}from"../chunk-GUNNA5LB.js";import"../chunk-M4NGX5NM.js";import"../chunk-EE2CVYFJ.js";import"../chunk-URW7MSCJ.js";import"../chunk-MN4M5QZ4.js";import{hb as Lo}from"../chunk-BXQQKDIX.js";import"../chunk-S3VH7IDA.js";import{d as Vo,l as Oo}from"../chunk-JBOTRSMY.js";import"../chunk-CRCGO52K.js";function br(t,e,n){let o=Math.floor(e.length/3),i=n.center[0],r=n.center[2];if(o>0){let l=Math.max(1,Math.floor(o/4e3)),u=0,m=0,h=0;for(let d=0;d<o;d+=l)u+=e[d*3],m+=e[d*3+2],h++;i=u/h,r=m/h}let a=t[0]-i,s=t[2]-r;return Math.hypot(a,s)>n.radius*.12?Math.atan2(a,s):void 0}import{Mat4 as Jc}from"ogl";function gr(t,e,n="#ffffff"){let{iPosition:o,count:i}=e.seats;if(i<2||typeof document>"u")return null;let r=1/0,a=-1/0,s=1/0,l=-1/0;for(let F=0;F<i;F++){let T=o[F*3],R=o[F*3+2];T<r&&(r=T),T>a&&(a=T),R<s&&(s=R),R>l&&(l=R)}for(let F of e.stages)r=Math.min(r,F.cx-F.halfX),a=Math.max(a,F.cx+F.halfX),s=Math.min(s,F.cz-F.halfZ),l=Math.max(l,F.cz+F.halfZ);let u=Math.min(130/Math.max(.001,a-r),86/Math.max(.001,l-s)),m=(148-(a-r)*u)/2,h=(104-(l-s)*u)/2,d=F=>m+(F-r)*u,c=F=>h+(F-s)*u,p=Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),f=document.createElement("canvas");f.width=Math.round(148*p),f.height=Math.round(104*p),f.setAttribute("aria-hidden","true"),f.setAttribute("data-seat-locator","");let y=f.style;y.position="absolute",y.left="12px",y.bottom="12px",y.width="148px",y.height="104px",y.borderRadius="10px",y.background="rgba(10,14,22,.72)",y.border="1px solid rgba(255,255,255,.14)",y.boxShadow="0 4px 14px rgba(0,0,0,.35)",y.pointerEvents="none",y.zIndex="3",y.display="none",t.appendChild(f);let w=document.createElement("canvas");w.width=f.width,w.height=f.height;let b=w.getContext("2d");if(b){b.scale(p,p),b.fillStyle="rgba(214,222,234,.28)";let F=Math.max(1,Math.ceil(i/6e3));for(let T=0;T<i;T+=F)b.fillRect(d(o[T*3])-.6,c(o[T*3+2])-.6,1.2,1.2);b.fillStyle="rgba(236,240,246,.16)",b.strokeStyle="rgba(236,240,246,.55)",b.lineWidth=1;for(let T of e.stages){let R=d(T.cx-T.halfX),D=c(T.cz-T.halfZ),x=T.halfX*2*u,M=T.halfZ*2*u;b.fillRect(R,D,x,M),b.strokeRect(R+.5,D+.5,Math.max(0,x-1),Math.max(0,M-1))}}let S=f.getContext("2d"),A="";return{el:f,update(F,T){if(!F||!S||t.clientWidth>0&&t.clientWidth<560){y.display!=="none"&&(y.display="none"),A="";return}let R=d(F[0]),D=c(F[2]),x=T?Math.atan2(T[2],T[0]):0,M=`${R.toFixed(1)},${D.toFixed(1)},${x.toFixed(2)}`;if(M!==A){if(A=M,y.display="block",S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,f.width,f.height),S.drawImage(w,0,0),S.setTransform(p,0,0,p,0,0),T){let C=S.createRadialGradient(R,D,0,R,D,26);C.addColorStop(0,"rgba(255,255,255,.55)"),C.addColorStop(1,"rgba(255,255,255,0)"),S.fillStyle=C,S.beginPath(),S.moveTo(R,D),S.arc(R,D,26,x-.5,x+.5),S.closePath(),S.fill()}S.fillStyle=n,S.strokeStyle="rgba(10,14,22,.9)",S.lineWidth=1.5,S.beginPath(),S.arc(R,D,3.6,0,Math.PI*2),S.fill(),S.stroke()}},dispose(){f.remove()}}}var Rn=78,yr=18;function xr(){let t=[],e=[],n=[],o=[],i=[],r=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];for(let s of[{part:1,min:[-1,.36,-.95],max:[1,.45,1]},{part:2,min:[-1,Le,-1],max:[1,We,-.72]}])for(let l of r){let u=t.length/3,m=l.n[1]+(s.part===2?Math.abs(l.n[0])*(1-Sn)/(We-Le):0),h=Math.hypot(l.n[0],m,l.n[2]),d=[l.n[0]/h,m/h,l.n[2]/h];for(let[c,p]of l.c.entries()){let f=p.map((y,w)=>s.min[w]+y*(s.max[w]-s.min[w]));s.part===2&&(f[0]*=1-p[1]*(1-Sn)),t.push(...f),e.push(...d),n.push(s.part),o.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][c])}i.push(u,u+1,u+2,u,u+2,u+3)}let a=t.length/3;for(let[s,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])t.push(s,l,0),e.push(0,1,0),n.push(0),o.push(s,l);return i.push(a,a+1,a+2,a,a+2,a+3),i.push(...i.slice(12,18),...i.slice(60,66),...i.slice(72,78)),{position:new Float32Array(t),normal:new Float32Array(e),surface:new Float32Array(n),uv:new Float32Array(o),index:new Uint16Array(i)}}import{Renderer as Ua}from"ogl";function Ya(){let t=typeof window<"u"&&window.devicePixelRatio||1,e=navigator.deviceMemory,n=typeof e=="number"&&e<=4?1.5:2;return Math.min(t,n)}var wr=1e4;function $a(t){if(typeof navigator<"u"){let e=navigator.deviceMemory;if(typeof e=="number"&&e<=4)return 0}return t>=1.5?2:4}var Nt=class{constructor(e,n){this.clearRgb=[0,0,0];this.container=e,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom.");let o=Ya();this.smoothingSamples=$a(o),this.renderer=new Ua({canvas:this.canvas,dpr:o,alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[zt.top[0],zt.top[1],zt.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),e.appendChild(this.canvas),this.lostHandler=i=>{i.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(e){this.clearRgb=[e[0],e[1],e[2]],this.gl.clearColor(e[0],e[1],e[2],1)}get clearColor(){return this.clearRgb}resize(){let e=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(e,n),{width:e,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let e=this.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let e=this.gl.getExtension("WEBGL_lose_context");e&&(e.loseContext(),setTimeout(()=>{e.restoreContext&&e.restoreContext()},300))}};import{Mesh as Xa,Program as ja,RenderTarget as Ka,Triangle as qa}from"ogl";var Za=`#version 300 es
2
2
  in vec2 position;
3
3
  in vec2 uv;
4
4
  out vec2 vUv;
5
5
  void main() {
6
6
  vUv = uv;
7
7
  gl_Position = vec4(position, 0.0, 1.0);
8
- }`,Ba=`#version 300 es
8
+ }`,Qa=`#version 300 es
9
9
  precision highp float;
10
10
  uniform sampler2D tFrame;
11
11
  in vec2 vUv;
12
12
  out vec4 fragColor;
13
13
  void main() {
14
14
  fragColor = vec4(texture(tFrame, vUv).rgb, 1.0);
15
- }`,Rt=class{constructor(e,n,r){this.gl=e;this.renderer=n;this.samples=r;this.fbo=null;this.colour=null;this.depth=null;this.resolved=null;this.copy=null;this.width=0;this.height=0;this.active=null;this.unavailable=!1}begin(e){if(this.active=null,!e||this.unavailable||this.samples<2)return null;let n=this.gl,r=n.drawingBufferWidth,a=n.drawingBufferHeight;return r<1||a<1?null:(!this.fbo||r!==this.width||a!==this.height)&&(this.release(),!this.allocate(r,a))?(this.unavailable=!0,this.release(),null):(this.active={target:n.FRAMEBUFFER,buffer:this.fbo,width:r,height:a,depth:!0,stencil:!1},this.active)}end(){if(!this.active||!this.resolved||!this.copy)return;let e=this.gl,{width:n,height:r}=this.active;this.active=null,e.bindFramebuffer(e.READ_FRAMEBUFFER,this.fbo),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this.resolved.buffer),e.blitFramebuffer(0,0,n,r,0,0,n,r,e.COLOR_BUFFER_BIT,e.NEAREST),this.unbind(),this.renderer.render({scene:this.copy,clear:!1})}reset(){this.fbo=null,this.colour=null,this.depth=null,this.resolved=null,this.copy=null,this.active=null,this.width=0,this.height=0}dispose(){this.release()}allocate(e,n){let r=this.gl,a=Math.min(this.samples,r.getParameter(r.MAX_SAMPLES));if(a<2)return!1;this.fbo=r.createFramebuffer(),this.colour=r.createRenderbuffer(),this.depth=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,this.colour),r.renderbufferStorageMultisample(r.RENDERBUFFER,a,r.RGBA8,e,n),r.bindRenderbuffer(r.RENDERBUFFER,this.depth),r.renderbufferStorageMultisample(r.RENDERBUFFER,a,r.DEPTH_COMPONENT24,e,n),r.bindRenderbuffer(r.RENDERBUFFER,null),r.bindFramebuffer(r.FRAMEBUFFER,this.fbo),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,this.colour),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,this.depth);let o=r.checkFramebufferStatus(r.FRAMEBUFFER)===r.FRAMEBUFFER_COMPLETE;if(this.unbind(),!o)return!1;this.resolved=new Na(this.gl,{width:e,height:n,depth:!1,minFilter:r.NEAREST,magFilter:r.NEAREST});let i=new Oa(this.gl,{vertex:Ga,fragment:Ba,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{tFrame:{value:this.resolved.texture}}});return this.copy=new za(this.gl,{geometry:new Ha(this.gl),program:i}),this.copy.frustumCulled=!1,this.width=e,this.height=n,!0}unbind(){let e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),this.renderer.state.framebuffer=null}release(){let e=this.gl;if(this.fbo&&e.deleteFramebuffer(this.fbo),this.colour&&e.deleteRenderbuffer(this.colour),this.depth&&e.deleteRenderbuffer(this.depth),this.resolved){for(let n of this.resolved.textures)e.deleteTexture(n.texture);e.deleteFramebuffer(this.resolved.buffer)}this.copy&&(this.copy.geometry.remove(),this.copy.program.remove()),this.reset()}};var _t=class{constructor(){this.limit=1/0;this.recent=[];this.slow=0;this.last=null}allows(e){return e<this.limit}frame(e,n,r){if(!e){this.last=null;return}let a=this.last===null?null:r-this.last;if(this.last=r,a===null||a>250)return;let o=a>25;this.recent.push(o),o&&(this.slow+=1),this.recent.length>30&&this.recent.shift()&&(this.slow-=1),this.slow>=8&&(this.limit=Math.min(this.limit,n*.8),this.recent=[],this.slow=0)}};import{Camera as Wa,Vec3 as mn}from"ogl";var he=Math.PI/180,pn=15*he,fn=80*he,je=.12,Go=35,vn=1.25,Bo=.006,Ua=4,Ke=.82,dt=1/Ke,Ya=.12,Xa=2;function $a(t,e){return{azimuth:0-t*Bo,polar:-e*Bo}}function Wo(t,e,n){let r=Math.max(Xa,Math.max(1,e)*Ya),a=n*Ua;return{minDist:t?Math.min(t.minDist,r):r,maxDist:t?Math.max(t.maxDist,a):a}}var qa=1.5;function ja(t,e,n){let r=Math.max(1,n)*qa;if(!t)return{anchor:[e[0],e[1],e[2]],limit:r};let[a,o,i]=t.anchor,s=e[1]-o,l=Math.max(Math.abs(e[0]-a),Math.abs(e[2]-i),s>=0?s:-s*2);return{anchor:t.anchor,limit:Math.max(t.limit,l+r)}}function Ka(t,e,n,r,a,o,i,s){let l=Math.sin(n),c=[l*Math.sin(e),Math.cos(n),l*Math.cos(e)],f=[t[0]+r*c[0],t[1]+r*c[1],t[2]+r*c[2]],m=[-c[0],-c[1],-c[2]],u=[-m[2],0,m[0]],d=Math.hypot(u[0],u[2])||1;u=[u[0]/d,0,u[2]/d];let h=[u[1]*m[2]-u[2]*m[1],u[2]*m[0]-u[0]*m[2],u[0]*m[1]-u[1]*m[0]],y=Math.tan(a*he/2),v=y*(o>0?o:1),x=[0,1,2].map(F=>m[F]+i*v*u[F]+s*y*h[F]);if(x[1]>=-1e-6)return null;let T=(t[1]-f[1])/x[1],A=Math.hypot(x[0],x[1],x[2]);return!(T>0)||T*A>r*Za?null:[f[0]+x[0]*T,t[1],f[2]+x[2]*T]}var Uo=3,Za=4,Yo=.72,Qa=.6;function Ja(t,e,n){return t!=="auto"?t:n!==null&&e<n*Qa?"pan":"orbit"}function Xo(t,e){let n=Math.sin(e),r=-n*Math.sin(t),a=-Math.cos(e),o=-n*Math.cos(t);if(Math.abs(a)>.999)return null;let i=-o,s=r,l=Math.hypot(i,s);return i/=l,s/=l,{fx:r,fy:a,fz:o,rx:i,rz:s,ux:-s*a,uy:s*r-i*o,uz:i*a}}var ei=.4;function ti(t,e,n,r,a,o){let i=[t.center[0],t.center[1],t.center[2]],s=o(i),l=t.fitPoints,c=Xo(r,a);if(!l||l.length<9||!c)return{center:i,distance:s};let{fx:f,fy:m,fz:u,rx:d,rz:h,ux:y,uy:v,uz:x}=c,T=Math.hypot(f,u),A=f/T,F=u/T,S=A*y+F*x,_=ei*Math.max(1,t.radius);for(let V=0;V<3;V++){let g=1/0,D=-1/0,w=1/0,I=-1/0;for(let B=0;B+2<l.length;B+=3){let H=l[B]-i[0],ee=l[B+1]-i[1],K=l[B+2]-i[2],te=s+H*f+ee*m+K*u;if(!(te>.001))continue;let R=(H*d+K*h)/(te*e),M=(H*y+ee*v+K*x)/(te*n);R<g&&(g=R),R>D&&(D=R),M<w&&(w=M),M>I&&(I=M)}if(!Number.isFinite(g))break;let N=(g+D)/2*s*e,P=Math.abs(S)>.1?(w+I)/2*s*n/S:0,O=N*d+P*A,G=N*h+P*F;if(Math.hypot(i[0]+O-t.center[0],i[2]+G-t.center[2])>_){let B=i[0]-t.center[0],H=i[2]-t.center[2],ee=B+O,K=H+G,te=_/Math.hypot(ee,K);O=ee*te-B,G=K*te-H}i=[i[0]+O,i[1],i[2]+G],s=o(i)}return{center:i,distance:s}}var Ft=class{constructor(e,n,r,a){this.fovY=Go;this.target=new mn;this.azimuth=-30*he;this.polar=55*he;this.distance=10;this.azT=-30*he;this.polT=55*he;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new mn;this.panAnchor=new mn;this.panLimit=0;this.panBox=null;this.zoomPointResolver=null;this.primaryDragMode="auto";this.overviewDist=null;this.pinchAngle=0;this.camera=new Wa(e,{fov:Go,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=a,this.onPointerDown=o=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(o.pointerId)}catch{}if(this.activePointers.set(o.pointerId,{x:o.clientX,y:o.clientY}),this.activePointers.size===1){let i=this.dragAction(),s=i==="orbit"?"pan":"orbit",l=o.button===2||o.button===1||o.shiftKey?s:i;this.panning=l==="pan",this.dragging=!this.panning,this.lastX=o.clientX,this.lastY=o.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance(),this.pinchAngle=this.currentPinchAngle();let i=this.pinchCentroid();this.pinchCx=i.x,this.pinchCy=i.y}}},this.onPointerMove=o=>{if(!this.interactionEnabled||!this.activePointers.has(o.pointerId))return;if(this.activePointers.set(o.pointerId,{x:o.clientX,y:o.clientY}),this.activePointers.size>=2){let c=this.currentPinchDistance(),f=this.pinchCentroid();this.pinchDist>0&&(this.dollyAt(Math.exp((this.pinchDist-c)*.005),f.x,f.y),this.fireGesture()),this.pinchDist=c;let m=this.currentPinchAngle(),u=m-this.pinchAngle;u>Math.PI&&(u-=2*Math.PI),u<-Math.PI&&(u+=2*Math.PI),this.pinchAngle=m,Math.abs(u)>1e-4&&Math.abs(u)<.5&&(this.azT+=u,this.fireGesture()),this.panBy(f.x-this.pinchCx,f.y-this.pinchCy),this.pinchCx=f.x,this.pinchCy=f.y;return}let i=o.clientX-this.lastX,s=o.clientY-this.lastY;if(this.panning){this.lastX=o.clientX,this.lastY=o.clientY,(i!==0||s!==0)&&(this.panBy(i,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=o.clientX,this.lastY=o.clientY,(i!==0||s!==0)&&this.fireGesture();let l=$a(i,s);this.azT+=l.azimuth,this.polT=Math.max(pn,Math.min(fn,this.polT+l.polar)),this.requestRender()},this.onPointerUp=o=>{this.activePointers.delete(o.pointerId);try{this.canvas.releasePointerCapture?.(o.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=o=>{o.preventDefault()},this.onWheel=o=>{if(o.preventDefault(),!this.interactionEnabled)return;let i=o.deltaMode===1?16:o.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,o.deltaY*i/100));this.dollyAt(Math.exp(s*.22),o.clientX,o.clientY),this.fireGesture()},this.onKeyDown=o=>{if(!this.interactionEnabled)return;let i=7*he;if(o.shiftKey&&(o.key==="ArrowLeft"||o.key==="ArrowRight"||o.key==="ArrowUp"||o.key==="ArrowDown"))this.panBy(o.key==="ArrowLeft"?-32:o.key==="ArrowRight"?32:0,o.key==="ArrowUp"?-32:o.key==="ArrowDown"?32:0);else if(o.key==="ArrowLeft"||o.key==="ArrowRight")this.azT+=o.key==="ArrowLeft"?i:-i;else if(o.key==="ArrowUp"||o.key==="ArrowDown")this.polT=Math.max(pn,Math.min(fn,this.polT+(o.key==="ArrowUp"?-i:i)));else if(o.key==="+"||o.key==="=")this.dollyBy(Ke);else if(o.key==="-"||o.key==="_")this.dollyBy(dt);else return;o.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let e=[...this.activePointers.values()];if(!e.length)return{x:0,y:0};let n=0,r=0;for(let a of e)n+=a.x,r+=a.y;return{x:n/e.length,y:r/e.length}}panBy(e,n){let r=this.canvas.clientHeight||1,a=2*this.distance*Math.tan(this.fovY*he/2)/r,o=Math.sin(this.azimuth),i=Math.cos(this.azimuth),s=i,l=-o,c=Math.cos(this.polar),f=Math.sin(this.polar),m=-o*c,u=-i*c;this.targetT.x+=(-e*s+n*m)*a,this.targetT.z+=(-e*l+n*u)*a,this.targetT.y+=n*f*a,this.clampPan(),this.requestRender()}widenPanBox(e){this.panBox=ja(this.panBox,e.center,e.radius),this.panAnchor.set(this.panBox.anchor[0],this.panBox.anchor[1],this.panBox.anchor[2]),this.panLimit=this.panBox.limit}clampPan(){if(this.panLimit<=0)return;let e=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,a=this.panAnchor.z;this.targetT.x=Math.max(n-e,Math.min(n+e,this.targetT.x)),this.targetT.z=Math.max(a-e,Math.min(a+e,this.targetT.z)),this.targetT.y=Math.max(r-e*.5,Math.min(r+e,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchAngle(){let[e,n]=[...this.activePointers.values()];return e&&n?Math.atan2(n.y-e.y,n.x-e.x):0}dragAction(){return Ja(this.primaryDragMode,this.distT,this.overviewDist)}currentPinchDistance(){let e=[...this.activePointers.values()];return e.length<2?0:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)}dollyBy(e){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*e)),this.requestRender()}dollyAt(e,n,r){let a=this.distT,o=this.canvas.getBoundingClientRect?.(),i=this.zoomPointResolver?.(n,r)??null;if(i){this.distT=Math.max(Uo,Math.min(this.maxDist,this.distT*e)),this.minDist=Math.min(this.minDist,Math.max(Uo,this.distT)),this.requestRender(),this.scaleTargetAbout(i,this.distT/a);return}let s=o&&o.width>0&&o.height>0?Ka([this.targetT.x,this.targetT.y,this.targetT.z],this.azT,this.polT,this.distT,this.fovY,this.camera.aspect||o.width/o.height,(n-o.left)/o.width*2-1,1-(r-o.top)/o.height*2):null;this.dollyBy(e),s&&this.scaleTargetAbout(s,this.distT/a)}scaleTargetAbout(e,n){!Number.isFinite(n)||n===1||(this.targetT.x=e[0]+(this.targetT.x-e[0])*n,this.targetT.y=e[1]+(this.targetT.y-e[1])*n,this.targetT.z=e[2]+(this.targetT.z-e[2])*n,this.clampPan())}setZoomPointResolver(e){this.zoomPointResolver=e}zoomBy(e){this.interactionEnabled&&(this.dollyBy(e),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}setPrimaryDragMode(e){this.primaryDragMode=e}setInteractionEnabled(e){this.interactionEnabled=e,!e&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(e,n=!1,r,a=!1,o){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.widenPanBox(e);let i=Math.max(1,e.radius),s=this.fovY*he/2,l=a?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,c=Math.atan(Math.tan(s)*l);this.azT=r??-30*he,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*he;let f=this.framedOn(e,s,c),m=f.distance;this.target.set(f.center[0],f.center[1],f.center[2]),this.targetT.copy(this.target),this.distT=m*Math.max(1.05,Math.min(2,o?.margin??vn)),this.envelope=Wo(this.envelope,i,m),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.overviewDist===null&&(this.overviewDist=this.distT),n?(this.azimuth=this.azT,this.polar=12*he,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(e){if(!(e>0)||!Number.isFinite(e))return;let n=this.camera.aspect;if(this.interactionEnabled&&n>0){let r=Math.min(n,1)/Math.min(e,1);this.distance*=r,this.distT*=r,this.overviewDist!==null&&(this.overviewDist*=r),this.maxDist=Math.max(this.maxDist,this.distance,this.distT),this.applyPosition()}this.camera.perspective({aspect:e})}glideTo(e,n){this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.widenPanBox(e),this.targetT.set(e.center[0],e.center[1],e.center[2]);let r=this.fovY*he/2,a=Math.atan(Math.tan(r)*(this.camera.aspect||1));this.azT=this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*he;let o=this.framedOn(e,r,a),i=o.distance;this.targetT.set(o.center[0],o.center[1],o.center[2]),this.distT=i*Math.max(1.05,Math.min(2,n?.margin??vn)),this.envelope=Wo(this.envelope,Math.max(1,e.radius),i),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.requestRender()}frameSoft(e,n,r=!1,a){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.widenPanBox(e),this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let o=this.fovY*he/2,i=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(o)*i);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,a?.polarDeg??55))*he;let l=this.framedOn(e,o,s);this.targetT.set(l.center[0],l.center[1],l.center[2]),this.distT=l.distance*Math.max(1.05,Math.min(2,a?.margin??vn))}framedOn(e,n,r){return ti(e,Math.tan(r),Math.tan(n),this.azT,this.polT,a=>this.fitDistance({...e,center:a},n,r,this.azT,this.polT))}fitDistance(e,n,r,a,o){let i=Math.max(1,e.radius),s=Math.max(i/Math.tan(n),i/Math.tan(r)),l=e.box;if(!l)return s;let c=Xo(a,o);if(!c)return s;let{fx:f,fy:m,fz:u,rx:d,rz:h,ux:y,uy:v,uz:x}=c,T=Math.tan(r),A=Math.tan(n),F=1;for(let w=0;w<8;w++){let I=(w&1?l.max[0]:l.min[0])-e.center[0],N=(w&2?l.max[1]:l.min[1])-e.center[1],P=(w&4?l.max[2]:l.min[2])-e.center[2],O=I*f+N*m+P*u,G=Math.abs(I*d+P*h),U=Math.abs(I*y+N*v+P*x);F=Math.max(F,G/T-O,U/A-O)}let S=Math.min(s,Math.max(F,i*.35)),_=e.fitPoints;if(!_||_.length<9)return S;let V=0,g=1/(T*Yo),D=1/(A*Yo);for(let w=0;w+2<_.length;w+=3){let I=_[w]-e.center[0],N=_[w+1]-e.center[1],P=_[w+2]-e.center[2],O=I*f+N*m+P*u,G=Math.abs(I*d+P*h),U=Math.abs(I*y+N*v+P*x);V=Math.max(V,G*g-O,U*D-O)}return Math.min(S*1.5,Math.max(S*.55,V))}updateClipping(e){let n=this.camera.position.x-e.center[0],r=this.camera.position.y-e.center[1],a=this.camera.position.z-e.center[2],o=Math.hypot(this.camera.position.x-this.target.x,this.camera.position.y-this.target.y,this.camera.position.z-this.target.z),i=this.interactionEnabled&&Math.abs(o-this.distance)<=this.distance*.01,{near:s,far:l}=ri(Math.hypot(n,r,a),e.radius,i?this.distance:null);this.camera.perspective({near:s,far:l,aspect:this.camera.aspect})}update(){let e=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,a=this.targetT.x-this.target.x,o=this.targetT.y-this.target.y,i=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),l=Math.abs(e)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(a)>s||Math.abs(o)>s||Math.abs(i)>s;return this.azimuth+=e*je,this.polar+=n*je,this.distance+=r*je,this.target.x+=a*je,this.target.y+=o*je,this.target.z+=i*je,l&&this.applyPosition(),l}get currentAzimuth(){return this.azimuth}get currentDistance(){return this.distance}get targetDistance(){return this.distT}syncFromCamera(){let e=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,a=Math.hypot(e,n,r)||1,o=Math.max(pn,Math.min(fn,Math.acos(Math.max(-1,Math.min(1,n/a)))));this.distance=this.distT=a,this.polar=this.polT=o,this.azimuth=this.azT=Math.atan2(e,r)}snapshot(){let e=this.target.clone(),n=this.targetT.clone(),{azimuth:r,azT:a,polar:o,polT:i,distance:s,distT:l}=this,c=this.camera.position.clone(),f=[...this.camera.quaternion],m=this.camera.fov;return()=>{this.target.copy(e),this.targetT.copy(n),Object.assign(this,{azimuth:r,azT:a,polar:o,polT:i,distance:s,distT:l}),this.camera.position.copy(c),this.camera.quaternion.set(f[0],f[1],f[2],f[3]),this.camera.perspective({fov:m,aspect:this.camera.aspect}),this.camera.updateMatrixWorld()}}setTarget(e){this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target)}resumeAfterFlight(e){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),e&&this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let e=Math.sin(this.polar),n=this.target.x+this.distance*e*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),a=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(n,r,a),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}},ni=.1,oi=.25;function ri(t,e,n){let r=Math.max(1,e)*1.18,a=n==null?oi:Math.max(.05,n*ni),o=Math.max(a,t-r),i=Math.max(o+10,t+r);return{near:o,far:i}}var It=class{constructor(e){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=e=>{let n=this.lastTime?(e-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=e,n>0){let a=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+a*.1:a}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=e}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};function $o(t){let e=!1;return n=>{n!==e&&(e=n,n?t.dataset.slReady="1":delete t.dataset.slReady)}}var Ze=2.5,ai=1.15,ht=12,Qe=22,bn=30,gn=4,Dt=8192;var Nl=Qe+gn;function qo(t,e){let n=e*1.4,r=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:Ze};let a=Math.min(1,(t-n)/Math.max(.001,r-n));return{scale:1-a*.4,fade:a*.55,minPixels:Ze+a*(ai-Ze)}}function jo(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}var ii=12;function Ko(t,e,n,r,a){if(!(t>0)||!(e>0)||!(n>0)||!(r>0)||!(a>0))return!1;let o=Math.tan(r/2*Math.PI/180);if(!(o>0))return!1;let i=e/(n*o)*(a/2);return Math.PI*i*i/t>=ii}import{Geometry as si,Mesh as li,Program as ci,Transform as ui}from"ogl";var di=.05,hi=.55,mi=12,pi=1.6,fi=1,vi=2.5,bi=650,He={height:6,baseRadius:.16,topRadius:.3,fadeInFromM:16,fullByM:40,nearStrength:.6};function gi(t,e){if(e)return 0;let n=(t-He.fadeInFromM)/(He.fullByM-He.fadeInFromM);return Math.max(He.nearStrength,Math.min(1,n))}var Zo=24;function yi(t){let e=[],n=[],r=[],a=(m,u,d)=>{e.push(...m),n.push(...u),r.push(d)};for(let m=0;m<16;m++){let u=m/16*Math.PI*2,d=(m+1)/16*Math.PI*2,h=A=>[Math.cos(A),0,Math.sin(A)],y=[Math.cos(u)*.012,0,Math.sin(u)*.012],v=[Math.cos(d)*.012,0,Math.sin(d)*.012],x=[Math.cos(u)*.03,1,Math.sin(u)*.03],T=[Math.cos(d)*.03,1,Math.sin(d)*.03];a(y,h(u),0),a(x,h(u),0),a(T,h(d),0),a(y,h(u),0),a(T,h(d),0),a(v,h(d),0)}let l=.16,c=.24,f=.01;for(let m=0;m<48;m++){let u=m/48*Math.PI*2,d=(m+1)/48*Math.PI*2,h=[Math.cos(u)*l,f,Math.sin(u)*l],y=[Math.cos(u)*c,f,Math.sin(u)*c],v=[Math.cos(d)*c,f,Math.sin(d)*c],x=[Math.cos(d)*l,f,Math.sin(d)*l];for(let T of[h,y,v,h,v,x])a(T,[0,1,0],1)}for(let m=0;m<32;m++){let u=m/32*Math.PI*2,d=(m+1)/32*Math.PI*2,h=He.baseRadius,y=He.topRadius,v=[Math.cos(u)*h,0,Math.sin(u)*h],x=[Math.cos(d)*h,0,Math.sin(d)*h],T=[Math.cos(u)*y,1,Math.sin(u)*y],A=[Math.cos(d)*y,1,Math.sin(d)*y],F=[Math.cos(u),0,Math.sin(u)],S=[Math.cos(d),0,Math.sin(d)];a(v,F,2),a(T,F,2),a(A,S,2),a(v,F,2),a(A,S,2),a(x,S,2)}return new si(t,{position:{size:3,data:new Float32Array(e)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(r)}})}var xi=`#version 300 es
15
+ }`,Ht=class{constructor(e,n,o){this.gl=e;this.renderer=n;this.samples=o;this.fbo=null;this.colour=null;this.depth=null;this.resolved=null;this.copy=null;this.width=0;this.height=0;this.active=null;this.unavailable=!1}begin(e){if(this.active=null,!e||this.unavailable||this.samples<2)return null;let n=this.gl,o=n.drawingBufferWidth,i=n.drawingBufferHeight;return o<1||i<1?null:(!this.fbo||o!==this.width||i!==this.height)&&(this.release(),!this.allocate(o,i))?(this.unavailable=!0,this.release(),null):(this.active={target:n.FRAMEBUFFER,buffer:this.fbo,width:o,height:i,depth:!0,stencil:!1},this.active)}end(){if(!this.active||!this.resolved||!this.copy)return;let e=this.gl,{width:n,height:o}=this.active;this.active=null,e.bindFramebuffer(e.READ_FRAMEBUFFER,this.fbo),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this.resolved.buffer),e.blitFramebuffer(0,0,n,o,0,0,n,o,e.COLOR_BUFFER_BIT,e.NEAREST),this.unbind(),this.renderer.render({scene:this.copy,clear:!1})}reset(){this.fbo=null,this.colour=null,this.depth=null,this.resolved=null,this.copy=null,this.active=null,this.width=0,this.height=0}dispose(){this.release()}allocate(e,n){let o=this.gl,i=Math.min(this.samples,o.getParameter(o.MAX_SAMPLES));if(i<2)return!1;this.fbo=o.createFramebuffer(),this.colour=o.createRenderbuffer(),this.depth=o.createRenderbuffer(),o.bindRenderbuffer(o.RENDERBUFFER,this.colour),o.renderbufferStorageMultisample(o.RENDERBUFFER,i,o.RGBA8,e,n),o.bindRenderbuffer(o.RENDERBUFFER,this.depth),o.renderbufferStorageMultisample(o.RENDERBUFFER,i,o.DEPTH_COMPONENT24,e,n),o.bindRenderbuffer(o.RENDERBUFFER,null),o.bindFramebuffer(o.FRAMEBUFFER,this.fbo),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.RENDERBUFFER,this.colour),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,this.depth);let r=o.checkFramebufferStatus(o.FRAMEBUFFER)===o.FRAMEBUFFER_COMPLETE;if(this.unbind(),!r)return!1;this.resolved=new Ka(this.gl,{width:e,height:n,depth:!1,minFilter:o.NEAREST,magFilter:o.NEAREST});let a=new ja(this.gl,{vertex:Za,fragment:Qa,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{tFrame:{value:this.resolved.texture}}});return this.copy=new Xa(this.gl,{geometry:new qa(this.gl),program:a}),this.copy.frustumCulled=!1,this.width=e,this.height=n,!0}unbind(){let e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),this.renderer.state.framebuffer=null}release(){let e=this.gl;if(this.fbo&&e.deleteFramebuffer(this.fbo),this.colour&&e.deleteRenderbuffer(this.colour),this.depth&&e.deleteRenderbuffer(this.depth),this.resolved){for(let n of this.resolved.textures)e.deleteTexture(n.texture);e.deleteFramebuffer(this.resolved.buffer)}this.copy&&(this.copy.geometry.remove(),this.copy.program.remove()),this.reset()}};function Sr(t,e,n){return t<=n&&e<=500}var Ja=25,es=30,ts=8,ns=.8,os=250,Gt=class{constructor(){this.limit=1/0;this.recent=[];this.slow=0;this.last=null}allows(e){return e<this.limit}frame(e,n,o){if(!e){this.last=null;return}let i=this.last===null?null:o-this.last;if(this.last=o,i===null||i>os)return;let r=i>Ja;this.recent.push(r),r&&(this.slow+=1),this.recent.length>es&&this.recent.shift()&&(this.slow-=1),this.slow>=ts&&(this.limit=Math.min(this.limit,n*ns),this.recent=[],this.slow=0)}};import{Camera as us,Vec3 as kn}from"ogl";var _n=Math.PI/180,rs="map";function Ar(t){return t.touchNavigation??rs}var is=3,Fn=6;function Bt(t,e,n=Fn){return Math.hypot(t,e)>n}var Wt=10*_n,as=10,ss=.35,ls=1e3/60;function cs(t,e,n){let o=Math.sin(t.polar),i=o*Math.sin(t.azimuth),r=Math.cos(t.polar),a=o*Math.cos(t.azimuth),s=[t.target[0]+t.distance*i,t.target[1]+t.distance*r,t.target[2]+t.distance*a],l=-i,u=-r,m=-a,h=-m,d=l,c=Math.hypot(h,d)||1;h/=c,d/=c;let p=-d*u,f=d*l-h*m,y=h*u,w=Math.tan(t.fovYDeg*_n/2),b=w*(t.aspect>0?t.aspect:1);return{eye:s,ray:[l+e*b*h+n*w*p,u+n*w*f,m+e*b*d+n*w*y]}}function In(t,e,n,o,i=is){let{eye:r,ray:a}=cs(t,e,n);if(a[1]>=-1e-6)return null;let s=(o-r[1])/a[1];return!(s>0)||s*Math.hypot(a[0],a[1],a[2])>t.distance*i?null:[r[0]+a[0]*s,o,r[2]+a[2]*s]}function Dn(t,e,n,o){let i=In(t,n,o,e[1]);return i?[t.target[0]+e[0]-i[0],t.target[1],t.target[2]+e[2]-i[2]]:null}function Tr(t,e){return!(t>0)||!(e>0)?1:Math.max(.5,Math.min(2,t/e))}function Pr(t,e,n){let o=t+n;if(e)return{soFar:o,turning:e,turn:n};let i=Math.abs(o)-Wt;return i>0?{soFar:o,turning:!0,turn:Math.sign(o)*i}:{soFar:o,turning:!1,turn:0}}function Er(t,e,n){let o=t[0]-e[0],i=t[2]-e[2],r=Math.cos(n),a=Math.sin(n);return[e[0]+o*r+i*a,t[1],e[2]-o*a+i*r]}function Cr(t,e){let n=e[0].x-t[0].x,o=e[0].y-t[0].y,i=e[1].x-t[1].x,r=e[1].y-t[1].y;if(Math.max(Math.hypot(n,o),Math.hypot(i,r))<as)return"undecided";let a=t[1].x-t[0].x,s=t[1].y-t[0].y,l=Math.hypot(a,s),u=l>0&&Math.abs(s)/l<.5,m=o*r>0&&Math.abs(o)>=4&&Math.abs(r)>=4&&Math.abs(o)>2*Math.abs(n)&&Math.abs(r)>2*Math.abs(i),h=Math.abs(Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y)-l);return u&&m&&h<Math.max(8,l*.1)?"tilt":"free"}function Rr(t){let e=Math.tan(t.fovYDeg*_n/2);return t.distance*e*Math.min(1,t.aspect>0?t.aspect:1)}function Mr(t,e,n,o,i){let r=2*Math.max(0,i),a=Math.min(Math.max(0,o-n),r*(1-ss)),s=Math.min(n+a-i,e),l=Math.max(o-a+i,e);return Math.max(s,Math.min(l,t))}function _r(t,e,n,o){return[Mr(t[0],e[0],n.minX,n.maxX,o),t[1],Mr(t[2],e[2],n.minZ,n.maxZ,o)]}function Fr(t,e,n){let o=n&&Number.isFinite(e)?Math.max(1,Math.min(4,e/ls)):1;return 1-Math.pow(1-t,o)}var fe=Math.PI/180,Ut=15*fe,Yt=80*fe,Ir=.12,Dr=35,Ln=1.25,kr=.006,hs=4,nt=.82,wt=1/nt,ds=.12,ms=2;function Lr(t,e){return{azimuth:0-t*kr,polar:-e*kr}}function Vr(t,e,n){let o=Math.max(ms,Math.max(1,e)*ds),i=n*hs;return{minDist:t?Math.min(t.minDist,o):o,maxDist:t?Math.max(t.maxDist,i):i}}var ps=1.5;function fs(t,e,n){let o=Math.max(1,n)*ps;if(!t)return{anchor:[e[0],e[1],e[2]],limit:o};let[i,r,a]=t.anchor,s=e[1]-r,l=Math.max(Math.abs(e[0]-i),Math.abs(e[2]-a),s>=0?s:-s*2);return{anchor:t.anchor,limit:Math.max(t.limit,l+o)}}function vs(t,e,n,o,i,r,a,s){let l=Math.sin(n),u=[l*Math.sin(e),Math.cos(n),l*Math.cos(e)],m=[t[0]+o*u[0],t[1]+o*u[1],t[2]+o*u[2]],h=[-u[0],-u[1],-u[2]],d=[-h[2],0,h[0]],c=Math.hypot(d[0],d[2])||1;d=[d[0]/c,0,d[2]/c];let p=[d[1]*h[2]-d[2]*h[1],d[2]*h[0]-d[0]*h[2],d[0]*h[1]-d[1]*h[0]],f=Math.tan(i*fe/2),y=f*(r>0?r:1),w=[0,1,2].map(A=>h[A]+a*y*d[A]+s*f*p[A]);if(w[1]>=-1e-6)return null;let b=(t[1]-m[1])/w[1],S=Math.hypot(w[0],w[1],w[2]);return!(b>0)||b*S>o*bs?null:[m[0]+w[0]*b,t[1],m[2]+w[2]*b]}var $t=3,bs=4,Or=.72,gs=.6;function ys(t,e,n){return t!=="auto"?t:n!==null&&e<n*gs?"pan":"orbit"}function zr(t,e){let n=Math.sin(e),o=-n*Math.sin(t),i=-Math.cos(e),r=-n*Math.cos(t);if(Math.abs(i)>.999)return null;let a=-r,s=o,l=Math.hypot(a,s);return a/=l,s/=l,{fx:o,fy:i,fz:r,rx:a,rz:s,ux:-s*i,uy:s*o-a*r,uz:a*i}}var xs=.4;function ws(t,e,n,o,i,r){let a=[t.center[0],t.center[1],t.center[2]],s=r(a),l=t.fitPoints,u=zr(o,i);if(!l||l.length<9||!u)return{center:a,distance:s};let{fx:m,fy:h,fz:d,rx:c,rz:p,ux:f,uy:y,uz:w}=u,b=Math.hypot(m,d),S=m/b,A=d/b,F=S*f+A*w,T=xs*Math.max(1,t.radius);for(let R=0;R<3;R++){let D=1/0,x=-1/0,M=1/0,C=-1/0;for(let $=0;$+2<l.length;$+=3){let Y=l[$]-a[0],X=l[$+1]-a[1],G=l[$+2]-a[2],te=s+Y*m+X*h+G*d;if(!(te>.001))continue;let I=(Y*c+G*p)/(te*e),j=(Y*f+X*y+G*w)/(te*n);I<D&&(D=I),I>x&&(x=I),j<M&&(M=j),j>C&&(C=j)}if(!Number.isFinite(D))break;let k=(D+x)/2*s*e,z=Math.abs(F)>.1?(M+C)/2*s*n/F:0,N=k*c+z*S,O=k*p+z*A;if(Math.hypot(a[0]+N-t.center[0],a[2]+O-t.center[2])>T){let $=a[0]-t.center[0],Y=a[2]-t.center[2],X=$+N,G=Y+O,te=T/Math.hypot(X,G);N=X*te-$,O=G*te-Y}a=[a[0]+N,a[1],a[2]+O],s=r(a)}return{center:a,distance:s}}var Xt=class{constructor(e,n,o,i){this.fovY=Dr;this.target=new kn;this.azimuth=-30*fe;this.polar=55*fe;this.distance=10;this.azT=-30*fe;this.polT=55*fe;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new kn;this.panAnchor=new kn;this.panLimit=0;this.panBox=null;this.zoomPointResolver=null;this.primaryDragMode="auto";this.overviewDist=null;this.pinchAngle=0;this.touchNavigation="classic";this.mapGesture=!1;this.hold=null;this.holdY=0;this.holdOnSeat=!1;this.touchStart=null;this.touchMoving=!1;this.twoStart=null;this.twoIntent="undecided";this.twistSoFar=0;this.twistTurning=!1;this.pair=null;this.catchingUp=!1;this.eventRect=null;this.venueFootprint=null;this.lastUpdateMs=0;this.wasMoving=!1;this.camera=new us(e,{fov:Dr,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=o,this.onGesture=i,this.onPointerDown=r=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(r.pointerId)}catch{}if(this.activePointers.set(r.pointerId,{x:r.clientX,y:r.clientY}),this.activePointers.size===1&&(this.mapGesture=this.touchNavigation==="map"&&(r.pointerType==="touch"||r.pointerType==="pen")),this.mapGesture){this.withEventRect(()=>this.mapTouchDown(r.clientX,r.clientY));return}if(this.activePointers.size===1){let a=this.dragAction(),s=a==="orbit"?"pan":"orbit",l=r.button===2||r.button===1||r.shiftKey?s:a;this.panning=l==="pan",this.dragging=!this.panning,this.lastX=r.clientX,this.lastY=r.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance(),this.pinchAngle=this.currentPinchAngle();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=r=>{if(!this.interactionEnabled||!this.activePointers.has(r.pointerId))return;let a=this.activePointers.get(r.pointerId);if(this.activePointers.set(r.pointerId,{x:r.clientX,y:r.clientY}),this.mapGesture){this.withEventRect(()=>this.mapTouchMove(r.clientX-a.x,r.clientY-a.y,r.pointerId));return}if(this.activePointers.size>=2){let m=this.currentPinchDistance(),h=this.pinchCentroid();this.pinchDist>0&&(this.dollyAt(Math.exp((this.pinchDist-m)*.005),h.x,h.y),this.fireGesture()),this.pinchDist=m;let d=this.currentPinchAngle(),c=d-this.pinchAngle;c>Math.PI&&(c-=2*Math.PI),c<-Math.PI&&(c+=2*Math.PI),this.pinchAngle=d,Math.abs(c)>1e-4&&Math.abs(c)<.5&&(this.azT+=c,this.fireGesture()),this.panBy(h.x-this.pinchCx,h.y-this.pinchCy),this.pinchCx=h.x,this.pinchCy=h.y;return}let s=r.clientX-this.lastX,l=r.clientY-this.lastY;if(this.panning){this.lastX=r.clientX,this.lastY=r.clientY,(s!==0||l!==0)&&(this.panBy(s,l),this.fireGesture());return}if(!this.dragging)return;this.lastX=r.clientX,this.lastY=r.clientY,(s!==0||l!==0)&&this.fireGesture();let u=Lr(s,l);this.azT+=u.azimuth,this.polT=Math.max(Ut,Math.min(Yt,this.polT+u.polar)),this.requestRender()},this.onPointerUp=r=>{this.activePointers.delete(r.pointerId);try{this.canvas.releasePointerCapture?.(r.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1),this.mapGesture&&this.withEventRect(()=>this.mapTouchUp())},this.onContextMenu=r=>{r.preventDefault()},this.onWheel=r=>{if(r.preventDefault(),!this.interactionEnabled)return;let a=r.deltaMode===1?16:r.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,r.deltaY*a/100));this.dollyAt(Math.exp(s*.22),r.clientX,r.clientY),this.fireGesture()},this.onKeyDown=r=>{if(!this.interactionEnabled)return;let a=7*fe;if(r.shiftKey&&(r.key==="ArrowLeft"||r.key==="ArrowRight"||r.key==="ArrowUp"||r.key==="ArrowDown"))this.panBy(r.key==="ArrowLeft"?-32:r.key==="ArrowRight"?32:0,r.key==="ArrowUp"?-32:r.key==="ArrowDown"?32:0);else if(r.key==="ArrowLeft"||r.key==="ArrowRight")this.azT+=r.key==="ArrowLeft"?a:-a;else if(r.key==="ArrowUp"||r.key==="ArrowDown")this.polT=Math.max(Ut,Math.min(Yt,this.polT+(r.key==="ArrowUp"?-a:a)));else if(r.key==="+"||r.key==="=")this.dollyBy(nt);else if(r.key==="-"||r.key==="_")this.dollyBy(wt);else return;r.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let e=[...this.activePointers.values()];if(!e.length)return{x:0,y:0};let n=0,o=0;for(let i of e)n+=i.x,o+=i.y;return{x:n/e.length,y:o/e.length}}panBy(e,n){let o=this.canvas.clientHeight||1,i=2*this.distance*Math.tan(this.fovY*fe/2)/o,r=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,l=-r,u=Math.cos(this.polar),m=Math.sin(this.polar),h=-r*u,d=-a*u;this.targetT.x+=(-e*s+n*h)*i,this.targetT.z+=(-e*l+n*d)*i,this.targetT.y+=n*m*i,this.clampPan(),this.requestRender()}widenPanBox(e){if(!this.panBox){let n=Math.max(1,e.radius);this.venueFootprint=e.box?{minX:e.box.min[0],maxX:e.box.max[0],minZ:e.box.min[2],maxZ:e.box.max[2]}:{minX:e.center[0]-n,maxX:e.center[0]+n,minZ:e.center[2]-n,maxZ:e.center[2]+n}}this.panBox=fs(this.panBox,e.center,e.radius),this.panAnchor.set(this.panBox.anchor[0],this.panBox.anchor[1],this.panBox.anchor[2]),this.panLimit=this.panBox.limit}clampPan(){if(this.panLimit<=0)return;let e=this.panLimit,n=this.panAnchor.x,o=this.panAnchor.y,i=this.panAnchor.z;this.targetT.x=Math.max(n-e,Math.min(n+e,this.targetT.x)),this.targetT.z=Math.max(i-e,Math.min(i+e,this.targetT.z)),this.targetT.y=Math.max(o-e*.5,Math.min(o+e,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchAngle(){let[e,n]=[...this.activePointers.values()];return e&&n?Math.atan2(n.y-e.y,n.x-e.x):0}dragAction(){return ys(this.primaryDragMode,this.distT,this.overviewDist)}currentPinchDistance(){let e=[...this.activePointers.values()];return e.length<2?0:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)}dollyBy(e){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*e)),this.requestRender()}dollyAt(e,n,o){let i=this.distT,r=this.canvas.getBoundingClientRect?.(),a=this.zoomPointResolver?.(n,o)??null;if(a){this.distT=Math.max($t,Math.min(this.maxDist,this.distT*e)),this.minDist=Math.min(this.minDist,Math.max($t,this.distT)),this.requestRender(),this.scaleTargetAbout(a,this.distT/i);return}let s=r&&r.width>0&&r.height>0?vs([this.targetT.x,this.targetT.y,this.targetT.z],this.azT,this.polT,this.distT,this.fovY,this.camera.aspect||r.width/r.height,(n-r.left)/r.width*2-1,1-(o-r.top)/r.height*2):null;this.dollyBy(e),s&&this.scaleTargetAbout(s,this.distT/i)}scaleTargetAbout(e,n){!Number.isFinite(n)||n===1||(this.targetT.x=e[0]+(this.targetT.x-e[0])*n,this.targetT.y=e[1]+(this.targetT.y-e[1])*n,this.targetT.z=e[2]+(this.targetT.z-e[2])*n,this.clampPan())}setZoomPointResolver(e){this.zoomPointResolver=e}zoomBy(e){this.interactionEnabled&&(this.dollyBy(e),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}setPrimaryDragMode(e){this.primaryDragMode=e}setInteractionEnabled(e){this.interactionEnabled=e,!e&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0,this.endMapGesture())}setTouchNavigation(e){this.touchNavigation=e,e!=="map"&&this.endMapGesture()}get touchNavigationMode(){return this.touchNavigation}endMapGesture(){this.mapGesture=!1,this.hold=null,this.touchStart=null,this.touchMoving=!1,this.twoStart=null,this.pair=null,this.catchingUp=!1}withEventRect(e){this.eventRect=this.canvas.getBoundingClientRect?.()??null;try{e()}finally{this.eventRect=null}}steeredPose(){let e=this.eventRect??this.canvas.getBoundingClientRect?.();return{target:[this.targetT.x,this.targetT.y,this.targetT.z],azimuth:this.azT,polar:this.polT,distance:this.distT,fovYDeg:this.fovY,aspect:this.camera.aspect||(e&&e.height>0?e.width/e.height:1)}}ndc(e,n){let o=this.eventRect??this.canvas.getBoundingClientRect?.();return!o||!(o.width>0)||!(o.height>0)?null:{x:(e-o.left)/o.width*2-1,y:1-(n-o.top)/o.height*2}}takeHold(e,n){let o=this.ndc(e,n);this.hold=o?In(this.steeredPose(),o.x,o.y,this.holdY):null}applySteered(){if(this.catchingUp){this.requestRender();return}this.target.copy(this.targetT),this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT,this.applyPosition(),this.requestRender()}steerTarget(e){let n=[this.targetT.x,this.targetT.y,this.targetT.z],o=this.venueFootprint?_r(e,n,this.venueFootprint,Rr(this.steeredPose())):e;this.targetT.set(o[0],o[1],o[2])}mapTouchDown(e,n){if(this.dragging=!1,this.panning=!1,this.activePointers.size===1){let o=this.zoomPointResolver?.(e,n)??null;this.holdY=o?o[1]:this.targetT.y,this.holdOnSeat=!!o,this.touchStart={x:e,y:n},this.touchMoving=!1,this.hold=null;return}if(this.activePointers.size===2){let[o,i]=[...this.activePointers.values()];this.twoStart=[{...o},{...i}],this.twoIntent="undecided",this.twistSoFar=0,this.twistTurning=!1,this.hold=null;let[r,a]=[...this.activePointers.keys()];this.pair=[r,a],this.touchMoving||(this.catchingUp=this.isSettling()),this.touchMoving=!0}}isSettling(){let e=Math.max(1e-4,this.distance*1e-4);return Math.abs(this.azT-this.azimuth)>1e-4||Math.abs(this.polT-this.polar)>1e-4||Math.abs(this.distT-this.distance)>1e-4||Math.abs(this.targetT.x-this.target.x)>e||Math.abs(this.targetT.y-this.target.y)>e||Math.abs(this.targetT.z-this.target.z)>e}rebasePair(){let e=[...this.activePointers.keys()],[n,o]=[...this.activePointers.values()];!n||!o||(this.pair=[e[0],e[1]],(this.twoIntent==="undecided"||!this.twoStart)&&(this.twoStart=[{...n},{...o}]),this.pinchDist=Math.hypot(o.x-n.x,o.y-n.y),this.pinchAngle=Math.atan2(o.y-n.y,o.x-n.x),this.pinchCy=(n.y+o.y)/2,this.hold=null,this.twoIntent==="free"&&this.takeHold((n.x+o.x)/2,(n.y+o.y)/2))}mapTouchMove(e,n,o){this.catchingUp&&!this.isSettling()&&(this.catchingUp=!1);let i=[...this.activePointers.values()];if(i.length>=2&&this.twoStart){let l=[...this.activePointers.keys()];if(o!==l[0]&&o!==l[1])return;this.mapTwoFingerMove(i[0],i[1]);return}let r=i[0];if(!r)return;if(!this.touchMoving){if(!this.touchStart||!Bt(r.x-this.touchStart.x,r.y-this.touchStart.y))return;this.touchMoving=!0,this.catchingUp=this.isSettling(),this.takeHold(r.x,r.y);return}let a=this.ndc(r.x,r.y),s=this.hold&&a?Dn(this.steeredPose(),this.hold,a.x,a.y):null;if(s)this.steerTarget(s);else{let l=[this.targetT.x,this.targetT.y,this.targetT.z];this.panBy(e,n);let u=[this.targetT.x,this.targetT.y,this.targetT.z];this.targetT.set(l[0],l[1],l[2]),this.steerTarget(u),this.takeHold(r.x,r.y)}this.fireGesture(),this.applySteered()}mapTwoFingerMove(e,n){let o=(e.x+n.x)/2,i=(e.y+n.y)/2,r=Math.hypot(n.x-e.x,n.y-e.y),a=Math.atan2(n.y-e.y,n.x-e.x);if(this.twoIntent==="undecided"){if(this.twoIntent=Cr(this.twoStart,[e,n]),this.twoIntent==="undecided")return;this.pinchDist=r,this.pinchAngle=a;let[h,d]=this.twoStart,c=a-Math.atan2(d.y-h.y,d.x-h.x);c>Math.PI&&(c-=2*Math.PI),c<-Math.PI&&(c+=2*Math.PI),this.twistSoFar=Math.max(-Wt,Math.min(Wt,c)),this.pinchCy=i,this.twoIntent==="free"&&this.takeHold(o,i);return}if(this.twoIntent==="tilt"){this.polT=Math.max(Ut,Math.min(Yt,this.polT+Lr(0,i-this.pinchCy).polar)),this.pinchCy=i,this.fireGesture(),this.applySteered();return}let s=this.ndc(o,i);this.hold||this.takeHold(o,i);let l=this.hold&&s?Dn(this.steeredPose(),this.hold,s.x,s.y):null;l&&this.steerTarget(l);let u=Tr(this.pinchDist,r);if(this.pinchDist=r,u!==1){let h=this.distT,d=this.holdOnSeat?$t:this.minDist;this.distT=Math.max(Math.min(d,h),Math.min(this.maxDist,h*u)),this.holdOnSeat&&(this.minDist=Math.min(this.minDist,Math.max($t,this.distT))),Number.isFinite(this.distT)||(this.distT=h);let c=this.distT/h;this.hold&&Number.isFinite(c)&&c!==1&&this.steerTarget([this.hold[0]+(this.targetT.x-this.hold[0])*c,this.hold[1]+(this.targetT.y-this.hold[1])*c,this.hold[2]+(this.targetT.z-this.hold[2])*c])}let m=a-this.pinchAngle;if(m>Math.PI&&(m-=2*Math.PI),m<-Math.PI&&(m+=2*Math.PI),this.pinchAngle=a,Math.abs(m)<.5){let h=Pr(this.twistSoFar,this.twistTurning,m);this.twistSoFar=h.soFar,this.twistTurning=h.turning,h.turn!==0&&(this.azT+=h.turn,this.hold&&this.steerTarget(Er([this.targetT.x,this.targetT.y,this.targetT.z],this.hold,h.turn)))}this.fireGesture(),this.applySteered()}mapTouchUp(){if(this.activePointers.size===0){this.endMapGesture();return}if(this.activePointers.size===1){let[n]=[...this.activePointers.values()];this.twoStart=null,this.pair=null,this.touchMoving=!0,this.takeHold(n.x,n.y);return}let e=[...this.activePointers.keys()];this.twoStart&&(!this.pair||this.pair[0]!==e[0]||this.pair[1]!==e[1])&&this.rebasePair()}frame(e,n=!1,o,i=!1,r){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.widenPanBox(e);let a=Math.max(1,e.radius),s=this.fovY*fe/2,l=i?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*l);this.azT=o??-30*fe,this.polT=Math.max(15,Math.min(80,r?.polarDeg??55))*fe;let m=this.framedOn(e,s,u),h=m.distance;this.target.set(m.center[0],m.center[1],m.center[2]),this.targetT.copy(this.target),this.distT=h*Math.max(1.05,Math.min(2,r?.margin??Ln)),this.envelope=Vr(this.envelope,a,h),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.overviewDist===null&&(this.overviewDist=this.distT),n?(this.azimuth=this.azT,this.polar=12*fe,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(e){if(!(e>0)||!Number.isFinite(e))return;let n=this.camera.aspect;if(this.interactionEnabled&&n>0){let o=Math.min(n,1)/Math.min(e,1);this.distance*=o,this.distT*=o,this.overviewDist!==null&&(this.overviewDist*=o),this.maxDist=Math.max(this.maxDist,this.distance,this.distT),this.applyPosition()}this.camera.perspective({aspect:e})}glideTo(e,n){this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.widenPanBox(e),this.targetT.set(e.center[0],e.center[1],e.center[2]);let o=this.fovY*fe/2,i=Math.atan(Math.tan(o)*(this.camera.aspect||1));this.azT=this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*fe;let r=this.framedOn(e,o,i),a=r.distance;this.targetT.set(r.center[0],r.center[1],r.center[2]),this.distT=a*Math.max(1.05,Math.min(2,n?.margin??Ln)),this.envelope=Vr(this.envelope,Math.max(1,e.radius),a),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.requestRender()}frameSoft(e,n,o=!1,i){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.widenPanBox(e),this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let r=this.fovY*fe/2,a=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(r)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*fe;let l=this.framedOn(e,r,s);this.targetT.set(l.center[0],l.center[1],l.center[2]),this.distT=l.distance*Math.max(1.05,Math.min(2,i?.margin??Ln))}framedOn(e,n,o){return ws(e,Math.tan(o),Math.tan(n),this.azT,this.polT,i=>this.fitDistance({...e,center:i},n,o,this.azT,this.polT))}fitDistance(e,n,o,i,r){let a=Math.max(1,e.radius),s=Math.max(a/Math.tan(n),a/Math.tan(o)),l=e.box;if(!l)return s;let u=zr(i,r);if(!u)return s;let{fx:m,fy:h,fz:d,rx:c,rz:p,ux:f,uy:y,uz:w}=u,b=Math.tan(o),S=Math.tan(n),A=1;for(let M=0;M<8;M++){let C=(M&1?l.max[0]:l.min[0])-e.center[0],k=(M&2?l.max[1]:l.min[1])-e.center[1],z=(M&4?l.max[2]:l.min[2])-e.center[2],N=C*m+k*h+z*d,O=Math.abs(C*c+z*p),U=Math.abs(C*f+k*y+z*w);A=Math.max(A,O/b-N,U/S-N)}let F=Math.min(s,Math.max(A,a*.35)),T=e.fitPoints;if(!T||T.length<9)return F;let R=0,D=1/(b*Or),x=1/(S*Or);for(let M=0;M+2<T.length;M+=3){let C=T[M]-e.center[0],k=T[M+1]-e.center[1],z=T[M+2]-e.center[2],N=C*m+k*h+z*d,O=Math.abs(C*c+z*p),U=Math.abs(C*f+k*y+z*w);R=Math.max(R,O*D-N,U*x-N)}return Math.min(F*1.5,Math.max(F*.55,R))}updateClipping(e){let n=this.camera.position.x-e.center[0],o=this.camera.position.y-e.center[1],i=this.camera.position.z-e.center[2],r=Math.hypot(this.camera.position.x-this.target.x,this.camera.position.y-this.target.y,this.camera.position.z-this.target.z),a=this.interactionEnabled&&Math.abs(r-this.distance)<=this.distance*.01,{near:s,far:l}=As(Math.hypot(n,o,i),e.radius,a?this.distance:null);this.camera.perspective({near:s,far:l,aspect:this.camera.aspect})}update(){let e=this.azT-this.azimuth,n=this.polT-this.polar,o=this.distT-this.distance,i=this.targetT.x-this.target.x,r=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),l=Math.abs(e)>1e-4||Math.abs(n)>1e-4||Math.abs(o)>1e-4||Math.abs(i)>s||Math.abs(r)>s||Math.abs(a)>s,u=typeof performance<"u"?performance.now():0,m=this.touchNavigation==="map"?Fr(Ir,u-this.lastUpdateMs,this.wasMoving):Ir;return this.lastUpdateMs=u,this.wasMoving=l,this.azimuth+=e*m,this.polar+=n*m,this.distance+=o*m,this.target.x+=i*m,this.target.y+=r*m,this.target.z+=a*m,l&&this.applyPosition(),l}get currentAzimuth(){return this.azimuth}get currentDistance(){return this.distance}get targetDistance(){return this.distT}syncFromCamera(){let e=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,o=this.camera.position.z-this.target.z,i=Math.hypot(e,n,o)||1,r=Math.max(Ut,Math.min(Yt,Math.acos(Math.max(-1,Math.min(1,n/i)))));this.distance=this.distT=i,this.polar=this.polT=r,this.azimuth=this.azT=Math.atan2(e,o)}snapshot(){let e=this.target.clone(),n=this.targetT.clone(),{azimuth:o,azT:i,polar:r,polT:a,distance:s,distT:l}=this,u=this.camera.position.clone(),m=[...this.camera.quaternion],h=this.camera.fov;return()=>{this.target.copy(e),this.targetT.copy(n),Object.assign(this,{azimuth:o,azT:i,polar:r,polT:a,distance:s,distT:l}),this.camera.position.copy(u),this.camera.quaternion.set(m[0],m[1],m[2],m[3]),this.camera.perspective({fov:h,aspect:this.camera.aspect}),this.camera.updateMatrixWorld()}}setTarget(e){this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target)}resumeAfterFlight(e){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),e&&this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let e=Math.sin(this.polar),n=this.target.x+this.distance*e*Math.sin(this.azimuth),o=this.target.y+this.distance*Math.cos(this.polar),i=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(n,o,i),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}},Ss=.1,Ms=.25;function As(t,e,n){let o=Math.max(1,e)*1.18,i=n==null?Ms:Math.max(.05,n*Ss),r=Math.max(i,t-o),a=Math.max(r+10,t+o);return{near:r,far:a}}var jt=class{constructor(e){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=e=>{let n=this.lastTime?(e-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=e,n>0){let i=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+i*.1:i}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=e}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};function Nr(t){let e=!1;return n=>{n!==e&&(e=n,n?t.dataset.slReady="1":delete t.dataset.slReady)}}var ot=2.5,Ts=1.15,St=12,rt=22,Vn=30,On=4,Kt=8192;var Mu=rt+On;function Hr(t,e){let n=e*1.4,o=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:ot};let i=Math.min(1,(t-n)/Math.max(.001,o-n));return{scale:1-i*.4,fade:i*.55,minPixels:ot+i*(Ts-ot)}}function Gr(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}var Ps=12;function Br(t,e,n,o,i){if(!(t>0)||!(e>0)||!(n>0)||!(o>0)||!(i>0))return!1;let r=Math.tan(o/2*Math.PI/180);if(!(r>0))return!1;let a=e/(n*r)*(i/2);return Math.PI*a*a/t>=Ps}import{Geometry as Es,Mesh as Cs,Program as Rs,Transform as _s}from"ogl";var Fs=.05,Is=.55,Ds=12,ks=1.6,Ls=1,Vs=2.5,Os=650,Ue={height:6,baseRadius:.16,topRadius:.3,fadeInFromM:16,fullByM:40,nearStrength:.6};function zs(t,e){if(e)return 0;let n=(t-Ue.fadeInFromM)/(Ue.fullByM-Ue.fadeInFromM);return Math.max(Ue.nearStrength,Math.min(1,n))}var Wr=24;function Ns(t){let e=[],n=[],o=[],i=(h,d,c)=>{e.push(...h),n.push(...d),o.push(c)};for(let h=0;h<16;h++){let d=h/16*Math.PI*2,c=(h+1)/16*Math.PI*2,p=S=>[Math.cos(S),0,Math.sin(S)],f=[Math.cos(d)*.012,0,Math.sin(d)*.012],y=[Math.cos(c)*.012,0,Math.sin(c)*.012],w=[Math.cos(d)*.03,1,Math.sin(d)*.03],b=[Math.cos(c)*.03,1,Math.sin(c)*.03];i(f,p(d),0),i(w,p(d),0),i(b,p(c),0),i(f,p(d),0),i(b,p(c),0),i(y,p(c),0)}let l=.16,u=.24,m=.01;for(let h=0;h<48;h++){let d=h/48*Math.PI*2,c=(h+1)/48*Math.PI*2,p=[Math.cos(d)*l,m,Math.sin(d)*l],f=[Math.cos(d)*u,m,Math.sin(d)*u],y=[Math.cos(c)*u,m,Math.sin(c)*u],w=[Math.cos(c)*l,m,Math.sin(c)*l];for(let b of[p,f,y,p,y,w])i(b,[0,1,0],1)}for(let h=0;h<32;h++){let d=h/32*Math.PI*2,c=(h+1)/32*Math.PI*2,p=Ue.baseRadius,f=Ue.topRadius,y=[Math.cos(d)*p,0,Math.sin(d)*p],w=[Math.cos(c)*p,0,Math.sin(c)*p],b=[Math.cos(d)*f,1,Math.sin(d)*f],S=[Math.cos(c)*f,1,Math.sin(c)*f],A=[Math.cos(d),0,Math.sin(d)],F=[Math.cos(c),0,Math.sin(c)];i(y,A,2),i(b,A,2),i(S,F,2),i(y,A,2),i(S,F,2),i(w,F,2)}return new Es(t,{position:{size:3,data:new Float32Array(e)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(o)}})}var Hs=`#version 300 es
16
16
  precision highp float;
17
17
  in vec3 position; in vec3 normal; in float part;
18
18
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform mat3 normalMatrix;
@@ -39,7 +39,7 @@ void main() {
39
39
  float scale = part > 0.5 ? uRingScale : uHeight;
40
40
  vec3 world = uSeat + vec3(position.x, position.y * grow, position.z) * scale;
41
41
  gl_Position = projectionMatrix * modelViewMatrix * vec4(world, 1.0);
42
- }`,wi=`#version 300 es
42
+ }`,Gs=`#version 300 es
43
43
  precision highp float;
44
44
  in vec3 vNormal; in float vPart; in float vAlong;
45
45
  uniform vec3 uColor; uniform float uRingAlpha; uniform vec3 uBeamColor; uniform float uBeam;
@@ -57,25 +57,25 @@ void main() {
57
57
  float key = max(dot(normalize(vNormal), normalize(vec3(-0.4, 0.7, 0.6))), 0.0);
58
58
  vec3 c = uColor * (0.55 + 0.5 * key) + vec3(0.12) * pow(key, 12.0);
59
59
  fragColor = vec4(c, 1.0);
60
- }`;function Si(t){if(t>=1)return 1;if(t<.72){let n=t/.72;return 1-(1-n)*(1-n)}let e=(t-.72)/.28;return 1-.08*Math.sin(e*Math.PI)}function yn(t){return Math.max(hi,Math.min(mi,t*di))}function Mi(t){let e=.2126*t[0]+.7152*t[1]+.0722*t[2],n=e>=.25?0:Math.min(.45,(.25-e)*2.2);return t.map(r=>r+(1-r)*n)}function Qo(t,e,n=[.24,.74,1]){let r=Mi(n),a=new ui,o=yi(t),i=new Map,s=(l,c)=>{let f=new ci(t,{vertex:xi,fragment:wi,uniforms:{uSeat:{value:l},uHeight:{value:1},uLift:{value:0},uRingScale:{value:1},uBeamHeight:{value:He.height},uBeam:{value:0},uBeamColor:{value:r},uColor:{value:e},uRingAlpha:{value:.85}},transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1}),m=new li(t,{geometry:o,program:f});return m.frustumCulled=!1,m.setParent(a),{mesh:m,program:f,seat:l,start:c}};return{root:a,setSeats(l,c,f){let m=new Set(l.slice(0,Zo).map(u=>u.id));for(let[u,d]of i)m.has(u)||(d.mesh.setParent(null),i.delete(u));for(let u of l.slice(0,Zo))i.has(u.id)||i.set(u.id,s(u.position,f?c:-1/0))},update(l,c,f,m=!1){let u=!1;for(let d of i.values()){let h=c[0]-d.seat[0],y=c[1]-d.seat[1],v=c[2]-d.seat[2],x=Math.hypot(h,y,v);d.mesh.visible=!f&&x>(m?fi:vi);let T=yn(x),A=Math.max(0,Math.min(1,(l-d.start)/bi));A<1&&(u=!0),d.program.uniforms.uHeight.value=T,d.program.uniforms.uRingScale.value=Math.min(T,pi),d.program.uniforms.uLift.value=m?1:1-Si(A),d.program.uniforms.uBeam.value=gi(x,m),d.program.uniforms.uRingAlpha.value=.55+.4*(A<1?Math.sin(A*Math.PI):0)}return u},dispose(){for(let l of i.values())l.mesh.setParent(null);i.clear(),o.remove()}}}var mt="#ffffff",Jo="#0b1220",pt=6,Ai=80,er=14,tr=88,nr=20,or={floor:{size:14,weight:"700",opacity:.98},stage:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},gate:{size:12,weight:"700",opacity:.98},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1},access:{size:12,weight:"700",opacity:1}},Pi=640,Ei=.8,Ci=11,Ti="3px 7px",Ri="2px 5px",rr="rgba(10,14,22,.62)",_i="#f4f7fb",ar=5,ir=2,Fi=6,ft=new Set(["row","seat","access"]),xn={stage:6,gate:5,floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Je={row:{x:66,y:20},seat:{x:52,y:22}},Ge=ro,wn=t=>ao(t);function Be(t,e){let n=wn(t),r=wn(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Ii(t){let e=Ge(t);if(!e)return null;let n=o=>`#${o.map(i=>Math.round(Math.max(0,Math.min(1,i))*255).toString(16).padStart(2,"0")).join("")}`,r=e.map(o=>o+(1-o)*.78),a=e.map(o=>o*.62);for(let o=0;o<12&&Be(a,r)<4.5;o++)a=a.map(i=>i*.8);return{fill:n(r),ink:n(a),border:n(e.map(o=>o+(1-o)*.35)),contrast:Be(a,r)}}var Di=30;function Sn(t,e){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(t.replace(/\s/g,""));if(!n)return e;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(a=>Number(n[a])/255*r+e[a-1]*(1-r))}function ki(t,e=[.04,.06,.1],n=!0){let r=wn(e)<.42,a=r?"#f4f7fb":"#0b1220",o=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",i=n?Sn(o,e):e,s=Ge(t),l=n?7:4.5,c=s&&Be(s,i)>=l?t:a;return r?{ink:c,backing:o,border:"rgba(210,222,245,.24)"}:{ink:c,backing:o,border:"rgba(11,18,32,.22)"}}function Li(t,e=[.04,.06,.1]){let n=Sn(rr,e),r=Ge(t);return{ink:r&&Be(r,n)>=4.5?t:_i,backing:rr}}var Vi=.8,et=20,zi=14,Oi=60,Ni='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',kt=class{constructor(e,n={}){this.nodes=new Map;this.labels=[];this.wheelchairFree=new Map;this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.overviewDistance=null;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.seatNumberRow=void 0;this.seatNumberSeat=null;this.pinHeads=[];this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",r.fontFamily=n.fontFamily||Ni,e.appendChild(this.root)}setVisible(e){this.root.style.visibility=e?"":"hidden"}setLabels(e){this.labels=e;let n=new Set(e.map(r=>r.id));for(let[r,a]of this.nodes)n.has(r)||(a.remove(),this.nodes.delete(r))}setForcedDense(e){this.forcedDense=e}setOverviewDistance(e){this.overviewDistance=e>0?e:null}setSeatNumberRow(e){return e===this.seatNumberRow?!1:(this.seatNumberRow=e,!0)}setSeatNumberSeat(e){let n=e?`seat:${e}`:null;return n===this.seatNumberSeat?!1:(this.seatNumberSeat=n,!0)}setWheelchairFree(e){let n=e.size!==this.wheelchairFree.size;if(!n){for(let[r,a]of e)if(this.wheelchairFree.get(r)!==a){n=!0;break}}return n&&(this.wheelchairFree=new Map(e)),n}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,n=>`seat:${n}`))}sizeFor(e){let n=or[e].size;return!this.narrowStage||ft.has(e)?n:Math.max(Ci,n*Ei)}qualityEvidence(){let e=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let a=this.nodes.get(r.id),o=a?.getBoundingClientRect(),i=!!(n&&a&&a.style.display!=="none"&&o&&o.width>0&&o.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:i,renderedFontPx:a&&Number.parseFloat(a.style.fontSize)||0,contrast:a?Number(a.dataset.qualityContrast??0):0,...i&&o?{screenBox:{x:o.x-e.x,y:o.y-e.y,width:o.width,height:o.height}}:{}}})}update(e,n,r,a,o,i){if(!this.labels.length)return;this.narrowStage=n>0&&n<Pi;let s=Eo(a,o,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"),s.add("access")),!this.forcedDense&&this.overviewDistance!==null&&a>this.overviewDistance*Vi&&(s.delete("section"),s.delete("ga")),s.has("section")&&this.labels.some(g=>g.kind==="section")&&s.delete("zone");let l=[];for(let g of this.labels){let D=g.kind==="annotation"&&!!g.venueIcon;if(!s.has(g.kind)&&!D&&!(g.kind==="seat"&&this.selectedSeatLabelIds.has(g.id)))continue;let w=g.kind==="seat"&&i&&this.selectedSeatLabelIds.has(g.id)?g.pinBase:void 0,I=w&&i?[w[0],w[1]+yn(Math.hypot(w[0]-i[0],w[1]-i[1],w[2]-i[2])),w[2]]:g.anchor,N=Te(e,I,n,r);if(!N.visible)continue;let P=ft.has(g.kind),O=this.sizeFor(g.kind),G=g.kind==="access"?et:_o(g.text,O,!P)+(P?ar*2:0)+((this.wheelchairFree.get(g.id)??0)>0?Di:0);if(g.kind==="access"&&g.seatWidthM!==void 0&&un(e,g.anchor,g.seatWidthM,n)<zi||g.kind==="seat"&&g.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(g.id)&&un(e,g.anchor,g.seatWidthM,n)<Math.max(22,G))continue;let U=Co(N,G/2,O/2+(P?ir:4),n,r),B=i?Math.hypot(g.anchor[0]-i[0],g.anchor[1]-i[1],g.anchor[2]-i[2]):1;l.push({label:g,screen:U,focus:Io(U,B,n,r),halfWidth:G/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let c=Po(l.filter(g=>g.label.kind==="floor"),n),f=[...l.filter(g=>!ft.has(g.label.kind)&&g.label.kind!=="floor"),...c],m=Fo(n),u=l.filter(g=>g.label.kind==="seat"&&this.selectedSeatLabelIds.has(g.label.id)),d=ct(u,Je.seat.x,Je.seat.y,m.seat);this.placePinHeads(u.filter(g=>g.label.pinBase&&!d.includes(g)).map(g=>g.screen));let h=To(f,tr,nr,g=>xn[g.label.kind]??0).filter(g=>!d.some(D=>Ro(g,D,tr,nr))),y=ct(l.filter(g=>g.label.kind==="access"),et,et,Oi,[...h,...d]),v=ct(l.filter(g=>g.label.kind==="row"),Je.row.x,Je.row.y,m.row,[...h,...d,...y]),x=this.seatNumberRow!==void 0||this.seatNumberSeat!==null,T=ct(l.filter(g=>g.label.kind==="seat"&&!this.selectedSeatLabelIds.has(g.label.id)&&(this.seatNumberSeat!==null?g.label.id===this.seatNumberSeat:!x||this.seatNumberRow!==null&&g.label.rowId===this.seatNumberRow)),Je.seat.x,Je.seat.y,x?Ai:m.seat-d.length,[...h,...d,...y,...v]),A=[...h,...y,...v,...d,...T],F=new Set(A.map(g=>g.label.id));for(let{label:g,screen:D}of A){let I=this.nodeFor(g).style;I.display=g.kind==="access"?"flex":g.kind==="gate"?"inline-flex":"";let N=!!g.pinBase&&this.selectedSeatLabelIds.has(g.id);I.transform=N?`translate(-50%, -100%) translate(${D.x.toFixed(1)}px, ${(D.y-pt).toFixed(1)}px)`:`translate(-50%, -50%) translate(${D.x.toFixed(1)}px, ${D.y.toFixed(1)}px)`}let _=A.filter(({label:g})=>!ft.has(g.kind)).sort((g,D)=>xn[D.label.kind]-xn[g.label.kind]||g.screen.depth-D.screen.depth||g.focus-D.focus).flatMap(({label:g})=>{let D=this.nodes.get(g.id);return D&&D.style.display!=="none"?[{node:D,box:D.getBoundingClientRect()}]:[]}),V=[];for(let{node:g,box:D}of _)V.some(I=>D.left<I.right+3&&D.right+3>I.left&&D.top<I.bottom+3&&D.bottom+3>I.top)?g.style.display="none":V.push(D);for(let[g,D]of this.nodes)F.has(g)||(D.style.display="none")}nodeFor(e){let n=this.nodes.get(e.id);if(!n){n=document.createElement("div");let x=n.style;x.position="absolute",x.left="0",x.top="0",x.whiteSpace="nowrap",x.display="none",this.root.appendChild(n),this.nodes.set(e.id,n)}let r=this.selectedSeatLabelIds.has(e.id),a=this.nodeAppearance.get(n),o=this.wheelchairFree.get(e.id)??0,i=e.text+(e.icon??"")+(e.venueIcon??"")+(e.tint??"")+(o>0?`|${o}`:"");if(a&&a.text===i&&a.kind===e.kind&&a.color===e.color&&a.selected===r&&a.narrow===this.narrowStage)return n;if(this.nodeAppearance.set(n,{text:i,kind:e.kind,color:e.color,selected:r,narrow:this.narrowStage}),e.kind==="access")return this.paintAccessChip(n,e);if(n.textContent=e.text,r){let x=document.createElement("span"),T=x.style;T.position="absolute",T.left="50%",T.bottom=`-${pt}px`,T.transform="translateX(-50%)",T.borderLeft=`${pt}px solid transparent`,T.borderRight=`${pt}px solid transparent`,T.borderTop=`${pt}px solid ${mt}`,n.appendChild(x)}n.setAttribute("data-label-kind",e.kind),n.toggleAttribute("data-selected-seat",r);let s=or[e.kind],l=n.style;l.fontSize=`${this.sizeFor(e.kind)}px`,l.fontWeight=r?"800":s.weight,l.opacity=r?"1":String(s.opacity);let c=ft.has(e.kind),f=!c,m=ki(e.color??this.opts.ink,this.opts.backgroundRgb,!0),u=c?Li(e.color??this.opts.ink,this.opts.backgroundRgb):m;l.color=r?Jo:u.ink,l.background=r?mt:u.backing,l.border=r?`1px solid ${mt}`:f?`1px solid ${m.border}`:"",l.borderRadius=r||f?"999px":`${Fi}px`;let d=this.narrowStage?Ri:Ti;l.padding=r||f?d:`${ir}px ${ar}px`,l.lineHeight=c?"1.1":"",l.boxShadow=r?"0 0 0 3px rgba(255,255,255,.28), 0 0 18px rgba(255,255,255,.55), 0 5px 14px rgba(0,0,0,.45)":f?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",l.textShadow=r||f?"none":"0 1px 1px rgba(0,0,0,0.4)",l.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let h=this.opts.backgroundRgb??[.04,.06,.1],y=Ge(r?Jo:u.ink)??[1,1,1],v=Sn(r?mt:u.backing,h);return n.dataset.qualityContrast=Be(y,v).toFixed(3),l.textTransform=e.kind==="zone"||e.kind==="floor"?"uppercase":"",e.kind==="section"&&this.dressSectionTag(n,e,o),e.kind==="gate"&&this.dressGateTag(n,e),e.venueIcon&&this.dressVenueIconTag(n,e.venueIcon),n}dressVenueIconTag(e,n){let r=lo(n);if(!r)return;let a=e.style;a.display="inline-flex",a.alignItems="center",a.gap="5px";let o=16,i=so.glyphScale,s=document.createElement("span");s.setAttribute("aria-hidden","true"),s.setAttribute("data-venue-icon",r.key),s.style.lineHeight="0",s.innerHTML=`<svg width="${o}" height="${o}" viewBox="0 0 24 24"><circle cx="12" cy="12" r="11.25" fill="${io[r.group]}" stroke="${rn}" stroke-width="1.5"/><path transform="translate(${12-12*i} ${12-12*i}) scale(${i})" d="${r.solid}" fill="${rn}"/></svg>`,e.prepend(s)}dressGateTag(e,n){let r=e.style;r.background="#0f172a",r.color="#ffffff",r.border="1px solid rgba(255,255,255,0.28)",r.textTransform="uppercase",r.letterSpacing="0.06em",r.display="inline-flex",r.alignItems="center",r.gap="5px";let a=document.createElement("span");if(a.setAttribute("aria-hidden","true"),a.setAttribute("data-gate-arrow",n.icon==="exit"?"out":"in"),a.innerHTML=n.icon==="exit"?'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M5 1.5H2v9h3"/><path d="M5.5 6h5M8.5 3.5 11 6 8.5 8.5"/></svg>':'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M7 1.5h3v9H7"/><path d="M1 6h5.5M4 3.5 6.5 6 4 8.5"/></svg>',e.prepend(a),n.stepFree){let o=document.createElement("span");o.setAttribute("data-gate-step-free","true"),o.setAttribute("aria-label","Step-free"),o.style.lineHeight="0",o.innerHTML=Pt("wheelchair",{size:11}),e.append(o)}e.dataset.qualityContrast=Be([1,1,1],Ge("#0f172a")).toFixed(3)}dressSectionTag(e,n,r){let a=n.tint?Ii(n.tint):null,o=e.style;if(a&&(o.background=a.fill,o.color=a.ink,o.border=`1px solid ${a.border}`,e.dataset.qualityContrast=a.contrast.toFixed(3)),r<=0)return;let i=document.createElement("span");i.setAttribute("data-wheelchair-free",String(r)),i.setAttribute("aria-label",`${r} wheelchair ${r===1?"place":"places"} free`),i.innerHTML=`${Pt("wheelchair",{size:11})}<span>${r}</span>`;let s=i.style;s.display="inline-flex",s.alignItems="center",s.gap="2px",s.marginLeft="6px",s.padding="1px 5px",s.borderRadius="999px",s.background="#2563eb",s.color="#ffffff",s.fontSize="0.85em",s.lineHeight="1.2",s.verticalAlign="middle",e.appendChild(i)}paintAccessChip(e,n){e.setAttribute("data-label-kind","access"),e.setAttribute("data-access-type",n.icon??""),e.innerHTML=n.icon?Pt(n.icon,{size:et-6}):"",e.setAttribute("role","img"),e.setAttribute("aria-label",n.text);let r=e.style;return r.width=`${et}px`,r.height=`${et}px`,r.alignItems="center",r.justifyContent="center",r.borderRadius="50%",r.background=n.color??"#3b82f6",r.color=n.ink??"#ffffff",r.border="1.5px solid #ffffff",r.boxShadow="0 2px 6px rgba(0,0,0,.35)",r.padding="0",r.lineHeight="0",r.boxSizing="border-box",e.dataset.qualityContrast=Be(Ge(n.ink??"#ffffff")??[1,1,1],Ge(n.color??"#3b82f6")??[.23,.51,.96]).toFixed(3),e}placePinHeads(e){for(;this.pinHeads.length<e.length;){let n=document.createElement("div");n.setAttribute("data-pin-head",""),n.setAttribute("aria-hidden","true");let r=n.style;r.position="absolute",r.left="0",r.top="0",r.width=`${er}px`,r.height=`${er}px`,r.borderRadius="50%",r.background=mt,r.boxShadow="0 0 0 3px rgba(255,255,255,.28), 0 0 14px rgba(255,255,255,.55), 0 3px 8px rgba(0,0,0,.45)",r.pointerEvents="none",this.root.appendChild(n),this.pinHeads.push(n)}this.pinHeads.forEach((n,r)=>{let a=e[r];n.style.display=a?"":"none",a&&(n.style.transform=`translate(-50%, -100%) translate(${a.x.toFixed(1)}px, ${a.y.toFixed(1)}px)`)})}dispose(){this.pinHeads=[],this.root.remove(),this.nodes.clear()}};var Hi=1;var Gi=new Set(["floor","stage","zone","section","ga","booth","annotation"]);function Bi(t){return t.every(e=>Number.isFinite(e))}function Wi(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function sr(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function We(t){return Math.round(t*1e4)/1e4}function Ui(t){if(t)return{box:{x:We(t.box.x),y:We(t.box.y),width:We(t.box.width),height:We(t.box.height)},horizontalFillRatio:We(t.horizontalFillRatio),verticalFillRatio:We(t.verticalFillRatio),visibleAreaRatio:We(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function Re(t,e,n){return n.length?{code:t,message:e,count:n.length,samples:n.slice(0,20)}:null}function Mn(t){let e=t.labels.filter(s=>s.visible&&s.screenBox),n=e.filter(s=>Gi.has(s.kind)),r=t.scene.floorCount>1?t.scene.floorCount:t.scene.zoneCount||t.scene.sectionCount,a=[];for(let s=0;s<n.length;s+=1)for(let l=0;l<s;l+=1)Wi(n[s].screenBox,n[l].screenBox)&&a.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[l].id});let o=[...t.camera.position,t.camera.distance,t.camera.verticalFovDeg],i=[Re("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Re("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Re("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Re("viewport-empty","The 3D viewport must have visible dimensions",t.viewport.width>1&&t.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${t.viewport.width}\xD7${t.viewport.height}`}]),Re("camera-invalid","The capture camera must have a finite physical pose",Bi(o)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Re("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!t.scene.authoredRelief||t.scene.renderedVerticalSpanM>.05&&t.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:t.scene.projectedReliefPx,minimum:2}]),Re("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Re("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Re("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Re("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",a)].filter(s=>!!s);return{version:1,state:"venue3d",passed:i.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:t.viewport,context:t.context,frame:t.frame,camera:t.camera,scene:t.scene,composition:{visibleLabels:e.map(({id:s,kind:l,text:c})=>({id:s,kind:l,text:c})).sort((s,l)=>s.kind.localeCompare(l.kind)||s.id.localeCompare(l.id)),framing:Ui(t.framing)},metrics:{minimumHierarchyFontPx:sr(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:sr(n.map(s=>s.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:i}}function lr(t,e,n){t.fill(0);for(let r=0;r<Math.min(n,e.length);r++)t[e[r]]=1}import{Geometry as vt,Mesh as bt,Program as fs,Texture as vs,Transform as Pr}from"ogl";import{Program as Ue}from"ogl";var Lt=`
60
+ }`;function Bs(t){if(t>=1)return 1;if(t<.72){let n=t/.72;return 1-(1-n)*(1-n)}let e=(t-.72)/.28;return 1-.08*Math.sin(e*Math.PI)}function zn(t){return Math.max(Is,Math.min(Ds,t*Fs))}function Ws(t){let e=.2126*t[0]+.7152*t[1]+.0722*t[2],n=e>=.25?0:Math.min(.45,(.25-e)*2.2);return t.map(o=>o+(1-o)*n)}function Ur(t,e,n=[.24,.74,1]){let o=Ws(n),i=new _s,r=Ns(t),a=new Map,s=(l,u)=>{let m=new Rs(t,{vertex:Hs,fragment:Gs,uniforms:{uSeat:{value:l},uHeight:{value:1},uLift:{value:0},uRingScale:{value:1},uBeamHeight:{value:Ue.height},uBeam:{value:0},uBeamColor:{value:o},uColor:{value:e},uRingAlpha:{value:.85}},transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1}),h=new Cs(t,{geometry:r,program:m});return h.frustumCulled=!1,h.setParent(i),{mesh:h,program:m,seat:l,start:u}};return{root:i,setSeats(l,u,m){let h=new Set(l.slice(0,Wr).map(d=>d.id));for(let[d,c]of a)h.has(d)||(c.mesh.setParent(null),a.delete(d));for(let d of l.slice(0,Wr))a.has(d.id)||a.set(d.id,s(d.position,m?u:-1/0))},update(l,u,m,h=!1){let d=!1;for(let c of a.values()){let p=u[0]-c.seat[0],f=u[1]-c.seat[1],y=u[2]-c.seat[2],w=Math.hypot(p,f,y);c.mesh.visible=!m&&w>(h?Ls:Vs);let b=zn(w),S=Math.max(0,Math.min(1,(l-c.start)/Os));S<1&&(d=!0),c.program.uniforms.uHeight.value=b,c.program.uniforms.uRingScale.value=Math.min(b,ks),c.program.uniforms.uLift.value=h?1:1-Bs(S),c.program.uniforms.uBeam.value=zs(w,h),c.program.uniforms.uRingAlpha.value=.55+.4*(S<1?Math.sin(S*Math.PI):0)}return d},dispose(){for(let l of a.values())l.mesh.setParent(null);a.clear(),r.remove()}}}var Ye="#ffffff",Nn="#0b1220",Mt=6,Us=80,Yr=14,$r=88,Xr=20,jr={floor:{size:14,weight:"700",opacity:.98},stage:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},gate:{size:12,weight:"700",opacity:.98},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1},access:{size:12,weight:"700",opacity:1}},Ys=640,$s=.8,Xs=11,js="3px 7px",Ks="2px 5px",Kr="rgba(10,14,22,.62)",qs="#f4f7fb",qr=5,Zr=2,Zs=6,At=new Set(["row","seat","access"]),Hn={stage:6,gate:5,floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},it={row:{x:66,y:20},seat:{x:52,y:22}},$e=Vo,Gn=t=>Oo(t);function Xe(t,e){let n=Gn(t),o=Gn(e);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function Qs(t){let e=$e(t);if(!e)return null;let n=r=>`#${r.map(a=>Math.round(Math.max(0,Math.min(1,a))*255).toString(16).padStart(2,"0")).join("")}`,o=e.map(r=>r+(1-r)*.78),i=e.map(r=>r*.62);for(let r=0;r<12&&Xe(i,o)<4.5;r++)i=i.map(a=>a*.8);return{fill:n(o),ink:n(i),border:n(e.map(r=>r+(1-r)*.35)),contrast:Xe(i,o)}}var Js=30,el=30,tl=.62;function Bn(t,e){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(t.replace(/\s/g,""));if(!n)return e;let o=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(i=>Number(n[i])/255*o+e[i-1]*(1-o))}function nl(t,e=[.04,.06,.1],n=!0){let o=Gn(e)<.42,i=o?"#f4f7fb":"#0b1220",r=o?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Bn(r,e):e,s=$e(t),l=n?7:4.5,u=s&&Xe(s,a)>=l?t:i;return o?{ink:u,backing:r,border:"rgba(210,222,245,.24)"}:{ink:u,backing:r,border:"rgba(11,18,32,.22)"}}function ol(t,e=[.04,.06,.1]){let n=Bn(Kr,e),o=$e(t);return{ink:o&&Xe(o,n)>=4.5?t:qs,backing:Kr}}var rl=.8,at=20,il=14,al=60,sl='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',qt=class{constructor(e,n={}){this.nodes=new Map;this.labels=[];this.wheelchairFree=new Map;this.placedTags=[];this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.overviewDistance=null;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.seatNumberRow=void 0;this.seatNumberSeat=null;this.pinHeads=[];this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let o=this.root.style;o.position="absolute",o.inset="0",o.pointerEvents="none",o.overflow="hidden",o.fontFamily=n.fontFamily||sl,e.appendChild(this.root)}setVisible(e){this.root.style.visibility=e?"":"hidden"}tagAt(e,n){if(this.root.style.visibility==="hidden")return null;for(let o of this.placedTags)if(e>=o.left&&e<=o.right&&n>=o.top&&n<=o.bottom)return o.id;return null}setLabels(e){this.labels=e;let n=new Set(e.map(o=>o.id));for(let[o,i]of this.nodes)n.has(o)||(i.remove(),this.nodes.delete(o))}setForcedDense(e){this.forcedDense=e}setOverviewDistance(e){this.overviewDistance=e>0?e:null}setSeatNumberRow(e){return e===this.seatNumberRow?!1:(this.seatNumberRow=e,!0)}setSeatNumberSeat(e){let n=e?`seat:${e}`:null;return n===this.seatNumberSeat?!1:(this.seatNumberSeat=n,!0)}setWheelchairFree(e){let n=e.size!==this.wheelchairFree.size;if(!n){for(let[o,i]of e)if(this.wheelchairFree.get(o)!==i){n=!0;break}}return n&&(this.wheelchairFree=new Map(e)),n}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,n=>`seat:${n}`))}sizeFor(e){let n=jr[e].size;return!this.narrowStage||At.has(e)?n:Math.max(Xs,n*$s)}qualityEvidence(){let e=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(o=>{let i=this.nodes.get(o.id),r=i?.getBoundingClientRect(),a=!!(n&&i&&i.style.display!=="none"&&r&&r.width>0&&r.height>0);return{id:o.id,kind:o.kind,text:o.text,visible:a,renderedFontPx:i&&Number.parseFloat(i.style.fontSize)||0,contrast:i?Number(i.dataset.qualityContrast??0):0,...a&&r?{screenBox:{x:r.x-e.x,y:r.y-e.y,width:r.width,height:r.height}}:{}}})}update(e,n,o,i,r,a){if(!this.labels.length){this.placedTags=[];return}this.narrowStage=n>0&&n<Ys;let s=sr(i,r,{hasZoneLabels:this.labels.some(x=>x.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"),s.add("access")),!this.forcedDense&&this.overviewDistance!==null&&i>this.overviewDistance*rl&&(s.delete("section"),s.delete("ga")),s.has("section")&&this.labels.some(x=>x.kind==="section")&&s.delete("zone");let l=[];for(let x of this.labels){let M=x.kind==="annotation"&&!!x.venueIcon;if(!s.has(x.kind)&&!M&&!(x.kind==="seat"&&this.selectedSeatLabelIds.has(x.id)))continue;let C=x.kind==="seat"&&a&&this.selectedSeatLabelIds.has(x.id)?x.pinBase:void 0,k=C&&a?[C[0],C[1]+zn(Math.hypot(C[0]-a[0],C[1]-a[1],C[2]-a[2])),C[2]]:x.anchor,z=Re(e,k,n,o);if(!z.visible)continue;let N=At.has(x.kind),O=this.sizeFor(x.kind),U=x.kind==="access"?at:hr(x.text,O,!N)+(N?qr*2:0)+((this.wheelchairFree.get(x.id)??0)>0?Js:0)+((x.count??0)>0?el:0);if(x.kind==="access"&&x.seatWidthM!==void 0&&En(e,x.anchor,x.seatWidthM,n)<il||x.kind==="seat"&&x.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(x.id)&&En(e,x.anchor,x.seatWidthM,n)<Math.max(22,U))continue;let $=lr(z,U/2,O/2+(N?Zr:4),n,o),Y=a?Math.hypot(x.anchor[0]-a[0],x.anchor[1]-a[1],x.anchor[2]-a[2]):1;l.push({label:x,screen:$,focus:mr($,Y,n,o),halfWidth:U/2,...this.selectedSeatLabelIds.has(x.id)?{priority:1}:{}})}let u=ar(l.filter(x=>x.label.kind==="floor"),n),m=[...l.filter(x=>!At.has(x.label.kind)&&x.label.kind!=="floor"),...u],h=dr(n),d=l.filter(x=>x.label.kind==="seat"&&this.selectedSeatLabelIds.has(x.label.id)),c=yt(d,it.seat.x,it.seat.y,h.seat);this.placePinHeads(d.filter(x=>x.label.pinBase&&!c.includes(x)).map(x=>x.screen));let p=cr(m,$r,Xr,x=>Hn[x.label.kind]??0).filter(x=>!c.some(M=>ur(x,M,$r,Xr))),f=yt(l.filter(x=>x.label.kind==="access"),at,at,al,[...p,...c]),y=yt(l.filter(x=>x.label.kind==="row"),it.row.x,it.row.y,h.row,[...p,...c,...f]),w=this.seatNumberRow!==void 0||this.seatNumberSeat!==null,b=yt(l.filter(x=>x.label.kind==="seat"&&!this.selectedSeatLabelIds.has(x.label.id)&&(this.seatNumberSeat!==null?x.label.id===this.seatNumberSeat:!w||this.seatNumberRow!==null&&x.label.rowId===this.seatNumberRow)),it.seat.x,it.seat.y,w?Us:h.seat-c.length,[...p,...c,...f,...y]),S=[...p,...f,...y,...c,...b],A=new Set(S.map(x=>x.label.id));for(let{label:x,screen:M}of S){let k=this.nodeFor(x).style;k.display=x.kind==="access"?"flex":x.kind==="gate"?"inline-flex":"";let z=!!x.pinBase&&this.selectedSeatLabelIds.has(x.id);k.transform=z?`translate(-50%, -100%) translate(${M.x.toFixed(1)}px, ${(M.y-Mt).toFixed(1)}px)`:`translate(-50%, -50%) translate(${M.x.toFixed(1)}px, ${M.y.toFixed(1)}px)`}let T=S.filter(({label:x})=>!At.has(x.kind)).sort((x,M)=>Hn[M.label.kind]-Hn[x.label.kind]||x.screen.depth-M.screen.depth||x.focus-M.focus).flatMap(({label:x})=>{let M=this.nodes.get(x.id);return M&&M.style.display!=="none"?[{id:x.id,node:M,box:M.getBoundingClientRect()}]:[]}),R=[],D=[];for(let{id:x,node:M,box:C}of T)R.some(z=>C.left<z.right+3&&C.right+3>z.left&&C.top<z.bottom+3&&C.bottom+3>z.top)?M.style.display="none":(R.push(C),C.width>0&&C.height>0&&D.push({id:x,left:C.left,right:C.right,top:C.top,bottom:C.bottom}));this.placedTags=D;for(let[x,M]of this.nodes)A.has(x)||(M.style.display="none")}nodeFor(e){let n=this.nodes.get(e.id);if(!n){n=document.createElement("div");let w=n.style;w.position="absolute",w.left="0",w.top="0",w.whiteSpace="nowrap",w.display="none",this.root.appendChild(n),this.nodes.set(e.id,n)}let o=this.selectedSeatLabelIds.has(e.id),i=this.nodeAppearance.get(n),r=this.wheelchairFree.get(e.id)??0,a=e.text+(e.icon??"")+(e.venueIcon??"")+(e.tint??"")+(r>0?`|${r}`:"")+((e.count??0)>0?`|x${e.count}`:"")+(e.muted?"|muted":"");if(i&&i.text===a&&i.kind===e.kind&&i.color===e.color&&i.selected===o&&i.narrow===this.narrowStage)return n;if(this.nodeAppearance.set(n,{text:a,kind:e.kind,color:e.color,selected:o,narrow:this.narrowStage}),e.kind==="access")return this.paintAccessChip(n,e);if(n.textContent=e.text,o){let w=document.createElement("span"),b=w.style;b.position="absolute",b.left="50%",b.bottom=`-${Mt}px`,b.transform="translateX(-50%)",b.borderLeft=`${Mt}px solid transparent`,b.borderRight=`${Mt}px solid transparent`,b.borderTop=`${Mt}px solid ${Ye}`,n.appendChild(w)}n.setAttribute("data-label-kind",e.kind),n.toggleAttribute("data-selected-seat",o);let s=jr[e.kind],l=n.style;l.fontSize=`${this.sizeFor(e.kind)}px`,l.fontWeight=o?"800":s.weight,l.opacity=o?"1":String(s.opacity);let u=At.has(e.kind),m=!u,h=nl(e.color??this.opts.ink,this.opts.backgroundRgb,!0),d=u?ol(e.color??this.opts.ink,this.opts.backgroundRgb):h;l.color=o?Nn:d.ink,l.background=o?Ye:d.backing,l.border=o?`1px solid ${Ye}`:m?`1px solid ${h.border}`:"",l.borderRadius=o||m?"999px":`${Zs}px`;let c=this.narrowStage?Ks:js;l.padding=o||m?c:`${Zr}px ${qr}px`,l.lineHeight=u?"1.1":"",l.boxShadow=o?"0 0 0 3px rgba(255,255,255,.28), 0 0 18px rgba(255,255,255,.55), 0 5px 14px rgba(0,0,0,.45)":m?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",l.textShadow=o||m?"none":"0 1px 1px rgba(0,0,0,0.4)",l.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let p=this.opts.backgroundRgb??[.04,.06,.1],f=$e(o?Nn:d.ink)??[1,1,1],y=Bn(o?Ye:d.backing,p);return n.dataset.qualityContrast=Xe(f,y).toFixed(3),l.textTransform=e.kind==="zone"||e.kind==="floor"?"uppercase":"",e.kind==="section"&&this.dressSectionTag(n,e,r),e.kind==="gate"&&this.dressGateTag(n,e),e.kind==="ga"&&this.dressAreaTag(n,e),e.venueIcon&&this.dressVenueIconTag(n,e.venueIcon),n}dressVenueIconTag(e,n){let o=Ho(n);if(!o)return;let i=e.style;i.display="inline-flex",i.alignItems="center",i.gap="5px";let r=16,a=No.glyphScale,s=document.createElement("span");s.setAttribute("aria-hidden","true"),s.setAttribute("data-venue-icon",o.key),s.style.lineHeight="0",s.innerHTML=`<svg width="${r}" height="${r}" viewBox="0 0 24 24"><circle cx="12" cy="12" r="11.25" fill="${zo[o.group]}" stroke="${wn}" stroke-width="1.5"/><path transform="translate(${12-12*a} ${12-12*a}) scale(${a})" d="${o.solid}" fill="${wn}"/></svg>`,e.prepend(s)}dressGateTag(e,n){let o=e.style;o.background="#0f172a",o.color="#ffffff",o.border="1px solid rgba(255,255,255,0.28)",o.textTransform="uppercase",o.letterSpacing="0.06em",o.display="inline-flex",o.alignItems="center",o.gap="5px";let i=document.createElement("span");if(i.setAttribute("aria-hidden","true"),i.setAttribute("data-gate-arrow",n.icon==="exit"?"out":"in"),i.innerHTML=n.icon==="exit"?'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M5 1.5H2v9h3"/><path d="M5.5 6h5M8.5 3.5 11 6 8.5 8.5"/></svg>':'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M7 1.5h3v9H7"/><path d="M1 6h5.5M4 3.5 6.5 6 4 8.5"/></svg>',e.prepend(i),n.stepFree){let r=document.createElement("span");r.setAttribute("data-gate-step-free","true"),r.setAttribute("aria-label","Step-free"),r.style.lineHeight="0",r.innerHTML=Vt("wheelchair",{size:11}),e.append(r)}e.dataset.qualityContrast=Xe([1,1,1],$e("#0f172a")).toFixed(3)}dressAreaTag(e,n){let o=n.count??0;if(e.toggleAttribute("data-area-quiet",n.muted===!0),n.muted&&o<=0&&(e.style.opacity=String(tl)),o<=0){e.removeAttribute("data-area-count");return}e.setAttribute("data-area-count",String(o)),e.style.border=`2px solid ${Ye}`;let i=document.createElement("span");i.textContent=String(o);let r=i.style;r.display="inline-block",r.minWidth="1.2em",r.textAlign="center",r.marginLeft="6px",r.padding="1px 6px",r.borderRadius="999px",r.background=Ye,r.color=Nn,r.fontWeight="800",r.fontSize="0.9em",r.lineHeight="1.2",r.verticalAlign="middle",e.appendChild(i)}dressSectionTag(e,n,o){let i=n.tint?Qs(n.tint):null,r=e.style;if(i&&(r.background=i.fill,r.color=i.ink,r.border=`1px solid ${i.border}`,e.dataset.qualityContrast=i.contrast.toFixed(3)),o<=0)return;let a=document.createElement("span");a.setAttribute("data-wheelchair-free",String(o)),a.setAttribute("aria-label",`${o} wheelchair ${o===1?"place":"places"} free`),a.innerHTML=`${Vt("wheelchair",{size:11})}<span>${o}</span>`;let s=a.style;s.display="inline-flex",s.alignItems="center",s.gap="2px",s.marginLeft="6px",s.padding="1px 5px",s.borderRadius="999px",s.background="#2563eb",s.color="#ffffff",s.fontSize="0.85em",s.lineHeight="1.2",s.verticalAlign="middle",e.appendChild(a)}paintAccessChip(e,n){e.setAttribute("data-label-kind","access"),e.setAttribute("data-access-type",n.icon??""),e.innerHTML=n.icon?Vt(n.icon,{size:at-6}):"",e.setAttribute("role","img"),e.setAttribute("aria-label",n.text);let o=e.style;return o.width=`${at}px`,o.height=`${at}px`,o.alignItems="center",o.justifyContent="center",o.borderRadius="50%",o.background=n.color??"#3b82f6",o.color=n.ink??"#ffffff",o.border="1.5px solid #ffffff",o.boxShadow="0 2px 6px rgba(0,0,0,.35)",o.padding="0",o.lineHeight="0",o.boxSizing="border-box",e.dataset.qualityContrast=Xe($e(n.ink??"#ffffff")??[1,1,1],$e(n.color??"#3b82f6")??[.23,.51,.96]).toFixed(3),e}placePinHeads(e){for(;this.pinHeads.length<e.length;){let n=document.createElement("div");n.setAttribute("data-pin-head",""),n.setAttribute("aria-hidden","true");let o=n.style;o.position="absolute",o.left="0",o.top="0",o.width=`${Yr}px`,o.height=`${Yr}px`,o.borderRadius="50%",o.background=Ye,o.boxShadow="0 0 0 3px rgba(255,255,255,.28), 0 0 14px rgba(255,255,255,.55), 0 3px 8px rgba(0,0,0,.45)",o.pointerEvents="none",this.root.appendChild(n),this.pinHeads.push(n)}this.pinHeads.forEach((n,o)=>{let i=e[o];n.style.display=i?"":"none",i&&(n.style.transform=`translate(-50%, -100%) translate(${i.x.toFixed(1)}px, ${i.y.toFixed(1)}px)`)})}dispose(){this.pinHeads=[],this.root.remove(),this.nodes.clear()}};var ll=1;var cl=new Set(["floor","stage","zone","section","ga","booth","annotation"]);function ul(t){return t.every(e=>Number.isFinite(e))}function hl(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function Qr(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function je(t){return Math.round(t*1e4)/1e4}function dl(t){if(t)return{box:{x:je(t.box.x),y:je(t.box.y),width:je(t.box.width),height:je(t.box.height)},horizontalFillRatio:je(t.horizontalFillRatio),verticalFillRatio:je(t.verticalFillRatio),visibleAreaRatio:je(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function _e(t,e,n){return n.length?{code:t,message:e,count:n.length,samples:n.slice(0,20)}:null}function Wn(t){let e=t.labels.filter(s=>s.visible&&s.screenBox),n=e.filter(s=>cl.has(s.kind)),o=t.scene.floorCount>1?t.scene.floorCount:t.scene.zoneCount||t.scene.sectionCount,i=[];for(let s=0;s<n.length;s+=1)for(let l=0;l<s;l+=1)hl(n[s].screenBox,n[l].screenBox)&&i.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[l].id});let r=[...t.camera.position,t.camera.distance,t.camera.verticalFovDeg],a=[_e("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),_e("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),_e("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),_e("viewport-empty","The 3D viewport must have visible dimensions",t.viewport.width>1&&t.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${t.viewport.width}\xD7${t.viewport.height}`}]),_e("camera-invalid","The capture camera must have a finite physical pose",ul(r)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),_e("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!t.scene.authoredRelief||t.scene.renderedVerticalSpanM>.05&&t.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:t.scene.projectedReliefPx,minimum:2}]),_e("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",o===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${o} expected hierarchy labels`}]),_e("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),_e("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),_e("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",i)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:t.viewport,context:t.context,frame:t.frame,camera:t.camera,scene:t.scene,composition:{visibleLabels:e.map(({id:s,kind:l,text:u})=>({id:s,kind:l,text:u})).sort((s,l)=>s.kind.localeCompare(l.kind)||s.id.localeCompare(l.id)),framing:dl(t.framing)},metrics:{minimumHierarchyFontPx:Qr(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Qr(n.map(s=>s.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:a}}function Jr(t,e,n){t.fill(0);for(let o=0;o<Math.min(n,e.length);o++)t[e[o]]=1}import{Geometry as Et,Mesh as Ct,Program as $l,Texture as Xl,Transform as Ei}from"ogl";function ml(t,e,n){let o=t+(e<<8)+(n<<16);return o===0?-1:o-1}var Un=128;function ei(t,e,n,o,i){if(!(o>=0&&o<e&&i>=0&&i<n))return!1;let r=(i*e+o)*4;return t[r]===0&&t[r+1]===0&&t[r+2]===0&&Math.abs(t[r+3]-Un)<=8}function ti(t,e,n,o,i,r){let a=-1,s=1/0;for(let l=0;l<n;l++)for(let u=0;u<e;u++){let m=(l*e+u)*4,h=ml(t[m],t[m+1],t[m+2]);if(h<0||h>=r)continue;let d=u-o,c=l-i,p=d*d+c*c;p<s&&(s=p,a=h)}return a}function ni(t,e,n,o,i,r){let a=t-n.left,s=e-n.top,l=Math.round(a*o),u=Math.round((n.height-s)*o);return{x:Math.max(0,Math.min(i-1,l)),y:Math.max(0,Math.min(r-1,u))}}import{Program as Ke}from"ogl";var Zt=`
61
61
  float chairWeight(float depth) {
62
62
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
63
- }`,An=`
64
- const float TIP_SIN = ${Math.sin(ln*Math.PI/180).toFixed(4)};
65
- const float TIP_COS = ${Math.cos(ln*Math.PI/180).toFixed(4)};
63
+ }`,Yn=`
64
+ const float TIP_SIN = ${Math.sin(An*Math.PI/180).toFixed(4)};
65
+ const float TIP_COS = ${Math.cos(An*Math.PI/180).toFixed(4)};
66
66
  vec3 tipUpPad(vec3 p, float halfWidth, float up) {
67
67
  if (up < 0.5) return p;
68
- float hingeZ = (${vo.toFixed(2)}) * halfWidth + ${bo.toFixed(2)};
69
- float dy = p.y - ${sn.toFixed(2)};
68
+ float hingeZ = (${Xo.toFixed(2)}) * halfWidth + ${jo.toFixed(2)};
69
+ float dy = p.y - ${Mn.toFixed(2)};
70
70
  float dz = p.z - hingeZ;
71
71
  return vec3(p.x,
72
- ${sn.toFixed(2)} + dz * TIP_SIN + dy * TIP_COS,
72
+ ${Mn.toFixed(2)} + dz * TIP_SIN + dy * TIP_COS,
73
73
  hingeZ + dz * TIP_COS - dy * TIP_SIN);
74
74
  }
75
75
  vec3 tipUpNormal(vec3 n, float up) {
76
76
  if (up < 0.5) return n;
77
77
  return vec3(n.x, n.z * TIP_SIN + n.y * TIP_COS, n.z * TIP_COS - n.y * TIP_SIN);
78
- }`,Pn=`
78
+ }`,$n=`
79
79
  float glyphEq(float glyph, float expected) {
80
80
  return 1.0 - step(0.25, abs(glyph - expected));
81
81
  }
@@ -110,7 +110,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
110
110
  if (stool > 0.5) return vec3(0.0);
111
111
  // A dining chair's back is a panel held clear of the seat on its two rear
112
112
  // legs: open under it, where an auditorium seat is closed to the pad.
113
- if (dining > 0.5) { p.x *= 0.78; p.y = ${Ne.toFixed(2)} - (${Ne.toFixed(2)} - p.y) * ${po.toFixed(2)}; }
113
+ if (dining > 0.5) { p.x *= 0.78; p.y = ${We.toFixed(2)} - (${We.toFixed(2)} - p.y) * ${Yo.toFixed(2)}; }
114
114
  else if (folding > 0.5) { p.x *= 0.90; p.y = 0.45 + (p.y - 0.45) * 0.72; }
115
115
  else if (bench > 0.5) { p.x *= 1.10; p.y = 0.45 + (p.y - 0.45) * 0.62; }
116
116
  } else if (partId < 3.5) {
@@ -126,11 +126,11 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
126
126
  // Slim legs set in under the seat. The rear pair stand behind the pad and
127
127
  // carry on up into the foot of the back, so the back is held by the
128
128
  // chair's own frame and daylight shows between it and the seat.
129
- p.x = sign(p.x) * (${uo.toFixed(2)} + (abs(p.x) - 0.72) * ${Et.toFixed(2)});
130
- if (p.z > 0.0) p.z = ${ho.toFixed(2)} + (p.z - 0.59) * ${Et.toFixed(2)};
129
+ p.x = sign(p.x) * (${Bo.toFixed(2)} + (abs(p.x) - 0.72) * ${Ot.toFixed(2)});
130
+ if (p.z > 0.0) p.z = ${Wo.toFixed(2)} + (p.z - 0.59) * ${Ot.toFixed(2)};
131
131
  else {
132
- p.z = ${mo.toFixed(2)} + (p.z + 0.59) * ${Et.toFixed(2)};
133
- if (p.y > 0.2) p.y = ${fo.toFixed(2)};
132
+ p.z = ${Uo.toFixed(2)} + (p.z + 0.59) * ${Ot.toFixed(2)};
133
+ if (p.y > 0.2) p.y = ${$o.toFixed(2)};
134
134
  }
135
135
  }
136
136
  } else if (partId < 6.5) {
@@ -146,7 +146,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
146
146
  if (generic < 0.5) return vec3(0.0);
147
147
  }
148
148
  return p;
149
- }`,Yi=1.5,tt=`
149
+ }`,pl=1.5,st=`
150
150
  uniform vec4 uSeeThrough; // xyz = the seats looked at, w = cone radius there; 0 = off
151
151
  bool seeThroughCut(vec3 p, vec3 eye) {
152
152
  if (uSeeThrough.w <= 0.0) return false;
@@ -155,11 +155,11 @@ bool seeThroughCut(vec3 p, vec3 eye) {
155
155
  if (len < 1.0) return false;
156
156
  vec3 dir = axis / len;
157
157
  float t = dot(p - eye, dir);
158
- if (t <= 0.0 || t > len - ${Yi.toFixed(2)}) return false;
158
+ if (t <= 0.0 || t > len - ${pl.toFixed(2)}) return false;
159
159
  vec3 onLine = eye + dir * t;
160
160
  if (p.y < onLine.y - 0.25) return false;
161
161
  return length(p - onLine) < uSeeThrough.w * t / len;
162
- }`,Xi=`#version 300 es
162
+ }`,fl=`#version 300 es
163
163
  precision highp float;
164
164
  in vec3 position;
165
165
  in vec3 normal;
@@ -197,13 +197,13 @@ void main() {
197
197
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
198
198
  vColor = color;
199
199
  gl_Position = projectionMatrix * mv;
200
- }`,cr=`
200
+ }`,oi=`
201
201
  bool roomWallHidden(float material, vec3 normalWorld, vec3 posWorld, vec3 eye, vec2 roomCentre) {
202
202
  if (abs(material - 6.0) > 0.5) return false;
203
203
  vec3 n = normalize(normalWorld);
204
204
  if (abs(n.y) > 0.5) return true;
205
205
  return dot(n.xz, eye.xz - posWorld.xz) * dot(n.xz, roomCentre - posWorld.xz) <= 0.0;
206
- }`,ur=`
206
+ }`,ri=`
207
207
  uniform vec3 uTop;
208
208
  uniform vec3 uBottom;
209
209
  uniform float uSky; // 1 for an open-air venue, see SceneModel.outdoor
@@ -225,7 +225,7 @@ vec3 backdrop(vec2 uv, vec3 dir) {
225
225
  col = mix(col, sky, smoothstep(-0.22, 0.03, dir.y));
226
226
  }
227
227
  return col;
228
- }`,$i=`
228
+ }`,vl=`
229
229
  // A fixed 4 by 4 threshold pattern: a net thinned by it reads as a fine mesh,
230
230
  // where random grain would read as dirt.
231
231
  float orderedThreshold(vec2 pixel) {
@@ -250,7 +250,7 @@ float netShown(vec2 place) {
250
250
  // less, gone by 4.5. pixelM: the world size of this pixel, metres.
251
251
  float slenderShown(float pixelM) {
252
252
  return 1.0 - smoothstep(0.025, 0.045, pixelM);
253
- }`,qi=`#version 300 es
253
+ }`,bl=`#version 300 es
254
254
  precision highp float;
255
255
  in vec3 vColor;
256
256
  in vec3 vNormalWorld;
@@ -273,10 +273,10 @@ uniform vec3 cameraPosition;
273
273
  uniform vec2 uRoomCentre;
274
274
  uniform vec2 uViewport; // drawing buffer size, pixels
275
275
  out vec4 fragColor;
276
- ${cr}
277
- ${tt}
278
- ${ur}
279
- ${$i}
276
+ ${oi}
277
+ ${st}
278
+ ${ri}
279
+ ${vl}
280
280
  // Stable world-space variation; no textures or per-frame random grain.
281
281
  float turfHash(vec2 p) {
282
282
  vec3 q = fract(vec3(p.xyx) * 0.1031);
@@ -387,6 +387,22 @@ void main() {
387
387
  * mix(0.10, 0.055, concreteSurface) * fine;
388
388
  vColorRung *= 1.0 + variation;
389
389
  }
390
+ if (abs(vMaterial - 13.0) < 0.5 && vNormalWorld.y > 0.5) {
391
+ // A standing area's floor (objectBuilders.ts STANDING_FLOOR_MATERIAL) is
392
+ // event flooring in the area's own colour: panels 1.2 m square in a
393
+ // staggered bond, a fine joint between them, each panel a shade apart.
394
+ // Joints and shades fade out before a panel is a few pixels wide, so a
395
+ // distant field is one even colour and never a moire.
396
+ vec2 panel = vPosWorld.xz / 1.2;
397
+ vec2 footprint = fwidth(panel);
398
+ float resolved = 1.0 - smoothstep(0.035, 0.11, max(footprint.x, footprint.y));
399
+ panel.x += 0.5 * mod(floor(panel.y), 2.0);
400
+ vec2 toJoint = 0.5 - abs(fract(panel) - 0.5);
401
+ vec2 line = 1.0 - smoothstep(vec2(0.0), max(footprint, vec2(0.012)), toJoint);
402
+ float shade = turfHash(floor(panel)) - 0.5;
403
+ vColorRung *= 1.0 + resolved * (shade * 0.07 - max(line.x, line.y) * 0.20);
404
+ vColorRung *= 1.0 + (turfNoise(vPosWorld.xz * 0.32) - 0.5) * 0.07;
405
+ }
390
406
  // Unresolved row faces need the same lighting, not merely the same paint:
391
407
  // alternating vertical/horizontal normals otherwise recreate a moire comb.
392
408
  float rowOverview = max(tread, riser) * (1.0 - uStructureDetail);
@@ -415,7 +431,7 @@ void main() {
415
431
  // exactly the historical rim strength so an unthemed chart does not shift.
416
432
  float poweredMaterial = 1.0 - step(0.5, abs(vMaterial - 1.0));
417
433
  float sheen = mix(clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0), 1.0, poweredMaterial);
418
- float concreteSheen = abs(vMaterial - 5.0) < 0.5 ? 0.45 : 1.0;
434
+ float concreteSheen = (abs(vMaterial - 5.0) < 0.5 || abs(vMaterial - 13.0) < 0.5) ? 0.45 : 1.0;
419
435
  base += vec3(0.26, 0.31, 0.38) * fres * 0.16 * sheen * (1.0 - rowOverview) * concreteSheen; // cool rim, restrained
420
436
  // Bright, saturated authored screen faces should read as powered displays,
421
437
  // not painted slabs. Vertex colour is deliberately the material signal here:
@@ -450,9 +466,9 @@ void main() {
450
466
  base = mix(base, backdrop(gl_FragCoord.xy / uViewport, normalize(vPosWorld - cameraPosition)), out_);
451
467
  }
452
468
  fragColor = vec4(base, 1.0);
453
- }`,dr=`
454
- ${Pn}
455
- ${An}
469
+ }`,ii=`
470
+ ${$n}
471
+ ${Yn}
456
472
  vec4 seatSurface(vec3 source, float radius) {
457
473
  vec4 origin = modelViewMatrix * vec4(iOffset, 1.0);
458
474
  if (iPhysicalSeat < 0.5) {
@@ -467,12 +483,12 @@ vec4 seatSurface(vec3 source, float radius) {
467
483
  vec3 p = glyphChairPosition(source, surface, iGlyph);
468
484
  p.xz *= iChairWidth;
469
485
  if (surface < 1.5) p = tipUpPad(p, iChairWidth, iTipUp);
470
- if (surface > 1.5) p.z -= max(p.y - ${ke.toFixed(2)}, 0.0) * ${it.toFixed(2)} * glyphBackRake(iGlyph);
486
+ if (surface > 1.5) p.z -= max(p.y - ${Le.toFixed(2)}, 0.0) * ${vt.toFixed(2)} * glyphBackRake(iGlyph);
471
487
  float c = cos(iYaw), s = sin(iYaw);
472
488
  vec3 rotated = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
473
489
  return modelViewMatrix * vec4(iOffset + rotated, 1.0);
474
490
  }
475
- `,ji=`#version 300 es
491
+ `,gl=`#version 300 es
476
492
  precision highp float;
477
493
  in float surface;
478
494
  in float iYaw;
@@ -513,9 +529,9 @@ out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
513
529
  out float vPhysicalSeat;
514
530
  out float vPixelRadius;
515
531
  uniform vec3 cameraPosition;
516
- ${Lt}
517
- ${dr}
518
- ${tt}
532
+ ${Zt}
533
+ ${ii}
534
+ ${st}
519
535
  void main() {
520
536
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
521
537
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
@@ -537,7 +553,7 @@ void main() {
537
553
  mv = seatSurface(position, r);
538
554
  // Match the shell's non-uniform width/depth scale before its back rake.
539
555
  vec3 n = vec3(normal.x / iChairWidth, normal.y, normal.z / iChairWidth);
540
- if (surface > 1.5) n.y += n.z * ${it.toFixed(2)} * glyphBackRake(iGlyph);
556
+ if (surface > 1.5) n.y += n.z * ${vt.toFixed(2)} * glyphBackRake(iGlyph);
541
557
  n = normalize(n);
542
558
  if (surface > 0.5 && surface < 1.5) n = tipUpNormal(n, iTipUp);
543
559
  vSeatNormal = vec3(n.x * cos(iYaw) + n.z * sin(iYaw), n.y, -n.x * sin(iYaw) + n.z * cos(iYaw));
@@ -550,13 +566,13 @@ void main() {
550
566
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
551
567
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
552
568
  gl_Position = projectionMatrix * mv;
553
- }`,hr=`
569
+ }`,ai=`
554
570
  float seatSilhouette(vec2 uv, float physical) {
555
571
  // Solid furniture owns its silhouette in geometry. Only empty bays need
556
572
  // a fragment mask; cutting physical faces would open holes in the volume.
557
573
  return mix(max(abs(uv.x), abs(uv.y)), 0.0, physical);
558
574
  }
559
- `,Ki=`#version 300 es
575
+ `,yl=`#version 300 es
560
576
  precision highp float;
561
577
  in vec3 vSeatNormal;
562
578
  in float vSeatHeight;
@@ -578,7 +594,7 @@ uniform float uSeatDetail; // 0 for venue/area overview; 1 in section/row/sea
578
594
  uniform vec3 uFadeColor;
579
595
  uniform float uRoughness;
580
596
  out vec4 fragColor;
581
- ${hr}
597
+ ${ai}
582
598
  void main() {
583
599
  if (vDim > 0.5) discard;
584
600
  // Same screen-door dissolve as the structure rung (uStructureDetail): the
@@ -651,7 +667,7 @@ void main() {
651
667
  c = mix(c, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
652
668
  }
653
669
  fragColor = vec4(c, alpha);
654
- }`,Zi=`#version 300 es
670
+ }`,xl=`#version 300 es
655
671
  precision highp float;
656
672
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
657
673
  in vec3 normal;
@@ -689,11 +705,11 @@ out float vSectionFade;
689
705
  out float vTaken; // 1 = sold or held: not for sale
690
706
  out vec3 vLocal; // x/z in chair half-widths, y in metres: where on the chair
691
707
  out vec3 vViewWorld;// from the surface to the eye, world space (not unit)
692
- ${Lt}
693
- ${Pn}
694
- ${An}
708
+ ${Zt}
709
+ ${$n}
710
+ ${Yn}
695
711
  uniform vec3 cameraPosition;
696
- ${tt}
712
+ ${st}
697
713
  void main() {
698
714
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
699
715
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
@@ -717,7 +733,7 @@ void main() {
717
733
  bool shared = position.x > 0.0;
718
734
  armrestAt = shared ? iArmrests.xy : iArmrests.zw;
719
735
  if (dot(armrestAt, armrestAt) <= 0.0) p = vec3(0.0);
720
- else if (dot(p, p) > 0.0) p.x += shared ? -${st.toFixed(2)} : ${st.toFixed(2)};
736
+ else if (dot(p, p) > 0.0) p.x += shared ? -${bt.toFixed(2)} : ${bt.toFixed(2)};
721
737
  }
722
738
  if (iPhysicalSeat < 0.5) p = vec3(0.0); // sellable space, but no physical chair
723
739
  float localHeight = p.y;
@@ -768,7 +784,7 @@ void main() {
768
784
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
769
785
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
770
786
  gl_Position = projectionMatrix * mv;
771
- }`,Qi=`#version 300 es
787
+ }`,wl=`#version 300 es
772
788
  precision highp float;
773
789
  in vec3 vColor;
774
790
  in vec3 vNormalWorld;
@@ -836,7 +852,7 @@ void main() {
836
852
  float padPart = step(0.5, vPart) * (1.0 - step(1.5, vPart));
837
853
  float backPart = step(1.5, vPart) * (1.0 - step(2.5, vPart));
838
854
  float crease = mix(1.0, mix(0.70, 1.0, smoothstep(-0.95, -0.15, vLocal.z)), padPart)
839
- * mix(1.0, mix(0.74, 1.0, smoothstep(0.0, 0.20, vLocal.y - ${ke.toFixed(2)})), backPart);
855
+ * mix(1.0, mix(0.74, 1.0, smoothstep(0.0, 0.20, vLocal.y - ${Le.toFixed(2)})), backPart);
840
856
  // The seam. On a tight row neighbouring pads meet edge to edge, and without a
841
857
  // line between them the row is one long bench. Each pad darkens toward its
842
858
  // own sides, which draws that line whether or not there is a gap to see.
@@ -872,17 +888,17 @@ void main() {
872
888
  base = mix(base, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
873
889
  }
874
890
  fragColor = vec4(base, 1.0);
875
- }`,Ji=`#version 300 es
891
+ }`,Sl=`#version 300 es
876
892
  precision highp float;
877
893
  in vec2 position;
878
894
  out vec2 vUv;
879
895
  void main() {
880
896
  vUv = position * 0.5 + 0.5;
881
897
  gl_Position = vec4(position, 0.999, 1.0);
882
- }`,es=`#version 300 es
898
+ }`,Ml=`#version 300 es
883
899
  precision highp float;
884
900
  in vec2 vUv;
885
- ${ur}
901
+ ${ri}
886
902
  uniform mat4 uInvViewProj;
887
903
  uniform float uHouse; // 1 for an indoor venue, see SceneModel.house
888
904
  uniform vec4 uHouseShape; // the wall: centre x, centre z, half-width x, half-width z (world metres)
@@ -890,6 +906,7 @@ uniform vec2 uHouseLevels; // floor y, ceiling y
890
906
  uniform vec3 uHouseCeiling;
891
907
  uniform vec3 uHouseWall;
892
908
  uniform vec3 uHouseLamp;
909
+ uniform float uHouseTheatre; // 1 for a theatre's room: pilasters, wall lights, a dado and a cornice
893
910
  uniform vec3 uEye; // camera, world metres
894
911
  out vec4 fragColor;
895
912
 
@@ -897,6 +914,16 @@ out vec4 fragColor;
897
914
  const float HOUSE_BAY_M = 7.0;
898
915
  const float HOUSE_LAMP_BAYS = 0.055; // lamp radius, in bays
899
916
  const float HOUSE_COURSE_M = 3.2; // height of one course of wall panels
917
+ // A theatre's wall, metres: a pilaster about every bay, a wall light in the
918
+ // middle of each bay on every second course, a dado at its foot and a cornice
919
+ // under the ceiling.
920
+ const float THEATRE_BAY_M = 5.0;
921
+ const float THEATRE_PILASTER_M = 0.26; // half its width
922
+ const float THEATRE_LIGHT_AT_M = 2.6; // the lowest row, above the floor
923
+ const float THEATRE_LIGHT_ROWS_M = 6.4; // between rows
924
+ const float THEATRE_LIGHT_M = 0.11; // a light's radius
925
+ const float THEATRE_DADO_M = 1.0;
926
+ const float THEATRE_CORNICE_M = 0.45;
900
927
 
901
928
  void main() {
902
929
  // This pixel's line of sight. A venue with neither a sky nor a room skips
@@ -931,6 +958,8 @@ void main() {
931
958
  float tWall = wa > 1e-9 ? (-wb + sqrt(max(0.0, wb * wb - wa * wk))) / wa : 1e9;
932
959
  float course = (uEye.y + dir.y * tWall - uHouseLevels.x) / HOUSE_COURSE_M;
933
960
  float coursePixel = fwidth(course); // courses per pixel
961
+ vec3 onWall = uEye + dir * min(tWall, 1.0e4);
962
+ float wallPixel = max(length(dFdx(onWall)), length(dFdy(onWall))); // metres per pixel
934
963
  float inside = smoothstep(0.0, 0.05, -wk) * smoothstep(0.0, 3.0, headroom);
935
964
  if (inside > 0.0) {
936
965
  if (dir.y > 1e-4 && tCeiling < tWall) {
@@ -958,12 +987,38 @@ void main() {
958
987
  vec3 room = uHouseWall * mix(1.06, 0.6, smoothstep(0.3, 1.0, h));
959
988
  float joint = 1.0 - smoothstep(0.014 - coursePixel, 0.014 + coursePixel, 0.5 - abs(fract(course) - 0.5));
960
989
  room *= 1.0 - 0.14 * joint * (1.0 - smoothstep(0.08, 0.35, coursePixel));
990
+ if (uHouseTheatre > 0.5) {
991
+ // A theatre's wall. All of it is paint on the backdrop: nothing
992
+ // stands in the room. Far away, where a light is a pixel or less,
993
+ // the detail gives way to the plain wall.
994
+ float fine = 1.0 - smoothstep(0.05, 0.22, wallPixel);
995
+ float tall = uHouseLevels.y - uHouseLevels.x;
996
+ float up = course * HOUSE_COURSE_M;
997
+ vec2 at = eye + across * tWall; // on the wall, as a unit circle
998
+ float girth = 6.2831853 * sqrt(0.5 * dot(uHouseShape.zw, uHouseShape.zw));
999
+ float bays = max(8.0, floor(girth / THEATRE_BAY_M));
1000
+ float bayM = girth / bays;
1001
+ float along = (fract(atan(at.y, at.x) / 6.2831853 * bays) - 0.5) * bayM; // metres from the bay's middle
1002
+ float pilaster = 1.0 - smoothstep(THEATRE_PILASTER_M - wallPixel, THEATRE_PILASTER_M + wallPixel, 0.5 * bayM - abs(along));
1003
+ room *= 1.0 + 0.2 * pilaster * fine;
1004
+ room *= mix(1.0, 0.74, (1.0 - smoothstep(THEATRE_DADO_M - wallPixel, THEATRE_DADO_M + wallPixel, up)) * fine);
1005
+ float cornice = smoothstep(tall - THEATRE_CORNICE_M - wallPixel, tall - THEATRE_CORNICE_M + wallPixel, up);
1006
+ room = mix(room, uHouseWall * 1.3, 0.7 * cornice * fine);
1007
+ // The wall lights: a small bright lamp and the wash it throws up and down the wall.
1008
+ float row = max(0.0, floor((up - THEATRE_LIGHT_AT_M) / THEATRE_LIGHT_ROWS_M + 0.5));
1009
+ float rowAt = THEATRE_LIGHT_AT_M + row * THEATRE_LIGHT_ROWS_M;
1010
+ float hangs = step(rowAt + 1.6, tall); // none in the cornice
1011
+ vec2 off = vec2(along, up - rowAt);
1012
+ float lampAt = 1.0 - smoothstep(THEATRE_LIGHT_M - wallPixel, THEATRE_LIGHT_M + wallPixel, length(off));
1013
+ float wash = exp(-(off.x * off.x * 1.3 + off.y * off.y * 0.26));
1014
+ room += uHouseLamp * hangs * mix(0.012, 0.85 * lampAt + 0.17 * wash, fine);
1015
+ }
961
1016
  col = mix(col, room, inside * smoothstep(-0.02, 0.0, h));
962
1017
  }
963
1018
  }
964
1019
  }
965
1020
  fragColor = vec4(col, 1.0);
966
- }`,ts=`#version 300 es
1021
+ }`,Al=`#version 300 es
967
1022
  precision highp float;
968
1023
  in float surface;
969
1024
  in float iYaw;
@@ -993,9 +1048,9 @@ out float vDotWeight;
993
1048
  out float vHidden;
994
1049
  flat out vec3 vPick;
995
1050
  uniform vec3 cameraPosition;
996
- ${Lt}
997
- ${dr}
998
- ${tt}
1051
+ ${Zt}
1052
+ ${ii}
1053
+ ${st}
999
1054
  void main() {
1000
1055
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
1001
1056
  int id = gl_InstanceID + 1; // 0 reserved for no-hit
@@ -1010,7 +1065,7 @@ void main() {
1010
1065
  vPhysicalSeat = iPhysicalSeat;
1011
1066
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
1012
1067
  gl_Position = projectionMatrix * mv;
1013
- }`,ns=`#version 300 es
1068
+ }`,Tl=`#version 300 es
1014
1069
  precision highp float;
1015
1070
  in vec2 vUv;
1016
1071
  in float vPhysicalSeat;
@@ -1018,7 +1073,7 @@ in float vDotWeight;
1018
1073
  in float vHidden;
1019
1074
  flat in vec3 vPick;
1020
1075
  out vec4 fragColor;
1021
- ${hr}
1076
+ ${ai}
1022
1077
  void main() {
1023
1078
  if (vHidden > 0.5) discard;
1024
1079
  if (vDotWeight <= 0.99) discard;
@@ -1026,7 +1081,7 @@ void main() {
1026
1081
  float d = seatSilhouette(vUv, vPhysicalSeat);
1027
1082
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
1028
1083
  fragColor = vec4(vPick, 1.0);
1029
- }`,os=`#version 300 es
1084
+ }`,Pl=`#version 300 es
1030
1085
  precision highp float;
1031
1086
  in vec3 position;
1032
1087
  in float part;
@@ -1050,10 +1105,10 @@ flat out vec3 vPick;
1050
1105
  out float vChairWeight;
1051
1106
  out float vHidden;
1052
1107
  uniform vec3 cameraPosition;
1053
- ${Lt}
1054
- ${Pn}
1055
- ${An}
1056
- ${tt}
1108
+ ${Zt}
1109
+ ${$n}
1110
+ ${Yn}
1111
+ ${st}
1057
1112
  void main() {
1058
1113
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
1059
1114
  int id = int(iPickIndex + 0.5); // already global index + 1
@@ -1073,7 +1128,7 @@ void main() {
1073
1128
  bool shared = position.x > 0.0;
1074
1129
  armrestAt = shared ? iArmrests.xy : iArmrests.zw;
1075
1130
  if (dot(armrestAt, armrestAt) <= 0.0) p = vec3(0.0);
1076
- else if (dot(p, p) > 0.0) p.x += shared ? -${st.toFixed(2)} : ${st.toFixed(2)};
1131
+ else if (dot(p, p) > 0.0) p.x += shared ? -${bt.toFixed(2)} : ${bt.toFixed(2)};
1077
1132
  }
1078
1133
  if (iPhysicalSeat < 0.5) p = vec3(0.0);
1079
1134
  p.xz *= iRadius;
@@ -1089,7 +1144,7 @@ void main() {
1089
1144
  // A collapsed armrest (p = 0) must stay collapsed, so the offset rides on w.
1090
1145
  rp.xz += armrestAt * step(0.01, w) * step(0.0001, dot(p, p));
1091
1146
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
1092
- }`,rs=`#version 300 es
1147
+ }`,El=`#version 300 es
1093
1148
  precision highp float;
1094
1149
  flat in vec3 vPick;
1095
1150
  in float vHidden;
@@ -1099,7 +1154,7 @@ void main() {
1099
1154
  if (vHidden > 0.5) discard;
1100
1155
  if (vChairWeight < 0.01) discard;
1101
1156
  fragColor = vec4(vPick, 1.0);
1102
- }`,as=`#version 300 es
1157
+ }`,Cl=`#version 300 es
1103
1158
  precision highp float;
1104
1159
  in vec3 position;
1105
1160
  in vec3 normal;
@@ -1114,12 +1169,14 @@ out float vMaterial;
1114
1169
  out vec3 vNormalWorld;
1115
1170
  out vec3 vPosWorld;
1116
1171
  void main() {
1117
- vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
1172
+ // What is drawn hides what is behind it: the venue-wide solids (floor -2)
1173
+ // stay in a single-level view, so they stay in its depth too.
1174
+ vHidden = (floorIndex > -1.5 && uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
1118
1175
  vMaterial = materialIndex;
1119
1176
  vNormalWorld = mat3(modelMatrix) * normal;
1120
1177
  vPosWorld = (modelMatrix * vec4(position, 1.0)).xyz;
1121
1178
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1122
- }`,is=`#version 300 es
1179
+ }`,Rl=`#version 300 es
1123
1180
  precision highp float;
1124
1181
  in float vHidden;
1125
1182
  in float vMaterial;
@@ -1128,8 +1185,8 @@ in vec3 vPosWorld;
1128
1185
  uniform vec3 cameraPosition;
1129
1186
  uniform vec2 uRoomCentre;
1130
1187
  out vec4 fragColor;
1131
- ${cr}
1132
- ${tt}
1188
+ ${oi}
1189
+ ${st}
1133
1190
  void main() {
1134
1191
  if (vHidden > 0.5) discard;
1135
1192
  if (roomWallHidden(vMaterial, vNormalWorld, vPosWorld, cameraPosition, uRoomCentre)) discard;
@@ -1138,8 +1195,12 @@ void main() {
1138
1195
  // buyer behind the goal picks a seat through the net. Nor does stage light
1139
1196
  // (12), which from behind is not there at all.
1140
1197
  if (vMaterial > 9.5 && vMaterial < 12.5) discard;
1141
- fragColor = vec4(0.0, 0.0, 0.0, 1.0);
1142
- }`;function mr(t){return new Ue(t,{vertex:ts,fragment:ns,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uSeatRadius:{value:lt},uSeatScale:{value:1},uMinPixels:{value:Ze},uPixelToWorld:{value:.002},uChairFull:{value:ht},uChairNone:{value:Qe},uFocusFloor:{value:-1}}})}function pr(t){return new Ue(t,{vertex:os,fragment:rs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uChairFull:{value:ht},uChairNone:{value:Qe},uBackRake:{value:it},uBackBase:{value:ke},uFocusFloor:{value:-1}}})}function fr(t){return new Ue(t,{vertex:as,fragment:is,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uFocusFloor:{value:-1},uRoomCentre:{value:new Float32Array([0,0])}}})}function vr(t,e=.78,n=[.63,.66,.65]){return new Ue(t,{vertex:Xi,fragment:qi,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:e},uRoomCentre:{value:new Float32Array([0,0])},uViewport:{value:new Float32Array([1,1])},uTop:{value:new Float32Array([0,0,0])},uBottom:{value:new Float32Array([0,0,0])},uSky:{value:0},uZenith:{value:new Float32Array([0,0,0])},uHorizon:{value:new Float32Array([0,0,0])}}})}function br(t){return new Ue(t,{vertex:ji,fragment:Ki,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uSeatRadius:{value:lt},uSeatScale:{value:1},uMinPixels:{value:Ze},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:ht},uChairNone:{value:Qe}}})}function gr(t,e=.78){return new Ue(t,{vertex:Zi,fragment:Qi,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:ht},uChairNone:{value:Qe},uBackRake:{value:it},uBackBase:{value:ke},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:e}}})}function yr(t,e,n,r,a){return new Ue(t,{vertex:Ji,fragment:es,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(n)},uSky:{value:r?1:0},uZenith:{value:new Float32Array(r?.zenith??[0,0,0])},uHorizon:{value:new Float32Array(r?.horizon??[0,0,0])},uInvViewProj:{value:new Float32Array(16)},uHouse:{value:a?1:0},uHouseShape:{value:new Float32Array(a?[...a.centre,...a.radii]:[0,0,1,1])},uHouseLevels:{value:new Float32Array(a?[a.floorY,a.ceilingY]:[0,1])},uHouseCeiling:{value:new Float32Array(a?.ceiling??[0,0,0])},uHouseWall:{value:new Float32Array(a?.wall??[0,0,0])},uHouseLamp:{value:new Float32Array(a?.lamp??[0,0,0])},uEye:{value:new Float32Array(3)}}})}import{Camera as ss,Mat4 as ls,Mesh as xr,Program as wr,RenderTarget as cs,Transform as us}from"ogl";var ds=45,hs=.16;function Sr(t,e,n,r){let a=Math.max(3,n.radius*1.04),o=t.getParameter(t.MAX_TEXTURE_SIZE),i=a<=ds||o<2048?1024:2048,s=!!r&&2*a/i<=hs,[l,c,f]=n.center,m=new ss(t,{left:-a,right:a,bottom:-a,top:a,near:.1,far:a*6});m.position.set(l-a*1.44,c+a*2.34,f+a*1.2),m.lookAt([l,c,f]);let u=new cs(t,{width:i,height:i,depthTexture:!0,minFilter:t.NEAREST,magFilter:t.NEAREST}),d=new wr(t,{cullFace:!1,vertex:`#version 300 es
1198
+ // A standing area's floor (material 13, its top face) says so in alpha: see
1199
+ // pick/encode.ts STANDING_FLOOR_PICK_ALPHA. Black like every solid, so seats
1200
+ // behind it still read as no hit.
1201
+ float floorMark = (abs(vMaterial - 13.0) < 0.5 && vNormalWorld.y > 0.5) ? ${(Un/255).toFixed(6)} : 1.0;
1202
+ fragColor = vec4(0.0, 0.0, 0.0, floorMark);
1203
+ }`;function si(t){return new Ke(t,{vertex:Al,fragment:Tl,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uSeatRadius:{value:gt},uSeatScale:{value:1},uMinPixels:{value:ot},uPixelToWorld:{value:.002},uChairFull:{value:St},uChairNone:{value:rt},uFocusFloor:{value:-1}}})}function li(t){return new Ke(t,{vertex:Pl,fragment:El,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uChairFull:{value:St},uChairNone:{value:rt},uBackRake:{value:vt},uBackBase:{value:Le},uFocusFloor:{value:-1}}})}function ci(t){return new Ke(t,{vertex:Cl,fragment:Rl,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uFocusFloor:{value:-1},uRoomCentre:{value:new Float32Array([0,0])}}})}function ui(t,e=.78,n=[.63,.66,.65]){return new Ke(t,{vertex:fl,fragment:bl,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:e},uRoomCentre:{value:new Float32Array([0,0])},uViewport:{value:new Float32Array([1,1])},uTop:{value:new Float32Array([0,0,0])},uBottom:{value:new Float32Array([0,0,0])},uSky:{value:0},uZenith:{value:new Float32Array([0,0,0])},uHorizon:{value:new Float32Array([0,0,0])}}})}function hi(t){return new Ke(t,{vertex:gl,fragment:yl,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uSeatRadius:{value:gt},uSeatScale:{value:1},uMinPixels:{value:ot},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:St},uChairNone:{value:rt}}})}function di(t,e=.78){return new Ke(t,{vertex:xl,fragment:wl,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uKeyColor:{value:new Float32Array([1,1,1])},uAmbientColor:{value:new Float32Array([1,1,1])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:St},uChairNone:{value:rt},uBackRake:{value:vt},uBackBase:{value:Le},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:e}}})}function mi(t,e,n,o,i){return new Ke(t,{vertex:Sl,fragment:Ml,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(n)},uSky:{value:o?1:0},uZenith:{value:new Float32Array(o?.zenith??[0,0,0])},uHorizon:{value:new Float32Array(o?.horizon??[0,0,0])},uInvViewProj:{value:new Float32Array(16)},uHouse:{value:i?1:0},uHouseShape:{value:new Float32Array(i?[...i.centre,...i.radii]:[0,0,1,1])},uHouseLevels:{value:new Float32Array(i?[i.floorY,i.ceilingY]:[0,1])},uHouseCeiling:{value:new Float32Array(i?.ceiling??[0,0,0])},uHouseWall:{value:new Float32Array(i?.wall??[0,0,0])},uHouseLamp:{value:new Float32Array(i?.lamp??[0,0,0])},uHouseTheatre:{value:i?.theatre?1:0},uEye:{value:new Float32Array(3)}}})}import{Camera as _l,Mat4 as Fl,Mesh as pi,Program as fi,RenderTarget as Il,Transform as Dl}from"ogl";var kl=45,Ll=.16;function vi(t,e,n,o){let i=Math.max(3,n.radius*1.04),r=t.getParameter(t.MAX_TEXTURE_SIZE),a=i<=kl||r<2048?1024:2048,s=!!o&&2*i/a<=Ll,[l,u,m]=n.center,h=new _l(t,{left:-i,right:i,bottom:-i,top:i,near:.1,far:i*6});h.position.set(l-i*1.44,u+i*2.34,m+i*1.2),h.lookAt([l,u,m]);let d=new Il(t,{width:a,height:a,depthTexture:!0,minFilter:t.NEAREST,magFilter:t.NEAREST}),c=new fi(t,{cullFace:!1,vertex:`#version 300 es
1143
1204
  in vec3 position;
1144
1205
  in float materialIndex;
1145
1206
  uniform mat4 modelViewMatrix;
@@ -1153,7 +1214,7 @@ void main() {
1153
1214
  // ...nor do nets and slender sport fittings (10, 11): a net is mostly air.
1154
1215
  if (abs(vMaterial - 6.0) < 0.5 || (vMaterial > 9.5 && vMaterial < 12.5)) discard;
1155
1216
  fragColor = vec4(1.0);
1156
- }`}),h=new us,y=new xr(t,{geometry:e,program:d});y.frustumCulled=!1,y.setParent(h);let v=s?new wr(t,{cullFace:!1,vertex:`#version 300 es
1217
+ }`}),p=new Dl,f=new pi(t,{geometry:e,program:c});f.frustumCulled=!1,f.setParent(p);let y=s?new fi(t,{cullFace:!1,vertex:`#version 300 es
1157
1218
  in vec3 position;
1158
1219
  in float surface;
1159
1220
  in vec3 iOffset;
@@ -1173,7 +1234,64 @@ void main() {
1173
1234
  }`,fragment:`#version 300 es
1174
1235
  precision highp float;
1175
1236
  out vec4 fragColor;
1176
- void main() { fragColor = vec4(1.0); }`}):null;if(v&&r){let F=new xr(t,{geometry:r,program:v});F.frustumCulled=!1,F.setParent(h)}let x=t.getParameter(t.COLOR_CLEAR_VALUE),T=t.isEnabled(t.DITHER);try{t.disable(t.DITHER),t.clearColor(1,1,1,1),t.renderer.render({scene:h,camera:m,target:u})}finally{T&&t.enable(t.DITHER),t.clearColor(x[0],x[1],x[2],x[3]),d.remove(),v?.remove()}let A=new ls().multiply(m.projectionMatrix,m.viewMatrix);return{texture:u.depthTexture,matrix:A,seatsCast:s,dispose(){for(let F of u.textures)t.deleteTexture(F.texture);t.deleteTexture(u.depthTexture.texture),t.deleteFramebuffer(u.buffer),u.depthBuffer&&t.deleteRenderbuffer(u.depthBuffer)}}}var ms=.65,ps=new Set(["dimmed","sold","held"]);function Mr(t,e,n){let r=new Set,a=!1;for(let o of t){let i=e.get(o.sectionId);if(!i||!i.length){r.add(o.sectionId);continue}let s=!1;for(let l of i){let c=Se[n[l]]??"available";if(!ps.has(c)){s=!0;break}}s?r.add(o.sectionId):a=!0}return{lit:r,anyUnlit:a}}function Ar(t,e,n,r,a,o){let i=[];for(let s of t){let l=a===null||a.has(s.sectionId);if(r.get(s.sectionId)===l)continue;r.set(s.sectionId,l);let c=(s.start+s.count)*3;for(let f=s.start*3;f<c;f++)e[f]=l?n[f]:n[f]+(o[f%3]-n[f])*ms;i.push(s)}return i}var bs=Se.map(t=>t==="available"||t==="dimmed"),Er=Se.indexOf("selected");function gs(t,e){return[0,1,2].map(n=>t[n]*.15+.75+e[n]*.1)}function Cr(t,e,n,r,a,o){for(let i=n;i<n+r;i++){let s=o&&e[i]===0,l=o&&e[i]===Er?gs([o[i*3],o[i*3+1],o[i*3+2]],a[Er]??a[0]):s?null:a[e[i]]??a[0];t[i*3]=l?l[0]:o[i*3],t[i*3+1]=l?l[1]:o[i*3+1],t[i*3+2]=l?l[2]:o[i*3+2]}}var ys=new Float32Array([-1,-1,3,-1,-1,3]);function Tr(t,e){let n=new Pr,r=new Pr,a=new vt(t,{position:{size:2,data:ys}}),o=yr(t,e.theme.background.top,e.theme.background.bottom,e.outdoor?e.theme.sky:null,e.house&&e.theme.house?{...e.house,...e.theme.house}:null),i=new bt(t,{geometry:a,program:o});i.frustumCulled=!1,i.setParent(r);let s=new vt(t,{position:{size:3,data:e.solids.position},normal:{size:3,data:e.solids.normal},color:{size:3,data:e.solids.color},floorIndex:{size:1,data:e.solids.floor},materialIndex:{size:1,data:e.solids.material}}),l=vr(t,e.theme.materials.roughness,e.theme.structure.tierTop);e.room&&l.uniforms.uRoomCentre.value.set(e.room.centre);for(let L of["uTop","uBottom","uSky","uZenith","uHorizon"])l.uniforms[L]=o.uniforms[L];let c=new bt(t,{geometry:s,program:l});c.frustumCulled=!1,c.setParent(n);let f=br(t),m=new Float32Array(e.seats.count*3),u=Se.map(L=>e.theme.seatStates[L]),d=e.seats.iCategory.slice(),h=xo(e.theme.structure);for(let L=0;L<e.seats.count;L++){if(e.seats.iPhysicalSeat[L]<.5)continue;let Y=e.theme.materials.seat??wo([d[L*3],d[L*3+1],d[L*3+2]],h);d.set(Y,L*3)}Cr(m,e.seats.iState,0,e.seats.count,u,d);let y=No(),v=new Uint8Array(e.seats.count),x=new Uint8Array(e.seats.count);for(let L=0;L<e.seats.count;L++){let Y=e.seats.iArmrests[L*4]!==0||e.seats.iArmrests[L*4+1]!==0;x[L]=Y&&e.seats.iPhysicalSeat[L]>=.5&&e.seats.iGlyph[L]<1.5?1:0}let T=new Float32Array(e.seats.count),A=(L,Y)=>{for(let J=L;J<L+Y;J++)T[J]=x[J]&&bs[e.seats.iState[J]]?1:0};A(0,e.seats.count);let F=new vt(t,{position:{size:3,data:y.position},normal:{size:3,data:y.normal},uv:{size:2,data:y.uv},index:{size:1,data:y.index},surface:{size:1,data:y.surface},iYaw:{size:1,data:e.seats.iYaw,instanced:1},iChairWidth:{size:1,data:e.seats.iChairWidth,instanced:1},iGlyph:{size:1,data:e.seats.iGlyph,instanced:1},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:m,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,instanced:1},iHasChair:{size:1,data:v,type:t.UNSIGNED_BYTE,usage:t.DYNAMIC_DRAW,instanced:1},iPhysicalSeat:{size:1,data:e.seats.iPhysicalSeat,instanced:1},iTipUp:{size:1,data:T,usage:t.DYNAMIC_DRAW,instanced:1},iRing:{size:3,data:e.seats.iRing,instanced:1},iFloor:{size:1,data:e.seats.iFloor,instanced:1},iSection:{size:1,data:e.seats.iSection,instanced:1}}),S=new bt(t,{geometry:F,program:f});S.frustumCulled=!1,e.seats.count>0&&S.setParent(n);let _=Sr(t,s,e.renderBounds,e.seats.count>0?F:null);l.uniforms.tVenueShadow={value:_.texture},l.uniforms.uShadowMatrix={value:_.matrix};let V=F.attributes.iColor,g=e.solids.color.slice(),D=e.theme.structure.ground,w=new Map(e.sectionSolidRanges.map(L=>[L.sectionId,!0])),I=go(),N=gr(t,e.theme.materials.roughness),P=Dt,O=new Float32Array(P*3),G=new Float32Array(P*3),U=new Float32Array(P),B=new Float32Array(P),H=new Float32Array(P),ee=new Float32Array(P*3),K=new Float32Array(P),te=new Float32Array(P),R=new Float32Array(P),M=new Float32Array(P*4),q=new Float32Array(P),$=new Float32Array(P),oe=new Float32Array(P),Q=new vt(t,{position:{size:3,data:I.position},normal:{size:3,data:I.normal},part:{size:1,data:I.part},index:{data:I.index},iOffset:{size:3,data:O,instanced:1},iColor:{size:3,data:G,instanced:1},iRadius:{size:1,data:U,instanced:1},iYaw:{size:1,data:B,instanced:1},iGlyph:{size:1,data:H,instanced:1},iRing:{size:3,data:ee,instanced:1},iFloor:{size:1,data:K,instanced:1},iSection:{size:1,data:te,instanced:1},iPhysicalSeat:{size:1,data:R,instanced:1},iArmrests:{size:4,data:M,instanced:1},iTipUp:{size:1,data:q,instanced:1},iTaken:{size:1,data:oe,instanced:1},iPickIndex:{size:1,data:$,instanced:1}}),C=L=>L.map(Y=>1+(Y-1)*Mo);l.uniforms.uKeyColor.value.set(e.theme.light.key),l.uniforms.uAmbientColor.value.set(e.theme.light.ambient);for(let L of[f,N])L.uniforms.uKeyColor.value.set(C(e.theme.light.key)),L.uniforms.uAmbientColor.value.set(C(e.theme.light.ambient));let me=new bt(t,{geometry:Q,program:N});me.frustumCulled=!1;let ie=0,ye=!1,xe=!1,Me=null,le=null,_e=null,Fe=new Int32Array(0),ae=()=>{let L=e.seats;for(let Y=0;Y<ie;Y++){let J=Fe[Y];oe[Y]=So(L.iState[J]),q[Y]=T[J],G[Y*3]=m[J*3],G[Y*3+1]=m[J*3+1],G[Y*3+2]=m[J*3+2]}Q.attributes.iColor.needsUpdate=!0,Q.attributes.iTipUp.needsUpdate=!0,Q.attributes.iTaken.needsUpdate=!0},Ee={main:n,background:r,backgroundProgram:o,seatProgram:f,solidProgram:l,chairProgram:N,seatGeometry:F,chairGeometry:Q,solidGeometry:s,drawCalls:3,setNearSeats(L,Y){let J=Math.min(Y,P,L.length);if(lr(v,L,J),F.attributes.iHasChair.needsUpdate=!0,Fe=L,ie=J,J===0){me.parent&&me.setParent(null),Q.instancedCount=0,Ee.drawCalls=3+(ye?1:0);return}let X=e.seats;for(let ne=0;ne<J;ne++){let se=L[ne];O[ne*3]=X.iPosition[se*3],O[ne*3+1]=X.iPosition[se*3+1],O[ne*3+2]=X.iPosition[se*3+2],U[ne]=X.iChairWidth[se],B[ne]=X.iYaw[se],H[ne]=X.iGlyph[se],ee[ne*3]=X.iRing[se*3],ee[ne*3+1]=X.iRing[se*3+1],ee[ne*3+2]=X.iRing[se*3+2],K[ne]=X.iFloor[se],te[ne]=X.iSection[se],R[ne]=X.iPhysicalSeat[se],M.set(X.iArmrests.subarray(se*4,se*4+4),ne*4),$[ne]=se+1}ae(),Q.attributes.iOffset.needsUpdate=!0,Q.attributes.iRadius.needsUpdate=!0,Q.attributes.iYaw.needsUpdate=!0,Q.attributes.iGlyph.needsUpdate=!0,Q.attributes.iRing.needsUpdate=!0,Q.attributes.iFloor.needsUpdate=!0,Q.attributes.iSection.needsUpdate=!0,Q.attributes.iPhysicalSeat.needsUpdate=!0,Q.attributes.iArmrests.needsUpdate=!0,Q.attributes.iTaken.needsUpdate=!0,Q.attributes.iPickIndex.needsUpdate=!0,Q.instancedCount=J,me.parent||me.setParent(n),Ee.drawCalls=4+(ye?1:0)},nearSeatCount(){return ie},setSectionShellLit(L){l.uniforms.uSectionFilter.value=L===null?0:1;let Y=Ar(e.sectionSolidRanges,e.solids.color,g,w,L,D);if(!Y.length)return;let J=s.attributes.color,X=J.buffer;if(!X){J.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,X);for(let ne of Y){let se=e.solids.color.subarray(ne.start*3,(ne.start+ne.count)*3);t.bufferSubData(t.ARRAY_BUFFER,ne.start*3*Float32Array.BYTES_PER_ELEMENT,se)}},uploadSeatStateRuns(L){if(!L.length)return;for(let X of L)A(X.start,X.length);let Y=F.attributes.iTipUp;if(!Y.buffer)Y.needsUpdate=!0;else{t.bindBuffer(t.ARRAY_BUFFER,Y.buffer);for(let X of L)t.bufferSubData(t.ARRAY_BUFFER,X.start*Float32Array.BYTES_PER_ELEMENT,T.subarray(X.start,X.start+X.length))}for(let X of L)Cr(m,e.seats.iState,X.start,X.length,u,d);ie&&ae();let J=V.buffer;if(!J){V.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,J);for(let X of L){let ne=m.subarray(X.start*3,(X.start+X.length)*3);t.bufferSubData(t.ARRAY_BUFFER,X.start*3*Float32Array.BYTES_PER_ELEMENT,ne)}},dispose(){xe=!0,_.dispose(),a.remove(),o.remove(),s.remove(),l.remove(),F.remove(),f.remove(),Q.remove(),N.remove(),Me?.remove(),le?.remove(),_e?.texture&&t.deleteTexture(_e.texture)}},Ie=e.productionElements.find(L=>L.contentImageUrl&&L.contentPlane);if(Ie?.contentImageUrl&&Ie.contentPlane?.length===4&&typeof Image<"u"){let L=new Image;L.crossOrigin="anonymous",L.onload=()=>{if(xe)return;let Y=Ie.contentPlane;Me=new vt(t,{position:{size:3,data:new Float32Array(Y.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(Ie.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),_e=new vs(t,{image:L,generateMipmaps:!0,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,flipY:!1}),le=new fs(t,{vertex:`#version 300 es
1237
+ void main() { fragColor = vec4(1.0); }`}):null;if(y&&o){let A=new pi(t,{geometry:o,program:y});A.frustumCulled=!1,A.setParent(p)}let w=t.getParameter(t.COLOR_CLEAR_VALUE),b=t.isEnabled(t.DITHER);try{t.disable(t.DITHER),t.clearColor(1,1,1,1),t.renderer.render({scene:p,camera:h,target:d})}finally{b&&t.enable(t.DITHER),t.clearColor(w[0],w[1],w[2],w[3]),c.remove(),y?.remove()}let S=new Fl().multiply(h.projectionMatrix,h.viewMatrix);return{texture:d.depthTexture,matrix:S,seatsCast:s,dispose(){for(let A of d.textures)t.deleteTexture(A.texture);t.deleteTexture(d.depthTexture.texture),t.deleteFramebuffer(d.buffer),d.depthBuffer&&t.deleteRenderbuffer(d.depthBuffer)}}}var Vl=.65,Ol=new Set(["dimmed","sold","held"]);function gi(t,e,n){let o=new Set,i=!1;for(let r of t){let a=e.get(r.sectionId);if(!a||!a.length){o.add(r.sectionId);continue}let s=!1;for(let l of a){let u=Te[n[l]]??"available";if(!Ol.has(u)){s=!0;break}}s?o.add(r.sectionId):i=!0}return{lit:o,anyUnlit:i}}var bi=new WeakMap;function yi(t){let e=bi.get(t);if(e)return t.color.set(e),e;let n=t.color.slice();return bi.set(t,n),n}function Xn(t,e,n,o,i,r){let a=[];for(let s of t){let l=i===null||i.has(s.sectionId);if(o.get(s.sectionId)===l)continue;o.set(s.sectionId,l);let u=(s.start+s.count)*3;for(let m=s.start*3;m<u;m++)e[m]=l?n[m]:n[m]+(r[m%3]-n[m])*Vl;a.push(s)}return a}import{Geometry as zl,Mesh as Nl,Program as Hl}from"ogl";var jn=[[.16,.2,.3],[.3,.14,.16],[.2,.26,.2],[.34,.3,.24],[.42,.42,.46],[.12,.12,.14],[.5,.36,.16],[.24,.3,.42]],qe=[[.78,.6,.48],[.56,.4,.3],[.36,.25,.19],[.86,.7,.58]],Kn=[[.08,.07,.06],[.2,.13,.08],[.36,.24,.13],[.62,.5,.3],[.5,.5,.5]],Qt=32,xi=1.6,wi=2.2,Gl=0,ct=1,Si=2,qn=3,Zn=[{part:Gl,y:[0,.47],halfWidth:[.105,.15],halfDepth:[.085,.1]},{part:ct,y:[.47,.8],halfWidth:[.15,.225],halfDepth:[.1,.115]},{part:ct,y:[.8,.845],halfWidth:[.225,.065],halfDepth:[.115,.06]}],lt=6,Tt={y:[.855,.95],halfWidth:[.075,.092],halfDepth:[.085,.1]},Bl={y:[.95,1],halfWidth:[.092,.05],halfDepth:[.1,.055]},Ve={hips:{y:.47,inside:.004},shoulders:{y:.8,inside:.001}};function Wl(){let t=[],e=(c,p,f,y,w="out")=>{let S=p[0]-c[0],A=(p[1]-c[1])*1.64,F=p[2]-c[2],T=f[0]-c[0],R=(f[1]-c[1])*1.64,D=f[2]-c[2],x=A*D-F*R,M=F*T-S*D,C=S*R-A*T,k=Math.hypot(x,M,C)||1;x/=k,M/=k,C/=k;let z=(c[0]+p[0]+f[0])*x+(c[2]+p[2]+f[2])*C,N=w==="down"?M>0:z<0||z===0&&M<0,O=N?[-x,-M,-C]:[x,M,C],U=N!==(w==="lining");t.push(U?{a:c,b:f,c:p,normal:O,part:y,lining:w==="lining"}:{a:c,b:p,c:f,normal:O,part:y,lining:w==="lining"})},n=(c,p,f,y)=>c===4?[[-f,p,-y],[f,p,-y],[f,p,y],[-f,p,y]]:Array.from({length:c},(w,b)=>{let S=2*Math.PI*(b+.5)/c;return[Math.sin(S)*f,p,-Math.cos(S)*y]}),o=(c,p,f,y="out")=>{let w=n(c,p.y[0],p.halfWidth[0],p.halfDepth[0]),b=n(c,p.y[1],p.halfWidth[1],p.halfDepth[1]);for(let S=0;S<c;S++){let A=(S+1)%c;e(w[S],w[A],b[A],f(S),y),e(w[S],b[A],b[S],f(S),y)}return b};for(let c of Zn)o(4,c,()=>c.part);let i=n(lt,Tt.y[0],Tt.halfWidth[0],Tt.halfDepth[0]);o(lt,Tt,c=>{let p=i[c],f=i[(c+1)%lt];return p[2]+f[2]<-Tt.halfDepth[0]?qn:Si});let r=o(lt,Bl,()=>qn);for(let c=1;c<lt-1;c++)e(r[0],r[c],r[c+1],qn);let a=Zn[1],s=Zn[2],l=s.halfWidth[0]-Ve.shoulders.inside,u=s.halfDepth[0]-Ve.shoulders.inside,m=a.halfWidth[0]-Ve.hips.inside,h=a.halfDepth[0]-Ve.hips.inside;o(4,{y:[Ve.shoulders.y,s.y[1]],halfWidth:[l,s.halfWidth[1]],halfDepth:[u,s.halfDepth[1]]},()=>ct,"lining"),o(4,{y:[Ve.hips.y,Ve.shoulders.y],halfWidth:[m,l],halfDepth:[h,u]},()=>ct,"lining");let d=n(4,Ve.hips.y,m,h);e(d[0],d[1],d[2],ct),e(d[0],d[2],d[3],ct);for(let c=1;c<lt-1;c++)e(i[0],i[c],i[c+1],Si,"down");return t}var Pt=t=>t.map(e=>Math.round(e*1e6)).join(",");function Ul(t="flat",e="last"){let n=Wl(),o=[],i=[],r=[],a=[],s=(l,u,m)=>(o.push(...l),i.push(...u),r.push(m),r.length-1);if(t==="indexed"){let l=new Map;for(let u of n)for(let m of[u.a,u.b,u.c]){let h=`${Pt(m)}|${Pt(u.normal)}|${u.part}`,d=l.get(h);d===void 0&&(d=s(m,u.normal,u.part),l.set(h,d)),a.push(d)}}else{let l=new Map,u=f=>{let y=l.get(Pt(f));return y===void 0&&(y=s(f,[0,1,0],0),l.set(Pt(f),y)),y},m=new Map;for(let f of n){let y=[f.a,f.b,f.c].map(u),w=`${Pt(f.normal)}|${f.part}`,b=m.get(w);b?(b.triangles.push(f),b.shared=b.shared.filter(S=>y.includes(S))):m.set(w,{triangles:[f],shared:y})}let h=[...m.values()],d=new Map,c=(f,y)=>{for(let w of h[f].shared){if(y.has(w))continue;y.add(w);let b=d.get(w);if(b===void 0||c(b,y))return d.set(w,f),!0}return!1};h.forEach((f,y)=>c(y,new Set));let p=new Map;for(let[f,y]of d)p.set(y,f);h.forEach((f,y)=>{let w=f.triangles[0],b=p.get(y),S=b;if(S===void 0){let A=f.shared[0];S=A===void 0?void 0:s([o[A*3],o[A*3+1],o[A*3+2]],w.normal,w.part)}for(let A of f.triangles){let F=[A.a,A.b,A.c].map(u),T=S===void 0?2:F.indexOf(b??f.shared[0]);T<0&&(T=2);let R=S??s(A.c,A.normal,A.part);i.splice(R*3,3,...A.normal),r[R]=A.part;let D=[F[(T+1)%3],F[(T+2)%3]];a.push(...e==="first"?[R,D[0],D[1]]:[D[0],D[1],R])}})}return{position:new Float32Array(o),normal:new Float32Array(i),part:new Float32Array(r),index:new Uint16Array(a),vertices:r.length,triangles:n.length}}var Qn=t=>t.map(([e,n,o])=>`vec3(${e.toFixed(3)}, ${n.toFixed(3)}, ${o.toFixed(3)})`).join(", "),Mi=t=>`#version 300 es
1238
+ precision highp float;
1239
+ in vec3 position;
1240
+ in vec3 normal;
1241
+ in float part; // 0 legs, 1 body, 2 skin, 3 hair
1242
+ in vec3 iOffset; // feet, world metres
1243
+ in vec2 iFacing; // unit, world (x, z)
1244
+ in float iHeight;
1245
+ in float iTone; // hair * ${Qt} + clothes * ${qe.length} + skin
1246
+ in float iFloor;
1247
+ uniform mat4 modelMatrix;
1248
+ uniform mat4 modelViewMatrix;
1249
+ uniform mat4 projectionMatrix;
1250
+ uniform vec3 cameraPosition;
1251
+ uniform float uFocusFloor; // -1 = show every floor
1252
+ uniform vec3 uKeyDir;
1253
+ uniform vec3 uKeyColor;
1254
+ uniform vec3 uAmbientColor;
1255
+ ${t?"flat ":""}out vec3 vColor;
1256
+ const vec3 CLOTHES[${jn.length}] = vec3[${jn.length}](${Qn(jn)});
1257
+ const vec3 SKIN[${qe.length}] = vec3[${qe.length}](${Qn(qe)});
1258
+ const vec3 HAIR[${Kn.length}] = vec3[${Kn.length}](${Qn(Kn)});
1259
+ void main() {
1260
+ // A figure that must not show is dropped whole, here: on another level than the one in focus, or
1261
+ // nearer the eye than its own distance between ${xi.toFixed(1)} and ${wi.toFixed(1)} m. No pixel is ever discarded.
1262
+ vec4 chest = modelMatrix * vec4(iOffset + vec3(0.0, iHeight * 0.7, 0.0), 1.0);
1263
+ float own = fract(52.9829189 * fract(dot(iOffset.xz, vec2(0.06711056, 0.00583715))));
1264
+ bool onLevel = uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5;
1265
+ if (!onLevel || distance(cameraPosition, chest.xyz) < mix(${xi.toFixed(1)}, ${wi.toFixed(1)}, own)) {
1266
+ vColor = vec3(0.0);
1267
+ gl_Position = vec4(2.0, 2.0, 2.0, 1.0);
1268
+ return;
1269
+ }
1270
+ vec2 f = iFacing;
1271
+ vec2 r = vec2(-f.y, f.x);
1272
+ vec3 local = iOffset + vec3(r.x * position.x + f.x * position.z, position.y * iHeight, r.y * position.x + f.y * position.z);
1273
+ vec3 n = vec3(r.x * normal.x + f.x * normal.z, normal.y, r.y * normal.x + f.y * normal.z);
1274
+ int tone = int(iTone + 0.5);
1275
+ int look = tone - (tone / ${Qt}) * ${Qt};
1276
+ vec3 clothes = CLOTHES[look / ${qe.length}];
1277
+ vec3 base = part > 2.5 ? HAIR[tone / ${Qt}]
1278
+ : part > 1.5 ? SKIN[look - (look / ${qe.length}) * ${qe.length}]
1279
+ : part > 0.5 ? clothes : clothes * 0.62;
1280
+ // A flat face has one colour, so the venue's light is worked out here, once a vertex, not once a pixel.
1281
+ vec3 N = normalize(mat3(modelMatrix) * n);
1282
+ float hemi = 0.5 + 0.5 * N.y;
1283
+ float key = max(dot(N, uKeyDir), 0.0);
1284
+ vec3 fillDir = normalize(vec3(-uKeyDir.x, 0.25, -uKeyDir.z));
1285
+ float fill = max(dot(N, fillDir), 0.0);
1286
+ vColor = base * ((0.34 + 0.26 * hemi) * uAmbientColor + key * 0.60 * uKeyColor + fill * 0.26 * uAmbientColor);
1287
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(local, 1.0);
1288
+ }`,Ai=t=>`#version 300 es
1289
+ precision highp float;
1290
+ ${t?"flat ":""}in vec3 vColor;
1291
+ out vec4 fragColor;
1292
+ void main() {
1293
+ fragColor = vec4(vColor, 1.0);
1294
+ }`,Xu=Mi(!0),ju=Ai(!0);function Ti(t,e,n,o="flat"){let i=o==="flat"?t.getExtension("WEBGL_provoking_vertex"):null;i?.provokingVertexWEBGL(i.FIRST_VERTEX_CONVENTION_WEBGL);let r=i?"first":"last",a=Ul(o,r),s=new zl(t,{position:{size:3,data:a.position},normal:{size:3,data:a.normal},part:{size:1,data:a.part},index:{data:a.index},iOffset:{size:3,data:e.iPosition,instanced:1},iFacing:{size:2,data:e.iFacing,instanced:1},iHeight:{size:1,data:e.iHeight,instanced:1},iTone:{size:1,data:e.iTone,instanced:1},iFloor:{size:1,data:e.iFloor,instanced:1}});s.instancedCount=e.count;let l=new Hl(t,{vertex:Mi(o==="flat"),fragment:Ai(o==="flat"),cullFace:t.BACK,frontFace:t.CW,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:n.uniforms.uKeyDir,uKeyColor:n.uniforms.uKeyColor,uAmbientColor:n.uniforms.uAmbientColor,uFocusFloor:n.uniforms.uFocusFloor}}),u=new Nl(t,{geometry:s,program:l});return u.frustumCulled=!1,{mesh:u,kind:o,provoking:r,dispose:()=>{s.remove(),l.remove()}}}function Pi(t){let e=null;try{if(e=t(),Yl(e.mesh.program))return e}catch{}try{e?.dispose()}catch{}return null}function Yl(t){let e=t;return e.uniformLocations instanceof Map&&e.attributeLocations instanceof Map}var jl=Te.map(t=>t==="available"||t==="dimmed"),Ci=Te.indexOf("selected");function Kl(t,e){return[0,1,2].map(n=>t[n]*.15+.75+e[n]*.1)}function Ri(t,e,n,o,i,r){for(let a=n;a<n+o;a++){let s=r&&e[a]===0,l=r&&e[a]===Ci?Kl([r[a*3],r[a*3+1],r[a*3+2]],i[Ci]??i[0]):s?null:i[e[a]]??i[0];t[a*3]=l?l[0]:r[a*3],t[a*3+1]=l?l[1]:r[a*3+1],t[a*3+2]=l?l[2]:r[a*3+2]}}var ql=new Float32Array([-1,-1,3,-1,-1,3]);function _i(t,e){let n=yi(e.solids),o=new Ei,i=new Ei,r=new Et(t,{position:{size:2,data:ql}}),a=mi(t,e.theme.background.top,e.theme.background.bottom,e.outdoor?e.theme.sky:null,e.house&&e.theme.house?{...e.house,...e.theme.house}:null),s=new Ct(t,{geometry:r,program:a});s.frustumCulled=!1,s.setParent(i);let l=new Et(t,{position:{size:3,data:e.solids.position},normal:{size:3,data:e.solids.normal},color:{size:3,data:e.solids.color},floorIndex:{size:1,data:e.solids.floor},materialIndex:{size:1,data:e.solids.material}}),u=ui(t,e.theme.materials.roughness,e.theme.structure.tierTop);e.room&&u.uniforms.uRoomCentre.value.set(e.room.centre);for(let V of["uTop","uBottom","uSky","uZenith","uHorizon"])u.uniforms[V]=a.uniforms[V];let m=new Ct(t,{geometry:l,program:u});m.frustumCulled=!1,m.setParent(o);let h=e.crowd,d=h?Pi(()=>Ti(t,h,u)):null;d?.mesh.setParent(o);let c=d?1:0,p=hi(t),f=new Float32Array(e.seats.count*3),y=Te.map(V=>e.theme.seatStates[V]),w=e.seats.iCategory.slice(),b=Zo(e.theme.structure);for(let V=0;V<e.seats.count;V++){if(e.seats.iPhysicalSeat[V]<.5)continue;let K=e.theme.materials.seat??Qo([w[V*3],w[V*3+1],w[V*3+2]],b);w.set(K,V*3)}Ri(f,e.seats.iState,0,e.seats.count,y,w);let S=xr(),A=new Uint8Array(e.seats.count),F=new Uint8Array(e.seats.count);for(let V=0;V<e.seats.count;V++){let K=e.seats.iArmrests[V*4]!==0||e.seats.iArmrests[V*4+1]!==0;F[V]=K&&e.seats.iPhysicalSeat[V]>=.5&&e.seats.iGlyph[V]<1.5?1:0}let T=new Float32Array(e.seats.count),R=(V,K)=>{for(let q=V;q<V+K;q++)T[q]=F[q]&&jl[e.seats.iState[q]]?1:0};R(0,e.seats.count);let D=new Et(t,{position:{size:3,data:S.position},normal:{size:3,data:S.normal},uv:{size:2,data:S.uv},index:{size:1,data:S.index},surface:{size:1,data:S.surface},iYaw:{size:1,data:e.seats.iYaw,instanced:1},iChairWidth:{size:1,data:e.seats.iChairWidth,instanced:1},iGlyph:{size:1,data:e.seats.iGlyph,instanced:1},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:f,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,instanced:1},iHasChair:{size:1,data:A,type:t.UNSIGNED_BYTE,usage:t.DYNAMIC_DRAW,instanced:1},iPhysicalSeat:{size:1,data:e.seats.iPhysicalSeat,instanced:1},iTipUp:{size:1,data:T,usage:t.DYNAMIC_DRAW,instanced:1},iRing:{size:3,data:e.seats.iRing,instanced:1},iFloor:{size:1,data:e.seats.iFloor,instanced:1},iSection:{size:1,data:e.seats.iSection,instanced:1}}),x=new Ct(t,{geometry:D,program:p});x.frustumCulled=!1,e.seats.count>0&&x.setParent(o);let M=vi(t,l,e.renderBounds,e.seats.count>0?D:null);u.uniforms.tVenueShadow={value:M.texture},u.uniforms.uShadowMatrix={value:M.matrix};let C=D.attributes.iColor,k=e.theme.structure.ground,z=new Map(e.sectionSolidRanges.map(V=>[V.sectionId,!0])),N=new Map((e.areaSolidRanges??[]).map(V=>[V.sectionId,!0])),O=V=>{if(!V.length)return;let K=l.attributes.color,q=K.buffer;if(!q){K.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,q);for(let B of V){let ie=e.solids.color.subarray(B.start*3,(B.start+B.count)*3);t.bufferSubData(t.ARRAY_BUFFER,B.start*3*Float32Array.BYTES_PER_ELEMENT,ie)}},U=Ko(),$=di(t,e.theme.materials.roughness),Y=Kt,X=new Float32Array(Y*3),G=new Float32Array(Y*3),te=new Float32Array(Y),I=new Float32Array(Y),j=new Float32Array(Y),J=new Float32Array(Y*3),_=new Float32Array(Y),oe=new Float32Array(Y),se=new Float32Array(Y),pe=new Float32Array(Y*4),re=new Float32Array(Y),P=new Float32Array(Y),ve=new Float32Array(Y),Z=new Et(t,{position:{size:3,data:U.position},normal:{size:3,data:U.normal},part:{size:1,data:U.part},index:{data:U.index},iOffset:{size:3,data:X,instanced:1},iColor:{size:3,data:G,instanced:1},iRadius:{size:1,data:te,instanced:1},iYaw:{size:1,data:I,instanced:1},iGlyph:{size:1,data:j,instanced:1},iRing:{size:3,data:J,instanced:1},iFloor:{size:1,data:_,instanced:1},iSection:{size:1,data:oe,instanced:1},iPhysicalSeat:{size:1,data:se,instanced:1},iArmrests:{size:4,data:pe,instanced:1},iTipUp:{size:1,data:re,instanced:1},iTaken:{size:1,data:ve,instanced:1},iPickIndex:{size:1,data:P,instanced:1}}),Fe=V=>V.map(K=>1+(K-1)*er);u.uniforms.uKeyColor.value.set(e.theme.light.key),u.uniforms.uAmbientColor.value.set(e.theme.light.ambient);for(let V of[p,$])V.uniforms.uKeyColor.value.set(Fe(e.theme.light.key)),V.uniforms.uAmbientColor.value.set(Fe(e.theme.light.ambient));let be=new Ct(t,{geometry:Z,program:$});be.frustumCulled=!1;let xe=0,ue=!1,ze=!1,Ie=null,ae=null,ke=null,Qe=new Int32Array(0),ht=()=>{let V=e.seats;for(let K=0;K<xe;K++){let q=Qe[K];ve[K]=Jo(V.iState[q]),re[K]=T[q],G[K*3]=f[q*3],G[K*3+1]=f[q*3+1],G[K*3+2]=f[q*3+2]}Z.attributes.iColor.needsUpdate=!0,Z.attributes.iTipUp.needsUpdate=!0,Z.attributes.iTaken.needsUpdate=!0},ge={main:o,background:i,backgroundProgram:a,seatProgram:p,solidProgram:u,chairProgram:$,seatGeometry:D,chairGeometry:Z,solidGeometry:l,drawCalls:3+c,setNearSeats(V,K){let q=Math.min(K,Y,V.length);if(Jr(A,V,q),D.attributes.iHasChair.needsUpdate=!0,Qe=V,xe=q,q===0){be.parent&&be.setParent(null),Z.instancedCount=0,ge.drawCalls=3+c+(ue?1:0);return}let B=e.seats;for(let ie=0;ie<q;ie++){let me=V[ie];X[ie*3]=B.iPosition[me*3],X[ie*3+1]=B.iPosition[me*3+1],X[ie*3+2]=B.iPosition[me*3+2],te[ie]=B.iChairWidth[me],I[ie]=B.iYaw[me],j[ie]=B.iGlyph[me],J[ie*3]=B.iRing[me*3],J[ie*3+1]=B.iRing[me*3+1],J[ie*3+2]=B.iRing[me*3+2],_[ie]=B.iFloor[me],oe[ie]=B.iSection[me],se[ie]=B.iPhysicalSeat[me],pe.set(B.iArmrests.subarray(me*4,me*4+4),ie*4),P[ie]=me+1}ht(),Z.attributes.iOffset.needsUpdate=!0,Z.attributes.iRadius.needsUpdate=!0,Z.attributes.iYaw.needsUpdate=!0,Z.attributes.iGlyph.needsUpdate=!0,Z.attributes.iRing.needsUpdate=!0,Z.attributes.iFloor.needsUpdate=!0,Z.attributes.iSection.needsUpdate=!0,Z.attributes.iPhysicalSeat.needsUpdate=!0,Z.attributes.iArmrests.needsUpdate=!0,Z.attributes.iTaken.needsUpdate=!0,Z.attributes.iPickIndex.needsUpdate=!0,Z.instancedCount=q,be.parent||be.setParent(o),ge.drawCalls=4+c+(ue?1:0)},nearSeatCount(){return xe},setSectionShellLit(V){u.uniforms.uSectionFilter.value=V===null?0:1;let K=Xn(e.sectionSolidRanges,e.solids.color,n,z,V,k);O(K)},setAreaFloorsQuiet(V){let K=e.areaSolidRanges;if(!K?.length)return;let q=new Set(K.map(B=>B.sectionId).filter(B=>!V.has(B)));O(Xn(K,e.solids.color,n,N,q,k))},uploadSeatStateRuns(V){if(!V.length)return;for(let B of V)R(B.start,B.length);let K=D.attributes.iTipUp;if(!K.buffer)K.needsUpdate=!0;else{t.bindBuffer(t.ARRAY_BUFFER,K.buffer);for(let B of V)t.bufferSubData(t.ARRAY_BUFFER,B.start*Float32Array.BYTES_PER_ELEMENT,T.subarray(B.start,B.start+B.length))}for(let B of V)Ri(f,e.seats.iState,B.start,B.length,y,w);xe&&ht();let q=C.buffer;if(!q){C.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,q);for(let B of V){let ie=f.subarray(B.start*3,(B.start+B.length)*3);t.bufferSubData(t.ARRAY_BUFFER,B.start*3*Float32Array.BYTES_PER_ELEMENT,ie)}},dispose(){ze=!0,M.dispose(),r.remove(),a.remove(),l.remove(),u.remove(),d?.dispose(),D.remove(),p.remove(),Z.remove(),$.remove(),Ie?.remove(),ae?.remove(),ke?.texture&&t.deleteTexture(ke.texture)}},Ne=e.productionElements.find(V=>V.contentImageUrl&&V.contentPlane);if(Ne?.contentImageUrl&&Ne.contentPlane?.length===4&&typeof Image<"u"){let V=new Image;V.crossOrigin="anonymous",V.onload=()=>{if(ze)return;let K=Ne.contentPlane;Ie=new Et(t,{position:{size:3,data:new Float32Array(K.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(Ne.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),ke=new Xl(t,{image:V,generateMipmaps:!0,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,flipY:!1}),ae=new $l(t,{vertex:`#version 300 es
1177
1295
  precision highp float;
1178
1296
  in vec3 position; in vec2 uv; in float floorIndex;
1179
1297
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
@@ -1181,4 +1299,4 @@ void main() {
1181
1299
  void main(){ vUv=uv; vDim=(uFocusFloor < -0.5 || abs(floorIndex-uFocusFloor)<0.5)?0.0:1.0; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }`,fragment:`#version 300 es
1182
1300
  precision highp float;
1183
1301
  in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
1184
- void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:_e},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let J=new bt(t,{geometry:Me,program:le});J.frustumCulled=!1,J.setParent(n),Ee.screenProgram=le,ye=!0,Ee.drawCalls=3+(ie?1:0)+1},L.src=Ie.contentImageUrl}return Ee}import{Mesh as En,RenderTarget as ws,Transform as Cn}from"ogl";function xs(t,e,n){let r=t+(e<<8)+(n<<16);return r===0?-1:r-1}function Rr(t,e,n,r,a,o){let i=-1,s=1/0;for(let l=0;l<n;l++)for(let c=0;c<e;c++){let f=(l*e+c)*4,m=xs(t[f],t[f+1],t[f+2]);if(m<0||m>=o)continue;let u=c-r,d=l-a,h=u*u+d*d;h<s&&(s=h,i=m)}return i}function _r(t,e,n,r,a,o){let i=t-n.left,s=e-n.top,l=Math.round(i*r),c=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(a-1,l)),y:Math.max(0,Math.min(o-1,c))}}var Ss=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Vt=class{constructor(e,n,r,a,o){this.seatScene=new Cn;this.chairScene=new Cn;this.solidScene=new Cn;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=o,this.seatProg=mr(this.gl),this.chairProg=pr(this.gl),this.depthProg=fr(this.gl);let i=new En(this.gl,{geometry:n,program:this.seatProg});i.frustumCulled=!1,i.setParent(this.seatScene);let s=new En(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let l=new En(this.gl,{geometry:a,program:this.depthProg});l.frustumCulled=!1,l.setParent(this.solidScene)}setRoomCentre(e){this.depthProg.uniforms.uRoomCentre.value.set(e??[0,0])}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let a of Ss)this.seatProg.uniforms[a].value=e.uniforms[a].value;let n=e.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n;let r=e.uniforms.uSeeThrough?.value;if(r)for(let a of[this.seatProg,this.chairProg,this.depthProg])a.uniforms.uSeeThrough.value=r}ensureTarget(){let e=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==e||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new ws(this.gl,{width:e,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let e=this.gl;this.target.buffer&&e.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&e.deleteTexture(n.texture);this.target.depthBuffer&&e.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(e,n,r,a){let o=this.gl,i=this.ensureTarget(),s=o.drawingBufferWidth,l=o.drawingBufferHeight,c=Math.max(0,n-a),f=Math.max(0,r-a),m=Math.max(1,Math.min(s,n+a+1)-c),u=Math.max(1,Math.min(l,r+a+1)-f);o.enable(o.SCISSOR_TEST),o.scissor(c,f,m,u);let[d,h,y]=this.restoreClear;o.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:e,target:i,clear:!0}),this.renderer.render({scene:this.seatScene,camera:e,target:i,clear:!1}),this.renderer.render({scene:this.chairScene,camera:e,target:i,clear:!1}),o.clearColor(d,h,y,1),o.disable(o.SCISSOR_TEST);let v=new Uint8Array(m*u*4);return this.renderer.bindFramebuffer(i),o.readPixels(c,f,m,u,o.RGBA,o.UNSIGNED_BYTE,v),this.renderer.bindFramebuffer(),Rr(v,m,u,n-c,r-f,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Fr(t,e){let n=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,yo(r.state)):n.push(r);return n}function Ir(t,e,n){let r=new Set;for(let i of e)(t.has(i)||n(i)!==void 0)&&r.add(i);let a=new Map(t),o=[];for(let[i,s]of t)r.has(i)||(o.push({seatId:i,state:Se[s]??"available"}),a.delete(i));for(let i of r){if(a.has(i))continue;let s=n(i);s!==void 0&&(a.set(i,s),o.push({seatId:i,state:"selected"}))}return{updates:o,next:a}}import{Quat as gt,Vec3 as Ps}from"ogl";function Ms(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function Dr(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function As(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function kr(t){let e=Math.hypot(t[0],t[1],t[2]);return e>1e-6?[t[0]/e,t[1]/e,t[2]/e]:[0,0,0]}function Tn(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function Rn(t,e){return Math.max(0,Math.min(1,t+e))}function Lr(t,e){let n=t.length;if(n===0)return[0,0,0];if(n===1)return[...t[0]];let r=Math.max(0,Math.min(1,e)),a=n-1,o=Math.floor(r*a);o>=a&&(o=a-1);let i=r*a-o,s=t[Math.max(0,o-1)],l=t[o],c=t[o+1],f=t[Math.min(n-1,o+2)],m=i*i,u=m*i,d=[0,0,0];for(let h=0;h<3;h++)d[h]=.5*(2*l[h]+(-s[h]+c[h])*i+(2*s[h]-5*l[h]+4*c[h]-f[h])*m+(-s[h]+3*l[h]-3*c[h]+f[h])*u);return d}function _n(t,e,n,r,a){let o=kr(Ms(e,n));o[0]===0&&o[1]===0&&o[2]===0&&(o=[0,0,1]);let i=Dr(Dr(e,As(o,2.5)),[0,1.5,0]),s=[e[0]-r[0],0,e[2]-r[2]],l=kr(s);l[0]===0&&l[2]===0&&(l=[o[0],0,o[2]]);let c=Math.max(1,a),f=[r[0]+l[0]*c*1.3,r[1]+c*.75,r[2]+l[2]*c*1.3];return{waypoints:[t,f,i],finalPos:i}}function Fn(t,e,n=35,r=28){let a=Tn(e),o=Lr(t,a),i=Tn(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:o,fov:n+(r-n)*i,eased:a}}function Nr(t,e,n){let r=t.position.clone(),a=new gt().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new Ps(n[0],n[1],n[2]));let o=new gt().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(a),o}var zt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new gt;this.endQuat=new gt;this.outQuat=new gt;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,n,r,a=2500,o=28){return this.settle(),this.waypoints=e,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=a,this.endFov=o,this.startTime=performance.now(),this.active=!0,new Promise(i=>{this.resolveFn=i})}update(e){if(!this.active)return!1;let n=Math.min(1,(e-this.startTime)/this.duration),{pos:r,fov:a,eased:o}=Fn(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Rn(o,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=a,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let e=this.resolveFn;this.resolveFn=null,e&&e()}};var Hr=co,Es=.12,Cs=1.6,Gr=.12;function Br(t,e,n){let r=t[e*3],a=t[e*3+1],o=t[e*3+2],i=n[0]-r,s=n[2]-o,l=Math.hypot(i,s);if(!(l>.001))return null;let c=i/l,f=s/l,m=1/0,u=null;for(let d=0;d*3<t.length;d++){if(d===e)continue;let h=t[d*3]-r,y=t[d*3+2]-o,v=h*c+y*f;v<.3||v>1.6||Math.abs(h*f-y*c)>.6||v<m&&(m=v,u=a-t[d*3+1])}return u}var Ts=.25,Rs=1.5;function Wr(t,e,n=0,r,a,o=!1){let i=[e.x*qe,n+Rs,e.y*qe],s=a?[a[0],a[1],a[2]]:i,l=t[1],c=Number.isFinite(l)?l+(o?Cs:Hr):Number.isFinite(r)?n+r:n+Hr,f=i[0]-t[0],m=i[2]-t[2],u=Math.hypot(f,m),d=u>.001?Math.min(Es,u*Ts):0,h=u>.001?f/u:0,y=u>.001?m/u:0;return{eye:[t[0]+h*d,c,t[2]+y*d],focal:s}}var Le=Math.PI/180,_s=45,In=80,Ot=70,Fs=1,Is=.99;function Ds(t,e){if(!(t<Fs))return In;if(!(Number.isFinite(e)&&e>0))return Ot;let n=2*Math.atan(e/(2*Nt*Is)/Math.max(.05,t))/Le;return Math.max(Ot,Math.min(In,n))}var ks=.25,Nt=1,Ls=.25,Vs=12*Le,zs=.2,Os=1.5,Ur=.8,Yr=6,Zr=1.9,Ns=2/3,Hs=.12,Gs=.9,Bs=1.2,Ws=2,Qr=.05,Us=6;function Jr(t,e,n=0){if(!t.length)return{min:[e[0]-6,n,e[2]-6],max:[e[0]+6,Math.max(n+Ur,e[1]),e[2]+6]};let r=1/0,a=-1/0,o=1/0,i=-1/0,s=n;for(let h of t)r=Math.min(r,h.cx-h.halfX),a=Math.max(a,h.cx+h.halfX),o=Math.min(o,h.cz-h.halfZ),i=Math.max(i,h.cz+h.halfZ),s=Math.max(s,h.y);let l=a-r,c=i-o,f=Math.max(l,Math.min(c,Yr))/2,m=Math.max(c,Math.min(l,Yr))/2,u=(r+a)/2,d=(o+i)/2;return{min:[u-f,n,d-m],max:[u+f,Math.max(n+Ur,s),d+m]}}function Ys(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+Zr,t.max[2]]}}function Dn(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+Os,e+zs,e+Zr*Ns),(t.min[2]+t.max[2])/2]}function ea(t,e){let n=t[0]-e[0],r=t[2]-e[2],a=Math.hypot(n,r);return a<.001?{x:0,z:1}:{x:n/a,z:r/a}}function Xr(t,e,n){let r=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],i=Math.hypot(r,a,o)||1;r/=i,a/=i,o/=i;let s=-o,l=r,c=Math.hypot(s,l);if(c<1e-6)return 1/0;s/=c,l/=c;let f=1/0,m=-1/0;for(let u=0;u<8;u++){let d=(u&1?n.max[0]:n.min[0])-t[0],h=(u&2?n.max[1]:n.min[1])-t[1],y=(u&4?n.max[2]:n.min[2])-t[2],v=Math.max(Qr,d*r+h*a+y*o),x=(d*s+y*l)/v;x<f&&(f=x),x>m&&(m=x)}return m-f}function $r(t,e,n){let r=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],i=Math.hypot(r,a,o)||1;r/=i,a/=i,o/=i;let s=-o,l=r,c=Math.hypot(s,l);if(c<1e-6)return 1/0;s/=c,l/=c;let f=-l*a,m=l*r-s*o,u=s*a,d=1/0,h=-1/0;for(let y=0;y<8;y++){let v=(y&1?n.max[0]:n.min[0])-t[0],x=(y&2?n.max[1]:n.min[1])-t[1],T=(y&4?n.max[2]:n.min[2])-t[2],A=Math.max(Qr,v*r+x*a+T*o),F=(v*f+x*m+T*u)/A;F<d&&(d=F),F>h&&(h=F)}return h-d}function Ht(t,e){return Math.tan(t*Le/2)*Math.max(.05,e)}function qr(t,e,n){let r=Ds(n,t),a=l=>Math.max(_s,Math.min(r,l)),o=l=>2*Math.atan(l)/Le,i=Number.isFinite(t)&&t>0?a(o(t/(2*ks)/Math.max(.05,n))):r;if(!(Number.isFinite(e)&&e>0))return i;let s=Math.min(i,a(o(e/(2*Hs))));return t/(2*Ht(s,n))>Nt?i:s}function ta(t,e,n,r={}){let a=Dn(e),o=[t[0],t[1],t[2]],i=0,s=0,l=h=>{if(!(h>0))return;let y=ea(o,a);o[0]+=y.x*h,o[2]+=y.z*h,s+=h},c=r.preserveEye?0:e.max[1]+Ls-o[1];c>0&&(o[1]+=c,i=c,l(c/Math.tan(Vs)));let f=Ys(e),m=Xr(o,a,e),u=qr(m,$r(o,a,f),n),d=m/(2*Ht(u,n));for(let h=0;!r.preserveEye&&h<Us&&d>Nt;h++){let y=Math.max(1,Math.hypot(o[0]-a[0],o[2]-a[2])),v=Number.isFinite(d)?d/Nt:2;l(Math.min(60,y*(Math.min(4,v)-1)+.5)),m=Xr(o,a,e),u=qr(m,$r(o,a,f),n),d=m/(2*Ht(u,n))}return{eye:o,focal:a,fov:u,raisedM:i,pulledBackM:s,stageFrameWidth:d}}function Xs(t,e,n){let r=Math.tan(e*Le/2),a=Ht(e,n);return Math.max(1,t/Math.max(.05,Math.min(r,a)))}var $s=.7,jr=.5,qs=.8;function Kr(t,e,n){let r=[e[0]-t[0],e[1]-t[1],e[2]-t[2]],a=[n[0]-t[0],n[1]-t[1],n[2]-t[2]],o=r[0]*a[0]+r[1]*a[1]+r[2]*a[2],i=Math.hypot(r[0],r[1],r[2])*Math.hypot(a[0],a[1],a[2])||1;return Math.acos(Math.max(-1,Math.min(1,o/i)))/Le}function js(t,e,n){let r=c=>{let f=Math.hypot(c[0],c[1],c[2])||1;return[c[0]/f,c[1]/f,c[2]/f]},a=[e[0]-t[0],e[1]-t[1],e[2]-t[2]],o=Math.hypot(a[0],a[1],a[2]),i=r(a),s=r([n[0]-t[0],n[1]-t[1],n[2]-t[2]]),l=r([0,1,2].map(c=>i[c]*(1-jr)+s[c]*jr));return[t[0]+l[0]*o,t[1]+l[1]*o,t[2]+l[2]*o]}function na(t,e){let{aspect:n,venue:r}=e,a=t.focal,o=ea(t.eye,a),i=y=>(y[0]-a[0])*o.x+(y[2]-a[2])*o.z,s=[{name:"seat",eye:t.eye,focal:a,fov:t.fov}],l=Ws*(e.rowDepthM??Gs),c=[t.eye[0]+o.x*l,t.eye[1]+Bs,t.eye[2]+o.z*l],f=[t.eye[0],t.eye[1]-$s,t.eye[2]],m=js(c,a,f);s.push({name:"row",eye:c,focal:m,fov:Math.min(In,Math.max(t.fov,2*Math.max(Kr(c,m,f),Kr(c,m,a))/qs))});let u=(y,v,x,T)=>{let A=Xs(x,t.fov,n)*1.08,F=A*Math.sin(T*Le),S=Number.isFinite(e.seatingTopY)?e.seatingTopY+2:-1/0,_=Math.max(F,S-v[1]),V=A*Math.cos(T*Le);return{name:y,eye:[v[0]+o.x*V,v[1]+_,v[2]+o.z*V],focal:v,fov:t.fov}};e.section&&e.section.radius>0&&s.push(u("section",e.section.center,e.section.radius,35)),s.push(u("venue",r.center,Math.max(1,r.radius),40));let d=[],h=-1/0;for(let y of s){let v=i(y.eye);d.length&&v<=h+.5||(d.push(y),h=v)}return d}import{Vec3 as Ks}from"ogl";var xt=Math.PI/180,kn=320,oa=70*xt,Zs=32*xt,Qs=24*xt,ra=.0026,Js=.22,el=.006,tl=180,nl=900,ol=1100,rl=4,be=(t,e,n)=>Math.max(e,Math.min(n,t)),aa=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function ia(t){let{canvas:e,camera:n}=t,r=[],a=!1,o=0,i=0,s=0,l=0,c=0,f=0,m=kn,u=null,d=()=>{u&&(clearTimeout(u),u=null)},h=!1,y=[0,0],v=0,x=!1,T=null,A=null,F=new Map,S=!1,_=0,V=0,g=0,D=0,w=()=>a&&r.length?r[be(Math.round(o),0,r.length-1)].name:null,I=()=>{let R=w();R!==T&&(T=R,t.onStopChange?.(R))},N=()=>{if(!a||!r.length)return;let R=r[be(Math.floor(o),0,r.length-1)],M=r[be(Math.ceil(o),0,r.length-1)],q=be(o-Math.floor(o),0,1),$=(ae,Ee)=>ae+(Ee-ae)*q,oe=[$(R.eye[0],M.eye[0]),$(R.eye[1],M.eye[1]),$(R.eye[2],M.eye[2])],Q=[$(R.focal[0],M.focal[0]),$(R.focal[1],M.focal[1]),$(R.focal[2],M.focal[2])],C=Q[0]-oe[0],me=Q[1]-oe[1],ie=Q[2]-oe[2],ye=Math.hypot(C,me,ie)||1,xe=Math.atan2(C,ie),Me=Math.asin(be(me/ye,-1,1)),le=xe+i,_e=be(Me+s,-80*xt,80*xt),Fe=Math.cos(_e)*ye;C=Math.sin(le)*Fe,me=Math.sin(_e)*ye,ie=Math.cos(le)*Fe,n.position.set(oe[0],oe[1],oe[2]),n.fov=$(R.fov,M.fov),n.updateProjectionMatrix(),n.lookAt(new Ks(oe[0]+C,oe[1]+me,oe[2]+ie)),t.onApplied?.()},P=()=>{if(!a||!r.length)return;let R=be(Math.round(o),0,r.length-1);if(t.reducedMotion()){h=!1,o=R,N(),I(),t.requestRender();return}if(Math.abs(R-o)<.001){h=!1,I();return}l=o,c=R,f=performance.now(),m=kn,h=!0,t.requestRender()},O=R=>{!a||r.length<2||(d(),h=!1,o=be(o+R,0,r.length-1),N(),I(),t.requestRender())},G=(R,M)=>{a&&(d(),h=!1,x=!1,i=be(i-R*ra,-oa,oa),s=be(s-M*ra,-Qs,Zs),N(),t.requestRender())},U=R=>{a&&(F.set(R.pointerId,{x:R.clientX,y:R.clientY}),F.size===1?(S=!0,D=0,_=R.clientX,V=R.clientY):F.size===2&&(S=!1,g=B()))},B=()=>{let R=[...F.values()];return R.length<2?0:Math.hypot(R[0].x-R[1].x,R[0].y-R[1].y)},H=R=>{if(!a||!F.has(R.pointerId))return;if(F.set(R.pointerId,{x:R.clientX,y:R.clientY}),F.size>=2){let $=B();g>0&&O((g-$)*el),g=$;return}if(!S)return;let M=R.clientX-_,q=R.clientY-V;_=R.clientX,V=R.clientY,D+=Math.abs(M)+Math.abs(q),!(D<=rl)&&G(M,q)},ee=R=>{F.delete(R.pointerId)&&(F.size<2&&(g=0),F.size===0&&(S=!1,P()))},K=R=>{if(!a)return;R.preventDefault();let M=R.deltaMode===1?16:R.deltaMode===2?100:1,q=be(R.deltaY*M/100,-2,2);O(q*Js),A&&clearTimeout(A),A=setTimeout(()=>{A=null,P()},tl)},te=()=>{d(),a&&(a=!1,h=!1,x=!1,r=[],F.clear(),S=!1,A&&(clearTimeout(A),A=null),T!==null&&(T=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",U),e.addEventListener("pointermove",H),e.addEventListener("pointerup",ee),e.addEventListener("pointercancel",ee),e.addEventListener("wheel",K,{passive:!1}),{get active(){return a},enter(R,M=0){if(R.length<2){te();return}d(),r=R,a=!0,o=t.reducedMotion()?0:be(M,0,R.length-1),o>0&&(u=setTimeout(()=>{u=null,a&&(l=o,c=0,f=performance.now(),m=ol,h=!0,t.requestRender())},nl)),i=0,s=0,h=!1,x=!1,T=null,N(),I(),t.requestRender()},exit:te,recentre(){return a?Math.abs(i)<1e-4&&Math.abs(s)<1e-4?!0:t.reducedMotion()?(x=!1,i=0,s=0,N(),t.requestRender(),!0):(y=[i,s],v=performance.now(),x=!0,t.requestRender(),!0):!1},update(R){if(!a)return!1;let M=!1;if(x){let q=be((R-v)/kn,0,1),$=1-aa(q);i=y[0]*$,s=y[1]*$,q>=1?(x=!1,i=0,s=0):M=!0}if(h){let q=be((R-f)/m,0,1);o=l+(c-l)*aa(q),q>=1?(h=!1,o=c,I()):M=!0}return N(),M},currentStop:w,dispose(){te(),e.removeEventListener("pointerdown",U),e.removeEventListener("pointermove",H),e.removeEventListener("pointerup",ee),e.removeEventListener("pointercancel",ee),e.removeEventListener("wheel",K)}}}function sa(t){return t.flying?"cinematic":t.panoramaMounted?"panorama":t.seatViewActive?"seatView":"orbit"}function la(t,e){return t?-1:e}var Ln=null;function ca(){return Ln??=import("../openPanorama-VD6PE3YZ.js").catch(t=>{throw Ln=null,t}),Ln}var ua=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Gt=class{constructor(e){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=e}emit(e,n){if(this.cb)try{this.cb(e,n)}catch{}}opened(e,n,r,a){this.emit("3d_opened",{seats:e,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...a===void 0?{}:{prepSource:a}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(e,n){this.emit("3d_seat_picked",{seatId:e,sectionId:n})}cinematicPlayed(e){this.emit("3d_cinematic_played",{durationMs:e,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=ua(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(ua()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:e})}panoramaFailed(e,n){this.emit("3d_panorama_failed",{seatId:e,phase:n})}panoramaFallback(e){this.emit("3d_panorama_fallback",{seatId:e})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function da(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function ha(t){let{container:e,model:n,opts:r,expandedSeatById:a,seatIdsByRow:o,isNarrow:i}=t,s=null,l=()=>{if(!s)return;let m=i();Object.assign(s.style,m?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},c=()=>{s?.remove(),s=null};return{show:(m,u,d=!1)=>{if(c(),t.isDisposed())return null;let h=document.createElement("div");h.setAttribute("role","group"),Object.assign(h.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let y=r.chrome?.caption!==!1,v=r.chrome?.seatStepper!==!1;if(!y&&!v)return null;let x=a.get(m),T=x?.sectionId?n.sections.find(w=>w.id===x.sectionId):void 0,A=x?.label??m;h.setAttribute("aria-label",`Explore views near ${T?.label?`${T.label}, `:""}seat ${A}`);let F=document.createElement("span");F.textContent=r.seatViewCaption?.(m)??["Live 3D seat view",T?.label,A].filter(Boolean).join(" \xB7 "),Object.assign(F.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),y&&h.appendChild(F);let S=document.createElement("div");Object.assign(S.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),h.appendChild(S);let _=x?.rowId?o.get(x.rowId):void 0,V=_?.indexOf(m)??-1,g=V>=0?[_?.[V-1],_?.[V+1]]:[void 0,void 0],D=(w,I,N,P=!1)=>{let O=document.createElement("button");O.type="button",O.textContent=w,O.setAttribute("aria-label",I),Object.assign(O.style,{minHeight:"44px",padding:P?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),P||(O.style.minWidth="44px"),P&&(O.dataset.panoramaTrigger=""),O.addEventListener("click",N),S.appendChild(O)};if(v&&g[0]){let w=a.get(g[0])?.label??g[0];D("\u2039",`View previous seat ${w}`,()=>{t.flyToSeat(g[0])})}if(v&&r.getSeatView){let w=r.seatViewActionLabel?.(m)??"Open 360\xB0 panorama";D(d?`\u21BB Retry ${w}`:`\u25C9 ${w}`,`${d?"Retry":w} from seat ${A}`,()=>{if(t.isDisposed()||u!==t.flightGen()){c();return}c(),t.openPanorama(m,400,u)},!0)}if(v&&g[1]){let w=a.get(g[1])?.label??g[1];D("\u203A",`View next seat ${w}`,()=>{t.flyToSeat(g[1])})}return!S.childElementCount&&!y?null:(e.appendChild(h),s=h,l(),h)},remove:c,layout:l}}var al={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function ma(t){let{container:e,orbit:n,isNarrow:r}=t,a={...al,...t.labels??{}},o=(S,_)=>{S.setAttribute("aria-label",_),S.title=_},i=document.createElement("div"),s=!1;i.className="sl-3d-navigation-controls",Object.assign(i.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let l=document.createElement("div");l.setAttribute("role","group"),l.setAttribute("aria-label","3D drag mode"),Object.assign(l.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let c=document.createElement("div");c.setAttribute("role","group"),c.setAttribute("aria-label","3D view controls"),Object.assign(c.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let f=document.createElement("button");f.type="button",f.textContent="\u21BB",o(f,a.rotate);let m=document.createElement("button");m.type="button",m.textContent="\u2725",o(m,a.move);let u=document.createElement("button");u.type="button",u.textContent="\u2212",o(u,a.zoomOut);let d=document.createElement("button");d.type="button",d.textContent="+",o(d,a.zoomIn);for(let S of[f,m,u,d])S.className="sl-3d-icon-control",Object.assign(S.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});l.append(f,m),c.append(d,u);let h=null,y=()=>{let S=n.dragAction();if(S===h)return;h=S;let _=S==="orbit";f.setAttribute("aria-pressed",String(_)),m.setAttribute("aria-pressed",String(!_)),f.style.background=_?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",m.style.background=_?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",i.title=_?`${a.rotate} \xB7 ${a.move} with Shift`:`${a.move} \xB7 ${a.rotate} with Shift`},v=S=>{n.setPrimaryDragMode(S),y()};f.addEventListener("click",()=>v("orbit")),m.addEventListener("click",()=>v("pan"));let x=()=>{let{atMin:S,atMax:_}=n.dollyLimitState();d.disabled!==S&&(d.disabled=S),u.disabled!==_&&(u.disabled=_)};u.addEventListener("click",()=>{n.zoomBy(dt),x()}),d.addEventListener("click",()=>{n.zoomBy(Ke),x()}),i.append(l,c),v("auto"),e.appendChild(i);let T=t.enabled!==!1,A=()=>{let S=r();i.style.display=s||!T?"none":"flex",i.style.right=S?"12px":"14px",i.style.bottom=S?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",l.style.display=S?"none":"flex",d.style.display=S?"none":"",u.style.display=S?"none":""};return A(),{element:i,utilityControls:c,setNavigationMode:v,syncNavigationMode:y,syncZoomLimits:x,setSeatViewLocked:S=>{s=S,n.setInteractionEnabled(!S),A()},seatViewLocked:()=>s,layout:A}}var il=.5,pa=12,fa=20,sl=28;function ll(t,e,n){return!(t>0)||!(n>0)?0:il*n/(2*t*Math.tan(e*Math.PI/360))}function va(t){let{glctx:e,orbit:n,model:r,seats:a,opts:o,cinematic:i,analytics:s,seatIdByIndex:l,sectionIdBySeatId:c,tapSlop:f,tapMs:m,cancelFlight:u,focusSectionCamera:d,setSelection:h,ensureSeatView:y}=t,v=0,x=0,T=0,A=-1,F=!1,S=!1,_=P=>{t.seatViewLocked()||A===-1&&(A=P.pointerId,v=P.clientX,x=P.clientY,T=performance.now(),F=!1,S=i.active,i.active&&(s.cinematicCancelled(),u(),o.onViewTargetChange?.(null)))},V=P=>{P.pointerId===A&&Math.hypot(P.clientX-v,P.clientY-x)>f&&(F=!0)},g=(P,O,G,U,B)=>{let H=e.canvas.getBoundingClientRect(),ee=e.canvas.clientWidth||H.width||1,K=e.canvas.clientHeight||H.height||1,te=P-H.left,R=O-H.top,M=U*U,q=-1,$=M,oe=1/0;for(let Q of a){if(G&&Q.sectionId!==G)continue;let C=r.seats.idToIndex.get(Q.id);if(C===void 0)continue;if(B){let le=Math.round(r.seats.iState[C]??0);if(le!==0&&le!==3)continue}let me=C*3,ie=Te(n.camera.projectionViewMatrix,[r.seats.iPosition[me],r.seats.iPosition[me+1]+.55,r.seats.iPosition[me+2]],ee,K);if(!ie.visible)continue;let ye=ie.x-te,xe=ie.y-R,Me=ye*ye+xe*xe;(Me<$||Math.abs(Me-$)<1&&ie.depth<oe)&&(q=C,$=Me,oe=ie.depth)}return q},D=(P,O)=>{let G=t.gpu(),U=t.pick();if(!G||!U)return-1;U.syncFromSeatProgram(G.seatProgram);let B=e.canvas.getBoundingClientRect(),H=e.renderer.dpr,{x:ee,y:K}=_r(P,O,B,H,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),te=Math.max(2,Math.round(8*H));return U.pick(n.camera,ee,K,te)},w=()=>e.canvas.clientHeight||e.canvas.getBoundingClientRect().height,I=(P,O=pa)=>{let G=n.camera?.position;if(!G)return!1;let U=P*3,B=Math.hypot(G.x-r.seats.iPosition[U],G.y-r.seats.iPosition[U+1],G.z-r.seats.iPosition[U+2]);return ll(B,n.fovY,w())>=O};return{onDown:_,onMove:V,onUp:P=>{if(P.pointerId!==A)return;let O=!F&&performance.now()-T<m;if(A=-1,S){S=!1;return}let G=t.gpu(),U=t.pick();if(!O||!G||!U)return;let B=D(P.clientX,P.clientY),H=P.pointerType==="touch"||P.pointerType==="pen",ee=H?fa:pa,K=B>=0&&I(B,ee),te=!1;if(t.focusedSectionId()&&B>=0){let q=l[B],$=q?c.get(q):void 0;if($&&$!==t.focusedSectionId()&&d($,{keepCamera:K})){if(!K)return;te=!0}}if(t.focusedSectionId()&&B<0&&(B=g(P.clientX,P.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&B<0){let q=g(P.clientX,P.clientY,null,72,!1),$=q>=0?l[q]:void 0,oe=$?c.get($):void 0;if(oe&&oe!==t.focusedSectionId()&&d(oe))return}if(!t.focusedSectionId()){B<0&&(B=g(P.clientX,P.clientY,null,42,!1));let q=B>=0?l[B]:void 0,$=q?c.get(q):void 0;if($&&d($,{keepCamera:K})){if(!K)return;te=!0}}if(B<0||B>=l.length){t.selection().size&&(h([]),o.onViewTargetChange?.(null));return}let R=l[B];if(H&&t.focusedSectionId()&&!te&&!I(B,fa)){t.focusSeatCamera(R,{seatPx:sl,viewportHeightPx:w()});return}let M=Se[Math.round(r.seats.iState[B]??0)]??"available";if(M!=="available"&&M!=="selected"){o.onSeatInspect?.(R,M);return}if(t.selection().has(R)&&t.selection().size===1){h([]),o.onViewTargetChange?.(null),o.onSeatPick?.(R);return}h([R]),y(R),s.seatPicked(R,c.get(R)),o.onSeatPick?.(R)}}}var Bt=class{constructor(e,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=e,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let e=this.iPosition,n=1/0,r=1/0,a=-1/0,o=-1/0;for(let d=0;d<this.count;d++){let h=e[d*3],y=e[d*3+2];h<n&&(n=h),h>a&&(a=h),y<r&&(r=y),y>o&&(o=y)}let i=Math.max(a-n,.001),s=Math.max(o-r,.001);this.cell=Math.max(Math.sqrt(i*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(i/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let l=this.cols*this.rows,c=new Int32Array(l+1),f=d=>{let h=Math.min(this.cols-1,Math.max(0,Math.floor((e[d*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[d*3+2]-r)/this.cell)))*this.cols+h};for(let d=0;d<this.count;d++)c[f(d)+1]++;for(let d=0;d<l;d++)c[d+1]+=c[d];let m=new Int32Array(this.count),u=c.slice(0,l);for(let d=0;d<this.count;d++)m[u[f(d)]++]=d;this.cellStart=c,this.cellItems=m}gather(e,n,r,a,o){this.ensureGrid();let i=this.cellStart,s=this.cellItems;if(!i||!s)return 0;let l=a.length,c=r*r,f=Math.floor((e-this.minX)/this.cell),m=Math.floor((n-this.minZ)/this.cell),u=Math.ceil(r/this.cell)+1,d=this.iPosition,h=0;for(let y=0;y<=u&&h<l;y++){let v=m-y,x=m+y,T=f-y,A=f+y;for(let F=v;F<=x&&h<l;F++){if(F<0||F>=this.rows)continue;let S=F===v||F===x;for(let _=T;_<=A&&h<l;_++){if(!S&&_!==T&&_!==A){_=A-1;continue}if(_<0||_>=this.cols)continue;let V=F*this.cols+_;for(let g=i[V],D=i[V+1];g<D&&h<l;g++){let w=s[g],I=d[w*3]-e,N=d[w*3+2]-n,P=o===void 0?0:d[w*3+1]-o;I*I+P*P+N*N<=c&&(a[h++]=w)}}}}return h}};var Wt=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Dt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new Bt(e.model.seats.iPosition,e.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(e){let n=this.ctx.gpu();e||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!e&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(e){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!e){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let a=this.ctx.orbit().camera.position;if(Math.hypot(a.x-this.lastGatherX,a.y-this.lastGatherY,a.z-this.lastGatherZ)<gn)return;if(this.lastGatherX=a.x,this.lastGatherY=a.y,this.lastGatherZ=a.z,Math.hypot(a.x-n.bounds.center[0],a.y-n.bounds.center[1],a.z-n.bounds.center[2])-n.bounds.radius>bn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(a.x,a.z,bn,this.nearBuf,a.y);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(e,n,r){let a=1-Math.exp(-e*9),o=1-Math.exp(-e*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?a:o),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?a:o),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};function ba(t){let e=Math.max(5,t.radius),n=t.focalWorld[0]-t.center[0],r=t.focalWorld[2]-t.center[2],a=Math.hypot(n,r);if(a<e*.12)return{center:t.center,radius:e,polarDeg:48};let o=Math.min(a*.25,e*.2);return{center:[t.center[0]+n/a*o,t.center[1],t.center[2]+r/a*o],radius:e+o,polarDeg:50}}import{Quat as cl,Vec3 as ul}from"ogl";function ga(){let t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round");let n=document.createElementNS(t,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),e.appendChild(n),e}function ya(t){let{container:e,model:n,opts:r,orbit:a,cinematic:o,analytics:i,loop:s,labelOverlay:l,stageAzimuth:c,overviewFraming:f}=t,m=0,u=-1,d=(w,I,N=28)=>{a.camera.position.set(w[0],w[1],w[2]),a.camera.lookAt(new ul(I[0],I[1],I[2])),a.camera.fov=N,a.camera.updateProjectionMatrix()},h=document.createElement("button");h.className="sl-3d-overview-control sl-3d-icon-control",h.type="button",h.replaceChildren(ga());let y=r.navLabels?.fitView??"Show whole venue";h.setAttribute("aria-label",y),h.title=y,Object.assign(h.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let v=()=>{h.firstElementChild||h.replaceChildren(ga())};v();let x=w=>{u=w;let I=t.gpu();I&&(I.seatProgram.uniforms.uFocusFloor.value=w,I.solidProgram.uniforms.uFocusFloor.value=w,I.chairProgram.uniforms.uFocusFloor.value=w),t.showSectionSeatLabels(null)},T=null,A=!1,F=()=>{if(T=null,A=!1,t.setSeeThrough?.(null),t.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),i.panoramaClosed()),t.setPanoramaSphereVisible(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.restorePanoramaLayer(),h.style.display="",l.setVisible(!0),t.setFrozen(!1);let w=u>=0?n.floors[u]:null;if(t.setNearFieldDetailEnabled(!!w),t.setSeatViewLocked(!1),S(),t.removeArriveChip(),t.setNavigationMode("auto"),w){let I=w.focalWorld[0]-w.center[0],N=w.focalWorld[2]-w.center[2],P=Math.hypot(I,N)>w.radius*.12?Math.atan2(I,N):c,O={center:w.center,radius:w.radius,box:w.box},G={polarDeg:58,margin:1.12};t.reducedMotion()?a.frame(O,!1,P,!1,G):a.frameSoft(O,P,!1,G)}else t.reducedMotion()?a.frame(n.bounds,!1,c,r.portraitOverviewCrop===!0,f):a.frameSoft(n.bounds,c,r.portraitOverviewCrop===!0,f);l.setOverviewDistance(a.targetDistance),t.showSectionSeatLabels(null),s.requestRender()},S=()=>{m++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),o.active&&(o.cancel(),a.resumeAfterFlight(n.focalWorld))},_=w=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let I=n.seats.idToIndex.get(w);if(I===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(w),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),h.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1);let N=t.inSeatView()&&r.arriveAtSeatEye===!0;t.setSeatStepping(N),t.setSeatViewLocked(!1);let P=++m;N?t.showArriveChip(w,P):t.removeArriveChip();let{eye:O,focal:G}=t.resolvedSeatViewPose(w,I),U=r.arriveAtSeatEye?t.seatViewArrival(w,I):null,B=U&&U.stops.length>1&&U.stops[1].name==="row"?U.stops[1]:null,H=U?U.focal:G,ee=[a.camera.position.x,a.camera.position.y,a.camera.position.z],K=_n(ee,U?.eye??O,H,n.bounds.center,n.bounds.radius),te=B?B.eye:U?U.eye:r.arriveAtSeatEye?O:K.finalPos,R=U?U.fov:r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?Ot:65:28,M=[K.waypoints[0],K.waypoints[1],te];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),d(te,H,R),s.requestRender(),i.cinematicSkipped(),t.isDisposed()||a.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),U&&t.enterSeatView(U.stops),t.showArriveChip(w,P),Promise.resolve();let q=new cl().copy(a.camera.quaternion),$=Nr(a.camera,te,H);s.requestRender();let oe=N?700:2500;return o.start(M,q,$,oe,R).then(()=>{t.isDisposed()||P!==m||(t.setSeatStepping(!1),i.cinematicPlayed(oe),a.resumeAfterFlight(H),t.setSeatViewLocked(r.arriveAtSeatEye===!0),U&&t.enterSeatView(U.stops,B?1:0),s.requestRender(),t.showArriveChip(w,P))})},V=(w,I)=>{let N=n.sections.find(P=>P.id===w);if(!N||N.seatCount===0)return!1;if(T=w,A=!1,t.setSeeThrough?.(null),t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),o.cancel(),t.removeArriveChip(),n.floors.length>1&&u!==N.floorIndex&&x(N.floorIndex),t.setNavigationMode("auto"),t.panorama()||l.setVisible(!0),t.showSectionSeatLabels(w),!I?.keepCamera){let P=ba(N),O={polarDeg:P.polarDeg,margin:1.12};t.reducedMotion()?a.frame({center:P.center,radius:P.radius},!1,a.currentAzimuth,!1,O):a.glideTo({center:P.center,radius:P.radius},O)}return r.onSectionFocusChange?.(w),s.requestRender(),!0},g=(w,I)=>{if(t.isDisposed()||!t.gpu())return!1;let N=n.seats.idToIndex.get(w);if(N===void 0)return!1;let P=N*3,O=[n.seats.iPosition[P],n.seats.iPosition[P+1]+.55,n.seats.iPosition[P+2]],G=I?dl(I,a.fovY,a.camera.aspect||1):xa;return A=!0,t.setSeeThrough?.(O),t.reducedMotion()?a.frame({center:O,radius:G},!1,void 0,!1,Vn):a.frameSoft({center:O,radius:G},void 0,!1,Vn),s.requestRender(),!0},D=()=>{if(t.isNarrow?.()&&A&&T&&V(T)){s.requestRender();return}F()};return h.addEventListener("click",D),{overviewChip:h,layoutOverviewChip:v,flightGen:()=>m,focusedFloor:()=>u,applyFloorFocus:x,placeCameraFinal:d,cancelFlight:S,focusOverview:F,flyToSeat:_,focusSectionCamera:V,focusSeatCamera:g}}var xa=4.5;function dl(t,e,n){let r=Math.tan(e*Math.PI/360),a=r*Math.max(.001,n),i=hl*t.viewportHeightPx/(2*Math.max(1,t.seatPx)*r)*Math.min(r,a)/Vn.margin;return Math.max(ml,Math.min(xa,i))}var hl=.5,ml=1.5,Vn={polarDeg:48,margin:1.25};function zn(t,e,n,r,a,o,i,s,l=.5){let c=-1,f=s*s,m=1/0;for(let u=0;u<e;u++){let d=u*3,h=Te(n,[t[d],t[d+1]+l,t[d+2]],r,a);if(!h.visible)continue;let y=h.x-o,v=h.y-i,x=y*y+v*v;(x<f-4||x<f+4&&h.depth<m)&&(c=u,f=Math.min(f,x),m=h.depth)}return c}function wa(t){let e=performance.now(),{input:n,estimate:r}=Lo(t);return{model:ut(n),buildMs:performance.now()-e,source:"main",...r?{estimate:r}:{}}}function pl(t){let e=oo(t.doc);return{...wa({...t,seats:e}),seats:e}}function Sa(t,e,n){let r=o=>({...e(),fallbackReason:o});if(typeof Worker>"u")return Promise.resolve(r("unavailable"));let a;try{a=new Worker(new URL("./scene/scene.worker.js",import.meta.url),{type:"module"})}catch{return Promise.resolve(r("unavailable"))}return new Promise(o=>{let i=!1,s=f=>{i||(i=!0,clearTimeout(c),a.terminate(),o(f))},l=f=>s(r(f)),c=window.setTimeout(()=>l("timeout"),15e3);a.onerror=()=>l("worker_error"),a.onmessage=f=>{let m=n(f.data);m?s(m):l("bad_response")},a.postMessage(t)})}function fl(t){return Sa(t,()=>wa(t),({model:e,buildMs:n,estimate:r})=>({model:e,buildMs:n,source:"worker",...r?{estimate:r}:{}}))}function vl(t){return Sa(t,()=>pl(t),({model:e,buildMs:n,seats:r,estimate:a})=>r?{model:e,buildMs:n,seats:r,source:"worker",...a?{estimate:a}:{}}:null)}var gl=40,yl=48,xl=Math.PI/180,wl=6,Sl=500,Ml=6;function nd(t,e,n={}){let r=performance.now(),a=e.prepared?e.prepared.estimate:e.estimate===!1?null:dn(e.doc,e.seats);a&&(e={...e,doc:a.doc,seats:ko(e.seats,a)});let o=e.prepared?.model??ut(e),i=new Gt(n.onAnalytics),s=new Array(o.seats.count);for(let[p,b]of o.seats.idToIndex)s[b]=p;let l=new Map(e.seats.map(p=>[p.id,p])),c=new Map;for(let p of e.seats){if(!p.rowId)continue;let b=c.get(p.rowId);b?b.push(p.id):c.set(p.rowId,[p.id])}let f=new Map,m=[0,0,0,0];function u(){if(v)for(let p of[v.seatProgram,v.solidProgram,v.chairProgram])p.uniforms.uSeeThrough.value=m}e.seats.forEach((p,b)=>{f.set(p.id,o.seatSectionIds?.[b]??p.sectionId)});let d=new Map;for(let[p,b]of o.seats.idToIndex){let E=f.get(p);if(!E)continue;let z=d.get(E);z?z.push(b):d.set(E,[b])}let h=()=>{if(!v||!o.sectionSolidRanges.length)return;let{lit:p,anyUnlit:b}=Mr(o.sectionSolidRanges,d,o.seats.iState);v.setSectionShellLit(b?p:null)},y=e.doc.floors?.some(b=>(b.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(b=>b.objects)??e.doc.objects).some(b=>b.type==="section"&&((b.height??0)>0||(b.rake??0)>0)),v=null,x=null,T=null,A=!1,F=!1,S=!1,_=new Map,V=null,g=null,D=null,w=new Map,I=null,N=()=>{D===null&&(D=t.style.zIndex,t.style.zIndex="20")},P=()=>{D!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=D),D=null)},O=!1,G=()=>O?ve.focusedFloor():-1,U=()=>{v=Tr(M.gl,o),x?.dispose(),x=Qo(M.gl,[1,1,1],o.theme.seatStates.selected),Un(!1),h(),ne(),T=new Vt(M.renderer,v.seatGeometry,v.chairGeometry,v.solidGeometry,o.seats.count),M.setClearColor(o.theme.background.top),T.setRestoreClear(o.theme.background.top),T.setRoomCentre(o.room?.centre),v.seatProgram.uniforms.uSeatRadius.value=lt*o.theme.seatScale,v.seatProgram.uniforms.uFocusFloor.value=G(),v.solidProgram.uniforms.uFocusFloor.value=G(),v.chairProgram.uniforms.uFocusFloor.value=G(),v.screenProgram&&(v.screenProgram.uniforms.uFocusFloor.value=G()),u(),H.forceRegather()},B=!1,H=new Wt({model:o,orbit:()=>C,gpu:()=>v}),ee=!1,K=new Map,te=24,R=p=>H.setDetailEnabled(p),M=new Tt(t,{onContextLost:()=>{S||i.contextLost(),A=!0,ce.stop(),v=null,T=null,q.reset()},onContextRestored:()=>{U(),A=!1,S||i.contextRestored(),ce.requestRender()}}),q=new Rt(M.gl,M.renderer,M.smoothingSamples),$=new _t,oe=!1,Q=(p,b)=>{if(!v)return{smooth:!1,onBudget:!1};if(o.seatCount<=Ho||v.nearSeatCount()>0||!p)return{smooth:!0,onBudget:!1};let E=$.allows(b);return{smooth:E,onBudget:E}},C=new Ft(M.gl,M.canvas,()=>ce.requestRender(),()=>i.orbitEngaged());C.setAspect(M.aspect);let me=(e.doc.floors?.flatMap(p=>p.objects)??e.doc.objects).some(p=>p.type==="section"&&p.physical3dProvenance?.surfaceKind?.status==="inferred"),ie=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(me&&o.stages.length===0))return Vo(o.focalWorld,o.seats.iPosition,o.bounds)})(),ye=(e.doc.floors?.flatMap(p=>p.objects)??e.doc.objects).some(p=>p.type==="shape"&&p.stageKind?.startsWith("pitch-")),xe=o.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:ye?36:48,margin:1.05},Me=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;C.frame(o.bounds,!Me&&n.skipInitialOverviewAnimation!==!0,ie,n.portraitOverviewCrop===!0,xe);let le=new zt(C.camera),_e=da(t),Fe=zo(t,o),ae=new kt(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),Ee=o.labels,Ie=()=>Ao(Ee,o.floors.length,G());ae.setLabels(Ie()),ae.setOverviewDistance(C.targetDistance);let L=()=>{let p=new Map,b=Se.indexOf("available");for(let E of Ee){if(!E.wheelchairSeats)continue;let z=0;for(let W of E.wheelchairSeats)o.seats.iState[W]===b&&z++;z>0&&p.set(E.id,z)}return ae.setWheelchairFree(p)};L();let Y=null,J=()=>[..._.keys()].flatMap(p=>{let b=o.seats.idToIndex.get(p),E=b===void 0?void 0:e.seats[b];if(b===void 0||E?.id!==p)return[];let z=b*3;return[{id:`seat:${p}`,kind:"seat",seatWidthM:o.seats.iChairWidth[b]*2,text:E.displayLabel||E.label,anchor:[o.seats.iPosition[z],o.seats.iPosition[z+1]+1.05,o.seats.iPosition[z+2]],pinBase:Yt(z)}]}),X=-1,ne=()=>{v&&(X=Y?o.sections.findIndex(p=>p.id===Y):-1,v.seatProgram.uniforms.uFocusSection.value=X,v.chairProgram.uniforms.uFocusSection.value=X)},se=p=>{if(Y=p,ne(),ae.setForcedDense(!!p),!p){let k=J(),de=new Set(k.map(ue=>ue.id));ae.setLabels([...Ie().filter(ue=>!de.has(ue.id)),...k]);return}let b=e.seats.filter(k=>f.get(k.id)===p),E=new Set(b.map(k=>k.id)),z=new Set(b.map(k=>k.rowId)),W=new Set(_.keys()),j=new Set(b.filter(k=>W.has(k.id)).map(k=>k.id)),Z=Ie().filter(k=>k.kind!=="row"&&k.kind!=="seat"&&k.kind!=="access"||k.kind==="access"&&E.has(k.id.slice(7))||(k.kind==="row"?z.has(k.id.slice(4)):E.has(k.id.slice(5))));if(o.seatCount<=6e3&&j.size===0){ae.setLabels(Z);return}let re=b,pe=new Set(re.map(k=>`seat:${k.id}`)),ge=re.flatMap(k=>{let de=o.seats.idToIndex.get(k.id);if(de===void 0)return[];let ue=de*3;return[{id:`seat:${k.id}`,kind:"seat",seatWidthM:o.seats.iChairWidth[de]*2,rowId:k.rowId,text:W.has(k.id)?k.displayLabel||k.label:Do(k.displayLabel||k.label),anchor:[o.seats.iPosition[ue],o.seats.iPosition[ue+1]+(W.has(k.id)?1.05:.55),o.seats.iPosition[ue+2]],...W.has(k.id)?{pinBase:Yt(ue)}:{}}]});ae.setLabels([...Z.filter(k=>!pe.has(k.id)),...ge])};U();let Ae=null,Ut=null,On=new bl,wt=p=>{if(A||!v||F)return!1;let b=sa({flying:le.active,panoramaMounted:V!==null,seatViewActive:Ae?.active===!0}),E=la(Ae?.active===!0,G());v.seatProgram.uniforms.uFocusFloor.value=E,v.solidProgram.uniforms.uFocusFloor.value=E,v.chairProgram.uniforms.uFocusFloor.value=E,v.screenProgram&&(v.screenProgram.uniforms.uFocusFloor.value=E);let z=b==="orbit"?X:-1;v.seatProgram.uniforms.uFocusSection.value=z,v.chairProgram.uniforms.uFocusSection.value=z;let W=ee?!1:b==="cinematic"?le.update(performance.now()):b==="seatView"?Ae.update(performance.now()):b==="orbit"?C.update():!1;Ut?.syncZoomLimits(),Ut?.syncNavigationMode();let j=G()>=0?o.floors[G()]:null,Z=j?.radius??o.bounds.radius,re=qo(C.currentDistance,Z),pe=B?{center:[C.camera.position.x,C.camera.position.y,C.camera.position.z],radius:520}:o.clipBounds??o.renderBounds;C.updateClipping(pe);let ge=j?.center??o.renderBounds.center,k=j?.radius??o.renderBounds.radius,de=(Pe,on)=>Math.hypot(C.camera.position.x-Pe[0],C.camera.position.y-Pe[1],C.camera.position.z-Pe[2])<=on*(H.detailVisible?1.8:1.55),ue=de(ge,k);if(!ue&&Y){let Pe=o.sections.find(on=>on.id===Y);Pe&&(ue=de(Pe.center,Math.max(12,Pe.radius*2)))}H.detailVisible=ue;let fe=v.seatProgram.uniforms;fe.uSeatScale.value=re.scale,fe.uSeatFade.value=re.fade;let Oe=!!j&&jo(j.seatCount,M.canvas.clientWidth||1,M.canvas.clientHeight||1),tn=Ko(o.seats.count,Z,C.currentDistance,C.camera.fov,M.canvas.clientHeight||1),Ye=H.detailVisible||Oe||tn?1:0,At=H.detailVisible||G()>=0||o.floors.length>1?1:0;H.ease(p,Ye,At),fe.uSeatDetail.value=H.seatDetailMix;let Xe=Ye===0&&H.seatDetailMix<.01;v.seatGeometry.setDrawRange(Xe?hn:0,Xe?Oo:hn),v.solidProgram.uniforms.uStructureDetail.value=H.structureDetailMix,v.solidProgram.uniforms.uViewport.value.set([M.gl.drawingBufferWidth,M.gl.drawingBufferHeight]),fe.uMinPixels.value=re.minPixels,fe.uPixelToWorld.value=2*Math.tan(C.camera.fov*xl/2)/Math.max(1,M.pixelHeight),H.update(H.detailVisible),(o.outdoor||o.house)&&(On.copy(C.camera.projectionViewMatrix).inverse(),v.backgroundProgram.uniforms.uInvViewProj.value.set(On),v.backgroundProgram.uniforms.uEye.value.set([C.camera.position.x,C.camera.position.y,C.camera.position.z]));let $e=Q(W,C.currentDistance),we=q.begin($e.smooth);oe=we!==null,$.frame($e.onBudget&&we!==null,C.currentDistance,performance.now());let nn=we?{target:we}:{};M.renderer.render({scene:v.background,clear:!0,...nn}),M.renderer.render({scene:v.main,camera:C.camera,clear:!1,...nn});let Ia=x?x.update(performance.now(),[C.camera.position.x,C.camera.position.y,C.camera.position.z],V!==null,b==="seatView"):!1;if(x&&M.renderer.render({scene:x.root,camera:C.camera,clear:!1,...nn}),q.end(),Fe){let Pe=C.camera.worldMatrix;Fe.update(b==="seatView"?[C.camera.position.x,C.camera.position.y,C.camera.position.z]:null,[-Pe[8],-Pe[9],-Pe[10]])}ae.update(C.camera.projectionViewMatrix,M.canvas.clientWidth||1,M.canvas.clientHeight||1,C.currentDistance,Z,[C.camera.position.x,C.camera.position.y,C.camera.position.z]);let no=W||Ia||H.seatDetailMix!==Ye||H.structureDetailMix!==At;return Nn(!no),no},Nn=$o(t),ce=new It(wt),Hn=typeof ResizeObserver<"u"?new ResizeObserver(()=>en.resize()):null;Hn?.observe(t),C.setZoomPointResolver((p,b)=>{let E=M.canvas.getBoundingClientRect(),z=M.canvas.clientWidth||E.width,W=M.canvas.clientHeight||E.height;if(!(z>0)||!(W>0))return null;C.camera.updateMatrixWorld();let j=zn(o.seats.iPosition,o.seats.count,C.camera.projectionViewMatrix,z,W,p-E.left,b-E.top,gl);if(j<0)return null;let Z=j*3;return[o.seats.iPosition[Z],o.seats.iPosition[Z+1]+.5,o.seats.iPosition[Z+2]]});function Yt(p){return[o.seats.iPosition[p],o.seats.iPosition[p+1]+.5,o.seats.iPosition[p+2]]}ae.setSeatNumberRow(null);let Ce=null,Ve=0,Xt=null,Gn=()=>{Ve=0;let p=null,b=null;if(Ce&&!Ae?.active&&!le.active){let W=M.canvas.getBoundingClientRect(),j=M.canvas.clientWidth||W.width,Z=M.canvas.clientHeight||W.height;if(j>0&&Z>0){let re=zn(o.seats.iPosition,o.seats.count,C.camera.projectionViewMatrix,j,Z,Ce.x-W.left,Ce.y-W.top,yl);p=re>=0?e.seats[re]?.rowId??null:null;let pe=re>=0?e.seats[re]?.id??null:null;if(b=pe,Ce.mouse&&!Ce.pressing&&!!Y&&!!pe&&f.get(pe)===Y){let k=t.getBoundingClientRect();Xt=pe,n.onSeatHover?.(pe,{x:Ce.x-k.left,y:Ce.y-k.top})}else Bn()}}else Bn();let E=Ce?.mouse?b:null,z=ae.setSeatNumberSeat(E);(ae.setSeatNumberRow(p)||z)&&ce.requestRender()};function Bn(){Xt!==null&&(Xt=null,n.onSeatHover?.(null,null))}let St=p=>{Ce={x:p.clientX,y:p.clientY,mouse:p.pointerType==="mouse",pressing:p.type==="pointerdown"},Ve||(Ve=requestAnimationFrame(Gn))},Wn=p=>{p.pointerType==="mouse"&&(Ce=null,Ve||(Ve=requestAnimationFrame(Gn)))};M.canvas.addEventListener("pointermove",St),M.canvas.addEventListener("pointerdown",St),M.canvas.addEventListener("pointerleave",Wn);function Un(p){if(!x)return;let b=[];for(let E of _.keys()){let z=o.seats.idToIndex.get(E);if(z===void 0)continue;let W=z*3;b.push({id:E,position:Yt(W)})}x.setSeats(b,performance.now(),p)}let Yn=p=>{let b=W=>{let j=o.seats.idToIndex.get(W);return j===void 0?void 0:o.seats.iState[j]},{updates:E,next:z}=Ir(_,p,b);if(_=z,ae.setSelectedSeatIds(_.keys()),Un(!ot()),ce.requestRender(),se(Y),E.length){let W=cn(o.seats,E);v&&v.uploadSeatStateRuns(W),h(),ce.requestRender()}},ot=()=>I!==null?I:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ma=8,Xn=p=>{if(!n.getSeatView)return null;let b=w.get(p);if(!b)for(b=Promise.resolve(n.getSeatView(p)),w.set(p,b),b.catch(()=>{w.get(p)===b&&w.delete(p)});w.size>Ma;){let E=w.keys().next().value;if(E===void 0)break;w.delete(E)}return b},$n=Jr(o.stages,o.focalWorld,o.bounds.groundY??0),qn=Dn($n),$t=(p,b)=>{let E=l.get(p),z=Math.max(0,Math.round(o.seats.iFloor[b]??0)),W=e.doc.floors?.[z],j=o.floors[z],Z=W?.focalPoint??e.doc.focalPoint,re=j?{x:j.focalWorld[0]/qe,y:j.focalWorld[2]/qe}:Z,pe=E?.focalPoint?{x:E.focalPoint.x+re.x-Z.x,y:E.focalPoint.y+re.y-Z.y}:re,ge=[o.seats.iPosition[b*3],o.seats.iPosition[b*3+1],o.seats.iPosition[b*3+2]],k=Br(o.seats.iPosition,b,qn),de=k!==null&&Math.abs(k)<Gr;return Wr(ge,pe,W?.baseHeightM??0,E?.eyeHeightM,qn,de)},qt=()=>(t.clientWidth||M.canvas.clientWidth)<=520,jt=null,jn=null,Aa=async(p,b,E)=>{if(!n.getSeatView||S||E!==ve.flightGen())return;let z;try{z=await ca()}catch{if(i.panoramaFailed(p,"mount"),!S&&E===ve.flightGen()){let W=Zt(p,E,!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(S||E!==ve.flightGen()||!jt))return jn??=z.createOpenPanorama(jt),jn(p,b,E)},Kt=ha({container:t,model:o,opts:n,expandedSeatById:l,seatIdsByRow:c,isNarrow:qt,isDisposed:()=>S,flightGen:()=>ve.flightGen(),flyToSeat:p=>eo(p),openPanorama:(p,b,E)=>Aa(p,b,E)}),Zt=Kt.show,Qt=Kt.remove,Pa=Kt.layout,ze=ma({container:t,orbit:C,isNarrow:qt,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});Ut=ze;let Ea=ze.element,rt=ze.setNavigationMode,Ca=ze.layout,Ta=ze.utilityControls,at=null,Kn=!1,Mt=p=>{ze.setSeatViewLocked(p),p||Ae?.exit()};Ae=ia({canvas:M.canvas,camera:C.camera,requestRender:()=>ce.requestRender(),reducedMotion:ot,onStopChange:p=>{let b=p??(Kn?"seat":null);at=b;try{n.onSeatViewStopChange?.(b)}catch{}},onApplied:()=>{S||C.syncFromCamera()}});let Zn=o.sections.reduce((p,b)=>b.seatCount>0&&b.box?Math.max(p,b.box.max[1]):p,-1/0),Qn=(p,b)=>{let{eye:E}=$t(p,b),z=(t.clientWidth||M.canvas.clientWidth||1)/Math.max(1,t.clientHeight||M.canvas.clientHeight||1),W=ta(E,$n,z,{preserveEye:!0});if(n.seatViewStops===!1)return{...W,stops:[]};let j=f.get(p),Z=j?o.sections.find(re=>re.id===j):void 0;return{...W,stops:na(W,{aspect:z,seatingTopY:Number.isFinite(Zn)?Zn:o.bounds.box.max[1],section:Z&&Z.seatCount>0?{center:Z.center,radius:Z.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},ve=ya({isNarrow:qt,setSeeThrough:p=>{m=p?[p[0],p[1],p[2],Ml]:[0,0,0,0],u(),ce.requestRender()},container:t,model:o,opts:n,orbit:C,cinematic:le,analytics:i,loop:ce,labelOverlay:ae,stageAzimuth:ie,overviewFraming:xe,gpu:()=>v,isDisposed:()=>S,panorama:()=>V,setPanorama:p=>{V=p},setPanoramaSphereVisible:p=>{B=p},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:p=>{g=p},setFrozen:p=>{F=p},restorePanoramaLayer:P,reducedMotion:ot,resolvedSeatViewPose:$t,showSectionSeatLabels:se,setNearFieldDetailEnabled:R,setSeatViewLocked:Mt,setNavigationMode:rt,showArriveChip:Zt,removeArriveChip:Qt,inSeatView:()=>at!==null,setSeatStepping:p=>{Kn=p},seatViewArrival:(p,b)=>n.arriveAtSeatEye?Qn(p,b):null,enterSeatView:(p,b)=>Ae?.enter(p,b)});O=!0;let Jt=ve.overviewChip,Ra=ve.layoutOverviewChip,_a=ve.applyFloorFocus,Fa=ve.focusOverview,Jn=ve.cancelFlight,eo=ve.flyToSeat,to=ve.focusSectionCamera;Ta.appendChild(Jt),jt={container:t,model:o,opts:n,analytics:i,orbit:C,loop:ce,seatsById:l,ensureSeatView:Xn,resolvedSeatViewPose:$t,gpu:()=>v,gl:M.gl,isContextLost:()=>A,isDisposed:()=>S,flightGen:()=>ve.flightGen(),setPanorama:p=>{V=p},getLoadAbort:()=>g,setLoadAbort:p=>{g=p},setPanoramaSphereVisible:p=>{B=p,p&&Ae?.exit()},setFrozen:p=>{F=p},raisePanoramaLayer:N,restorePanoramaLayer:P,getOverviewChip:()=>Jt,labelOverlay:ae,reducedMotion:ot,removeArriveChip:Qt,showArriveChip:Zt};let De=va({glctx:M,orbit:C,model:o,seats:e.seats,opts:n,cinematic:le,analytics:i,seatIdByIndex:s,sectionIdBySeatId:f,tapSlop:wl,tapMs:Sl,gpu:()=>v,pick:()=>T,seatViewLocked:()=>ze.seatViewLocked(),focusedSectionId:()=>Y,selection:()=>_,cancelFlight:Jn,focusSectionCamera:to,focusSeatCamera:ve.focusSeatCamera,setSelection:Yn,ensureSeatView:Xn});M.canvas.addEventListener("pointerdown",De.onDown),M.canvas.addEventListener("pointermove",De.onMove),M.canvas.addEventListener("pointerup",De.onUp),M.canvas.addEventListener("pointercancel",De.onUp),ce.requestRender();let en={setAvailability(p){let b=Fr(_,p),E=cn(o.seats,b);E.length&&v&&v.uploadSeatStateRuns(E),h(),E.length&&L(),ce.requestRender()},setSelection:Yn,setNavigationMode:rt,zoomIn(){C.zoomBy(Ke),ce.requestRender()},zoomOut(){C.zoomBy(dt),ce.requestRender()},flyToSeat:eo,focusOverview:Fa,seatViewStop:()=>at,recentreSeatView:()=>Ae?.recentre()??!1,resize(){let{width:p,height:b}=M.resize();C.setAspect(p/Math.max(1,b)),Pa(),Ca(),Ra(),ce.requestRender()},stats(){return{...ce.stats(),drawCalls:v?v.drawCalls:0,fallbackTriangles:v?v.seatGeometry.drawRange.count/3*o.seats.count:0,seatCount:o.seatCount}},captureImage(p=1280){if(A||!v||typeof document>"u")return null;wt(0);let b=M.canvas,E=Math.min(1,p/Math.max(b.width,b.height,1)),z=document.createElement("canvas");z.width=Math.max(1,Math.round(b.width*E)),z.height=Math.max(1,Math.round(b.height*E));let W=z.getContext("2d");return W?(W.drawImage(b,0,0,z.width,z.height),z.toDataURL("image/jpeg",.82)):null},captureSeatView(p,b=480){if(A||!v||F||typeof document>"u"||le.active||V!==null||Ae?.active)return null;let E=K.get(p);if(E)return E;let z=o.seats.idToIndex.get(p);if(z===void 0)return null;let{eye:W,focal:j,fov:Z}=Qn(p,z),re=C.snapshot(),pe=[H.seatDetailMix,H.structureDetailMix],ge=null;try{ee=!0,C.camera.position.set(W[0],W[1],W[2]),C.camera.perspective({fov:Z,aspect:C.camera.aspect}),C.camera.lookAt(j),C.camera.updateMatrixWorld(),C.syncFromCamera(),H.seatDetailMix=1,H.structureDetailMix=1,H.forceRegather(),wt(0);let k=M.canvas,de=Math.min(k.width,Math.round(k.height*16/9)),ue=Math.round(de*9/16),fe=document.createElement("canvas");fe.width=Math.max(1,Math.round(b)),fe.height=Math.max(1,Math.round(b*9/16));let Oe=fe.getContext("2d");Oe&&(Oe.drawImage(k,(k.width-de)/2,(k.height-ue)/2,de,ue,0,0,fe.width,fe.height),ge=fe.toDataURL("image/jpeg",.8))}finally{ee=!1,re(),H.seatDetailMix=pe[0],H.structureDetailMix=pe[1],H.forceRegather(),wt(0)}if(ge)for(K.set(p,ge);K.size>te;)K.delete(K.keys().next().value);return ge},getQualityEvidence(){let p=ce.stats(),b=M.canvas.clientWidth||1,E=M.canvas.clientHeight||1,z=o.bounds.center,W=Te(C.camera.projectionViewMatrix,[z[0],o.bounds.box.min[1],z[2]],b,E),j=Te(C.camera.projectionViewMatrix,[z[0],o.bounds.box.max[1],z[2]],b,E),Z=o.bounds.box,re=[Z.min[0],Z.max[0]].flatMap(k=>[Z.min[1],Z.max[1]].flatMap(de=>[Z.min[2],Z.max[2]].map(ue=>Te(C.camera.projectionViewMatrix,[k,de,ue],b,E)))).filter(k=>Number.isFinite(k.x)&&Number.isFinite(k.y)&&Number.isFinite(k.depth)),pe=re.length?(()=>{let k=Math.min(...re.map(we=>we.x)),de=Math.max(...re.map(we=>we.x)),ue=Math.min(...re.map(we=>we.y)),fe=Math.max(...re.map(we=>we.y)),Oe=Math.max(0,k),tn=Math.min(b,de),Ye=Math.max(0,ue),At=Math.min(E,fe),Xe=Math.max(0,tn-Oe),$e=Math.max(0,At-Ye);return{box:{x:Oe,y:Ye,width:Xe,height:$e},horizontalFillRatio:Xe/b,verticalFillRatio:$e/E,visibleAreaRatio:Xe*$e/(b*E),clippedEdges:[...ue<0?["top"]:[],...de>b?["right"]:[],...fe>E?["bottom"]:[],...k<0?["left"]:[]]}})():void 0,ge=String(M.gl.getParameter(M.gl.VERSION)??"");return{viewport:{width:b,height:E},context:{webgl2:/webgl\s*2/i.test(ge),lost:A},frame:{rendered:p.rendered,idle:p.idle,smoothed:oe},camera:{position:[C.camera.position.x,C.camera.position.y,C.camera.position.z],distance:C.currentDistance,verticalFovDeg:C.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:y,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:W.visible&&j.visible?Math.abs(W.y-j.y):0},labels:ae.qualityEvidence(),framing:pe,...at?{seatView:{fovDeg:C.camera.fov,stop:at}}:{}}},getQualityReport(){return Mn(en.getQualityEvidence())},loseContextForTest(){M.simulateContextLossCycle()},floors(){return o.floors},focusFloor(p){if(p!==null&&!o.floors.some(E=>E.index===p))return!1;let b=p??-1;if(R(p!==null),Mt(!1),_a(b),rt("orbit"),p===null)le.cancel(),ot()?C.frame(o.bounds,!1,ie,n.portraitOverviewCrop===!0,xe):C.frameSoft(o.bounds,ie,n.portraitOverviewCrop===!0,xe),ae.setOverviewDistance(C.targetDistance);else{let E=o.floors[p];if(E.seatCount>0){le.cancel();let z=E.focalWorld[0]-E.center[0],W=E.focalWorld[2]-E.center[2],j=Math.hypot(z,W)>E.radius*.12?Math.atan2(z,W):ie;C.frame({center:E.center,radius:E.radius,box:E.box},!1,j,!1,{polarDeg:58,margin:1.12}),ae.setOverviewDistance(C.targetDistance)}}return ce.requestRender(),!0},zones(){return o.zones},focusZone(p){let b=o.zones.find(j=>j.id===p);if(!b||b.seatCount===0)return!1;R(!1),Mt(!1),le.cancel(),rt("orbit"),se(null),n.onSectionFocusChange?.(null);let E=b.focalWorld[0]-b.center[0],z=b.focalWorld[2]-b.center[2],W=Math.hypot(E,z)>b.radius*.12?Math.atan2(E,z):void 0;return C.frame({center:b.center,radius:b.radius*1.25},!1,W),ce.requestRender(),!0},sections(){return o.sections},focusSection(p){return to(p)},rows(p){return p?o.rows.filter(b=>b.sectionId===p):o.rows},seatsInRow(p){return e.seats.filter(b=>b.rowId===p).map(b=>({id:b.id,label:b.displayLabel||b.label}))},focusRow(p){let b=o.rows.find(E=>E.id===p);return!b||b.seatCount===0?!1:(R(!0),Mt(!1),le.cancel(),rt("pan"),b.sectionId&&(se(b.sectionId),n.onSectionFocusChange?.(b.sectionId)),C.frame({center:b.center,radius:Math.max(2.5,b.radius*.65)}),ce.requestRender(),!0)},setReducedMotionForTest(p){I=p},dispose(){S=!0,Fe?.dispose(),Nn(!1),Qt(),Jt.remove(),Ea.remove(),Jn(),Ae?.dispose(),ce.stop(),ae.dispose(),Hn?.disconnect(),V&&(V.dispose(),V=null),P(),_e(),M.canvas.removeEventListener("pointerdown",De.onDown),M.canvas.removeEventListener("pointermove",De.onMove),M.canvas.removeEventListener("pointerup",De.onUp),M.canvas.removeEventListener("pointercancel",De.onUp),M.canvas.removeEventListener("pointermove",St),M.canvas.removeEventListener("pointerdown",St),M.canvas.removeEventListener("pointerleave",Wn),Ve&&cancelAnimationFrame(Ve),C.dispose(),T&&T.dispose(),v&&v.dispose(),v=null,x?.dispose(),x=null,T=null,q.dispose(),M.dispose()}};return i.opened(o.seatCount,y,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),en}export{Hi as VENUE3D_QUALITY_REPORT_VERSION,Da as autoVenue3d,ut as buildSceneModel,dn as estimateVenue3D,Mn as inspectVenue3DQualityEvidence,nd as mountVenue3D,fl as prepareVenue3D,vl as prepareVenue3DFromChart};
1302
+ void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:ke},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let q=new Ct(t,{geometry:Ie,program:ae});q.frustumCulled=!1,q.setParent(o),ge.screenProgram=ae,ue=!0,ge.drawCalls=3+c+(xe?1:0)+1},V.src=Ne.contentImageUrl}return ge}import{Mesh as Jn,RenderTarget as Zl,Transform as eo}from"ogl";var Ql=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Jt=class{constructor(e,n,o,i,r){this.seatScene=new eo;this.chairScene=new eo;this.solidScene=new eo;this.target=null;this.floorAtLastPick=!1;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=r,this.seatProg=si(this.gl),this.chairProg=li(this.gl),this.depthProg=ci(this.gl);let a=new Jn(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Jn(this.gl,{geometry:o,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let l=new Jn(this.gl,{geometry:i,program:this.depthProg});l.frustumCulled=!1,l.setParent(this.solidScene)}standingFloorAtLastPick(){return this.floorAtLastPick}setRoomCentre(e){this.depthProg.uniforms.uRoomCentre.value.set(e??[0,0])}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let i of Ql)this.seatProg.uniforms[i].value=e.uniforms[i].value;let n=e.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n;let o=e.uniforms.uSeeThrough?.value;if(o)for(let i of[this.seatProg,this.chairProg,this.depthProg])i.uniforms.uSeeThrough.value=o}ensureTarget(){let e=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==e||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new Zl(this.gl,{width:e,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let e=this.gl;this.target.buffer&&e.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&e.deleteTexture(n.texture);this.target.depthBuffer&&e.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(e,n,o,i){let r=this.gl,a=this.ensureTarget(),s=r.drawingBufferWidth,l=r.drawingBufferHeight,u=Math.max(0,n-i),m=Math.max(0,o-i),h=Math.max(1,Math.min(s,n+i+1)-u),d=Math.max(1,Math.min(l,o+i+1)-m);r.enable(r.SCISSOR_TEST),r.scissor(u,m,h,d);let[c,p,f]=this.restoreClear;r.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:e,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:e,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:e,target:a,clear:!1}),r.clearColor(c,p,f,1),r.disable(r.SCISSOR_TEST);let y=new Uint8Array(h*d*4);return this.renderer.bindFramebuffer(a),r.readPixels(u,m,h,d,r.RGBA,r.UNSIGNED_BYTE,y),this.renderer.bindFramebuffer(),this.floorAtLastPick=ei(y,h,d,n-u,o-m),ti(y,h,d,n-u,o-m,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Fi(t,e){let n=[];for(let o of e)t.has(o.seatId)?t.set(o.seatId,qo(o.state)):n.push(o);return n}function Ii(t,e,n){let o=new Set;for(let a of e)(t.has(a)||n(a)!==void 0)&&o.add(a);let i=new Map(t),r=[];for(let[a,s]of t)o.has(a)||(r.push({seatId:a,state:Te[s]??"available"}),i.delete(a));for(let a of o){if(i.has(a))continue;let s=n(a);s!==void 0&&(i.set(a,s),r.push({seatId:a,state:"selected"}))}return{updates:r,next:i}}import{Quat as Rt,Vec3 as tc}from"ogl";function Jl(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function Di(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function ec(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function ki(t){let e=Math.hypot(t[0],t[1],t[2]);return e>1e-6?[t[0]/e,t[1]/e,t[2]/e]:[0,0,0]}function to(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function no(t,e){return Math.max(0,Math.min(1,t+e))}function Li(t,e){let n=t.length;if(n===0)return[0,0,0];if(n===1)return[...t[0]];let o=Math.max(0,Math.min(1,e)),i=n-1,r=Math.floor(o*i);r>=i&&(r=i-1);let a=o*i-r,s=t[Math.max(0,r-1)],l=t[r],u=t[r+1],m=t[Math.min(n-1,r+2)],h=a*a,d=h*a,c=[0,0,0];for(let p=0;p<3;p++)c[p]=.5*(2*l[p]+(-s[p]+u[p])*a+(2*s[p]-5*l[p]+4*u[p]-m[p])*h+(-s[p]+3*l[p]-3*u[p]+m[p])*d);return c}function oo(t,e,n,o,i){let r=ki(Jl(e,n));r[0]===0&&r[1]===0&&r[2]===0&&(r=[0,0,1]);let a=Di(Di(e,ec(r,2.5)),[0,1.5,0]),s=[e[0]-o[0],0,e[2]-o[2]],l=ki(s);l[0]===0&&l[2]===0&&(l=[r[0],0,r[2]]);let u=Math.max(1,i),m=[o[0]+l[0]*u*1.3,o[1]+u*.75,o[2]+l[2]*u*1.3];return{waypoints:[t,m,a],finalPos:a}}function ro(t,e,n=35,o=28){let i=to(e),r=Li(t,i),a=to(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:r,fov:n+(o-n)*a,eased:i}}function Ni(t,e,n){let o=t.position.clone(),i=new Rt().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new tc(n[0],n[1],n[2]));let r=new Rt().copy(t.quaternion);return t.position.copy(o),t.quaternion.copy(i),r}var en=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new Rt;this.endQuat=new Rt;this.outQuat=new Rt;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,n,o,i=2500,r=28){return this.settle(),this.waypoints=e,this.startQuat.copy(n),this.endQuat.copy(o),this.duration=i,this.endFov=r,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(e){if(!this.active)return!1;let n=Math.min(1,(e-this.startTime)/this.duration),{pos:o,fov:i,eased:r}=ro(this.waypoints,n,35,this.endFov);return this.camera.position.set(o[0],o[1],o[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,no(r,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=i,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let e=this.resolveFn;this.resolveFn=null,e&&e()}};var Hi=Go,nc=.12,io=1.6,Gi=.12;function Bi(t,e,n){let o=t[e*3],i=t[e*3+1],r=t[e*3+2],a=n[0]-o,s=n[2]-r,l=Math.hypot(a,s);if(!(l>.001))return null;let u=a/l,m=s/l,h=1/0,d=null;for(let c=0;c*3<t.length;c++){if(c===e)continue;let p=t[c*3]-o,f=t[c*3+2]-r,y=p*u+f*m;y<.3||y>1.6||Math.abs(p*m-f*u)>.6||y<h&&(h=y,d=i-t[c*3+1])}return d}var oc=.25,rc=1.5;function Wi(t,e,n=0,o,i,r=!1){let a=[e.x*De,n+rc,e.y*De],s=i?[i[0],i[1],i[2]]:a,l=t[1],u=Number.isFinite(l)?l+(r?io:Hi):Number.isFinite(o)?n+o:n+Hi,m=a[0]-t[0],h=a[2]-t[2],d=Math.hypot(m,h),c=d>.001?Math.min(nc,d*oc):0,p=d>.001?m/d:0,f=d>.001?h/d:0;return{eye:[t[0]+p*c,u,t[2]+f*c],focal:s}}var Ze={aisleShare:.7,aisleMost:.9,standOffM:[.9,2.6],lookHeightM:1.25,frameMargin:1.12,fovDeg:[45,80]};function ic(t,e){let n=0,o=0,i=!1;for(let r of e)r.kind==="booth"?n++:o++;for(let r of Pn(t,t.eventConfigurationId))for(let a of r.objects)a.type==="gaArea"?o+=a.capacity>0?a.capacity:0:a.type==="shape"&&a.role==="stage"&&(i=!0);return i&&o>n}function Ui(t,e){let n=new Map;if(ic(t,e))return n;for(let o of Pn(t,t.eventConfigurationId)){let i=o.objects.filter(a=>a.type==="booth");if(!i.length)continue;let r=rr(i,o.focal);for(let a of i){let s=r.get(a.id),l=nr(a);if(!s||!l)continue;e.some(m=>m.kind!=="booth"&&ft(l,m.x,m.y))||n.set(`${a.id}:0`,s)}}return n}function Yi(t){let[e,n]=Ze.standOffM;return Math.min(n,Math.max(Math.min(e,t.aisleM*Ze.aisleMost),t.aisleM*Ze.aisleShare))}function ao(t,e){let n=e.halfDepthM+Yi(e);return{eye:[t[0]+e.normal.x*n,t[1]+io,t[2]+e.normal.y*n],focal:[t[0],t[1]+Ze.lookHeightM,t[2]]}}function $i(t,e,n){let{eye:o,focal:i}=ao(t,e),r=Yi(e),a=Ze.frameMargin,s=e.halfWidthM*a/r,l=tr/2*a/r,u=2*Math.atan(Math.max(l,s/Math.max(.3,n)))*180/Math.PI,m=Math.max(Ze.fovDeg[0],Math.min(Ze.fovDeg[1],u)),h=Math.tan(m*Math.PI/360)*n;return{eye:o,focal:i,fov:m,raisedM:0,pulledBackM:0,stageFrameWidth:e.halfWidthM/(r*h)}}var Oe=Math.PI/180,ac=45,so=80,tn=70,sc=1,lc=.99;function cc(t,e){if(!(t<sc))return so;if(!(Number.isFinite(e)&&e>0))return tn;let n=2*Math.atan(e/(2*nn*lc)/Math.max(.05,t))/Oe;return Math.max(tn,Math.min(so,n))}var uc=.25,nn=1,hc=.25,dc=12*Oe,mc=.2,pc=1.5,Xi=.8,ji=6,ea=1.9,fc=2/3,vc=.12,bc=.9,gc=1.2,yc=2,ta=.05,xc=6;function na(t,e,n=0){if(!t.length)return{min:[e[0]-6,n,e[2]-6],max:[e[0]+6,Math.max(n+Xi,e[1]),e[2]+6]};let o=1/0,i=-1/0,r=1/0,a=-1/0,s=n;for(let p of t)o=Math.min(o,p.cx-p.halfX),i=Math.max(i,p.cx+p.halfX),r=Math.min(r,p.cz-p.halfZ),a=Math.max(a,p.cz+p.halfZ),s=Math.max(s,p.y);let l=i-o,u=a-r,m=Math.max(l,Math.min(u,ji))/2,h=Math.max(u,Math.min(l,ji))/2,d=(o+i)/2,c=(r+a)/2;return{min:[d-m,n,c-h],max:[d+m,Math.max(n+Xi,s),c+h]}}function wc(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+ea,t.max[2]]}}function lo(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+pc,e+mc,e+ea*fc),(t.min[2]+t.max[2])/2]}function oa(t,e){let n=t[0]-e[0],o=t[2]-e[2],i=Math.hypot(n,o);return i<.001?{x:0,z:1}:{x:n/i,z:o/i}}function Ki(t,e,n){let o=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],a=Math.hypot(o,i,r)||1;o/=a,i/=a,r/=a;let s=-r,l=o,u=Math.hypot(s,l);if(u<1e-6)return 1/0;s/=u,l/=u;let m=1/0,h=-1/0;for(let d=0;d<8;d++){let c=(d&1?n.max[0]:n.min[0])-t[0],p=(d&2?n.max[1]:n.min[1])-t[1],f=(d&4?n.max[2]:n.min[2])-t[2],y=Math.max(ta,c*o+p*i+f*r),w=(c*s+f*l)/y;w<m&&(m=w),w>h&&(h=w)}return h-m}function qi(t,e,n){let o=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],a=Math.hypot(o,i,r)||1;o/=a,i/=a,r/=a;let s=-r,l=o,u=Math.hypot(s,l);if(u<1e-6)return 1/0;s/=u,l/=u;let m=-l*i,h=l*o-s*r,d=s*i,c=1/0,p=-1/0;for(let f=0;f<8;f++){let y=(f&1?n.max[0]:n.min[0])-t[0],w=(f&2?n.max[1]:n.min[1])-t[1],b=(f&4?n.max[2]:n.min[2])-t[2],S=Math.max(ta,y*o+w*i+b*r),A=(y*m+w*h+b*d)/S;A<c&&(c=A),A>p&&(p=A)}return p-c}function on(t,e){return Math.tan(t*Oe/2)*Math.max(.05,e)}function Zi(t,e,n){let o=cc(n,t),i=l=>Math.max(ac,Math.min(o,l)),r=l=>2*Math.atan(l)/Oe,a=Number.isFinite(t)&&t>0?i(r(t/(2*uc)/Math.max(.05,n))):o;if(!(Number.isFinite(e)&&e>0))return a;let s=Math.min(a,i(r(e/(2*vc))));return t/(2*on(s,n))>nn?a:s}function ra(t,e,n,o={}){let i=lo(e),r=[t[0],t[1],t[2]],a=0,s=0,l=p=>{if(!(p>0))return;let f=oa(r,i);r[0]+=f.x*p,r[2]+=f.z*p,s+=p},u=o.preserveEye?0:e.max[1]+hc-r[1];u>0&&(r[1]+=u,a=u,l(u/Math.tan(dc)));let m=wc(e),h=Ki(r,i,e),d=Zi(h,qi(r,i,m),n),c=h/(2*on(d,n));for(let p=0;!o.preserveEye&&p<xc&&c>nn;p++){let f=Math.max(1,Math.hypot(r[0]-i[0],r[2]-i[2])),y=Number.isFinite(c)?c/nn:2;l(Math.min(60,f*(Math.min(4,y)-1)+.5)),h=Ki(r,i,e),d=Zi(h,qi(r,i,m),n),c=h/(2*on(d,n))}return{eye:r,focal:i,fov:d,raisedM:a,pulledBackM:s,stageFrameWidth:c}}function Sc(t,e,n){let o=Math.tan(e*Oe/2),i=on(e,n);return Math.max(1,t/Math.max(.05,Math.min(o,i)))}var Mc=.7,Qi=.5,Ac=.8;function Ji(t,e,n){let o=[e[0]-t[0],e[1]-t[1],e[2]-t[2]],i=[n[0]-t[0],n[1]-t[1],n[2]-t[2]],r=o[0]*i[0]+o[1]*i[1]+o[2]*i[2],a=Math.hypot(o[0],o[1],o[2])*Math.hypot(i[0],i[1],i[2])||1;return Math.acos(Math.max(-1,Math.min(1,r/a)))/Oe}function Tc(t,e,n){let o=u=>{let m=Math.hypot(u[0],u[1],u[2])||1;return[u[0]/m,u[1]/m,u[2]/m]},i=[e[0]-t[0],e[1]-t[1],e[2]-t[2]],r=Math.hypot(i[0],i[1],i[2]),a=o(i),s=o([n[0]-t[0],n[1]-t[1],n[2]-t[2]]),l=o([0,1,2].map(u=>a[u]*(1-Qi)+s[u]*Qi));return[t[0]+l[0]*r,t[1]+l[1]*r,t[2]+l[2]*r]}function ia(t,e){let{aspect:n,venue:o}=e,i=t.focal,r=oa(t.eye,i),a=f=>(f[0]-i[0])*r.x+(f[2]-i[2])*r.z,s=[{name:"seat",eye:t.eye,focal:i,fov:t.fov}],l=yc*(e.rowDepthM??bc),u=[t.eye[0]+r.x*l,t.eye[1]+gc,t.eye[2]+r.z*l],m=[t.eye[0],t.eye[1]-Mc,t.eye[2]],h=Tc(u,i,m);s.push({name:"row",eye:u,focal:h,fov:Math.min(so,Math.max(t.fov,2*Math.max(Ji(u,h,m),Ji(u,h,i))/Ac))});let d=(f,y,w,b)=>{let S=Sc(w,t.fov,n)*1.08,A=S*Math.sin(b*Oe),F=Number.isFinite(e.seatingTopY)?e.seatingTopY+2:-1/0,T=Math.max(A,F-y[1]),R=S*Math.cos(b*Oe);return{name:f,eye:[y[0]+r.x*R,y[1]+T,y[2]+r.z*R],focal:y,fov:t.fov}};e.section&&e.section.radius>0&&s.push(d("section",e.section.center,e.section.radius,35)),s.push(d("venue",o.center,Math.max(1,o.radius),40));let c=[],p=-1/0;for(let f of s){let y=a(f.eye);c.length&&y<=p+.5||(c.push(f),p=y)}return c}import{Vec3 as Pc}from"ogl";var Ft=Math.PI/180,co=320,aa=70*Ft,Ec=32*Ft,Cc=24*Ft,sa=.0026,Rc=.22,_c=.006,Fc=180,Ic=900,Dc=1100,kc=4,Se=(t,e,n)=>Math.max(e,Math.min(n,t)),la=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function ca(t){let{canvas:e,camera:n}=t,o=[],i=!1,r=0,a=0,s=0,l=0,u=0,m=0,h=co,d=null,c=()=>{d&&(clearTimeout(d),d=null)},p=!1,f=[0,0],y=0,w=!1,b=null,S=null,A=new Map,F=!1,T=0,R=0,D=0,x=0,M=()=>i&&o.length?o[Se(Math.round(r),0,o.length-1)].name:null,C=()=>{let I=M();I!==b&&(b=I,t.onStopChange?.(I))},k=()=>{if(!i||!o.length)return;let I=o[Se(Math.floor(r),0,o.length-1)],j=o[Se(Math.ceil(r),0,o.length-1)],J=Se(r-Math.floor(r),0,1),_=(ze,Ie)=>ze+(Ie-ze)*J,oe=[_(I.eye[0],j.eye[0]),_(I.eye[1],j.eye[1]),_(I.eye[2],j.eye[2])],se=[_(I.focal[0],j.focal[0]),_(I.focal[1],j.focal[1]),_(I.focal[2],j.focal[2])],pe=se[0]-oe[0],re=se[1]-oe[1],P=se[2]-oe[2],ve=Math.hypot(pe,re,P)||1,Z=Math.atan2(pe,P),Fe=Math.asin(Se(re/ve,-1,1)),be=Z+a,xe=Se(Fe+s,-80*Ft,80*Ft),ue=Math.cos(xe)*ve;pe=Math.sin(be)*ue,re=Math.sin(xe)*ve,P=Math.cos(be)*ue,n.position.set(oe[0],oe[1],oe[2]),n.fov=_(I.fov,j.fov),n.updateProjectionMatrix(),n.lookAt(new Pc(oe[0]+pe,oe[1]+re,oe[2]+P)),t.onApplied?.()},z=()=>{if(!i||!o.length)return;let I=Se(Math.round(r),0,o.length-1);if(t.reducedMotion()){p=!1,r=I,k(),C(),t.requestRender();return}if(Math.abs(I-r)<.001){p=!1,C();return}l=r,u=I,m=performance.now(),h=co,p=!0,t.requestRender()},N=I=>{!i||o.length<2||(c(),p=!1,r=Se(r+I,0,o.length-1),k(),C(),t.requestRender())},O=(I,j)=>{i&&(c(),p=!1,w=!1,a=Se(a-I*sa,-aa,aa),s=Se(s-j*sa,-Cc,Ec),k(),t.requestRender())},U=I=>{i&&(A.set(I.pointerId,{x:I.clientX,y:I.clientY}),A.size===1?(F=!0,x=0,T=I.clientX,R=I.clientY):A.size===2&&(F=!1,D=$()))},$=()=>{let I=[...A.values()];return I.length<2?0:Math.hypot(I[0].x-I[1].x,I[0].y-I[1].y)},Y=I=>{if(!i||!A.has(I.pointerId))return;if(A.set(I.pointerId,{x:I.clientX,y:I.clientY}),A.size>=2){let _=$();D>0&&N((D-_)*_c),D=_;return}if(!F)return;let j=I.clientX-T,J=I.clientY-R;T=I.clientX,R=I.clientY,x+=Math.abs(j)+Math.abs(J),!(x<=kc)&&O(j,J)},X=I=>{A.delete(I.pointerId)&&(A.size<2&&(D=0),A.size===0&&(F=!1,z()))},G=I=>{if(!i)return;I.preventDefault();let j=I.deltaMode===1?16:I.deltaMode===2?100:1,J=Se(I.deltaY*j/100,-2,2);N(J*Rc),S&&clearTimeout(S),S=setTimeout(()=>{S=null,z()},Fc)},te=()=>{c(),i&&(i=!1,p=!1,w=!1,o=[],A.clear(),F=!1,S&&(clearTimeout(S),S=null),b!==null&&(b=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",U),e.addEventListener("pointermove",Y),e.addEventListener("pointerup",X),e.addEventListener("pointercancel",X),e.addEventListener("wheel",G,{passive:!1}),{get active(){return i},enter(I,j=0){if(I.length<2){te();return}c(),o=I,i=!0,r=t.reducedMotion()?0:Se(j,0,I.length-1),r>0&&(d=setTimeout(()=>{d=null,i&&(l=r,u=0,m=performance.now(),h=Dc,p=!0,t.requestRender())},Ic)),a=0,s=0,p=!1,w=!1,b=null,k(),C(),t.requestRender()},exit:te,recentre(){return i?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:t.reducedMotion()?(w=!1,a=0,s=0,k(),t.requestRender(),!0):(f=[a,s],y=performance.now(),w=!0,t.requestRender(),!0):!1},update(I){if(!i)return!1;let j=!1;if(w){let J=Se((I-y)/co,0,1),_=1-la(J);a=f[0]*_,s=f[1]*_,J>=1?(w=!1,a=0,s=0):j=!0}if(p){let J=Se((I-m)/h,0,1);r=l+(u-l)*la(J),J>=1?(p=!1,r=u,C()):j=!0}return k(),j},currentStop:M,dispose(){te(),e.removeEventListener("pointerdown",U),e.removeEventListener("pointermove",Y),e.removeEventListener("pointerup",X),e.removeEventListener("pointercancel",X),e.removeEventListener("wheel",G)}}}function ua(t){return t.flying?"cinematic":t.panoramaMounted?"panorama":t.seatViewActive?"seatView":"orbit"}function ha(t,e){return t?-1:e}var uo=null;function da(){return uo??=import("../openPanorama-VD6PE3YZ.js").catch(t=>{throw uo=null,t}),uo}var ma=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),rn=class{constructor(e){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=e}emit(e,n){if(this.cb)try{this.cb(e,n)}catch{}}opened(e,n,o,i){this.emit("3d_opened",{seats:e,hasHeights:n,...o===void 0?{}:{buildMs:Math.round(o)},...i===void 0?{}:{prepSource:i}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(e,n){this.emit("3d_seat_picked",{seatId:e,sectionId:n})}cinematicPlayed(e){this.emit("3d_cinematic_played",{durationMs:e,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=ma(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(ma()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:e})}panoramaFailed(e,n){this.emit("3d_panorama_failed",{seatId:e,phase:n})}panoramaFallback(e){this.emit("3d_panorama_fallback",{seatId:e})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function pa(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function fa(t){let{container:e,model:n,opts:o,expandedSeatById:i,seatIdsByRow:r,isNarrow:a}=t,s=null,l=()=>{if(!s)return;let h=a();Object.assign(s.style,h?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{s?.remove(),s=null};return{show:(h,d,c=!1)=>{if(u(),t.isDisposed())return null;let p=document.createElement("div");p.setAttribute("role","group"),Object.assign(p.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let f=o.chrome?.caption!==!1,y=o.chrome?.seatStepper!==!1;if(!f&&!y)return null;let w=i.get(h),b=w?.sectionId?n.sections.find(M=>M.id===w.sectionId):void 0,S=w?.label??h;p.setAttribute("aria-label",`Explore views near ${b?.label?`${b.label}, `:""}seat ${S}`);let A=document.createElement("span");A.textContent=o.seatViewCaption?.(h)??["Live 3D seat view",b?.label,S].filter(Boolean).join(" \xB7 "),Object.assign(A.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),f&&p.appendChild(A);let F=document.createElement("div");Object.assign(F.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),p.appendChild(F);let T=w?.rowId?r.get(w.rowId):void 0,R=T?.indexOf(h)??-1,D=R>=0?[T?.[R-1],T?.[R+1]]:[void 0,void 0],x=(M,C,k,z=!1)=>{let N=document.createElement("button");N.type="button",N.textContent=M,N.setAttribute("aria-label",C),Object.assign(N.style,{minHeight:"44px",padding:z?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),z||(N.style.minWidth="44px"),z&&(N.dataset.panoramaTrigger=""),N.addEventListener("click",k),F.appendChild(N)};if(y&&D[0]){let M=i.get(D[0])?.label??D[0];x("\u2039",`View previous seat ${M}`,()=>{t.flyToSeat(D[0])})}if(y&&o.getSeatView){let M=o.seatViewActionLabel?.(h)??"Open 360\xB0 panorama";x(c?`\u21BB Retry ${M}`:`\u25C9 ${M}`,`${c?"Retry":M} from seat ${S}`,()=>{if(t.isDisposed()||d!==t.flightGen()){u();return}u(),t.openPanorama(h,400,d)},!0)}if(y&&D[1]){let M=i.get(D[1])?.label??D[1];x("\u203A",`View next seat ${M}`,()=>{t.flyToSeat(D[1])})}return!F.childElementCount&&!f?null:(e.appendChild(p),s=p,l(),p)},remove:u,layout:l}}var Lc={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function Vc(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}function va(t){let{container:e,orbit:n,isNarrow:o}=t,i={...Lc,...t.labels??{}},r=(T,R)=>{T.setAttribute("aria-label",R),T.title=R},a=document.createElement("div"),s=!1;a.className="sl-3d-navigation-controls",Object.assign(a.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let l=document.createElement("div");l.setAttribute("role","group"),l.setAttribute("aria-label","3D drag mode"),Object.assign(l.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("div");u.setAttribute("role","group"),u.setAttribute("aria-label","3D view controls"),Object.assign(u.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let m=document.createElement("button");m.type="button",m.textContent="\u21BB",r(m,i.rotate);let h=document.createElement("button");h.type="button",h.textContent="\u2725",r(h,i.move);let d=document.createElement("button");d.type="button",d.textContent="\u2212",r(d,i.zoomOut);let c=document.createElement("button");c.type="button",c.textContent="+",r(c,i.zoomIn);for(let T of[m,h,d,c])T.className="sl-3d-icon-control",Object.assign(T.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});l.append(m,h),u.append(c,d);let p=null,f=()=>{let T=n.dragAction();if(T===p)return;p=T;let R=T==="orbit";m.setAttribute("aria-pressed",String(R)),h.setAttribute("aria-pressed",String(!R)),m.style.background=R?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",h.style.background=R?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=R?`${i.rotate} \xB7 ${i.move} with Shift`:`${i.move} \xB7 ${i.rotate} with Shift`},y=T=>{n.setPrimaryDragMode(T),f()};m.addEventListener("click",()=>y("orbit")),h.addEventListener("click",()=>y("pan"));let w=()=>{let{atMin:T,atMax:R}=n.dollyLimitState();c.disabled!==T&&(c.disabled=T),d.disabled!==R&&(d.disabled=R)};d.addEventListener("click",()=>{n.zoomBy(wt),w()}),c.addEventListener("click",()=>{n.zoomBy(nt),w()}),a.append(l,u),y("auto"),e.appendChild(a);let b=t.enabled!==!1,S=()=>n.touchNavigationMode==="map"&&Vc(),A=()=>{let T=o();a.style.display=s||!b?"none":"flex",a.style.right=T?"12px":"14px",a.style.bottom=T?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",l.style.display=T||S()?"none":"flex",c.style.display=T?"none":"",d.style.display=T?"none":""};return A(),{element:a,utilityControls:u,setNavigationMode:y,syncNavigationMode:f,syncZoomLimits:w,setSeatViewLocked:T=>{s=T,n.setInteractionEnabled(!T),A()},seatViewLocked:()=>s,layout:A}}var Oc=.5,ba=12,ga=20,zc=28;function Nc(t,e,n){return!(t>0)||!(n>0)?0:Oc*n/(2*t*Math.tan(e*Math.PI/360))}var Hc=700;function ya(t){let{glctx:e,orbit:n,model:o,seats:i,opts:r,cinematic:a,analytics:s,seatIdByIndex:l,sectionIdBySeatId:u,tapSlop:m,tapMs:h,cancelFlight:d,focusSectionCamera:c,setSelection:p,ensureSeatView:f}=t,y=0,w=0,b=0,S=-1,A=!1,F=!1,T=0,R=O=>{t.seatViewLocked()||S===-1&&(S=O.pointerId,y=O.clientX,w=O.clientY,b=performance.now(),A=!1,F=a.active,a.active&&(s.cinematicCancelled(),d(),r.onViewTargetChange?.(null)))},D=O=>{O.pointerId===S&&Bt(O.clientX-y,O.clientY-w,m)&&(A=!0)},x=(O,U,$,Y,X)=>{let G=e.canvas.getBoundingClientRect(),te=e.canvas.clientWidth||G.width||1,I=e.canvas.clientHeight||G.height||1,j=O-G.left,J=U-G.top,_=Y*Y,oe=-1,se=_,pe=1/0;for(let re of i){if($&&re.sectionId!==$)continue;let P=o.seats.idToIndex.get(re.id);if(P===void 0)continue;if(X){let ue=Math.round(o.seats.iState[P]??0);if(ue!==0&&ue!==3)continue}let ve=P*3,Z=Re(n.camera.projectionViewMatrix,[o.seats.iPosition[ve],o.seats.iPosition[ve+1]+.55,o.seats.iPosition[ve+2]],te,I);if(!Z.visible)continue;let Fe=Z.x-j,be=Z.y-J,xe=Fe*Fe+be*be;(xe<se||Math.abs(xe-se)<1&&Z.depth<pe)&&(oe=P,se=xe,pe=Z.depth)}return oe},M=(O,U)=>{let $=t.gpu(),Y=t.pick();if(!$||!Y)return-1;Y.syncFromSeatProgram($.seatProgram);let X=e.canvas.getBoundingClientRect(),G=e.renderer.dpr,{x:te,y:I}=ni(O,U,X,G,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),j=Math.max(2,Math.round(8*G));return Y.pick(n.camera,te,I,j)},C=()=>e.canvas.clientHeight||e.canvas.getBoundingClientRect().height,k=(O,U=ba)=>{let $=n.camera?.position;if(!$)return!1;let Y=O*3,X=Math.hypot($.x-o.seats.iPosition[Y],$.y-o.seats.iPosition[Y+1],$.z-o.seats.iPosition[Y+2]);return Nc(X,n.fovY,C())>=U};return{onDown:R,onMove:D,onUp:O=>{if(O.pointerId!==S)return;let U=!A&&performance.now()-b<h;if(S=-1,F){F=!1;return}let $=t.gpu(),Y=t.pick();if(!U||!$||!Y)return;let X=M(O.clientX,O.clientY),G=X,te=O.pointerType==="touch"||O.pointerType==="pen",I=te?ga:ba,j=X>=0&&k(X,I),J=!1;if(t.focusedSectionId()&&X>=0){let re=l[X],P=re?u.get(re):void 0;if(P&&P!==t.focusedSectionId()&&c(P,{keepCamera:j})){if(!j)return;J=!0}}let _=G<0&&!!r.onObjectPick,oe=_&&Y.standingFloorAtLastPick?.()===!0;if(t.focusedSectionId()&&X<0&&(X=x(O.clientX,O.clientY,t.focusedSectionId(),44,!1)),X<0&&_){let re=t.areaAt?.(O.clientX,O.clientY,oe)??null;if(re){if(!re.pickable)return;O.pointerType!=="mouse"&&(T=performance.now()),r.onObjectPick?.({kind:"area",id:re.id,point:{x:O.clientX,y:O.clientY}});return}}if(t.focusedSectionId()&&X<0){let re=x(O.clientX,O.clientY,null,72,!1),P=re>=0?l[re]:void 0,ve=P?u.get(P):void 0;if(ve&&ve!==t.focusedSectionId()&&c(ve))return}if(!t.focusedSectionId()){X<0&&(X=x(O.clientX,O.clientY,null,42,!1));let re=X>=0?l[X]:void 0,P=re?u.get(re):void 0;if(P&&c(P,{keepCamera:j})){if(!j)return;J=!0}}if(X<0||X>=l.length){t.selection().size&&(p([]),r.onViewTargetChange?.(null));return}let se=l[X];if(te&&t.focusedSectionId()&&!J&&!k(X,ga)){t.focusSeatCamera(se,{seatPx:zc,viewportHeightPx:C()});return}let pe=Te[Math.round(o.seats.iState[X]??0)]??"available";if(pe!=="available"&&pe!=="selected"){r.onSeatInspect?.(se,pe);return}if(t.selection().has(se)&&t.selection().size===1){p([]),r.onViewTargetChange?.(null),r.onSeatPick?.(se);return}p([se]),f(se),s.seatPicked(se,u.get(se)),r.onSeatPick?.(se)},onTouchEnd:O=>{let U=T;T=0,U&&performance.now()-U<Hc&&O.cancelable&&O.preventDefault()}}}function Sa(t,e){return t.available===e.available&&(t.selected??0)===(e.selected??0)&&(t.wheelchairFree??null)===(e.wheelchairFree??null)&&t.filteredOut===!0==(e.filteredOut===!0)&&(t.statusText??"")===(e.statusText??"")}function Ma(t){return t?.available!=null&&t.available<=0}function Gc(t){return Ma(t)||t?.wheelchairFree!=null&&t.wheelchairFree<=0}function ho(t){return Gc(t)||t?.filteredOut===!0}function Bc(t){return!Ma(t)&&t?.filteredOut!==!0}function xa(t,e,n){return e<0?n<=1:t.floorIndex===e}function Aa(t,e){return e.size===0?t:t.map(n=>{if(n.kind!=="ga")return n;let o=e.get(n.id.slice(3));if(!o)return n;let i=n.areaName??"",r=o.statusText?[i,o.statusText].filter(Boolean).join(" \xB7 "):o.available!=null&&i?i:n.text,a=o.selected&&o.selected>0?Math.floor(o.selected):0;return{...n,text:r,...a?{count:a}:{},...ho(o)?{muted:!0}:{}}})}function Wc(t){let e=t[0],n=t[1],o=t[2],i=t[3],r=t[4],a=t[5],s=t[6],l=t[7],u=t[8],m=t[9],h=t[10],d=t[11],c=t[12],p=t[13],f=t[14],y=t[15],w=e*a-n*r,b=e*s-o*r,S=e*l-i*r,A=n*s-o*a,F=n*l-i*a,T=o*l-i*s,R=u*p-m*c,D=u*f-h*c,x=u*y-d*c,M=m*f-h*p,C=m*y-d*p,k=h*y-d*f,z=w*k-b*C+S*M+A*x-F*D+T*R;if(!Number.isFinite(z)||Math.abs(z)<1e-18)return null;let N=1/z;return[(a*k-s*C+l*M)*N,(o*C-n*k-i*M)*N,(p*T-f*F+y*A)*N,(h*F-m*T-d*A)*N,(s*x-r*k-l*D)*N,(e*k-o*x+i*D)*N,(f*S-c*T-y*b)*N,(u*T-h*S+d*b)*N,(r*C-a*x+l*R)*N,(n*x-e*C-i*R)*N,(c*F-p*S+y*w)*N,(m*S-u*F-d*w)*N,(a*D-r*M-s*R)*N,(e*M-n*D+o*R)*N,(p*b-c*A-f*w)*N,(u*A-m*b+h*w)*N]}function wa(t,e,n,o){let i=t[3]*e+t[7]*n+t[11]*o+t[15];return!Number.isFinite(i)||Math.abs(i)<1e-12?null:[(t[0]*e+t[4]*n+t[8]*o+t[12])/i,(t[1]*e+t[5]*n+t[9]*o+t[13])/i,(t[2]*e+t[6]*n+t[10]*o+t[14])/i]}function Uc(t,e,n,o,i=()=>!0){if(!t.length||!(n>=-1&&n<=1&&o>=-1&&o<=1))return null;let r=Wc(e);if(!r)return null;let a=wa(r,n,o,-1),s=wa(r,n,o,1);if(!a||!s)return null;let l=s[1]-a[1];if(Math.abs(l)<1e-9)return null;let u=null,m=1/0;for(let h of t){if(h.points.length<3||!i(h))continue;let d=(h.floorY-a[1])/l;if(!(d>=0&&d<=1)||d>=m)continue;let c=(a[0]+(s[0]-a[0])*d)/De,p=(a[2]+(s[2]-a[2])*d)/De;ft(h.points,c,p)&&(h.holes?.some(f=>f.length>=3&&ft(f,c,p))||(u=h,m=d))}return u}function Ta(t){return(e,n,o=!0)=>{let i=t.areas;if(!i?.length)return null;let r=t.focusedFloor(),a=m=>({id:m.id,pickable:Bc(t.state(m.id))}),s=t.tagAt?.(e,n)??null;if(s){let m=s.startsWith("ga:")?i.find(h=>h.id===s.slice(3)&&xa(h,r,t.floorCount)):void 0;return m?a(m):null}if(!o)return null;let l=t.canvas.getBoundingClientRect();if(!(l.width>0&&l.height>0))return null;let u=Uc(i,t.viewProjection(),(e-l.left)/l.width*2-1,1-(n-l.top)/l.height*2,m=>xa(m,r,t.floorCount));return u?a(u):null}}var an=class{constructor(e,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=e,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let e=this.iPosition,n=1/0,o=1/0,i=-1/0,r=-1/0;for(let c=0;c<this.count;c++){let p=e[c*3],f=e[c*3+2];p<n&&(n=p),p>i&&(i=p),f<o&&(o=f),f>r&&(r=f)}let a=Math.max(i-n,.001),s=Math.max(r-o,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=o;let l=this.cols*this.rows,u=new Int32Array(l+1),m=c=>{let p=Math.min(this.cols-1,Math.max(0,Math.floor((e[c*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[c*3+2]-o)/this.cell)))*this.cols+p};for(let c=0;c<this.count;c++)u[m(c)+1]++;for(let c=0;c<l;c++)u[c+1]+=u[c];let h=new Int32Array(this.count),d=u.slice(0,l);for(let c=0;c<this.count;c++)h[d[m(c)]++]=c;this.cellStart=u,this.cellItems=h}gather(e,n,o,i,r){this.ensureGrid();let a=this.cellStart,s=this.cellItems;if(!a||!s)return 0;let l=i.length,u=o*o,m=Math.floor((e-this.minX)/this.cell),h=Math.floor((n-this.minZ)/this.cell),d=Math.ceil(o/this.cell)+1,c=this.iPosition,p=0;for(let f=0;f<=d&&p<l;f++){let y=h-f,w=h+f,b=m-f,S=m+f;for(let A=y;A<=w&&p<l;A++){if(A<0||A>=this.rows)continue;let F=A===y||A===w;for(let T=b;T<=S&&p<l;T++){if(!F&&T!==b&&T!==S){T=S-1;continue}if(T<0||T>=this.cols)continue;let R=A*this.cols+T;for(let D=a[R],x=a[R+1];D<x&&p<l;D++){let M=s[D],C=c[M*3]-e,k=c[M*3+2]-n,z=r===void 0?0:c[M*3+1]-r;C*C+z*z+k*k<=u&&(i[p++]=M)}}}}return p}};var sn=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Kt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new an(e.model.seats.iPosition,e.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(e){let n=this.ctx.gpu();e||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!e&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(e){let{model:n}=this.ctx,o=this.ctx.gpu();if(!o)return;if(!e){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let i=this.ctx.orbit().camera.position;if(Math.hypot(i.x-this.lastGatherX,i.y-this.lastGatherY,i.z-this.lastGatherZ)<On)return;if(this.lastGatherX=i.x,this.lastGatherY=i.y,this.lastGatherZ=i.z,Math.hypot(i.x-n.bounds.center[0],i.y-n.bounds.center[1],i.z-n.bounds.center[2])-n.bounds.radius>Vn){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(i.x,i.z,Vn,this.nearBuf,i.y);s===0&&o.nearSeatCount()===0||o.setNearSeats(this.nearBuf,s)}ease(e,n,o){let i=1-Math.exp(-e*9),r=1-Math.exp(-e*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?i:r),this.structureDetailMix+=(o-this.structureDetailMix)*(o>this.structureDetailMix?i:r),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(o-this.structureDetailMix)<.01&&(this.structureDetailMix=o)}};function Pa(t){let e=Math.max(5,t.radius),n=t.focalWorld[0]-t.center[0],o=t.focalWorld[2]-t.center[2],i=Math.hypot(n,o);if(i<e*.12)return{center:t.center,radius:e,polarDeg:48};let r=Math.min(i*.25,e*.2);return{center:[t.center[0]+n/i*r,t.center[1],t.center[2]+o/i*r],radius:e+r,polarDeg:50}}import{Quat as Yc,Vec3 as $c}from"ogl";function Ea(){let t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round");let n=document.createElementNS(t,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),e.appendChild(n),e}function Ca(t){let{container:e,model:n,opts:o,orbit:i,cinematic:r,analytics:a,loop:s,labelOverlay:l,stageAzimuth:u,overviewFraming:m}=t,h=0,d=-1,c=(M,C,k=28)=>{i.camera.position.set(M[0],M[1],M[2]),i.camera.lookAt(new $c(C[0],C[1],C[2])),i.camera.fov=k,i.camera.updateProjectionMatrix()},p=document.createElement("button");p.className="sl-3d-overview-control sl-3d-icon-control",p.type="button",p.replaceChildren(Ea());let f=o.navLabels?.fitView??"Show whole venue";p.setAttribute("aria-label",f),p.title=f,Object.assign(p.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let y=()=>{p.firstElementChild||p.replaceChildren(Ea())};y();let w=M=>{d=M;let C=t.gpu();C&&(C.seatProgram.uniforms.uFocusFloor.value=M,C.solidProgram.uniforms.uFocusFloor.value=M,C.chairProgram.uniforms.uFocusFloor.value=M),t.showSectionSeatLabels(null)},b=null,S=!1,A=()=>{if(b=null,S=!1,t.setSeeThrough?.(null),t.isDisposed())return;o.onViewTargetChange?.(null),o.onSectionFocusChange?.(null),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),a.panoramaClosed()),t.setPanoramaSphereVisible(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.restorePanoramaLayer(),p.style.display="",l.setVisible(!0),t.setFrozen(!1);let M=d>=0?n.floors[d]:null;if(t.setNearFieldDetailEnabled(!!M),t.setSeatViewLocked(!1),F(),t.removeArriveChip(),t.setNavigationMode("auto"),M){let C=M.focalWorld[0]-M.center[0],k=M.focalWorld[2]-M.center[2],z=Math.hypot(C,k)>M.radius*.12?Math.atan2(C,k):u,N={center:M.center,radius:M.radius,box:M.box},O={polarDeg:58,margin:1.12};t.reducedMotion()?i.frame(N,!1,z,!1,O):i.frameSoft(N,z,!1,O)}else t.reducedMotion()?i.frame(n.bounds,!1,u,o.portraitOverviewCrop===!0,m):i.frameSoft(n.bounds,u,o.portraitOverviewCrop===!0,m);l.setOverviewDistance(i.targetDistance),t.showSectionSeatLabels(null),s.requestRender()},F=()=>{h++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),r.active&&(r.cancel(),i.resumeAfterFlight(n.focalWorld))},T=M=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let C=n.seats.idToIndex.get(M);if(C===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),o.onViewTargetChange?.(M),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),p.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1);let k=t.inSeatView()&&o.arriveAtSeatEye===!0;t.setSeatStepping(k),t.setSeatViewLocked(!1);let z=++h;k?t.showArriveChip(M,z):t.removeArriveChip();let{eye:N,focal:O}=t.resolvedSeatViewPose(M,C),U=o.arriveAtSeatEye?t.seatViewArrival(M,C):null,$=U&&U.stops.length>1&&U.stops[1].name==="row"?U.stops[1]:null,Y=U?U.focal:O,X=[i.camera.position.x,i.camera.position.y,i.camera.position.z],G=oo(X,U?.eye??N,Y,n.bounds.center,n.bounds.radius),te=$?$.eye:U?U.eye:o.arriveAtSeatEye?N:G.finalPos,I=U?U.fov:o.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?tn:65:28,j=[G.waypoints[0],G.waypoints[1],te];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),c(te,Y,I),s.requestRender(),a.cinematicSkipped(),t.isDisposed()||i.syncFromCamera(),t.setSeatViewLocked(o.arriveAtSeatEye===!0),U&&t.enterSeatView(U.stops),t.showArriveChip(M,z),Promise.resolve();let J=new Yc().copy(i.camera.quaternion),_=Ni(i.camera,te,Y);s.requestRender();let oe=k?700:2500;return r.start(j,J,_,oe,I).then(()=>{t.isDisposed()||z!==h||(t.setSeatStepping(!1),a.cinematicPlayed(oe),i.resumeAfterFlight(Y),t.setSeatViewLocked(o.arriveAtSeatEye===!0),U&&t.enterSeatView(U.stops,$?1:0),s.requestRender(),t.showArriveChip(M,z))})},R=(M,C)=>{let k=n.sections.find(z=>z.id===M);if(!k||k.seatCount===0)return!1;if(b=M,S=!1,t.setSeeThrough?.(null),t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),r.cancel(),t.removeArriveChip(),n.floors.length>1&&d!==k.floorIndex&&w(k.floorIndex),t.setNavigationMode("auto"),t.panorama()||l.setVisible(!0),t.showSectionSeatLabels(M),!C?.keepCamera){let z=Pa(k),N={polarDeg:z.polarDeg,margin:1.12};t.reducedMotion()?i.frame({center:z.center,radius:z.radius},!1,i.currentAzimuth,!1,N):i.glideTo({center:z.center,radius:z.radius},N)}return o.onSectionFocusChange?.(M),s.requestRender(),!0},D=(M,C)=>{if(t.isDisposed()||!t.gpu())return!1;let k=n.seats.idToIndex.get(M);if(k===void 0)return!1;let z=k*3,N=[n.seats.iPosition[z],n.seats.iPosition[z+1]+.55,n.seats.iPosition[z+2]],O=C?Xc(C,i.fovY,i.camera.aspect||1):Ra;return S=!0,t.setSeeThrough?.(N),t.reducedMotion()?i.frame({center:N,radius:O},!1,void 0,!1,mo):i.frameSoft({center:N,radius:O},void 0,!1,mo),s.requestRender(),!0},x=()=>{if(t.isNarrow?.()&&S&&b&&R(b)){s.requestRender();return}A()};return p.addEventListener("click",x),{overviewChip:p,layoutOverviewChip:y,flightGen:()=>h,focusedFloor:()=>d,applyFloorFocus:w,placeCameraFinal:c,cancelFlight:F,focusOverview:A,flyToSeat:T,focusSectionCamera:R,focusSeatCamera:D}}var Ra=4.5;function Xc(t,e,n){let o=Math.tan(e*Math.PI/360),i=o*Math.max(.001,n),a=jc*t.viewportHeightPx/(2*Math.max(1,t.seatPx)*o)*Math.min(o,i)/mo.margin;return Math.max(Kc,Math.min(Ra,a))}var jc=.5,Kc=1.5,mo={polarDeg:48,margin:1.25};function po(t,e,n,o,i,r,a,s,l=.5){let u=-1,m=s*s,h=1/0;for(let d=0;d<e;d++){let c=d*3,p=Re(n,[t[c],t[c+1]+l,t[c+2]],o,i);if(!p.visible)continue;let f=p.x-r,y=p.y-a,w=f*f+y*y;(w<m-4||w<m+4&&p.depth<h)&&(u=d,m=Math.min(m,w),h=p.depth)}return u}function _a(t){let e=performance.now(),{input:n,estimate:o}=vr(t);return{model:xt(n),buildMs:performance.now()-e,source:"main",...o?{estimate:o}:{}}}function qc(t){let e=Lo(t.doc);return{..._a({...t,seats:e}),seats:e}}function Fa(t,e,n){let o=r=>({...e(),fallbackReason:r});if(typeof Worker>"u")return Promise.resolve(o("unavailable"));let i;try{i=new Worker(new URL("./scene/scene.worker.js",import.meta.url),{type:"module"})}catch{return Promise.resolve(o("unavailable"))}return new Promise(r=>{let a=!1,s=m=>{a||(a=!0,clearTimeout(u),i.terminate(),r(m))},l=m=>s(o(m)),u=window.setTimeout(()=>l("timeout"),15e3);i.onerror=()=>l("worker_error"),i.onmessage=m=>{let h=n(m.data);h?s(h):l("bad_response")},i.postMessage({...t,crowdSeatCeiling:t.crowdSeatCeiling??or()})})}function Zc(t){return Fa(t,()=>_a(t),({model:e,buildMs:n,estimate:o})=>({model:e,buildMs:n,source:"worker",...o?{estimate:o}:{}}))}function Qc(t){return Fa(t,()=>qc(t),({model:e,buildMs:n,seats:o,estimate:i})=>o?{model:e,buildMs:n,seats:o,source:"worker",...i?{estimate:i}:{}}:null)}var eu=40,tu=48,nu=Math.PI/180,ou=Fn,ru=500,iu=6;function am(t,e,n={}){let o=performance.now(),i=e.prepared?e.prepared.estimate:e.estimate===!1?null:Cn(e.doc,e.seats);i&&(e={...e,doc:i.doc,seats:fr(e.seats,i)});let r=e.prepared?.model??xt(e),a=new rn(n.onAnalytics),s=new Array(r.seats.count);for(let[v,g]of r.seats.idToIndex)s[g]=v;let l=new Map(e.seats.map(v=>[v.id,v])),u=new Map;for(let v of e.seats){if(!v.rowId)continue;let g=u.get(v.rowId);g?g.push(v.id):u.set(v.rowId,[v.id])}let m=new Map,h=[0,0,0,0];function d(){if(b)for(let v of[b.seatProgram,b.solidProgram,b.chairProgram])v.uniforms.uSeeThrough.value=h}e.seats.forEach((v,g)=>{m.set(v.id,r.seatSectionIds?.[g]??v.sectionId)});let c=new Map;for(let[v,g]of r.seats.idToIndex){let E=m.get(v);if(!E)continue;let L=c.get(E);L?L.push(g):c.set(E,[g])}let p=()=>{if(!b||!r.sectionSolidRanges.length)return;let{lit:v,anyUnlit:g}=gi(r.sectionSolidRanges,c,r.seats.iState);b.setSectionShellLit(g?v:null)},f=new Map,y=()=>{!b||!r.areaSolidRanges?.length||b.setAreaFloorsQuiet(new Set([...f].filter(([,v])=>ho(v)).map(([v])=>v)))},w=e.doc.floors?.some(g=>(g.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(g=>g.objects)??e.doc.objects).some(g=>g.type==="section"&&((g.height??0)>0||(g.rake??0)>0)),b=null,S=null,A=null,F=!1,T=!1,R=!1,D=new Map,x=null,M=null,C=null,k=new Map,z=null,N=()=>{C===null&&(C=t.style.zIndex,t.style.zIndex="20")},O=()=>{C!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=C),C=null)},U=!1,$=()=>U?we.focusedFloor():-1,Y=()=>{b=_i(_.gl,r),S?.dispose(),S=Ur(_.gl,[1,1,1],r.theme.seatStates.selected),xo(!1),p(),y(),K(),A=new Jt(_.renderer,b.seatGeometry,b.chairGeometry,b.solidGeometry,r.seats.count),_.setClearColor(r.theme.background.top),A.setRestoreClear(r.theme.background.top),A.setRoomCentre(r.room?.centre),b.seatProgram.uniforms.uSeatRadius.value=gt*r.theme.seatScale,b.seatProgram.uniforms.uFocusFloor.value=$(),b.solidProgram.uniforms.uFocusFloor.value=$(),b.chairProgram.uniforms.uFocusFloor.value=$(),b.screenProgram&&(b.screenProgram.uniforms.uFocusFloor.value=$()),d(),G.forceRegather()},X=!1,G=new sn({model:r,orbit:()=>P,gpu:()=>b}),te=!1,I=new Map,j=24,J=v=>G.setDetailEnabled(v),_=new Nt(t,{onContextLost:()=>{R||a.contextLost(),F=!0,le.stop(),b=null,A=null,oe.reset()},onContextRestored:()=>{Y(),F=!1,R||a.contextRestored(),le.requestRender()}}),oe=new Ht(_.gl,_.renderer,_.smoothingSamples),se=new Gt,pe=!1,re=(v,g)=>{if(!b)return{smooth:!1,onBudget:!1};if(Sr(r.seatCount,r.crowd?.count??0,wr)||b.nearSeatCount()>0||!v)return{smooth:!0,onBudget:!1};let E=se.allows(g);return{smooth:E,onBudget:E}},P=new Xt(_.gl,_.canvas,()=>le.requestRender(),()=>a.orbitEngaged());P.setTouchNavigation(Ar(n)),P.setAspect(_.aspect);let ve=(e.doc.floors?.flatMap(v=>v.objects)??e.doc.objects).some(v=>v.type==="section"&&v.physical3dProvenance?.surfaceKind?.status==="inferred"),Z=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(ve&&r.stages.length===0))return br(r.focalWorld,r.seats.iPosition,r.bounds)})(),Fe=(e.doc.floors?.flatMap(v=>v.objects)??e.doc.objects).some(v=>v.type==="shape"&&v.stageKind?.startsWith("pitch-")),be=r.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:Fe?36:48,margin:1.05},xe=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;P.frame(r.bounds,!xe&&n.skipInitialOverviewAnimation!==!0,Z,n.portraitOverviewCrop===!0,be);let ue=new en(P.camera),ze=pa(t),Ie=gr(t,r),ae=new qt(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:r.theme.background.top}),ke=r.labels,Qe=()=>ir(ke,r.floors.length,$());ae.setLabels(Qe()),ae.setOverviewDistance(P.targetDistance);let ht=()=>{let v=new Map,g=Te.indexOf("available");for(let E of ke){if(!E.wheelchairSeats)continue;let L=0;for(let W of E.wheelchairSeats)r.seats.iState[W]===g&&L++;L>0&&v.set(E.id,L)}return ae.setWheelchairFree(v)};ht();let ge=null,Ne=()=>[...D.keys()].flatMap(v=>{let g=r.seats.idToIndex.get(v),E=g===void 0?void 0:e.seats[g];if(g===void 0||E?.id!==v)return[];let L=g*3;return[{id:`seat:${v}`,kind:"seat",seatWidthM:r.seats.iChairWidth[g]*2,text:E.displayLabel||E.label,anchor:[r.seats.iPosition[L],r.seats.iPosition[L+1]+1.05,r.seats.iPosition[L+2]],pinBase:ln(L)}]}),V=-1,K=()=>{b&&(V=ge?r.sections.findIndex(v=>v.id===ge):-1,b.seatProgram.uniforms.uFocusSection.value=V,b.chairProgram.uniforms.uFocusSection.value=V)},q=v=>{if(ge=v,K(),ae.setForcedDense(!!v),!v){let H=Ne(),de=new Set(H.map(ce=>ce.id));ae.setLabels([...Qe().filter(ce=>!de.has(ce.id)),...H]);return}let g=e.seats.filter(H=>m.get(H.id)===v),E=new Set(g.map(H=>H.id)),L=new Set(g.map(H=>H.rowId)),W=new Set(D.keys()),Q=new Set(g.filter(H=>W.has(H.id)).map(H=>H.id)),ee=Qe().filter(H=>H.kind!=="row"&&H.kind!=="seat"&&H.kind!=="access"||H.kind==="access"&&E.has(H.id.slice(7))||(H.kind==="row"?L.has(H.id.slice(4)):E.has(H.id.slice(5))));if(r.seatCount<=6e3&&Q.size===0){ae.setLabels(ee);return}let ne=g,he=new Set(ne.map(H=>`seat:${H.id}`)),Me=ne.flatMap(H=>{let de=r.seats.idToIndex.get(H.id);if(de===void 0)return[];let ce=de*3;return[{id:`seat:${H.id}`,kind:"seat",seatWidthM:r.seats.iChairWidth[de]*2,rowId:H.rowId,text:W.has(H.id)?H.displayLabel||H.label:pr(H.displayLabel||H.label),anchor:[r.seats.iPosition[ce],r.seats.iPosition[ce+1]+(W.has(H.id)?1.05:.55),r.seats.iPosition[ce+2]],...W.has(H.id)?{pinBase:ln(ce)}:{}}]});ae.setLabels([...ee.filter(H=>!he.has(H.id)),...Me])};Y();let B=null,ie=null,me=new Jc,It=v=>{if(F||!b||T)return!1;let g=ua({flying:ue.active,panoramaMounted:x!==null,seatViewActive:B?.active===!0}),E=ha(B?.active===!0,$());b.seatProgram.uniforms.uFocusFloor.value=E,b.solidProgram.uniforms.uFocusFloor.value=E,b.chairProgram.uniforms.uFocusFloor.value=E,b.screenProgram&&(b.screenProgram.uniforms.uFocusFloor.value=E);let L=g==="orbit"?V:-1;b.seatProgram.uniforms.uFocusSection.value=L,b.chairProgram.uniforms.uFocusSection.value=L;let W=te?!1:g==="cinematic"?ue.update(performance.now()):g==="seatView"?B.update(performance.now()):g==="orbit"?P.update():!1;ie?.syncZoomLimits(),ie?.syncNavigationMode();let Q=$()>=0?r.floors[$()]:null,ee=Q?.radius??r.bounds.radius,ne=Hr(P.currentDistance,ee),he=X?{center:[P.camera.position.x,P.camera.position.y,P.camera.position.z],radius:520}:r.clipBounds??r.renderBounds;P.updateClipping(he);let Me=Q?.center??r.renderBounds.center,H=Q?.radius??r.renderBounds.radius,de=(Pe,xn)=>Math.hypot(P.camera.position.x-Pe[0],P.camera.position.y-Pe[1],P.camera.position.z-Pe[2])<=xn*(G.detailVisible?1.8:1.55),ce=de(Me,H);if(!ce&&ge){let Pe=r.sections.find(xn=>xn.id===ge);Pe&&(ce=de(Pe.center,Math.max(12,Pe.radius*2)))}G.detailVisible=ce;let ye=b.seatProgram.uniforms;ye.uSeatScale.value=ne.scale,ye.uSeatFade.value=ne.fade;let Be=!!Q&&Gr(Q.seatCount,_.canvas.clientWidth||1,_.canvas.clientHeight||1),gn=Br(r.seats.count,ee,P.currentDistance,P.camera.fov,_.canvas.clientHeight||1),Je=G.detailVisible||Be||gn?1:0,Lt=G.detailVisible||$()>=0||r.floors.length>1?1:0;G.ease(v,Je,Lt),ye.uSeatDetail.value=G.seatDetailMix;let et=Je===0&&G.seatDetailMix<.01;b.seatGeometry.setDrawRange(et?Rn:0,et?yr:Rn),b.solidProgram.uniforms.uStructureDetail.value=G.structureDetailMix,b.solidProgram.uniforms.uViewport.value.set([_.gl.drawingBufferWidth,_.gl.drawingBufferHeight]),ye.uMinPixels.value=ne.minPixels,ye.uPixelToWorld.value=2*Math.tan(P.camera.fov*nu/2)/Math.max(1,_.pixelHeight),G.update(G.detailVisible),(r.outdoor||r.house)&&(me.copy(P.camera.projectionViewMatrix).inverse(),b.backgroundProgram.uniforms.uInvViewProj.value.set(me),b.backgroundProgram.uniforms.uEye.value.set([P.camera.position.x,P.camera.position.y,P.camera.position.z]));let tt=re(W,P.currentDistance),Ae=oe.begin(tt.smooth);pe=Ae!==null,se.frame(tt.onBudget&&Ae!==null,P.currentDistance,performance.now());let yn=Ae?{target:Ae}:{};_.renderer.render({scene:b.background,clear:!0,...yn}),_.renderer.render({scene:b.main,camera:P.camera,clear:!1,...yn});let Ba=S?S.update(performance.now(),[P.camera.position.x,P.camera.position.y,P.camera.position.z],x!==null,g==="seatView"):!1;if(S&&_.renderer.render({scene:S.root,camera:P.camera,clear:!1,...yn}),oe.end(),Ie){let Pe=P.camera.worldMatrix;Ie.update(g==="seatView"?[P.camera.position.x,P.camera.position.y,P.camera.position.z]:null,[-Pe[8],-Pe[9],-Pe[10]])}ae.update(P.camera.projectionViewMatrix,_.canvas.clientWidth||1,_.canvas.clientHeight||1,P.currentDistance,ee,[P.camera.position.x,P.camera.position.y,P.camera.position.z]);let ko=W||Ba||G.seatDetailMix!==Je||G.structureDetailMix!==Lt;return fo(!ko),ko},fo=Nr(t),le=new jt(It),vo=typeof ResizeObserver<"u"?new ResizeObserver(()=>bn.resize()):null;vo?.observe(t),P.setZoomPointResolver((v,g)=>{let E=_.canvas.getBoundingClientRect(),L=_.canvas.clientWidth||E.width,W=_.canvas.clientHeight||E.height;if(!(L>0)||!(W>0))return null;P.camera.updateMatrixWorld();let Q=po(r.seats.iPosition,r.seats.count,P.camera.projectionViewMatrix,L,W,v-E.left,g-E.top,eu);if(Q<0)return null;let ee=Q*3;return[r.seats.iPosition[ee],r.seats.iPosition[ee+1]+.5,r.seats.iPosition[ee+2]]});function ln(v){return[r.seats.iPosition[v],r.seats.iPosition[v+1]+.5,r.seats.iPosition[v+2]]}ae.setSeatNumberRow(null);let Ee=null,He=0,cn=null,bo=()=>{He=0;let v=null,g=null;if(Ee&&!B?.active&&!ue.active){let W=_.canvas.getBoundingClientRect(),Q=_.canvas.clientWidth||W.width,ee=_.canvas.clientHeight||W.height;if(Q>0&&ee>0){let ne=po(r.seats.iPosition,r.seats.count,P.camera.projectionViewMatrix,Q,ee,Ee.x-W.left,Ee.y-W.top,tu);v=ne>=0?e.seats[ne]?.rowId??null:null;let he=ne>=0?e.seats[ne]?.id??null:null;if(g=he,Ee.mouse&&!Ee.pressing&&!!ge&&!!he&&m.get(he)===ge){let H=t.getBoundingClientRect();cn=he,n.onSeatHover?.(he,{x:Ee.x-H.left,y:Ee.y-H.top})}else go()}}else go();let E=Ee?.mouse?g:null,L=ae.setSeatNumberSeat(E);(ae.setSeatNumberRow(v)||L)&&le.requestRender()};function go(){cn!==null&&(cn=null,n.onSeatHover?.(null,null))}let Dt=v=>{Ee={x:v.clientX,y:v.clientY,mouse:v.pointerType==="mouse",pressing:v.type==="pointerdown"},He||(He=requestAnimationFrame(bo))},yo=v=>{v.pointerType==="mouse"&&(Ee=null,He||(He=requestAnimationFrame(bo)))};_.canvas.addEventListener("pointermove",Dt),_.canvas.addEventListener("pointerdown",Dt),_.canvas.addEventListener("pointerleave",yo);function xo(v){if(!S)return;let g=[];for(let E of D.keys()){let L=r.seats.idToIndex.get(E);if(L===void 0)continue;let W=L*3;g.push({id:E,position:ln(W)})}S.setSeats(g,performance.now(),v)}let wo=v=>{let g=W=>{let Q=r.seats.idToIndex.get(W);return Q===void 0?void 0:r.seats.iState[Q]},{updates:E,next:L}=Ii(D,v,g);if(D=L,ae.setSelectedSeatIds(D.keys()),xo(!dt()),le.requestRender(),q(ge),E.length){let W=Tn(r.seats,E);b&&b.uploadSeatStateRuns(W),p(),le.requestRender()}},dt=()=>z!==null?z:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ia=8,So=v=>{if(!n.getSeatView)return null;let g=k.get(v);if(!g)for(g=Promise.resolve(n.getSeatView(v)),k.set(v,g),g.catch(()=>{k.get(v)===g&&k.delete(v)});k.size>Ia;){let E=k.keys().next().value;if(E===void 0)break;k.delete(E)}return g},Mo=na(r.stages,r.focalWorld,r.bounds.groundY??0),Ao=lo(Mo),To=null,Po=(v,g)=>{if(l.get(v)?.kind!=="booth")return null;To??=Ui(e.doc,e.seats);let E=To.get(v),L=[r.seats.iPosition[g*3],r.seats.iPosition[g*3+1],r.seats.iPosition[g*3+2]];return E?{at:L,front:E}:null},un=(v,g)=>{let E=Po(v,g);if(E)return ao(E.at,E.front);let L=l.get(v),W=Math.max(0,Math.round(r.seats.iFloor[g]??0)),Q=e.doc.floors?.[W],ee=r.floors[W],ne=Q?.focalPoint??e.doc.focalPoint,he=ee?{x:ee.focalWorld[0]/De,y:ee.focalWorld[2]/De}:ne,Me=L?.focalPoint?{x:L.focalPoint.x+he.x-ne.x,y:L.focalPoint.y+he.y-ne.y}:he,H=[r.seats.iPosition[g*3],r.seats.iPosition[g*3+1],r.seats.iPosition[g*3+2]],de=Bi(r.seats.iPosition,g,Ao),ce=de!==null&&Math.abs(de)<Gi;return Wi(H,Me,Q?.baseHeightM??0,L?.eyeHeightM,Ao,ce)},hn=()=>(t.clientWidth||_.canvas.clientWidth)<=520,dn=null,Eo=null,Da=async(v,g,E)=>{if(!n.getSeatView||R||E!==we.flightGen())return;let L;try{L=await da()}catch{if(a.panoramaFailed(v,"mount"),!R&&E===we.flightGen()){let W=pn(v,E,!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(R||E!==we.flightGen()||!dn))return Eo??=L.createOpenPanorama(dn),Eo(v,g,E)},mn=fa({container:t,model:r,opts:n,expandedSeatById:l,seatIdsByRow:u,isNarrow:hn,isDisposed:()=>R,flightGen:()=>we.flightGen(),flyToSeat:v=>Io(v),openPanorama:(v,g,E)=>Da(v,g,E)}),pn=mn.show,fn=mn.remove,ka=mn.layout,Ge=va({container:t,orbit:P,isNarrow:hn,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});ie=Ge;let La=Ge.element,mt=Ge.setNavigationMode,Va=Ge.layout,Oa=Ge.utilityControls,pt=null,Co=!1,kt=v=>{Ge.setSeatViewLocked(v),v||B?.exit()};B=ca({canvas:_.canvas,camera:P.camera,requestRender:()=>le.requestRender(),reducedMotion:dt,onStopChange:v=>{let g=v??(Co?"seat":null);pt=g;try{n.onSeatViewStopChange?.(g)}catch{}},onApplied:()=>{R||P.syncFromCamera()}});let Ro=r.sections.reduce((v,g)=>g.seatCount>0&&g.box?Math.max(v,g.box.max[1]):v,-1/0),_o=(v,g)=>{let{eye:E}=un(v,g),L=(t.clientWidth||_.canvas.clientWidth||1)/Math.max(1,t.clientHeight||_.canvas.clientHeight||1),W=Po(v,g),Q=W?$i(W.at,W.front,L):ra(E,Mo,L,{preserveEye:!0});if(n.seatViewStops===!1)return{...Q,stops:[]};let ee=m.get(v),ne=ee?r.sections.find(he=>he.id===ee):void 0;return{...Q,stops:ia(Q,{aspect:L,seatingTopY:Number.isFinite(Ro)?Ro:r.bounds.box.max[1],section:ne&&ne.seatCount>0?{center:ne.center,radius:ne.radius}:null,venue:{center:r.bounds.center,radius:r.bounds.radius}})}},we=Ca({isNarrow:hn,setSeeThrough:v=>{h=v?[v[0],v[1],v[2],iu]:[0,0,0,0],d(),le.requestRender()},container:t,model:r,opts:n,orbit:P,cinematic:ue,analytics:a,loop:le,labelOverlay:ae,stageAzimuth:Z,overviewFraming:be,gpu:()=>b,isDisposed:()=>R,panorama:()=>x,setPanorama:v=>{x=v},setPanoramaSphereVisible:v=>{X=v},panoramaLoadAbort:()=>M,setPanoramaLoadAbort:v=>{M=v},setFrozen:v=>{T=v},restorePanoramaLayer:O,reducedMotion:dt,resolvedSeatViewPose:un,showSectionSeatLabels:q,setNearFieldDetailEnabled:J,setSeatViewLocked:kt,setNavigationMode:mt,showArriveChip:pn,removeArriveChip:fn,inSeatView:()=>pt!==null,setSeatStepping:v=>{Co=v},seatViewArrival:(v,g)=>n.arriveAtSeatEye?_o(v,g):null,enterSeatView:(v,g)=>B?.enter(v,g)});U=!0;let vn=we.overviewChip,za=we.layoutOverviewChip,Na=we.applyFloorFocus,Ha=we.focusOverview,Fo=we.cancelFlight,Io=we.flyToSeat,Do=we.focusSectionCamera;Oa.appendChild(vn),dn={container:t,model:r,opts:n,analytics:a,orbit:P,loop:le,seatsById:l,ensureSeatView:So,resolvedSeatViewPose:un,gpu:()=>b,gl:_.gl,isContextLost:()=>F,isDisposed:()=>R,flightGen:()=>we.flightGen(),setPanorama:v=>{x=v},getLoadAbort:()=>M,setLoadAbort:v=>{M=v},setPanoramaSphereVisible:v=>{X=v,v&&B?.exit()},setFrozen:v=>{T=v},raisePanoramaLayer:N,restorePanoramaLayer:O,getOverviewChip:()=>vn,labelOverlay:ae,reducedMotion:dt,removeArriveChip:fn,showArriveChip:pn};let Ga=Ta({canvas:_.canvas,areas:r.areas,viewProjection:()=>P.camera.projectionViewMatrix,state:v=>f.get(v),focusedFloor:$,floorCount:r.floors.length,tagAt:(v,g)=>ae.tagAt(v,g)}),Ce=ya({glctx:_,orbit:P,model:r,seats:e.seats,opts:n,cinematic:ue,analytics:a,seatIdByIndex:s,sectionIdBySeatId:m,tapSlop:ou,tapMs:ru,gpu:()=>b,pick:()=>A,seatViewLocked:()=>Ge.seatViewLocked(),focusedSectionId:()=>ge,selection:()=>D,cancelFlight:Fo,focusSectionCamera:Do,focusSeatCamera:we.focusSeatCamera,setSelection:wo,ensureSeatView:So,areaAt:Ga});_.canvas.addEventListener("pointerdown",Ce.onDown),_.canvas.addEventListener("pointermove",Ce.onMove),_.canvas.addEventListener("pointerup",Ce.onUp),_.canvas.addEventListener("pointercancel",Ce.onUp),_.canvas.addEventListener("touchend",Ce.onTouchEnd,{passive:!1}),le.requestRender();let bn={setAvailability(v){let g=Fi(D,v),E=Tn(r.seats,g);E.length&&b&&b.uploadSeatStateRuns(E),p(),E.length&&ht(),le.requestRender()},setSelection:wo,setAreaStates(v){let g=!1;for(let[E,L]of Object.entries(v)){let W=f.get(E);W&&Sa(W,L)||(f.set(E,{available:L.available,selected:L.selected,wheelchairFree:L.wheelchairFree,filteredOut:L.filteredOut===!0,statusText:L.statusText??""}),g=!0)}g&&(ke=Aa(r.labels,f),y(),q(ge),le.requestRender())},setNavigationMode:mt,zoomIn(){P.zoomBy(nt),le.requestRender()},zoomOut(){P.zoomBy(wt),le.requestRender()},flyToSeat:Io,focusOverview:Ha,seatViewStop:()=>pt,recentreSeatView:()=>B?.recentre()??!1,resize(){let{width:v,height:g}=_.resize();P.setAspect(v/Math.max(1,g)),ka(),Va(),za(),le.requestRender()},stats(){return{...le.stats(),drawCalls:b?b.drawCalls:0,fallbackTriangles:b?b.seatGeometry.drawRange.count/3*r.seats.count:0,seatCount:r.seatCount}},captureImage(v=1280){if(F||!b||typeof document>"u")return null;It(0);let g=_.canvas,E=Math.min(1,v/Math.max(g.width,g.height,1)),L=document.createElement("canvas");L.width=Math.max(1,Math.round(g.width*E)),L.height=Math.max(1,Math.round(g.height*E));let W=L.getContext("2d");return W?(W.drawImage(g,0,0,L.width,L.height),L.toDataURL("image/jpeg",.82)):null},captureSeatView(v,g=480){if(F||!b||T||typeof document>"u"||ue.active||x!==null||B?.active)return null;let E=I.get(v);if(E)return E;let L=r.seats.idToIndex.get(v);if(L===void 0)return null;let{eye:W,focal:Q,fov:ee}=_o(v,L),ne=P.snapshot(),he=[G.seatDetailMix,G.structureDetailMix],Me=null;try{te=!0,P.camera.position.set(W[0],W[1],W[2]),P.camera.perspective({fov:ee,aspect:P.camera.aspect}),P.camera.lookAt(Q),P.camera.updateMatrixWorld(),P.syncFromCamera(),G.seatDetailMix=1,G.structureDetailMix=1,G.forceRegather(),It(0);let H=_.canvas,de=Math.min(H.width,Math.round(H.height*16/9)),ce=Math.round(de*9/16),ye=document.createElement("canvas");ye.width=Math.max(1,Math.round(g)),ye.height=Math.max(1,Math.round(g*9/16));let Be=ye.getContext("2d");Be&&(Be.drawImage(H,(H.width-de)/2,(H.height-ce)/2,de,ce,0,0,ye.width,ye.height),Me=ye.toDataURL("image/jpeg",.8))}finally{te=!1,ne(),G.seatDetailMix=he[0],G.structureDetailMix=he[1],G.forceRegather(),It(0)}if(Me)for(I.set(v,Me);I.size>j;)I.delete(I.keys().next().value);return Me},getQualityEvidence(){let v=le.stats(),g=_.canvas.clientWidth||1,E=_.canvas.clientHeight||1,L=r.bounds.center,W=Re(P.camera.projectionViewMatrix,[L[0],r.bounds.box.min[1],L[2]],g,E),Q=Re(P.camera.projectionViewMatrix,[L[0],r.bounds.box.max[1],L[2]],g,E),ee=r.bounds.box,ne=[ee.min[0],ee.max[0]].flatMap(H=>[ee.min[1],ee.max[1]].flatMap(de=>[ee.min[2],ee.max[2]].map(ce=>Re(P.camera.projectionViewMatrix,[H,de,ce],g,E)))).filter(H=>Number.isFinite(H.x)&&Number.isFinite(H.y)&&Number.isFinite(H.depth)),he=ne.length?(()=>{let H=Math.min(...ne.map(Ae=>Ae.x)),de=Math.max(...ne.map(Ae=>Ae.x)),ce=Math.min(...ne.map(Ae=>Ae.y)),ye=Math.max(...ne.map(Ae=>Ae.y)),Be=Math.max(0,H),gn=Math.min(g,de),Je=Math.max(0,ce),Lt=Math.min(E,ye),et=Math.max(0,gn-Be),tt=Math.max(0,Lt-Je);return{box:{x:Be,y:Je,width:et,height:tt},horizontalFillRatio:et/g,verticalFillRatio:tt/E,visibleAreaRatio:et*tt/(g*E),clippedEdges:[...ce<0?["top"]:[],...de>g?["right"]:[],...ye>E?["bottom"]:[],...H<0?["left"]:[]]}})():void 0,Me=String(_.gl.getParameter(_.gl.VERSION)??"");return{viewport:{width:g,height:E},context:{webgl2:/webgl\s*2/i.test(Me),lost:F},frame:{rendered:v.rendered,idle:v.idle,smoothed:pe},camera:{position:[P.camera.position.x,P.camera.position.y,P.camera.position.z],distance:P.currentDistance,verticalFovDeg:P.fovY},scene:{seatCount:r.seatCount,floorCount:r.floors.length,zoneCount:r.zones.length,sectionCount:r.sections.length,authoredRelief:w,renderedVerticalSpanM:Math.max(0,r.bounds.box.max[1]-r.bounds.box.min[1]),projectedReliefPx:W.visible&&Q.visible?Math.abs(W.y-Q.y):0},labels:ae.qualityEvidence(),framing:he,...pt?{seatView:{fovDeg:P.camera.fov,stop:pt}}:{}}},getQualityReport(){return Wn(bn.getQualityEvidence())},loseContextForTest(){_.simulateContextLossCycle()},floors(){return r.floors},focusFloor(v){if(v!==null&&!r.floors.some(E=>E.index===v))return!1;let g=v??-1;if(J(v!==null),kt(!1),Na(g),mt("orbit"),v===null)ue.cancel(),dt()?P.frame(r.bounds,!1,Z,n.portraitOverviewCrop===!0,be):P.frameSoft(r.bounds,Z,n.portraitOverviewCrop===!0,be),ae.setOverviewDistance(P.targetDistance);else{let E=r.floors[v];if(E.seatCount>0){ue.cancel();let L=E.focalWorld[0]-E.center[0],W=E.focalWorld[2]-E.center[2],Q=Math.hypot(L,W)>E.radius*.12?Math.atan2(L,W):Z;P.frame({center:E.center,radius:E.radius,box:E.box},!1,Q,!1,{polarDeg:58,margin:1.12}),ae.setOverviewDistance(P.targetDistance)}}return le.requestRender(),!0},zones(){return r.zones},focusZone(v){let g=r.zones.find(Q=>Q.id===v);if(!g||g.seatCount===0)return!1;J(!1),kt(!1),ue.cancel(),mt("orbit"),q(null),n.onSectionFocusChange?.(null);let E=g.focalWorld[0]-g.center[0],L=g.focalWorld[2]-g.center[2],W=Math.hypot(E,L)>g.radius*.12?Math.atan2(E,L):void 0;return P.frame({center:g.center,radius:g.radius*1.25},!1,W),le.requestRender(),!0},sections(){return r.sections},focusSection(v){return Do(v)},rows(v){return v?r.rows.filter(g=>g.sectionId===v):r.rows},seatsInRow(v){return e.seats.filter(g=>g.rowId===v).map(g=>({id:g.id,label:g.displayLabel||g.label}))},focusRow(v){let g=r.rows.find(E=>E.id===v);return!g||g.seatCount===0?!1:(J(!0),kt(!1),ue.cancel(),mt("pan"),g.sectionId&&(q(g.sectionId),n.onSectionFocusChange?.(g.sectionId)),P.frame({center:g.center,radius:Math.max(2.5,g.radius*.65)}),le.requestRender(),!0)},setReducedMotionForTest(v){z=v},dispose(){R=!0,Ie?.dispose(),fo(!1),fn(),vn.remove(),La.remove(),Fo(),B?.dispose(),le.stop(),ae.dispose(),vo?.disconnect(),x&&(x.dispose(),x=null),O(),ze(),_.canvas.removeEventListener("pointerdown",Ce.onDown),_.canvas.removeEventListener("touchend",Ce.onTouchEnd),_.canvas.removeEventListener("pointermove",Ce.onMove),_.canvas.removeEventListener("pointerup",Ce.onUp),_.canvas.removeEventListener("pointercancel",Ce.onUp),_.canvas.removeEventListener("pointermove",Dt),_.canvas.removeEventListener("pointerdown",Dt),_.canvas.removeEventListener("pointerleave",yo),He&&cancelAnimationFrame(He),P.dispose(),A&&A.dispose(),b&&b.dispose(),b=null,S?.dispose(),S=null,A=null,oe.dispose(),_.dispose()}};return a.opened(r.seatCount,w,e.prepared?.buildMs??performance.now()-o,e.prepared?.source??"inline"),bn}export{ll as VENUE3D_QUALITY_REPORT_VERSION,Wa as autoVenue3d,xt as buildSceneModel,Cn as estimateVenue3D,Wn as inspectVenue3DQualityEvidence,am as mountVenue3D,Zc as prepareVenue3D,Qc as prepareVenue3DFromChart};