@seatlayer/core 0.110.0 → 0.111.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 (162) 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/{categoryInventory-BfvwE3nC.d.cts → categoryInventory-BE1AThTx.d.cts} +1 -1
  6. package/dist/{categoryInventory-ClZ-68jI.d.ts → categoryInventory-DxciZQK_.d.ts} +1 -1
  7. package/dist/{chunk-ZYQXT5JP.js → chunk-5FIX35HN.js} +1 -1
  8. package/dist/{chunk-2JFCDE27.js → chunk-5GHPGPWE.js} +1 -1
  9. package/dist/{chunk-MRLWH6RC.js → chunk-AZWAP4OE.js} +1 -1
  10. package/dist/chunk-BXQQKDIX.js +1 -0
  11. package/dist/{chunk-OJSGMXJS.js → chunk-FZ74MVKY.js} +1 -1
  12. package/dist/chunk-JQBJZMLG.js +1 -0
  13. package/dist/{chunk-UUIZHJYL.js → chunk-MN4M5QZ4.js} +1 -1
  14. package/dist/chunk-N6K5NQYG.js +1 -0
  15. package/dist/{chunk-6VOUTNRV.js → chunk-NQLQNJV2.js} +1 -1
  16. package/dist/{chunk-BNLANXXZ.js → chunk-NXS6JFBI.js} +1 -1
  17. package/dist/{chunk-WUNZCUE6.js → chunk-XWTAFHYQ.js} +1 -1
  18. package/dist/{chunk-FBXZWNND.js → chunk-Z6YGWTT3.js} +1 -1
  19. package/dist/core/chart-ops/index.cjs +1 -1
  20. package/dist/core/chart-ops/index.d.cts +7 -5
  21. package/dist/core/chart-ops/index.d.ts +7 -5
  22. package/dist/core/chart-ops/index.js +1 -1
  23. package/dist/core/inventory/index.cjs +1 -1
  24. package/dist/core/inventory/index.d.cts +4 -4
  25. package/dist/core/inventory/index.d.ts +4 -4
  26. package/dist/core/inventory/index.js +1 -1
  27. package/dist/core/layout/index.cjs +1 -1
  28. package/dist/core/layout/index.d.cts +5 -5
  29. package/dist/core/layout/index.d.ts +5 -5
  30. package/dist/core/layout/index.js +1 -1
  31. package/dist/core/quality/index.cjs +1 -1
  32. package/dist/core/quality/index.d.cts +3 -3
  33. package/dist/core/quality/index.d.ts +3 -3
  34. package/dist/core/render-assets/index.cjs +1 -1
  35. package/dist/core/render-assets/index.d.cts +2 -2
  36. package/dist/core/render-assets/index.d.ts +2 -2
  37. package/dist/core/render-assets/index.js +1 -1
  38. package/dist/core/seatConfidence.d.cts +1 -1
  39. package/dist/core/seatConfidence.d.ts +1 -1
  40. package/dist/core/sections/index.d.cts +5 -5
  41. package/dist/core/sections/index.d.ts +5 -5
  42. package/dist/core/sections/index.js +1 -1
  43. package/dist/cs-JRLKXXM5.js +1 -0
  44. package/dist/cy-W3CYXTOV.js +1 -0
  45. package/dist/da-HG4PFYWH.js +1 -0
  46. package/dist/de-KOM2AXXJ.js +1 -0
  47. package/dist/el-NBRQ66EQ.js +1 -0
  48. package/dist/es-AVEG4ZNM.js +1 -0
  49. package/dist/et-33PIOTI4.js +1 -0
  50. package/dist/{eventConfigurations-DsW5Mj2e.d.ts → eventConfigurations-Cdt-e0uD.d.ts} +1 -1
  51. package/dist/{eventConfigurations-dmn9FClw.d.cts → eventConfigurations-D0us5j0K.d.cts} +1 -1
  52. package/dist/fa-CDV2VTXV.js +1 -0
  53. package/dist/fi-TKATIOE6.js +1 -0
  54. package/dist/fr-TMDNSR5N.js +1 -0
  55. package/dist/he-4G7OVLJX.js +1 -0
  56. package/dist/hi-XKXNYPYF.js +1 -0
  57. package/dist/hr-BX444QNM.js +1 -0
  58. package/dist/hu-FM46JMDP.js +1 -0
  59. package/dist/id-CBVTYGFP.js +1 -0
  60. package/dist/index.cjs +1 -1
  61. package/dist/index.d.cts +46 -38
  62. package/dist/index.d.ts +46 -38
  63. package/dist/index.js +1 -1
  64. package/dist/it-ZOFOAG6E.js +1 -0
  65. package/dist/ja-NKEBMXTO.js +1 -0
  66. package/dist/ko-RUCELYV7.js +1 -0
  67. package/dist/ku-KKYBDVSA.js +1 -0
  68. package/dist/{labeling-Bn41ByDd.d.ts → labeling-DXgkxMoi.d.ts} +1 -1
  69. package/dist/{labeling-BmEjVxFt.d.cts → labeling-eYKVPLMb.d.cts} +1 -1
  70. package/dist/localeLoaders-YQXZZVNH.js +1 -0
  71. package/dist/lt-3CJ37W7A.js +1 -0
  72. package/dist/lv-H37RDMRX.js +1 -0
  73. package/dist/ms-E5RVBRE6.js +1 -0
  74. package/dist/nl-QHEOTQ7U.js +1 -0
  75. package/dist/no-43HJQ5MK.js +1 -0
  76. package/dist/pl-4LKJHMFJ.js +1 -0
  77. package/dist/pt-LSSE5QHE.js +1 -0
  78. package/dist/{renderedQuality-MDkNe8GA.d.ts → renderedQuality-Dzo2_8f4.d.ts} +1 -1
  79. package/dist/{renderedQuality-Bt2d0uq1.d.cts → renderedQuality-Frgw6jdx.d.cts} +1 -1
  80. package/dist/{renderer-DH0yI32q.d.cts → renderer-DM2sv1un.d.cts} +1 -1
  81. package/dist/{renderer-BJrpMV6U.d.ts → renderer-DuieD7jP.d.ts} +1 -1
  82. package/dist/ro-U2QASPIY.js +1 -0
  83. package/dist/ru-PTMWREXY.js +1 -0
  84. package/dist/{seatTypeIcons-CG_Uzpaw.d.ts → seatTypeIcons-Bz0OJtEi.d.ts} +1 -1
  85. package/dist/{seatTypeIcons-Ck7oEFei.d.cts → seatTypeIcons-Cm8tjLYl.d.cts} +1 -1
  86. package/dist/{sections-C-UAqr1x.d.ts → sections-Bf_DV0oG.d.ts} +1 -1
  87. package/dist/{sections-C8HApYxd.d.cts → sections-PbQiqN0i.d.cts} +1 -1
  88. package/dist/{segmentedRowModel-DR1w9M13.d.ts → segmentedRowModel-CO7DD803.d.ts} +1 -1
  89. package/dist/{segmentedRowModel-CeoMsBnt.d.cts → segmentedRowModel-Co9LqS4i.d.cts} +1 -1
  90. package/dist/sk-AY2N2ORA.js +1 -0
  91. package/dist/sl-5MQJVNB7.js +1 -0
  92. package/dist/sr-25FTJPUA.js +1 -0
  93. package/dist/{stage-CKb7aNoH.d.cts → stage-BtqKu5aX.d.cts} +1 -1
  94. package/dist/{stage-CKb7aNoH.d.ts → stage-BtqKu5aX.d.ts} +1 -1
  95. package/dist/sv-7VQX4BFH.js +1 -0
  96. package/dist/{tableSizing-RRmpxOXl.d.ts → tableSizing-BDePQyPD.d.ts} +3 -3
  97. package/dist/{tableSizing-Bz-hxLza.d.cts → tableSizing-C6EjKNnk.d.cts} +3 -3
  98. package/dist/th-E53HQMDC.js +1 -0
  99. package/dist/{ticketRestrictions-lq4dH4k6.d.cts → ticketRestrictions-CgYwHQOf.d.cts} +2 -2
  100. package/dist/{ticketRestrictions-C7KUrulv.d.ts → ticketRestrictions-D5wgOq4P.d.ts} +2 -2
  101. package/dist/tr-IIR6E7OD.js +1 -0
  102. package/dist/{types-DM-OneoD.d.ts → types-CGOr0BpE.d.cts} +40 -16
  103. package/dist/{types-DM-OneoD.d.cts → types-CGOr0BpE.d.ts} +40 -16
  104. package/dist/uk-HBINQ4XE.js +1 -0
  105. package/dist/vi-TX6I5RWN.js +1 -0
  106. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  107. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  108. package/dist/view3d/index.cjs +531 -172
  109. package/dist/view3d/index.d.cts +350 -73
  110. package/dist/view3d/index.d.ts +350 -73
  111. package/dist/view3d/index.js +529 -170
  112. package/dist/view3d/scene/scene.worker.cjs +1 -1
  113. package/dist/view3d/scene/scene.worker.js +1 -1
  114. package/dist/zh-Hans-7QNBTEYC.js +1 -0
  115. package/dist/zh-Hant-6KK3D42X.js +1 -0
  116. package/package.json +1 -1
  117. package/dist/ar-O3RHQRH3.js +0 -1
  118. package/dist/be-SXFCG3F5.js +0 -1
  119. package/dist/bg-W7YBNYB2.js +0 -1
  120. package/dist/ca-FA7WHACR.js +0 -1
  121. package/dist/chunk-4N5CHKHD.js +0 -1
  122. package/dist/chunk-4QQG5EEP.js +0 -1
  123. package/dist/chunk-YE4NP3XB.js +0 -1
  124. package/dist/cs-RR3VIKRC.js +0 -1
  125. package/dist/cy-U4JJ5C47.js +0 -1
  126. package/dist/da-ATULGB2M.js +0 -1
  127. package/dist/de-VB543CPC.js +0 -1
  128. package/dist/el-7Y2KXU6N.js +0 -1
  129. package/dist/es-GUV5XIYC.js +0 -1
  130. package/dist/et-SZ6I4Z44.js +0 -1
  131. package/dist/fa-FM6ELEN7.js +0 -1
  132. package/dist/fi-6QQ2M5JI.js +0 -1
  133. package/dist/fr-2SEQSVLR.js +0 -1
  134. package/dist/he-V3EVB7IW.js +0 -1
  135. package/dist/hi-I4QIBK5Q.js +0 -1
  136. package/dist/hr-I5DNEVUU.js +0 -1
  137. package/dist/hu-KTFWBQMF.js +0 -1
  138. package/dist/id-RZWUH426.js +0 -1
  139. package/dist/it-CNQP36V4.js +0 -1
  140. package/dist/ja-JQZOYIHI.js +0 -1
  141. package/dist/ko-6YCWWHFQ.js +0 -1
  142. package/dist/ku-33PM4OWG.js +0 -1
  143. package/dist/localeLoaders-VFQOZMUH.js +0 -1
  144. package/dist/lt-24JO2B7V.js +0 -1
  145. package/dist/lv-HTSDEEAB.js +0 -1
  146. package/dist/ms-PUEZJJ3R.js +0 -1
  147. package/dist/nl-NQPDRSCW.js +0 -1
  148. package/dist/no-3N3MUMSA.js +0 -1
  149. package/dist/pl-YHBEO6ZF.js +0 -1
  150. package/dist/pt-5RPESNZB.js +0 -1
  151. package/dist/ro-XDFXIMHX.js +0 -1
  152. package/dist/ru-BIIALOM5.js +0 -1
  153. package/dist/sk-LHSFRUFT.js +0 -1
  154. package/dist/sl-MPE5TPI3.js +0 -1
  155. package/dist/sr-T3N67KTP.js +0 -1
  156. package/dist/sv-LJWWYUIY.js +0 -1
  157. package/dist/th-E5POGG37.js +0 -1
  158. package/dist/tr-2DCWQ2CY.js +0 -1
  159. package/dist/uk-C3VJP6EA.js +0 -1
  160. package/dist/vi-XVMTKCOL.js +0 -1
  161. package/dist/zh-Hans-RG4CQGBY.js +0 -1
  162. package/dist/zh-Hant-YHNTYPFS.js +0 -1
@@ -1,4 +1,18 @@
1
- import{A as tt,B as Kt,C as uo,D as nt,E as Qt,F as mo,G as ho,a as Je,b as Ie,c as yt,d as jt,e as $n,f as Kn,g as Se,h as Qn,i as Zn,j as Jn,k as xt,l as ze,m as et,n as eo,o as $t,p as ua,q as to,r as no,s as oo,t as ro,u as Ae,v as ao,w as io,x as so,y as lo,z as co}from"../chunk-4QQG5EEP.js";import"../chunk-WUNZCUE6.js";import"../chunk-2JFCDE27.js";import{d as gt}from"../chunk-YPVYZYMH.js";import"../chunk-PBXGWYB4.js";import"../chunk-6VOUTNRV.js";import"../chunk-OJSGMXJS.js";import"../chunk-FBXZWNND.js";import"../chunk-BNLANXXZ.js";import"../chunk-4N5CHKHD.js";import{b as Xn,c as qt,d as qn,n as jn}from"../chunk-GUNNA5LB.js";import"../chunk-M4NGX5NM.js";import"../chunk-EE2CVYFJ.js";import"../chunk-URW7MSCJ.js";import"../chunk-UUIZHJYL.js";import{eb as Wn}from"../chunk-YE4NP3XB.js";import"../chunk-S3VH7IDA.js";import{d as Un,l as Yn}from"../chunk-JBOTRSMY.js";import"../chunk-CRCGO52K.js";function po(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,p=0;for(let u=0;u<r;u+=l)c+=e[u*3],f+=e[u*3+2],p++;a=c/p,o=f/p}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 Ns}from"ogl";function fo(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 A=0;A<a;A++){let R=r[A*3],L=r[A*3+2];R<o&&(o=R),R>i&&(i=R),L<s&&(s=L),L>l&&(l=L)}for(let A of e.stages)o=Math.min(o,A.cx-A.halfX),i=Math.max(i,A.cx+A.halfX),s=Math.min(s,A.cz-A.halfZ),l=Math.max(l,A.cz+A.halfZ);let c=Math.min(130/Math.max(.001,i-o),86/Math.max(.001,l-s)),f=(148-(i-o)*c)/2,p=(104-(l-s)*c)/2,u=A=>f+(A-o)*c,m=A=>p+(A-s)*c,d=Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),y=document.createElement("canvas");y.width=Math.round(148*d),y.height=Math.round(104*d),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 w=document.createElement("canvas");w.width=y.width,w.height=y.height;let E=w.getContext("2d");if(E){E.scale(d,d),E.fillStyle="rgba(214,222,234,.28)";let A=Math.max(1,Math.ceil(a/6e3));for(let R=0;R<a;R+=A)E.fillRect(u(r[R*3])-.6,m(r[R*3+2])-.6,1.2,1.2);E.fillStyle="rgba(236,240,246,.16)",E.strokeStyle="rgba(236,240,246,.55)",E.lineWidth=1;for(let R of e.stages){let L=u(R.cx-R.halfX),b=m(R.cz-R.halfZ),F=R.halfX*2*c,x=R.halfZ*2*c;E.fillRect(L,b,F,x),E.strokeRect(L+.5,b+.5,Math.max(0,F-1),Math.max(0,x-1))}}let C=y.getContext("2d"),D="";return{el:y,update(A,R){if(!A||!C||t.clientWidth>0&&t.clientWidth<560){v.display!=="none"&&(v.display="none"),D="";return}let L=u(A[0]),b=m(A[2]),F=R?Math.atan2(R[2],R[0]):0,x=`${L.toFixed(1)},${b.toFixed(1)},${F.toFixed(2)}`;if(x!==D){if(D=x,v.display="block",C.setTransform(1,0,0,1,0,0),C.clearRect(0,0,y.width,y.height),C.drawImage(w,0,0),C.setTransform(d,0,0,d,0,0),R){let I=C.createRadialGradient(L,b,0,L,b,26);I.addColorStop(0,"rgba(255,255,255,.55)"),I.addColorStop(1,"rgba(255,255,255,0)"),C.fillStyle=I,C.beginPath(),C.moveTo(L,b),C.arc(L,b,26,F-.5,F+.5),C.closePath(),C.fill()}C.fillStyle=n,C.strokeStyle="rgba(10,14,22,.9)",C.lineWidth=1.5,C.beginPath(),C.arc(L,b,3.6,0,Math.PI*2),C.fill(),C.stroke()}},dispose(){y.remove()}}}var Zt=78,vo=18;function bo(){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,Ie,-1],max:[1,yt,-.72]}])for(let l of o){let c=t.length/3,f=l.n[1]+(s.part===2?Math.abs(l.n[0])*(1-jt)/(yt-Ie):0),p=Math.hypot(l.n[0],f,l.n[2]),u=[l.n[0]/p,f/p,l.n[2]/p];for(let[m,d]of l.c.entries()){let y=d.map((v,w)=>s.min[w]+v*(s.max[w]-s.min[w]));s.part===2&&(y[0]*=1-d[1]*(1-jt)),t.push(...y),e.push(...u),n.push(s.part),r.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][m])}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 da}from"ogl";function ma(){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 St=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."),this.renderer=new da({canvas:this.canvas,dpr:ma(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[xt.top[0],xt.top[1],xt.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),e.appendChild(this.canvas),this.lostHandler=r=>{r.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{Camera as ha,Vec3 as Jt}from"ogl";var de=Math.PI/180,en=15*de,tn=80*de,Ne=.12,go=35,nn=1.25,yo=.006,pa=4,He=.82,ot=1/He,fa=.12,va=2;function ba(t,e){return{azimuth:0-t*yo,polar:-e*yo}}function xo(t,e,n){let r=Math.max(va,Math.max(1,e)*fa),a=n*pa;return{minDist:t?Math.min(t.minDist,r):r,maxDist:t?Math.max(t.maxDist,a):a}}var ga=1.5;function ya(t,e,n){let r=Math.max(1,n)*ga;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 xa(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]],p=[-c[0],-c[1],-c[2]],u=[-p[2],0,p[0]],m=Math.hypot(u[0],u[2])||1;u=[u[0]/m,0,u[2]/m];let d=[u[1]*p[2]-u[2]*p[1],u[2]*p[0]-u[0]*p[2],u[0]*p[1]-u[1]*p[0]],y=Math.tan(a*de/2),v=y*(o>0?o:1),w=[0,1,2].map(D=>p[D]+i*v*u[D]+s*y*d[D]);if(w[1]>=-1e-6)return null;let E=(t[1]-f[1])/w[1],C=Math.hypot(w[0],w[1],w[2]);return!(E>0)||E*C>r*Sa?null:[f[0]+w[0]*E,t[1],f[2]+w[2]*E]}var So=3,Sa=4,wo=.72,wa=.6;function Ma(t,e,n){return t!=="auto"?t:n!==null&&e<n*wa?"pan":"orbit"}function Mo(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 Aa=.4;function Pa(t,e,n,r,a,o){let i=[t.center[0],t.center[1],t.center[2]],s=o(i),l=t.fitPoints,c=Mo(r,a);if(!l||l.length<9||!c)return{center:i,distance:s};let{fx:f,fy:p,fz:u,rx:m,rz:d,ux:y,uy:v,uz:w}=c,E=Math.hypot(f,u),C=f/E,D=u/E,A=C*y+D*w,R=Aa*Math.max(1,t.radius);for(let L=0;L<3;L++){let b=1/0,F=-1/0,x=1/0,I=-1/0;for(let W=0;W+2<l.length;W+=3){let N=l[W]-i[0],te=l[W+1]-i[1],X=l[W+2]-i[2],J=s+N*f+te*p+X*u;if(!(J>.001))continue;let M=(N*m+X*d)/(J*e),P=(N*y+te*v+X*w)/(J*n);M<b&&(b=M),M>F&&(F=M),P<x&&(x=P),P>I&&(I=P)}if(!Number.isFinite(b))break;let z=(b+F)/2*s*e,_=Math.abs(A)>.1?(x+I)/2*s*n/A:0,O=z*m+_*C,G=z*d+_*D;if(Math.hypot(i[0]+O-t.center[0],i[2]+G-t.center[2])>R){let W=i[0]-t.center[0],N=i[2]-t.center[2],te=W+O,X=N+G,J=R/Math.hypot(te,X);O=te*J-W,G=X*J-N}i=[i[0]+O,i[1],i[2]+G],s=o(i)}return{center:i,distance:s}}var wt=class{constructor(e,n,r,a){this.fovY=go;this.target=new Jt;this.azimuth=-30*de;this.polar=55*de;this.distance=10;this.azT=-30*de;this.polT=55*de;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 Jt;this.panAnchor=new Jt;this.panLimit=0;this.panBox=null;this.zoomPointResolver=null;this.primaryDragMode="auto";this.overviewDist=null;this.pinchAngle=0;this.camera=new ha(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 p=this.currentPinchAngle(),u=p-this.pinchAngle;u>Math.PI&&(u-=2*Math.PI),u<-Math.PI&&(u+=2*Math.PI),this.pinchAngle=p,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=ba(i,s);this.azT+=l.azimuth,this.polT=Math.max(en,Math.min(tn,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*de;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(en,Math.min(tn,this.polT+(o.key==="ArrowUp"?-i:i)));else if(o.key==="+"||o.key==="=")this.dollyBy(He);else if(o.key==="-"||o.key==="_")this.dollyBy(ot);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*de/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),p=-o*c,u=-i*c;this.targetT.x+=(-e*s+n*p)*a,this.targetT.z+=(-e*l+n*u)*a,this.targetT.y+=n*f*a,this.clampPan(),this.requestRender()}widenPanBox(e){this.panBox=ya(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 Ma(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(So,Math.min(this.maxDist,this.distT*e)),this.minDist=Math.min(this.minDist,Math.max(So,this.distT)),this.requestRender(),this.scaleTargetAbout(i,this.distT/a);return}let s=o&&o.width>0&&o.height>0?xa([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*de/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*de,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*de;let f=this.framedOn(e,s,c),p=f.distance;this.target.set(f.center[0],f.center[1],f.center[2]),this.targetT.copy(this.target),this.distT=p*Math.max(1.05,Math.min(2,o?.margin??nn)),this.envelope=xo(this.envelope,i,p),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*de,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*de/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))*de;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??nn)),this.envelope=xo(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*de/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))*de;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??nn))}framedOn(e,n,r){return Pa(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=Mo(a,o);if(!c)return s;let{fx:f,fy:p,fz:u,rx:m,rz:d,ux:y,uy:v,uz:w}=c,E=Math.tan(r),C=Math.tan(n),D=1;for(let x=0;x<8;x++){let I=(x&1?l.max[0]:l.min[0])-e.center[0],z=(x&2?l.max[1]:l.min[1])-e.center[1],_=(x&4?l.max[2]:l.min[2])-e.center[2],O=I*f+z*p+_*u,G=Math.abs(I*m+_*d),B=Math.abs(I*y+z*v+_*w);D=Math.max(D,G/E-O,B/C-O)}let A=Math.min(s,Math.max(D,i*.35)),R=e.fitPoints;if(!R||R.length<9)return A;let L=0,b=1/(E*wo),F=1/(C*wo);for(let x=0;x+2<R.length;x+=3){let I=R[x]-e.center[0],z=R[x+1]-e.center[1],_=R[x+2]-e.center[2],O=I*f+z*p+_*u,G=Math.abs(I*m+_*d),B=Math.abs(I*y+z*v+_*w);L=Math.max(L,G*b-O,B*F-O)}return Math.min(A*1.5,Math.max(A*.55,L))}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}=Ta(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*Ne,this.polar+=n*Ne,this.distance+=r*Ne,this.target.x+=a*Ne,this.target.y+=o*Ne,this.target.z+=i*Ne,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(en,Math.min(tn,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],p=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:p,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()}},Ca=.1,Ea=.25;function Ta(t,e,n){let r=Math.max(1,e)*1.18,a=n==null?Ea:Math.max(.05,n*Ca),o=Math.max(a,t-r),i=Math.max(o+10,t+r);return{near:o,far:i}}var Mt=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 Ao(t){let e=!1;return n=>{n!==e&&(e=n,n?t.dataset.slReady="1":delete t.dataset.slReady)}}var Ge=2.5,Ra=1.15,rt=12,Be=22,Po=6,Co=9.5,Eo=.9,To=2.2,on=30,rn=4,At=8192;var rl=Be+rn;function Ro(t,e){let n=e*1.4,r=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:Ge};let a=Math.min(1,(t-n)/Math.max(.001,r-n));return{scale:1-a*.4,fade:a*.55,minPixels:Ge+a*(Ra-Ge)}}function _o(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}var _a=12;function Io(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>=_a}import{Geometry as Ia,Mesh as Da,Program as Fa,Transform as ka}from"ogl";var La=.05,Va=.55,Oa=12,za=1.6,Na=1,Ha=2.5,Ga=650,De={height:6,baseRadius:.16,topRadius:.3,fadeInFromM:16,fullByM:40,nearStrength:.6};function Ba(t,e){if(e)return 0;let n=(t-De.fadeInFromM)/(De.fullByM-De.fadeInFromM);return Math.max(De.nearStrength,Math.min(1,n))}var Do=24;function Wa(t){let e=[],n=[],r=[],a=(p,u,m)=>{e.push(...p),n.push(...u),r.push(m)};for(let p=0;p<16;p++){let u=p/16*Math.PI*2,m=(p+1)/16*Math.PI*2,d=C=>[Math.cos(C),0,Math.sin(C)],y=[Math.cos(u)*.012,0,Math.sin(u)*.012],v=[Math.cos(m)*.012,0,Math.sin(m)*.012],w=[Math.cos(u)*.03,1,Math.sin(u)*.03],E=[Math.cos(m)*.03,1,Math.sin(m)*.03];a(y,d(u),0),a(w,d(u),0),a(E,d(m),0),a(y,d(u),0),a(E,d(m),0),a(v,d(m),0)}let l=.16,c=.24,f=.01;for(let p=0;p<48;p++){let u=p/48*Math.PI*2,m=(p+1)/48*Math.PI*2,d=[Math.cos(u)*l,f,Math.sin(u)*l],y=[Math.cos(u)*c,f,Math.sin(u)*c],v=[Math.cos(m)*c,f,Math.sin(m)*c],w=[Math.cos(m)*l,f,Math.sin(m)*l];for(let E of[d,y,v,d,v,w])a(E,[0,1,0],1)}for(let p=0;p<32;p++){let u=p/32*Math.PI*2,m=(p+1)/32*Math.PI*2,d=De.baseRadius,y=De.topRadius,v=[Math.cos(u)*d,0,Math.sin(u)*d],w=[Math.cos(m)*d,0,Math.sin(m)*d],E=[Math.cos(u)*y,1,Math.sin(u)*y],C=[Math.cos(m)*y,1,Math.sin(m)*y],D=[Math.cos(u),0,Math.sin(u)],A=[Math.cos(m),0,Math.sin(m)];a(v,D,2),a(E,D,2),a(C,A,2),a(v,D,2),a(C,A,2),a(w,A,2)}return new Ia(t,{position:{size:3,data:new Float32Array(e)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(r)}})}var Ua=`#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
+ in vec2 position;
3
+ in vec2 uv;
4
+ out vec2 vUv;
5
+ void main() {
6
+ vUv = uv;
7
+ gl_Position = vec4(position, 0.0, 1.0);
8
+ }`,Qa=`#version 300 es
9
+ precision highp float;
10
+ uniform sampler2D tFrame;
11
+ in vec2 vUv;
12
+ out vec4 fragColor;
13
+ void main() {
14
+ fragColor = vec4(texture(tFrame, vUv).rgb, 1.0);
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
2
16
  precision highp float;
3
17
  in vec3 position; in vec3 normal; in float part;
4
18
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform mat3 normalMatrix;
@@ -25,7 +39,7 @@ void main() {
25
39
  float scale = part > 0.5 ? uRingScale : uHeight;
26
40
  vec3 world = uSeat + vec3(position.x, position.y * grow, position.z) * scale;
27
41
  gl_Position = projectionMatrix * modelViewMatrix * vec4(world, 1.0);
28
- }`,Ya=`#version 300 es
42
+ }`,Gs=`#version 300 es
29
43
  precision highp float;
30
44
  in vec3 vNormal; in float vPart; in float vAlong;
31
45
  uniform vec3 uColor; uniform float uRingAlpha; uniform vec3 uBeamColor; uniform float uBeam;
@@ -43,15 +57,25 @@ void main() {
43
57
  float key = max(dot(normalize(vNormal), normalize(vec3(-0.4, 0.7, 0.6))), 0.0);
44
58
  vec3 c = uColor * (0.55 + 0.5 * key) + vec3(0.12) * pow(key, 12.0);
45
59
  fragColor = vec4(c, 1.0);
46
- }`;function Xa(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 an(t){return Math.max(Va,Math.min(Oa,t*La))}function qa(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 Fo(t,e,n=[.24,.74,1]){let r=qa(n),a=new ka,o=Wa(t),i=new Map,s=(l,c)=>{let f=new Fa(t,{vertex:Ua,fragment:Ya,uniforms:{uSeat:{value:l},uHeight:{value:1},uLift:{value:0},uRingScale:{value:1},uBeamHeight:{value:De.height},uBeam:{value:0},uBeamColor:{value:r},uColor:{value:e},uRingAlpha:{value:.85}},transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1}),p=new Da(t,{geometry:o,program:f});return p.frustumCulled=!1,p.setParent(a),{mesh:p,program:f,seat:l,start:c}};return{root:a,setSeats(l,c,f){let p=new Set(l.slice(0,Do).map(u=>u.id));for(let[u,m]of i)p.has(u)||(m.mesh.setParent(null),i.delete(u));for(let u of l.slice(0,Do))i.has(u.id)||i.set(u.id,s(u.position,f?c:-1/0))},update(l,c,f,p=!1){let u=!1;for(let m of i.values()){let d=c[0]-m.seat[0],y=c[1]-m.seat[1],v=c[2]-m.seat[2],w=Math.hypot(d,y,v);m.mesh.visible=!f&&w>(p?Na:Ha);let E=an(w),C=Math.max(0,Math.min(1,(l-m.start)/Ga));C<1&&(u=!0),m.program.uniforms.uHeight.value=E,m.program.uniforms.uRingScale.value=Math.min(E,za),m.program.uniforms.uLift.value=p?1:1-Xa(C),m.program.uniforms.uBeam.value=Ba(w,p),m.program.uniforms.uRingAlpha.value=.55+.4*(C<1?Math.sin(C*Math.PI):0)}return u},dispose(){for(let l of i.values())l.mesh.setParent(null);i.clear(),o.remove()}}}var at="#ffffff",ko="#0b1220",it=6,ja=80,Lo=14,Vo=88,Oo=20,zo={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}},$a=640,Ka=.8,Qa=11,Za="3px 7px",Ja="2px 5px",No="rgba(10,14,22,.62)",ei="#f4f7fb",Ho=5,Go=2,ti=6,st=new Set(["row","seat","access"]),sn={stage:6,gate:5,floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},We={row:{x:66,y:20},seat:{x:52,y:22}},Fe=Un,ln=t=>Yn(t);function ke(t,e){let n=ln(t),r=ln(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function ni(t){let e=Fe(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&&ke(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:ke(a,r)}}var oi=30;function cn(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 ri(t,e=[.04,.06,.1],n=!0){let r=ln(e)<.42,a=r?"#f4f7fb":"#0b1220",o=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",i=n?cn(o,e):e,s=Fe(t),l=n?7:4.5,c=s&&ke(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 ai(t,e=[.04,.06,.1]){let n=cn(No,e),r=Fe(t);return{ink:r&&ke(r,n)>=4.5?t:ei,backing:No}}var ii=.8,Ue=20,si=14,li=60,ci='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Pt=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||ci,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=zo[e].size;return!this.narrowStage||st.has(e)?n:Math.max(Qa,n*Ka)}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<$a;let s=oo(a,o,{hasZoneLabels:this.labels.some(b=>b.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"),s.add("access")),!this.forcedDense&&this.overviewDistance!==null&&a>this.overviewDistance*ii&&(s.delete("section"),s.delete("ga")),s.has("section")&&this.labels.some(b=>b.kind==="section")&&s.delete("zone");let l=[];for(let b of this.labels){let F=b.kind==="annotation"&&!!b.venueIcon;if(!s.has(b.kind)&&!F&&!(b.kind==="seat"&&this.selectedSeatLabelIds.has(b.id)))continue;let x=b.kind==="seat"&&i&&this.selectedSeatLabelIds.has(b.id)?b.pinBase:void 0,I=x&&i?[x[0],x[1]+an(Math.hypot(x[0]-i[0],x[1]-i[1],x[2]-i[2])),x[2]]:b.anchor,z=Ae(e,I,n,r);if(!z.visible)continue;let _=st.has(b.kind),O=this.sizeFor(b.kind),G=b.kind==="access"?Ue:so(b.text,O,!_)+(_?Ho*2:0)+((this.wheelchairFree.get(b.id)??0)>0?oi:0);if(b.kind==="access"&&b.seatWidthM!==void 0&&Kt(e,b.anchor,b.seatWidthM,n)<si||b.kind==="seat"&&b.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(b.id)&&Kt(e,b.anchor,b.seatWidthM,n)<Math.max(22,G))continue;let B=ro(z,G/2,O/2+(_?Go:4),n,r),W=i?Math.hypot(b.anchor[0]-i[0],b.anchor[1]-i[1],b.anchor[2]-i[2]):1;l.push({label:b,screen:B,focus:co(B,W,n,r),halfWidth:G/2,...this.selectedSeatLabelIds.has(b.id)?{priority:1}:{}})}let c=no(l.filter(b=>b.label.kind==="floor"),n),f=[...l.filter(b=>!st.has(b.label.kind)&&b.label.kind!=="floor"),...c],p=lo(n),u=l.filter(b=>b.label.kind==="seat"&&this.selectedSeatLabelIds.has(b.label.id)),m=tt(u,We.seat.x,We.seat.y,p.seat);this.placePinHeads(u.filter(b=>b.label.pinBase&&!m.includes(b)).map(b=>b.screen));let d=ao(f,Vo,Oo,b=>sn[b.label.kind]??0).filter(b=>!m.some(F=>io(b,F,Vo,Oo))),y=tt(l.filter(b=>b.label.kind==="access"),Ue,Ue,li,[...d,...m]),v=tt(l.filter(b=>b.label.kind==="row"),We.row.x,We.row.y,p.row,[...d,...m,...y]),w=this.seatNumberRow!==void 0||this.seatNumberSeat!==null,E=tt(l.filter(b=>b.label.kind==="seat"&&!this.selectedSeatLabelIds.has(b.label.id)&&(this.seatNumberSeat!==null?b.label.id===this.seatNumberSeat:!w||this.seatNumberRow!==null&&b.label.rowId===this.seatNumberRow)),We.seat.x,We.seat.y,w?ja:p.seat-m.length,[...d,...m,...y,...v]),C=[...d,...y,...v,...m,...E],D=new Set(C.map(b=>b.label.id));for(let{label:b,screen:F}of C){let I=this.nodeFor(b).style;I.display=b.kind==="access"?"flex":b.kind==="gate"?"inline-flex":"";let z=!!b.pinBase&&this.selectedSeatLabelIds.has(b.id);I.transform=z?`translate(-50%, -100%) translate(${F.x.toFixed(1)}px, ${(F.y-it).toFixed(1)}px)`:`translate(-50%, -50%) translate(${F.x.toFixed(1)}px, ${F.y.toFixed(1)}px)`}let R=C.filter(({label:b})=>!st.has(b.kind)).sort((b,F)=>sn[F.label.kind]-sn[b.label.kind]||b.screen.depth-F.screen.depth||b.focus-F.focus).flatMap(({label:b})=>{let F=this.nodes.get(b.id);return F&&F.style.display!=="none"?[{node:F,box:F.getBoundingClientRect()}]:[]}),L=[];for(let{node:b,box:F}of R)L.some(I=>F.left<I.right+3&&F.right+3>I.left&&F.top<I.bottom+3&&F.bottom+3>I.top)?b.style.display="none":L.push(F);for(let[b,F]of this.nodes)D.has(b)||(F.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 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 w=document.createElement("span"),E=w.style;E.position="absolute",E.left="50%",E.bottom=`-${it}px`,E.transform="translateX(-50%)",E.borderLeft=`${it}px solid transparent`,E.borderRight=`${it}px solid transparent`,E.borderTop=`${it}px solid ${at}`,n.appendChild(w)}n.setAttribute("data-label-kind",e.kind),n.toggleAttribute("data-selected-seat",r);let s=zo[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=st.has(e.kind),f=!c,p=ri(e.color??this.opts.ink,this.opts.backgroundRgb,!0),u=c?ai(e.color??this.opts.ink,this.opts.backgroundRgb):p;l.color=r?ko:u.ink,l.background=r?at:u.backing,l.border=r?`1px solid ${at}`:f?`1px solid ${p.border}`:"",l.borderRadius=r||f?"999px":`${ti}px`;let m=this.narrowStage?Ja:Za;l.padding=r||f?m:`${Go}px ${Ho}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 d=this.opts.backgroundRgb??[.04,.06,.1],y=Fe(r?ko:u.ink)??[1,1,1],v=cn(r?at:u.backing,d);return n.dataset.qualityContrast=ke(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=jn(n);if(!r)return;let a=e.style;a.display="inline-flex",a.alignItems="center",a.gap="5px";let o=16,i=qn.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="${Xn[r.group]}" stroke="${qt}" stroke-width="1.5"/><path transform="translate(${12-12*i} ${12-12*i}) scale(${i})" d="${r.solid}" fill="${qt}"/></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=gt("wheelchair",{size:11}),e.append(o)}e.dataset.qualityContrast=ke([1,1,1],Fe("#0f172a")).toFixed(3)}dressSectionTag(e,n,r){let a=n.tint?ni(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=`${gt("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?gt(n.icon,{size:Ue-6}):"",e.setAttribute("role","img"),e.setAttribute("aria-label",n.text);let r=e.style;return r.width=`${Ue}px`,r.height=`${Ue}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=ke(Fe(n.ink??"#ffffff")??[1,1,1],Fe(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=`${Lo}px`,r.height=`${Lo}px`,r.borderRadius="50%",r.background=at,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 ui=1;var di=new Set(["floor","stage","zone","section","ga","booth","annotation"]);function mi(t){return t.every(e=>Number.isFinite(e))}function hi(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 Bo(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function Le(t){return Math.round(t*1e4)/1e4}function pi(t){if(t)return{box:{x:Le(t.box.x),y:Le(t.box.y),width:Le(t.box.width),height:Le(t.box.height)},horizontalFillRatio:Le(t.horizontalFillRatio),verticalFillRatio:Le(t.verticalFillRatio),visibleAreaRatio:Le(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function Pe(t,e,n){return n.length?{code:t,message:e,count:n.length,samples:n.slice(0,20)}:null}function un(t){let e=t.labels.filter(s=>s.visible&&s.screenBox),n=e.filter(s=>di.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)hi(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=[Pe("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Pe("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Pe("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Pe("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}`}]),Pe("camera-invalid","The capture camera must have a finite physical pose",mi(o)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Pe("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}]),Pe("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`}]),Pe("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}))),Pe("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}))),Pe("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:pi(t.framing)},metrics:{minimumHierarchyFontPx:Bo(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Bo(n.map(s=>s.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:i}}function Wo(t,e,n){t.fill(0);for(let r=0;r<Math.min(n,e.length);r++)t[e[r]]=1}import{Geometry as lt,Mesh as ct,Program as zi,Texture as Ni,Transform as rr}from"ogl";import{Program as Ve}from"ogl";var Ct=`
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=`
47
61
  float chairWeight(float depth) {
48
62
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
49
- }`,Uo=`
50
- float occupantWeight(float depth) {
51
- float nearWeight = smoothstep(${Eo.toFixed(1)}, ${To.toFixed(1)}, depth);
52
- float farWeight = 1.0 - smoothstep(${Po.toFixed(1)}, ${Co.toFixed(1)}, depth);
53
- return nearWeight * farWeight;
54
- }`,dn=`
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
+ vec3 tipUpPad(vec3 p, float halfWidth, float up) {
67
+ if (up < 0.5) return p;
68
+ float hingeZ = (${Xo.toFixed(2)}) * halfWidth + ${jo.toFixed(2)};
69
+ float dy = p.y - ${Mn.toFixed(2)};
70
+ float dz = p.z - hingeZ;
71
+ return vec3(p.x,
72
+ ${Mn.toFixed(2)} + dz * TIP_SIN + dy * TIP_COS,
73
+ hingeZ + dz * TIP_COS - dy * TIP_SIN);
74
+ }
75
+ vec3 tipUpNormal(vec3 n, float up) {
76
+ if (up < 0.5) return n;
77
+ return vec3(n.x, n.z * TIP_SIN + n.y * TIP_COS, n.z * TIP_COS - n.y * TIP_SIN);
78
+ }`,$n=`
55
79
  float glyphEq(float glyph, float expected) {
56
80
  return 1.0 - step(0.25, abs(glyph - expected));
57
81
  }
@@ -84,7 +108,9 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
84
108
  else if (bench > 0.5) { p.x *= 1.10; p.z *= 0.82; }
85
109
  } else if (partId < 2.5) {
86
110
  if (stool > 0.5) return vec3(0.0);
87
- if (dining > 0.5) { p.x *= 0.78; p.y = 0.45 + (p.y - 0.45) * 0.82; }
111
+ // A dining chair's back is a panel held clear of the seat on its two rear
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 = ${We.toFixed(2)} - (${We.toFixed(2)} - p.y) * ${Yo.toFixed(2)}; }
88
114
  else if (folding > 0.5) { p.x *= 0.90; p.y = 0.45 + (p.y - 0.45) * 0.72; }
89
115
  else if (bench > 0.5) { p.x *= 1.10; p.y = 0.45 + (p.y - 0.45) * 0.62; }
90
116
  } else if (partId < 3.5) {
@@ -96,11 +122,31 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
96
122
  if (max(max(dining, folding), bench) < 0.5) return vec3(0.0);
97
123
  if (folding > 0.5) p.x *= 0.88;
98
124
  if (bench > 0.5) p.x *= 1.10;
99
- } else if (partId > 9.5 && stool > 0.5) {
100
- p.y += 0.16;
125
+ if (dining > 0.5) {
126
+ // Slim legs set in under the seat. The rear pair stand behind the pad and
127
+ // carry on up into the foot of the back, so the back is held by the
128
+ // chair's own frame and daylight shows between it and the seat.
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
+ else {
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
+ }
135
+ }
136
+ } else if (partId < 6.5) {
137
+ // The spine joins the back to the seat, so it goes where the back goes:
138
+ // as wide as that furniture's back, and gone where there is no back.
139
+ // A dining chair's back stands on its rear legs instead (see the legs).
140
+ if (max(stool, dining) > 0.5) return vec3(0.0);
141
+ if (folding > 0.5) p.x *= 0.90;
142
+ else if (bench > 0.5) p.x *= 1.10;
143
+ } else if (partId < 7.5) {
144
+ // Armrest standards are fixed auditorium seating; every other furniture
145
+ // family either has its own arms or has none.
146
+ if (generic < 0.5) return vec3(0.0);
101
147
  }
102
148
  return p;
103
- }`,fi=1.5,Ye=`
149
+ }`,pl=1.5,st=`
104
150
  uniform vec4 uSeeThrough; // xyz = the seats looked at, w = cone radius there; 0 = off
105
151
  bool seeThroughCut(vec3 p, vec3 eye) {
106
152
  if (uSeeThrough.w <= 0.0) return false;
@@ -109,11 +155,11 @@ bool seeThroughCut(vec3 p, vec3 eye) {
109
155
  if (len < 1.0) return false;
110
156
  vec3 dir = axis / len;
111
157
  float t = dot(p - eye, dir);
112
- if (t <= 0.0 || t > len - ${fi.toFixed(2)}) return false;
158
+ if (t <= 0.0 || t > len - ${pl.toFixed(2)}) return false;
113
159
  vec3 onLine = eye + dir * t;
114
160
  if (p.y < onLine.y - 0.25) return false;
115
161
  return length(p - onLine) < uSeeThrough.w * t / len;
116
- }`,vi=`#version 300 es
162
+ }`,fl=`#version 300 es
117
163
  precision highp float;
118
164
  in vec3 position;
119
165
  in vec3 normal;
@@ -151,13 +197,60 @@ void main() {
151
197
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
152
198
  vColor = color;
153
199
  gl_Position = projectionMatrix * mv;
154
- }`,Yo=`
200
+ }`,oi=`
155
201
  bool roomWallHidden(float material, vec3 normalWorld, vec3 posWorld, vec3 eye, vec2 roomCentre) {
156
202
  if (abs(material - 6.0) > 0.5) return false;
157
203
  vec3 n = normalize(normalWorld);
158
204
  if (abs(n.y) > 0.5) return true;
159
205
  return dot(n.xz, eye.xz - posWorld.xz) * dot(n.xz, roomCentre - posWorld.xz) <= 0.0;
160
- }`,bi=`#version 300 es
206
+ }`,ri=`
207
+ uniform vec3 uTop;
208
+ uniform vec3 uBottom;
209
+ uniform float uSky; // 1 for an open-air venue, see SceneModel.outdoor
210
+ uniform vec3 uZenith;
211
+ uniform vec3 uHorizon;
212
+ // uv: the pixel's place on screen, 0..1. dir: its line of sight, used only under a sky.
213
+ vec3 backdrop(vec2 uv, vec3 dir) {
214
+ vec3 col = mix(uBottom, uTop, uv.y);
215
+ vec2 c = uv - 0.5;
216
+ col *= 1.0 - dot(c, c) * 0.16; // soft vignette
217
+ // Above the horizon an open-air venue has a sky, not the chart's flat
218
+ // backdrop: from a seat, the stands used to meet a black void. Below the
219
+ // horizon (every overview) nothing changes.
220
+ if (uSky > 0.5) {
221
+ vec3 sky = mix(uHorizon, uZenith, pow(clamp(dir.y, 0.0, 1.0), 0.45));
222
+ // Reaching a little below the horizon too: from a low seat the far stands
223
+ // top out right at it, and a sliver of backdrop showed as a dark band.
224
+ // Every overview looks further down than this (at least ~24 degrees).
225
+ col = mix(col, sky, smoothstep(-0.22, 0.03, dir.y));
226
+ }
227
+ return col;
228
+ }`,vl=`
229
+ // A fixed 4 by 4 threshold pattern: a net thinned by it reads as a fine mesh,
230
+ // where random grain would read as dirt.
231
+ float orderedThreshold(vec2 pixel) {
232
+ const float m[16] = float[16](0.0, 8.0, 2.0, 10.0, 12.0, 4.0, 14.0, 6.0, 3.0, 11.0, 1.0, 9.0, 15.0, 7.0, 13.0, 5.0);
233
+ ivec2 i = ivec2(mod(pixel, 4.0));
234
+ return (m[i.x + i.y * 4] + 0.5) / 16.0;
235
+ }
236
+ const float NET_MESH_M = 0.12; // one mesh of a goal net
237
+ const float NET_CORD = 0.07; // half a cord's width, in meshes (drawn heavier than life)
238
+ const float NET_VEIL = 0.3; // how much of a distant net shows
239
+ // place: the point's place on its panel, metres (carried where a colour would be).
240
+ float netShown(vec2 place) {
241
+ vec2 mesh = place / NET_MESH_M;
242
+ vec2 w = fwidth(mesh); // meshes per pixel
243
+ vec2 toCord = 0.5 - abs(fract(mesh) - 0.5);
244
+ vec2 cord = 1.0 - smoothstep(NET_CORD - w, NET_CORD + w, toCord);
245
+ // Cords while a mesh is a dozen pixels or more; a veil once it is under six.
246
+ float crisp = 1.0 - smoothstep(0.08, 0.16, max(w.x, w.y));
247
+ return mix(NET_VEIL, max(cord.x, cord.y), crisp);
248
+ }
249
+ // A part a few centimetres thick: in full while a pixel covers 2.5 cm of it or
250
+ // less, gone by 4.5. pixelM: the world size of this pixel, metres.
251
+ float slenderShown(float pixelM) {
252
+ return 1.0 - smoothstep(0.025, 0.045, pixelM);
253
+ }`,bl=`#version 300 es
161
254
  precision highp float;
162
255
  in vec3 vColor;
163
256
  in vec3 vNormalWorld;
@@ -167,6 +260,8 @@ in vec3 vPosWorld;
167
260
  in float vDim;
168
261
  in float vMaterial;
169
262
  uniform vec3 uKeyDir; // WORLD space, unit, points at the light
263
+ uniform vec3 uKeyColor; // the look's tint of the key light (1 = white)
264
+ uniform vec3 uAmbientColor; // ...and of the ambient and fill
170
265
  uniform float uStructureDetail;
171
266
  uniform float uRoughness;
172
267
  uniform vec3 uDeckColor;
@@ -176,9 +271,12 @@ uniform sampler2D tVenueShadow;
176
271
  uniform mat4 uShadowMatrix;
177
272
  uniform vec3 cameraPosition;
178
273
  uniform vec2 uRoomCentre;
274
+ uniform vec2 uViewport; // drawing buffer size, pixels
179
275
  out vec4 fragColor;
180
- ${Yo}
181
- ${Ye}
276
+ ${oi}
277
+ ${st}
278
+ ${ri}
279
+ ${vl}
182
280
  // Stable world-space variation; no textures or per-frame random grain.
183
281
  float turfHash(vec2 p) {
184
282
  vec3 q = fract(vec3(p.xyx) * 0.1031);
@@ -219,6 +317,36 @@ void main() {
219
317
  if (vDim > 0.5) discard;
220
318
  if (roomWallHidden(vMaterial, vNormalWorld, vPosWorld, cameraPosition, uRoomCentre)) discard;
221
319
  if (seeThroughCut(vPosWorld, cameraPosition)) discard;
320
+ // Stage light (material 12, stageDressing.ts): the drape behind a stage and
321
+ // the lamps along it. It is light, not a surface: it is drawn in exactly its
322
+ // own colour, whatever the venue's rig does, and only from the side it faces,
323
+ // so the overview from behind a stage still looks over a low backdrop.
324
+ if (abs(vMaterial - 12.0) < 0.5) {
325
+ if (dot(vNormalWorld, cameraPosition - vPosWorld) <= 0.0) discard;
326
+ fragColor = vec4(vColor, 1.0);
327
+ return;
328
+ }
329
+ // A step nosing (material 7, see sectionAisles.ts) is a 5 cm strip. It is
330
+ // drawn in full only while a pixel covers about a centimetre of it or less,
331
+ // so it is four or five pixels deep, and it is gone by three: a short
332
+ // screen-door band between the two, never a thin line. Drawn at every
333
+ // distance, the first nosing thinned to a dash on every step and made a
334
+ // zig-zag down each section edge. The tread it lies on is underneath, so a
335
+ // dropped fragment shows the plain step.
336
+ if (abs(vMaterial - 7.0) < 0.5) {
337
+ float nosingPixel = max(length(dFdx(vPosWorld)), length(dFdy(vPosWorld)));
338
+ float nosingShown = 1.0 - smoothstep(0.011, 0.016, nosingPixel);
339
+ float nosingStipple = fract(sin(dot(gl_FragCoord.xy, vec2(12.9898, 78.233))) * 43758.5453);
340
+ if (nosingStipple >= nosingShown) discard;
341
+ }
342
+ // Sport fittings: a slender part thins out like a nosing, a net is cords up
343
+ // close and a veil further off (see FITTINGS_GLSL).
344
+ bool net = abs(vMaterial - 10.0) < 0.5;
345
+ if (abs(vMaterial - 11.0) < 0.5) {
346
+ float shown = slenderShown(max(length(dFdx(vPosWorld)), length(dFdy(vPosWorld))));
347
+ if (fract(sin(dot(gl_FragCoord.xy, vec2(12.9898, 78.233))) * 43758.5453) >= shown) discard;
348
+ }
349
+ if (net && orderedThreshold(gl_FragCoord.xy) >= netShown(vColor.rg)) discard;
222
350
  // Row treads (material 3) and risers (material 2) are chart truth: the
223
351
  // stepped deck IS the stand, at every distance. What must not survive at
224
352
  // whole-venue scale is the risers' darker shade \u2014 hundreds of sub-pixel dark
@@ -236,6 +364,8 @@ void main() {
236
364
  // Risers are baked at 0.72 of their tread (see tiers.ts bandColors); lift
237
365
  // them back to the tread colour as detail fades out.
238
366
  vec3 vColorRung = vColor * mix(mix(1.0 / 0.72, 1.0, uStructureDetail), 1.0, 1.0 - riser);
367
+ // A net's vertex colour is its place on the panel, not a colour.
368
+ if (net) vColorRung = vec3(0.90, 0.92, 0.95);
239
369
  // Concrete remains visible at overview instead of painting the entire
240
370
  // seating deck like upholstery. Keep a category tint for navigation;
241
371
  // filtering retains its existing shell color cues.
@@ -257,6 +387,22 @@ void main() {
257
387
  * mix(0.10, 0.055, concreteSurface) * fine;
258
388
  vColorRung *= 1.0 + variation;
259
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
+ }
260
406
  // Unresolved row faces need the same lighting, not merely the same paint:
261
407
  // alternating vertical/horizontal normals otherwise recreate a moire comb.
262
408
  float rowOverview = max(tread, riser) * (1.0 - uStructureDetail);
@@ -275,14 +421,17 @@ void main() {
275
421
  // The fill keeps the turned faces from going charcoal: at 0.10 a wall facing
276
422
  // away from the sun kept about half its colour, and the walls under every
277
423
  // tier and box read as dark blocks (owner, 2026-09-24).
278
- vec3 base = vColorRung * (0.34 + 0.26 * hemi) * mix(0.72, 1.0, visibility) + vColorRung * key * 0.60 + vColorRung * fill * 0.26;
424
+ // The look tints the light, never the surface: the same concrete under an
425
+ // amber house and under floodlights (see looks.ts). White for no look.
426
+ vec3 base = vColorRung * ((0.34 + 0.26 * hemi) * mix(0.72, 1.0, visibility) * uAmbientColor
427
+ + key * 0.60 * uKeyColor + fill * 0.26 * uAmbientColor);
279
428
  float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
280
429
  // Material 1 is a powered display and keeps its authored emission treatment.
281
430
  // Every architectural material uses the venue roughness token; 0.78 maps to
282
431
  // exactly the historical rim strength so an unthemed chart does not shift.
283
432
  float poweredMaterial = 1.0 - step(0.5, abs(vMaterial - 1.0));
284
433
  float sheen = mix(clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0), 1.0, poweredMaterial);
285
- 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;
286
435
  base += vec3(0.26, 0.31, 0.38) * fres * 0.16 * sheen * (1.0 - rowOverview) * concreteSheen; // cool rim, restrained
287
436
  // Bright, saturated authored screen faces should read as powered displays,
288
437
  // not painted slabs. Vertex colour is deliberately the material signal here:
@@ -308,9 +457,18 @@ void main() {
308
457
  + vec3(0.62, 0.46, 0.20) * band * 0.28
309
458
  + vec3(0.20, 0.10, 0.34) * focalHalo;
310
459
  base = mix(base, display, poweredDisplay * verticalFace * 0.92);
460
+ // The site's open land (material 8 at the paving, rising to 9 at its outer
461
+ // edge: bounds.ts emitSite) dissolves into the backdrop behind it, so the
462
+ // venue stands on ground that has no rim. Matched to the backdrop pixel for
463
+ // pixel: a rim painted one fixed colour showed as a pale disc.
464
+ if (vMaterial > 7.5 && vMaterial < 9.5) {
465
+ float out_ = smoothstep(0.0, 1.0, clamp(vMaterial - 8.0, 0.0, 1.0));
466
+ base = mix(base, backdrop(gl_FragCoord.xy / uViewport, normalize(vPosWorld - cameraPosition)), out_);
467
+ }
311
468
  fragColor = vec4(base, 1.0);
312
- }`,Xo=`
313
- ${dn}
469
+ }`,ii=`
470
+ ${$n}
471
+ ${Yn}
314
472
  vec4 seatSurface(vec3 source, float radius) {
315
473
  vec4 origin = modelViewMatrix * vec4(iOffset, 1.0);
316
474
  if (iPhysicalSeat < 0.5) {
@@ -324,12 +482,13 @@ vec4 seatSurface(vec3 source, float radius) {
324
482
  if (surface < 0.5) return origin;
325
483
  vec3 p = glyphChairPosition(source, surface, iGlyph);
326
484
  p.xz *= iChairWidth;
327
- if (surface > 1.5) p.z -= max(p.y - ${Ie.toFixed(2)}, 0.0) * ${Je.toFixed(2)} * glyphBackRake(iGlyph);
485
+ if (surface < 1.5) p = tipUpPad(p, iChairWidth, iTipUp);
486
+ if (surface > 1.5) p.z -= max(p.y - ${Le.toFixed(2)}, 0.0) * ${vt.toFixed(2)} * glyphBackRake(iGlyph);
328
487
  float c = cos(iYaw), s = sin(iYaw);
329
488
  vec3 rotated = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
330
489
  return modelViewMatrix * vec4(iOffset + rotated, 1.0);
331
490
  }
332
- `,gi=`#version 300 es
491
+ `,gl=`#version 300 es
333
492
  precision highp float;
334
493
  in float surface;
335
494
  in float iYaw;
@@ -343,6 +502,7 @@ in vec3 iColor; // per-instance state colour (resolved CPU-side)
343
502
  in float iMaxRadius; // per-instance world-radius ceiling (seat pitch derived)
344
503
  in float iHasChair;
345
504
  in float iPhysicalSeat;// 1 = chair; 0 = empty wheelchair bay
505
+ in float iTipUp; // 1 = an empty tip-up seat, drawn folded against its back
346
506
  in vec3 iRing; // accommodation ring colour; (0,0,0) = not accessible
347
507
  in float iFloor; // owning floor index
348
508
  in float iSection; // owning section index, -1 = none
@@ -369,9 +529,9 @@ out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
369
529
  out float vPhysicalSeat;
370
530
  out float vPixelRadius;
371
531
  uniform vec3 cameraPosition;
372
- ${Ct}
373
- ${Xo}
374
- ${Ye}
532
+ ${Zt}
533
+ ${ii}
534
+ ${st}
375
535
  void main() {
376
536
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
377
537
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
@@ -393,8 +553,9 @@ void main() {
393
553
  mv = seatSurface(position, r);
394
554
  // Match the shell's non-uniform width/depth scale before its back rake.
395
555
  vec3 n = vec3(normal.x / iChairWidth, normal.y, normal.z / iChairWidth);
396
- if (surface > 1.5) n.y += n.z * ${Je.toFixed(2)} * glyphBackRake(iGlyph);
556
+ if (surface > 1.5) n.y += n.z * ${vt.toFixed(2)} * glyphBackRake(iGlyph);
397
557
  n = normalize(n);
558
+ if (surface > 0.5 && surface < 1.5) n = tipUpNormal(n, iTipUp);
398
559
  vSeatNormal = vec3(n.x * cos(iYaw) + n.z * sin(iYaw), n.y, -n.x * sin(iYaw) + n.z * cos(iYaw));
399
560
  vSeatHeight = position.y;
400
561
  vSeatSurface = step(1.5, surface);
@@ -405,18 +566,20 @@ void main() {
405
566
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
406
567
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
407
568
  gl_Position = projectionMatrix * mv;
408
- }`,qo=`
569
+ }`,ai=`
409
570
  float seatSilhouette(vec2 uv, float physical) {
410
571
  // Solid furniture owns its silhouette in geometry. Only empty bays need
411
572
  // a fragment mask; cutting physical faces would open holes in the volume.
412
573
  return mix(max(abs(uv.x), abs(uv.y)), 0.0, physical);
413
574
  }
414
- `,yi=`#version 300 es
575
+ `,yl=`#version 300 es
415
576
  precision highp float;
416
577
  in vec3 vSeatNormal;
417
578
  in float vSeatHeight;
418
579
  in float vSeatSurface;
419
580
  uniform vec3 uKeyDir;
581
+ uniform vec3 uKeyColor; // the look's light, at the seats' share (looks.ts)
582
+ uniform vec3 uAmbientColor;
420
583
  in vec2 vUv;
421
584
  in vec3 vColor;
422
585
  in float vBudget;
@@ -431,7 +594,7 @@ uniform float uSeatDetail; // 0 for venue/area overview; 1 in section/row/sea
431
594
  uniform vec3 uFadeColor;
432
595
  uniform float uRoughness;
433
596
  out vec4 fragColor;
434
- ${qo}
597
+ ${ai}
435
598
  void main() {
436
599
  if (vDim > 0.5) discard;
437
600
  // Same screen-door dissolve as the structure rung (uStructureDetail): the
@@ -452,7 +615,15 @@ void main() {
452
615
  float fill = max(dot(N, normalize(vec3(-uKeyDir.x, 0.25, -uKeyDir.z))), 0.0);
453
616
  float ao = mix(0.58, 1.0, clamp(vSeatHeight / 0.92, 0.0, 1.0));
454
617
  float partShade = mix(1.10, 0.80, vSeatSurface);
455
- vec3 c = vColor * (partShade * ao * (0.60 + 0.30 * hemi) + key * 0.28 + fill * 0.16);
618
+ vec3 c = vColor * (partShade * ao * (0.60 + 0.30 * hemi) * uAmbientColor + key * 0.28 * uKeyColor + fill * 0.16 * uAmbientColor);
619
+ // The far seat is two boxes, and a box face is one flat value. Each face
620
+ // darkens toward its own edges instead, so the pad and the back read as
621
+ // cushions and the row matches the rounded near chair it hands over to (see
622
+ // seatChair.ts) without a single extra triangle. Only once a seat is several
623
+ // pixels across: below that the falloff would be sub-pixel noise.
624
+ vec2 edge = vUv * vUv;
625
+ float cushion = (1.0 - edge.x * edge.x) * (1.0 - edge.y * edge.y);
626
+ c *= mix(1.0, mix(0.78, 1.06, cushion), vPhysicalSeat * smoothstep(3.0, 7.0, vPixelRadius));
456
627
  c = mix(c, uFadeColor, uSeatFade);
457
628
  // Accommodation ring \u2014 the 3D echo of the coloured ring 2D draws around every
458
629
  // accessible seat. Painted INSIDE the dot's own radius rather than outside it,
@@ -496,11 +667,11 @@ void main() {
496
667
  c = mix(c, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
497
668
  }
498
669
  fragColor = vec4(c, alpha);
499
- }`,xi=`#version 300 es
670
+ }`,xl=`#version 300 es
500
671
  precision highp float;
501
672
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
502
673
  in vec3 normal;
503
- in float part; // 0..5 furniture modules, 10 body, 11 head
674
+ in float part; // 0..7 furniture modules (see CHAIR_PART)
504
675
  in vec3 iOffset; // per-instance world deck point (identical to the dot's)
505
676
  in vec3 iColor; // per-instance state colour
506
677
  in float iRadius; // per-instance horizontal half-width, world metres
@@ -508,9 +679,11 @@ in float iYaw; // per-instance facing, radians (local +Z -> facing dir)
508
679
  in vec3 iRing; // accommodation ring colour; (0,0,0) = not accessible
509
680
  in float iFloor;
510
681
  in float iSection; // owning section index, -1 = none
511
- in float iSeed; // <0 = seat is empty; else per-person hash in [0,1)
682
+ in float iTaken; // 1 = sold or held: not for sale
512
683
  in float iPhysicalSeat;// 1 = chair; 0 = empty wheelchair bay
513
684
  in float iGlyph; // stable SEAT_GLYPH_ORDER index
685
+ in vec4 iArmrests; // xy / zw = world offsets (x, z) of the two armrests; 0 = none
686
+ in float iTipUp; // 1 = an empty tip-up seat, drawn folded against its back
514
687
  uniform mat4 modelViewMatrix;
515
688
  uniform mat4 projectionMatrix;
516
689
  uniform float uChairFull;
@@ -529,14 +702,14 @@ out float vHeight; // local height in metres, for the vertical occlusion ramp
529
702
  out vec3 vRing;
530
703
  out float vDim;
531
704
  out float vSectionFade;
532
- out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
533
- out vec3 vOccupantTint;
534
705
  out float vTaken; // 1 = sold or held: not for sale
535
- ${Ct}
536
- ${Uo}
537
- ${dn}
706
+ out vec3 vLocal; // x/z in chair half-widths, y in metres: where on the chair
707
+ out vec3 vViewWorld;// from the surface to the eye, world space (not unit)
708
+ ${Zt}
709
+ ${$n}
710
+ ${Yn}
538
711
  uniform vec3 cameraPosition;
539
- ${Ye}
712
+ ${st}
540
713
  void main() {
541
714
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
542
715
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
@@ -550,80 +723,68 @@ void main() {
550
723
  // chairs, but nobody gets a short one (people are the same height at every
551
724
  // seat pitch).
552
725
  vec3 p = position;
553
- // The occupant. Parts 10 and 11 are a person; lower ids are furniture modules.
554
- //
555
- // One instanced mesh draws both an empty seat and a taken one, because the
556
- // alternative \u2014 a second geometry and a second draw call gathered per frame \u2014
557
- // would double the near-field cost to show what is already known per instance.
558
- // An unoccupied seat collapses its person to a point at the seat, which the
559
- // rasteriser discards, exactly as the chair itself collapses at w=0.
560
- float occupant = step(9.5, part);
561
- float taken = step(0.0, iSeed);
562
- vTaken = taken;
563
- vOccupant = occupant;
726
+ vTaken = step(0.5, iTaken);
564
727
  p = glyphChairPosition(p, part, iGlyph);
565
- if (iPhysicalSeat < 0.5) {
566
- p = vec3(0.0); // sellable space, but no physical chair/person
567
- } else if (occupant > 0.5) {
568
- if (taken < 0.5) {
569
- p = vec3(0.0); // empty seat: no person
570
- } else {
571
- // Vary the build so a sold-out row is people rather than a rank of
572
- // identical mannequins: +/-6% height and +/-8% width off the hash.
573
- p.y *= 0.94 + 0.12 * iSeed;
574
- p.xz *= 0.92 + 0.16 * fract(iSeed * 7.13);
575
- // People only appear once they are large enough to read as people. At
576
- // section/overview distance their tiny dark geometry aliases into radial
577
- // streaks; seat dots already communicate held/booked state there.
578
- p *= occupantWeight(depth);
579
- }
728
+ // Armrest standards (see fixedRowSeating in seatInstances.ts). The mesh holds
729
+ // two, told apart by the side of x = 0 they are built on; each is recentred
730
+ // on its own axis here and stood at its world offset after the yaw below.
731
+ vec2 armrestAt = vec2(0.0);
732
+ if (part > 6.5 && part < 7.5) {
733
+ bool shared = position.x > 0.0;
734
+ armrestAt = shared ? iArmrests.xy : iArmrests.zw;
735
+ if (dot(armrestAt, armrestAt) <= 0.0) p = vec3(0.0);
736
+ else if (dot(p, p) > 0.0) p.x += shared ? -${bt.toFixed(2)} : ${bt.toFixed(2)};
580
737
  }
738
+ if (iPhysicalSeat < 0.5) p = vec3(0.0); // sellable space, but no physical chair
581
739
  float localHeight = p.y;
740
+ vLocal = p;
582
741
  p.xz *= iRadius;
742
+ // A seat in a fixed row hangs between its armrest standards, as a real
743
+ // tip-up does: no post under the middle of it. An accessible seat keeps the
744
+ // pedestal, which is what carries its ring colour at close range.
745
+ if (part < 0.5 && iGlyph < 1.5 && dot(iArmrests, iArmrests) > 0.0 && dot(iRing, iRing) < 0.001) p = vec3(0.0);
746
+ // The pad of an empty tip-up seat stands folded against the back. Its height
747
+ // for the occlusion ramp is where it now stands, not where it lay.
748
+ bool padPart = part > 0.5 && part < 1.5;
749
+ if (padPart) { p = tipUpPad(p, iRadius, iTipUp); localHeight = p.y; }
583
750
  // 2. Lean the back. Done here rather than in the base mesh so the lean is a
584
751
  // real angle in METRES \u2014 baked into the mesh it would scale with the seat's
585
752
  // width and the same chair would lean 20 degrees on a wide stadium row and
586
753
  // 6 on a tight theatre one.
587
- // Only the BACK panel rakes. The old test (part > 1.5) meant "the back", and
588
- // now also catches the occupant \u2014 leaning a person by the panel's rule would
589
- // translate their head backwards by a rake measured from the panel's base.
754
+ // Only the back and the spine that carries it rake.
590
755
  float resolvedRake = uBackRake * glyphBackRake(iGlyph);
591
- float rake = (part > 1.5 && part < 2.5) ? max(p.y - uBackBase, 0.0) * resolvedRake : 0.0;
756
+ // (And a leg, where it rises past the back's base: a dining chair's rear legs.)
757
+ float rake = ((part > 1.5 && part < 2.5) || (part > 4.5 && part < 6.5)) ? max(p.y - uBackBase, 0.0) * resolvedRake : 0.0;
592
758
  p.z -= rake;
593
759
  // Fixed-size detail swap: no miniature chair inside a larger fallback.
594
760
  p *= step(0.01, w);
595
761
  vChairWeight = w;
596
762
  float c = cos(iYaw), s = sin(iYaw);
597
763
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
764
+ // A collapsed armrest (p = 0) must stay collapsed, so the offset rides on w.
765
+ rp.xz += armrestAt * step(0.01, w) * step(0.0001, dot(p, p));
598
766
  // Normals under the same two transforms, in reverse and inverted-transposed.
599
767
  // The xz scale is non-uniform, so an axis-aligned normal does NOT survive it
600
768
  // unchanged; and the rake is a shear, whose normal transform adds a y term.
601
769
  // Skipping either lights the raked back as though it were still vertical.
602
770
  vec3 n = vec3(normal.x / iRadius, normal.y, normal.z / iRadius);
603
- if (part > 1.5 && part < 2.5) n.y += resolvedRake * n.z;
771
+ if ((part > 1.5 && part < 2.5) || (part > 5.5 && part < 6.5)) n.y += resolvedRake * n.z;
604
772
  n = normalize(n);
773
+ if (padPart) n = tipUpNormal(n, iTipUp);
605
774
  vec3 rn = vec3(n.x * c + n.z * s, n.y, -n.x * s + n.z * c);
606
775
  vec4 mv = modelViewMatrix * vec4(iOffset + rp, 1.0);
607
776
  vPosView = mv.xyz;
777
+ vViewWorld = cameraPosition - (iOffset + rp);
608
778
  vNormalWorld = rn;
609
779
  vNormalView = normalize(mat3(modelViewMatrix) * rn);
610
780
  vColor = iColor;
611
- // Occupant colour, resolved here so the fragment stage needs no extra
612
- // varyings beyond this one. A person is NOT painted in the seat's state
613
- // colour: a sold seat is red, and a hall of red people reads as a warning,
614
- // not an audience. Hair/clothing for the body, a warm tone for the head,
615
- // both varied by the same per-person hash.
616
- float t = fract(iSeed * 3.71);
617
- vec3 clothes = mix(vec3(0.18, 0.22, 0.30), vec3(0.42, 0.29, 0.34), t);
618
- vec3 skin = mix(vec3(0.52, 0.38, 0.29), vec3(0.86, 0.70, 0.58), fract(iSeed * 11.3));
619
- vOccupantTint = (part > 10.5) ? skin : clothes;
620
781
  vPart = part;
621
782
  vHeight = localHeight;
622
783
  vRing = iRing;
623
784
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
624
785
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
625
786
  gl_Position = projectionMatrix * mv;
626
- }`,Si=`#version 300 es
787
+ }`,wl=`#version 300 es
627
788
  precision highp float;
628
789
  in vec3 vColor;
629
790
  in vec3 vNormalWorld;
@@ -634,10 +795,12 @@ in float vHeight;
634
795
  in vec3 vRing;
635
796
  in float vDim;
636
797
  in float vSectionFade;
637
- in float vOccupant;
638
- in vec3 vOccupantTint;
639
798
  in float vTaken;
799
+ in vec3 vLocal;
800
+ in vec3 vViewWorld;
640
801
  uniform vec3 uKeyDir;
802
+ uniform vec3 uKeyColor; // the look's light, at the seats' share (looks.ts)
803
+ uniform vec3 uAmbientColor;
641
804
  uniform vec3 uFadeColor;
642
805
  uniform float uRoughness;
643
806
  in float vChairWeight;
@@ -653,55 +816,68 @@ void main() {
653
816
  vec3 fillDir = normalize(vec3(-uKeyDir.x, 0.25, -uKeyDir.z));
654
817
  float fill = max(dot(N, fillDir), 0.0);
655
818
  vec3 tint = vColor;
656
- if (vOccupant > 0.5) tint = vOccupantTint;
657
- // The crowd in taken seats is one crisp, dark tone, not the seat's muted
658
- // grey: on a light venue that grey went pale, and the people read as soft
659
- // grey blobs (owner, 2026-09-25: "not crisp"). Dark silhouettes with the rim
660
- // below read as an audience at every distance; the head is a step lighter so
661
- // it separates from the shoulders.
662
- if (vOccupant > 0.5 && vTaken > 0.5) {
663
- // A little per-person variety (the clothing hash), so a full stand reads
664
- // as people and not as one moulded block.
665
- float vary = dot(vOccupantTint, vec3(0.33)) - 0.3;
666
- tint = (vPart > 10.5 ? vec3(0.31, 0.32, 0.36) : vec3(0.19, 0.22, 0.27)) + vary * 0.12;
667
- }
668
819
  // The accommodation ring, kept legible once the dot (which drew it) is gone:
669
820
  // an accessible seat's support is painted in the ring colour, so the marker
670
821
  // survives to close range instead of vanishing exactly when the buyer arrives.
671
822
  float ringMask = step(0.001, dot(vRing, vRing));
672
823
  float supportPart = max(1.0 - step(0.5, vPart),
673
824
  step(4.5, vPart) * (1.0 - step(5.5, vPart)));
825
+ // The frame is a frame. The pedestal and legs were the upholstery's colour at
826
+ // half strength, so a red seat stood on a dark-red post and the whole chair
827
+ // read as one moulded block. Real seating is fabric on a graphite frame; the
828
+ // little tint that stays keeps the frame in the venue's light, not a cut-out.
829
+ // The spine (6) and the armrest standards (7) are frame as well.
830
+ float framePart = step(5.5, vPart) * (1.0 - step(7.5, vPart));
831
+ float frame = max(supportPart, framePart);
832
+ // An armrest takes none of its seat's colour: it is shared with the seat
833
+ // next door, which may be another colour.
834
+ float armrestPart = step(6.5, vPart) * (1.0 - step(7.5, vPart));
835
+ tint = mix(tint, mix(vec3(0.17, 0.18, 0.20), tint, 0.12 * (1.0 - armrestPart)) * 2.0, frame);
674
836
  if (supportPart > 0.5 && ringMask > 0.5) tint = vRing;
675
837
  // Tonal separation keeps the modular silhouettes readable without textures.
676
- // A person is lit as a person, not as upholstery: no part shading, and less
677
- // of the pad's sheen, so a head does not read as a polished box.
678
- float furnitureShade = vPart < 0.5 ? 0.50
838
+ float partShade = vPart < 0.5 ? 0.50
679
839
  : (vPart < 1.5 ? 1.10
680
840
  : (vPart < 2.5 ? 0.80
681
841
  : (vPart < 3.5 ? 0.72
682
842
  : (vPart < 4.5 ? 0.90 : 0.55))));
683
- float partShade = vOccupant > 0.5 ? 0.95 : furnitureShade;
684
843
  // Cheap vertical occlusion: a chair is in a dense row, so the closer a surface
685
844
  // sits to the deck the less sky it can actually see. This is the depth cue \u2014
686
845
  // without it the pad top, the back and the deck all resolve to the same flat
687
846
  // value and the row loses its form entirely.
688
- // Occupants rise above the 0.92 m chair back, so their ramp uses their own
689
- // height or every head would clamp to full brightness and float.
690
- float ao = mix(0.58, 1.0, clamp(vHeight / (vOccupant > 0.5 ? 1.30 : 0.92), 0.0, 1.0));
847
+ float ao = mix(0.58, 1.0, clamp(vHeight / 0.92, 0.0, 1.0));
848
+ // The crease. Where the back meets the pad neither can see the sky: the foot
849
+ // of the back and the rear of the pad darken toward the join. This is the
850
+ // line that makes two cushions read as one chair, and it is what the flat
851
+ // panels were missing most.
852
+ float padPart = step(0.5, vPart) * (1.0 - step(1.5, vPart));
853
+ float backPart = step(1.5, vPart) * (1.0 - step(2.5, vPart));
854
+ float crease = mix(1.0, mix(0.70, 1.0, smoothstep(-0.95, -0.15, vLocal.z)), padPart)
855
+ * mix(1.0, mix(0.74, 1.0, smoothstep(0.0, 0.20, vLocal.y - ${Le.toFixed(2)})), backPart);
856
+ // The seam. On a tight row neighbouring pads meet edge to edge, and without a
857
+ // line between them the row is one long bench. Each pad darkens toward its
858
+ // own sides, which draws that line whether or not there is a gap to see.
859
+ crease *= mix(1.0, mix(1.0, 0.72, smoothstep(0.58, 0.90, abs(vLocal.x))), padPart);
860
+ ao *= crease;
691
861
  // Chairs follow the structure's balance (see SOLID_FRAG): more sun, less
692
862
  // ambient, so seat pads, backs and arms separate instead of reading as one
693
863
  // coloured mass.
694
- vec3 base = tint * partShade * ao * (0.52 + 0.26 * hemi) + tint * key * 0.40 + tint * fill * 0.14;
864
+ vec3 base = tint * (partShade * ao * (0.52 + 0.26 * hemi) * uAmbientColor + key * 0.40 * uKeyColor + fill * 0.14 * uAmbientColor);
695
865
  float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
696
866
  // A restrained furniture rim keeps the low-poly edges from looking outlined.
697
- // Occupant silhouettes retain their existing stronger separation.
698
867
  float sheen = clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0);
699
- base += vec3(0.26, 0.31, 0.38) * fres * mix(0.24, 0.55, vOccupant) * mix(sheen, 1.0, vOccupant);
700
- // Not for sale: the chair and the person in it go one muted grey, a step
701
- // toward the venue. Their own clothing and the chair's category tint made a
702
- // taken seat look like any other at a glance (owner report, 2026-09-23);
703
- // now only the seats a buyer can take wear full colour.
704
- if (vTaken > 0.5 && vOccupant < 0.5) {
868
+ base += vec3(0.26, 0.31, 0.38) * fres * 0.24 * sheen;
869
+ // A soft highlight where a cushion turns toward the light. Broad and weak:
870
+ // it is upholstery catching the sun, not a polished shell.
871
+ vec3 halfway = normalize(uKeyDir + normalize(vViewWorld));
872
+ float gloss = pow(max(dot(N, halfway), 0.0), 18.0) * (padPart + backPart);
873
+ base += (tint * 0.35 + vec3(0.10)) * gloss * 0.42 * clamp(sheen, 0.5, 1.5);
874
+ // Not for sale: the chair goes one muted grey, a step toward the venue. The
875
+ // chair's category tint made a taken seat look like any other at a glance
876
+ // (owner report, 2026-09-23); now only the seats a buyer can take wear full
877
+ // colour. With its pad down among folded neighbours, that grey IS the taken
878
+ // seat: no figure sits in it (owner, 2026-11-11).
879
+ // (Not the armrest: it is shared with the seat next door, which may be free.)
880
+ if (vTaken > 0.5 && armrestPart < 0.5) {
705
881
  float takenLum = dot(base, vec3(0.299, 0.587, 0.114));
706
882
  base = mix(vec3(takenLum), uFadeColor, 0.35) * 0.92;
707
883
  }
@@ -712,45 +888,137 @@ void main() {
712
888
  base = mix(base, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
713
889
  }
714
890
  fragColor = vec4(base, 1.0);
715
- }`,wi=`#version 300 es
891
+ }`,Sl=`#version 300 es
716
892
  precision highp float;
717
893
  in vec2 position;
718
894
  out vec2 vUv;
719
895
  void main() {
720
896
  vUv = position * 0.5 + 0.5;
721
897
  gl_Position = vec4(position, 0.999, 1.0);
722
- }`,Mi=`#version 300 es
898
+ }`,Ml=`#version 300 es
723
899
  precision highp float;
724
900
  in vec2 vUv;
725
- uniform vec3 uTop;
726
- uniform vec3 uBottom;
727
- uniform float uSky; // 1 for an open-air venue, see SceneModel.outdoor
728
- uniform vec3 uZenith;
729
- uniform vec3 uHorizon;
901
+ ${ri}
730
902
  uniform mat4 uInvViewProj;
903
+ uniform float uHouse; // 1 for an indoor venue, see SceneModel.house
904
+ uniform vec4 uHouseShape; // the wall: centre x, centre z, half-width x, half-width z (world metres)
905
+ uniform vec2 uHouseLevels; // floor y, ceiling y
906
+ uniform vec3 uHouseCeiling;
907
+ uniform vec3 uHouseWall;
908
+ uniform vec3 uHouseLamp;
909
+ uniform float uHouseTheatre; // 1 for a theatre's room: pilasters, wall lights, a dado and a cornice
910
+ uniform vec3 uEye; // camera, world metres
731
911
  out vec4 fragColor;
912
+
913
+ // One house light to a bay of the ceiling, and the bay's own width, metres.
914
+ const float HOUSE_BAY_M = 7.0;
915
+ const float HOUSE_LAMP_BAYS = 0.055; // lamp radius, in bays
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;
927
+
732
928
  void main() {
733
- vec3 col = mix(uBottom, uTop, vUv.y);
734
- vec2 c = vUv - 0.5;
735
- float vig = 1.0 - dot(c, c) * 0.16; // soft vignette
736
- col *= vig;
737
- // Above the horizon an open-air venue has a sky, not the chart's flat
738
- // backdrop: from a seat, the stands used to meet a black void. Below the
739
- // horizon (every overview) nothing changes.
740
- if (uSky > 0.5) {
929
+ // This pixel's line of sight. A venue with neither a sky nor a room skips
930
+ // it: its backdrop is the flat gradient.
931
+ vec3 dir = vec3(0.0, -1.0, 0.0);
932
+ if (uSky > 0.5 || uHouse > 0.5) {
741
933
  vec2 ndc = vUv * 2.0 - 1.0;
742
934
  vec4 near = uInvViewProj * vec4(ndc, -1.0, 1.0);
743
935
  vec4 far = uInvViewProj * vec4(ndc, 1.0, 1.0);
744
- vec3 dir = normalize(far.xyz / far.w - near.xyz / near.w);
745
- float up = dir.y;
746
- vec3 sky = mix(uHorizon, uZenith, pow(clamp(up, 0.0, 1.0), 0.45));
747
- // Reaching a little below the horizon too: from a low seat the far stands
748
- // top out right at it, and a sliver of backdrop showed as a dark band.
749
- // Every overview looks further down than this (at least ~24 degrees).
750
- col = mix(col, sky, smoothstep(-0.22, 0.03, up));
936
+ dir = normalize(far.xyz / far.w - near.xyz / near.w);
937
+ }
938
+ // The gradient and, for an open-air venue, the sky. A venue never has both
939
+ // a sky and a room, so the room below paints over the plain gradient.
940
+ vec3 col = backdrop(vUv, dir);
941
+ // An indoor venue has a room, not the chart's flat backdrop: from a seat the
942
+ // stands used to end in a void (see scene/model/house.ts). Painted here, so
943
+ // it is behind everything drawn. Only from inside the room and under its
944
+ // ceiling: every overview stands outside or above, and is unchanged.
945
+ if (uHouse > 0.5) {
946
+ // Where the line of sight would meet the ceiling, and where it would leave
947
+ // the elliptical wall. Worked out for every pixel before the branch on
948
+ // what it actually hits, so each pattern's pixel footprint (fwidth) is
949
+ // defined everywhere.
950
+ float headroom = uHouseLevels.y - uEye.y;
951
+ float tCeiling = headroom / max(dir.y, 1e-4);
952
+ vec2 onCeiling = uEye.xz + dir.xz * tCeiling - uHouseShape.xy;
953
+ vec2 bay = onCeiling / HOUSE_BAY_M;
954
+ float bayPixel = max(fwidth(bay.x), fwidth(bay.y)); // bays per pixel
955
+ vec2 eye = (uEye.xz - uHouseShape.xy) / uHouseShape.zw;
956
+ vec2 across = dir.xz / uHouseShape.zw;
957
+ float wa = dot(across, across), wb = dot(eye, across), wk = dot(eye, eye) - 1.0;
958
+ float tWall = wa > 1e-9 ? (-wb + sqrt(max(0.0, wb * wb - wa * wk))) / wa : 1e9;
959
+ float course = (uEye.y + dir.y * tWall - uHouseLevels.x) / HOUSE_COURSE_M;
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
963
+ float inside = smoothstep(0.0, 0.05, -wk) * smoothstep(0.0, 3.0, headroom);
964
+ if (inside > 0.0) {
965
+ if (dir.y > 1e-4 && tCeiling < tWall) {
966
+ // The ceiling: darker into the cove where it meets the wall, a faint
967
+ // line between bays, one house light to a bay. Far away, where a bay
968
+ // is a pixel or less, lamps and lines give way to their average.
969
+ float edge = length(onCeiling / uHouseShape.zw);
970
+ vec3 room = uHouseCeiling * mix(1.0, 0.7, smoothstep(0.5, 1.0, edge));
971
+ float detail = 1.0 - smoothstep(0.06, 0.3, bayPixel);
972
+ vec2 cell = fract(bay) - 0.5;
973
+ float r = length(cell);
974
+ float lamp = 1.0 - smoothstep(HOUSE_LAMP_BAYS - bayPixel, HOUSE_LAMP_BAYS + bayPixel, r);
975
+ float glow = exp(-r * r * 46.0);
976
+ vec2 toLine = 0.5 - abs(cell);
977
+ float line = 1.0 - smoothstep(0.012 - bayPixel, 0.012 + bayPixel, min(toLine.x, toLine.y));
978
+ // A joint is a shadow line: plain on a dark ceiling, slight on a pale one.
979
+ room *= 1.0 - mix(0.16, 0.05, dot(uHouseCeiling, vec3(0.2126, 0.7152, 0.0722))) * line * detail;
980
+ room += uHouseLamp * mix(0.05, lamp + 0.22 * glow, detail);
981
+ col = mix(col, room, inside);
982
+ } else {
983
+ // The wall, floor to ceiling: lit from the floor, darkening toward the
984
+ // cove, with the faint joint of each course of panels. Below the
985
+ // floor there is nothing to paint: the ground is drawn there.
986
+ float h = course * HOUSE_COURSE_M / max(1.0, uHouseLevels.y - uHouseLevels.x);
987
+ vec3 room = uHouseWall * mix(1.06, 0.6, smoothstep(0.3, 1.0, h));
988
+ float joint = 1.0 - smoothstep(0.014 - coursePixel, 0.014 + coursePixel, 0.5 - abs(fract(course) - 0.5));
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
+ }
1016
+ col = mix(col, room, inside * smoothstep(-0.02, 0.0, h));
1017
+ }
1018
+ }
751
1019
  }
752
1020
  fragColor = vec4(col, 1.0);
753
- }`,Ai=`#version 300 es
1021
+ }`,Al=`#version 300 es
754
1022
  precision highp float;
755
1023
  in float surface;
756
1024
  in float iYaw;
@@ -763,6 +1031,7 @@ in vec3 iOffset;
763
1031
  in float iMaxRadius;
764
1032
  in float iHasChair;
765
1033
  in float iPhysicalSeat;
1034
+ in float iTipUp;
766
1035
  in float iFloor;
767
1036
  uniform mat4 modelViewMatrix;
768
1037
  uniform mat4 projectionMatrix;
@@ -779,9 +1048,9 @@ out float vDotWeight;
779
1048
  out float vHidden;
780
1049
  flat out vec3 vPick;
781
1050
  uniform vec3 cameraPosition;
782
- ${Ct}
783
- ${Xo}
784
- ${Ye}
1051
+ ${Zt}
1052
+ ${ii}
1053
+ ${st}
785
1054
  void main() {
786
1055
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
787
1056
  int id = gl_InstanceID + 1; // 0 reserved for no-hit
@@ -796,7 +1065,7 @@ void main() {
796
1065
  vPhysicalSeat = iPhysicalSeat;
797
1066
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
798
1067
  gl_Position = projectionMatrix * mv;
799
- }`,Pi=`#version 300 es
1068
+ }`,Tl=`#version 300 es
800
1069
  precision highp float;
801
1070
  in vec2 vUv;
802
1071
  in float vPhysicalSeat;
@@ -804,7 +1073,7 @@ in float vDotWeight;
804
1073
  in float vHidden;
805
1074
  flat in vec3 vPick;
806
1075
  out vec4 fragColor;
807
- ${qo}
1076
+ ${ai}
808
1077
  void main() {
809
1078
  if (vHidden > 0.5) discard;
810
1079
  if (vDotWeight <= 0.99) discard;
@@ -812,16 +1081,17 @@ void main() {
812
1081
  float d = seatSilhouette(vUv, vPhysicalSeat);
813
1082
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
814
1083
  fragColor = vec4(vPick, 1.0);
815
- }`,Ci=`#version 300 es
1084
+ }`,Pl=`#version 300 es
816
1085
  precision highp float;
817
1086
  in vec3 position;
818
1087
  in float part;
819
1088
  in vec3 iOffset;
820
1089
  in float iRadius;
821
1090
  in float iYaw;
822
- in float iSeed;
823
1091
  in float iPhysicalSeat;
824
1092
  in float iGlyph;
1093
+ in vec4 iArmrests;
1094
+ in float iTipUp;
825
1095
  in float iPickIndex;
826
1096
  in float iFloor;
827
1097
  uniform mat4 modelViewMatrix;
@@ -835,10 +1105,10 @@ flat out vec3 vPick;
835
1105
  out float vChairWeight;
836
1106
  out float vHidden;
837
1107
  uniform vec3 cameraPosition;
838
- ${Ct}
839
- ${Uo}
840
- ${dn}
841
- ${Ye}
1108
+ ${Zt}
1109
+ ${$n}
1110
+ ${Yn}
1111
+ ${st}
842
1112
  void main() {
843
1113
  if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
844
1114
  int id = int(iPickIndex + 0.5); // already global index + 1
@@ -849,22 +1119,21 @@ void main() {
849
1119
  float depth = max(viewDepth, 0.001);
850
1120
  float w = viewDepth > 0.05 ? chairWeight(length(anchor.xyz)) : 0.0;
851
1121
  vec3 p = position;
852
- float occupant = step(9.5, part);
853
- float taken = step(0.0, iSeed);
854
1122
  p = glyphChairPosition(p, part, iGlyph);
855
- if (iPhysicalSeat < 0.5) {
856
- p = vec3(0.0);
857
- } else if (occupant > 0.5) {
858
- if (taken < 0.5) {
859
- p = vec3(0.0);
860
- } else {
861
- p.y *= 0.94 + 0.12 * iSeed;
862
- p.xz *= 0.92 + 0.16 * fract(iSeed * 7.13);
863
- p *= occupantWeight(depth);
864
- }
1123
+ // Armrest standards (see fixedRowSeating in seatInstances.ts). The mesh holds
1124
+ // two, told apart by the side of x = 0 they are built on; each is recentred
1125
+ // on its own axis here and stood at its world offset after the yaw below.
1126
+ vec2 armrestAt = vec2(0.0);
1127
+ if (part > 6.5 && part < 7.5) {
1128
+ bool shared = position.x > 0.0;
1129
+ armrestAt = shared ? iArmrests.xy : iArmrests.zw;
1130
+ if (dot(armrestAt, armrestAt) <= 0.0) p = vec3(0.0);
1131
+ else if (dot(p, p) > 0.0) p.x += shared ? -${bt.toFixed(2)} : ${bt.toFixed(2)};
865
1132
  }
1133
+ if (iPhysicalSeat < 0.5) p = vec3(0.0);
866
1134
  p.xz *= iRadius;
867
- float rake = (part > 1.5 && part < 2.5)
1135
+ if (part > 0.5 && part < 1.5) p = tipUpPad(p, iRadius, iTipUp);
1136
+ float rake = ((part > 1.5 && part < 2.5) || (part > 4.5 && part < 6.5))
868
1137
  ? max(p.y - uBackBase, 0.0) * uBackRake * glyphBackRake(iGlyph)
869
1138
  : 0.0;
870
1139
  p.z -= rake;
@@ -872,8 +1141,10 @@ void main() {
872
1141
  vChairWeight = w;
873
1142
  float c = cos(iYaw), s = sin(iYaw);
874
1143
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
1144
+ // A collapsed armrest (p = 0) must stay collapsed, so the offset rides on w.
1145
+ rp.xz += armrestAt * step(0.01, w) * step(0.0001, dot(p, p));
875
1146
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
876
- }`,Ei=`#version 300 es
1147
+ }`,El=`#version 300 es
877
1148
  precision highp float;
878
1149
  flat in vec3 vPick;
879
1150
  in float vHidden;
@@ -883,7 +1154,7 @@ void main() {
883
1154
  if (vHidden > 0.5) discard;
884
1155
  if (vChairWeight < 0.01) discard;
885
1156
  fragColor = vec4(vPick, 1.0);
886
- }`,Ti=`#version 300 es
1157
+ }`,Cl=`#version 300 es
887
1158
  precision highp float;
888
1159
  in vec3 position;
889
1160
  in vec3 normal;
@@ -898,12 +1169,14 @@ out float vMaterial;
898
1169
  out vec3 vNormalWorld;
899
1170
  out vec3 vPosWorld;
900
1171
  void main() {
901
- 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;
902
1175
  vMaterial = materialIndex;
903
1176
  vNormalWorld = mat3(modelMatrix) * normal;
904
1177
  vPosWorld = (modelMatrix * vec4(position, 1.0)).xyz;
905
1178
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
906
- }`,Ri=`#version 300 es
1179
+ }`,Rl=`#version 300 es
907
1180
  precision highp float;
908
1181
  in float vHidden;
909
1182
  in float vMaterial;
@@ -912,14 +1185,22 @@ in vec3 vPosWorld;
912
1185
  uniform vec3 cameraPosition;
913
1186
  uniform vec2 uRoomCentre;
914
1187
  out vec4 fragColor;
915
- ${Yo}
916
- ${Ye}
1188
+ ${oi}
1189
+ ${st}
917
1190
  void main() {
918
1191
  if (vHidden > 0.5) discard;
919
1192
  if (roomWallHidden(vMaterial, vNormalWorld, vPosWorld, cameraPosition, uRoomCentre)) discard;
920
1193
  if (seeThroughCut(vPosWorld, cameraPosition)) discard;
921
- fragColor = vec4(0.0, 0.0, 0.0, 1.0);
922
- }`;function jo(t){return new Ve(t,{vertex:Ai,fragment:Pi,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uSeatRadius:{value:et},uSeatScale:{value:1},uMinPixels:{value:Ge},uPixelToWorld:{value:.002},uChairFull:{value:rt},uChairNone:{value:Be},uFocusFloor:{value:-1}}})}function $o(t){return new Ve(t,{vertex:Ci,fragment:Ei,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uChairFull:{value:rt},uChairNone:{value:Be},uBackRake:{value:Je},uBackBase:{value:Ie},uFocusFloor:{value:-1}}})}function Ko(t){return new Ve(t,{vertex:Ti,fragment:Ri,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 Qo(t,e=.78,n=[.63,.66,.65]){return new Ve(t,{vertex:vi,fragment:bi,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:e},uRoomCentre:{value:new Float32Array([0,0])}}})}function Zo(t){return new Ve(t,{vertex:gi,fragment:yi,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uSeatRadius:{value:et},uSeatScale:{value:1},uMinPixels:{value:Ge},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:rt},uChairNone:{value:Be}}})}function Jo(t,e=.78){return new Ve(t,{vertex:xi,fragment:Si,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:rt},uChairNone:{value:Be},uBackRake:{value:Je},uBackBase:{value:Ie},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:e}}})}function er(t,e,n,r){return new Ve(t,{vertex:wi,fragment:Mi,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)}}})}import{Camera as _i,Mat4 as Ii,Mesh as Di,Program as Fi,RenderTarget as ki,Transform as Li}from"ogl";function tr(t,e,n){let a=Math.max(3,n.radius*1.04),[o,i,s]=n.center,l=new _i(t,{left:-a,right:a,bottom:-a,top:a,near:.1,far:a*6});l.position.set(o-a*1.44,i+a*2.34,s+a*1.2),l.lookAt([o,i,s]);let c=new ki(t,{width:1024,height:1024,depthTexture:!0,minFilter:t.NEAREST,magFilter:t.NEAREST}),f=new Fi(t,{cullFace:!1,vertex:`#version 300 es
1194
+ // Nets and slender fittings (materials 10 and 11) never swallow a tap: a
1195
+ // buyer behind the goal picks a seat through the net. Nor does stage light
1196
+ // (12), which from behind is not there at all.
1197
+ if (vMaterial > 9.5 && vMaterial < 12.5) discard;
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
923
1204
  in vec3 position;
924
1205
  in float materialIndex;
925
1206
  uniform mat4 modelViewMatrix;
@@ -930,9 +1211,87 @@ void main() {
930
1211
  in float vMaterial;
931
1212
  out vec4 fragColor;
932
1213
  void main() {
933
- if (abs(vMaterial - 6.0) < 0.5) discard;
1214
+ // ...nor do nets and slender sport fittings (10, 11): a net is mostly air.
1215
+ if (abs(vMaterial - 6.0) < 0.5 || (vMaterial > 9.5 && vMaterial < 12.5)) discard;
934
1216
  fragColor = vec4(1.0);
935
- }`}),p=new Li,u=new Di(t,{geometry:e,program:f});u.frustumCulled=!1,u.setParent(p);let m=t.getParameter(t.COLOR_CLEAR_VALUE),d=t.isEnabled(t.DITHER);try{t.disable(t.DITHER),t.clearColor(1,1,1,1),t.renderer.render({scene:p,camera:l,target:c})}finally{d&&t.enable(t.DITHER),t.clearColor(m[0],m[1],m[2],m[3]),f.remove()}let y=new Ii().multiply(l.projectionMatrix,l.viewMatrix);return{texture:c.depthTexture,matrix:y,dispose(){for(let v of c.textures)t.deleteTexture(v.texture);t.deleteTexture(c.depthTexture.texture),t.deleteFramebuffer(c.buffer),c.depthBuffer&&t.deleteRenderbuffer(c.depthBuffer)}}}var Vi=.65,Oi=new Set(["dimmed","sold","held"]);function nr(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(!Oi.has(c)){s=!0;break}}s?r.add(o.sectionId):a=!0}return{lit:r,anyUnlit:a}}function or(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])*Vi;i.push(s)}return i}var ar=Se.indexOf("selected");function Hi(t,e){return[0,1,2].map(n=>t[n]*.15+.75+e[n]*.1)}function ir(t,e,n,r,a,o){for(let i=n;i<n+r;i++){let s=o&&e[i]===0,l=o&&e[i]===ar?Hi([o[i*3],o[i*3+1],o[i*3+2]],a[ar]??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 Gi=new Float32Array([-1,-1,3,-1,-1,3]);function sr(t,e){let n=new rr,r=new rr,a=new lt(t,{position:{size:2,data:Gi}}),o=er(t,e.theme.background.top,e.theme.background.bottom,e.outdoor?e.theme.sky:null),i=new ct(t,{geometry:a,program:o});i.frustumCulled=!1,i.setParent(r);let s=new lt(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=tr(t,s,e.renderBounds),c=Qo(t,e.theme.materials.roughness,e.theme.structure.tierTop);c.uniforms.tVenueShadow={value:l.texture},c.uniforms.uShadowMatrix={value:l.matrix},e.room&&c.uniforms.uRoomCentre.value.set(e.room.centre);let f=new ct(t,{geometry:s,program:c});f.frustumCulled=!1,f.setParent(n);let p=Zo(t),u=new Float32Array(e.seats.count*3),m=Se.map(U=>e.theme.seatStates[U]),d=e.seats.iCategory.slice(),y=Zn(e.theme.structure);for(let U=0;U<e.seats.count;U++){if(e.seats.iPhysicalSeat[U]<.5)continue;let ee=e.theme.materials.seat??Jn([d[U*3],d[U*3+1],d[U*3+2]],y);d.set(ee,U*3)}ir(u,e.seats.iState,0,e.seats.count,m,d);let v=bo(),w=new Uint8Array(e.seats.count),E=new lt(t,{position:{size:3,data:v.position},normal:{size:3,data:v.normal},uv:{size:2,data:v.uv},index:{size:1,data:v.index},surface:{size:1,data:v.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:u,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,instanced:1},iHasChair:{size:1,data:w,type:t.UNSIGNED_BYTE,usage:t.DYNAMIC_DRAW,instanced:1},iPhysicalSeat:{size:1,data:e.seats.iPhysicalSeat,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}}),C=new ct(t,{geometry:E,program:p});C.frustumCulled=!1,e.seats.count>0&&C.setParent(n);let D=E.attributes.iColor,A=e.solids.color.slice(),R=e.theme.structure.ground,L=new Map(e.sectionSolidRanges.map(U=>[U.sectionId,!0])),b=Kn(),F=Jo(t,e.theme.materials.roughness),x=At,I=new Float32Array(x*3),z=new Float32Array(x*3),_=new Float32Array(x),O=new Float32Array(x),G=new Float32Array(x),B=new Float32Array(x*3),W=new Float32Array(x),N=new Float32Array(x),te=new Float32Array(x),X=new Float32Array(x),J=new Float32Array(x),M=new lt(t,{position:{size:3,data:b.position},normal:{size:3,data:b.normal},part:{size:1,data:b.part},index:{data:b.index},iOffset:{size:3,data:I,instanced:1},iColor:{size:3,data:z,instanced:1},iRadius:{size:1,data:_,instanced:1},iYaw:{size:1,data:O,instanced:1},iGlyph:{size:1,data:G,instanced:1},iRing:{size:3,data:B,instanced:1},iFloor:{size:1,data:W,instanced:1},iSection:{size:1,data:N,instanced:1},iPhysicalSeat:{size:1,data:te,instanced:1},iSeed:{size:1,data:J,instanced:1},iPickIndex:{size:1,data:X,instanced:1}}),P=new ct(t,{geometry:M,program:F});P.frustumCulled=!1;let S=0,Y=!1,Z=!1,ge=null,ce=null,he=null,oe=new Int32Array(0),ye=()=>{let U=e.seats;for(let ee=0;ee<S;ee++){let q=oe[ee];J[ee]=eo(U.iState[q],q),z[ee*3]=u[q*3],z[ee*3+1]=u[q*3+1],z[ee*3+2]=u[q*3+2]}M.attributes.iColor.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0},pe={main:n,background:r,backgroundProgram:o,seatProgram:p,solidProgram:c,chairProgram:F,seatGeometry:E,chairGeometry:M,solidGeometry:s,drawCalls:3,setNearSeats(U,ee){let q=Math.min(ee,x,U.length);if(Wo(w,U,q),E.attributes.iHasChair.needsUpdate=!0,oe=U,S=q,q===0){P.parent&&P.setParent(null),M.instancedCount=0,pe.drawCalls=3+(Y?1:0);return}let K=e.seats;for(let ne=0;ne<q;ne++){let se=U[ne];I[ne*3]=K.iPosition[se*3],I[ne*3+1]=K.iPosition[se*3+1],I[ne*3+2]=K.iPosition[se*3+2],_[ne]=K.iChairWidth[se],O[ne]=K.iYaw[se],G[ne]=K.iGlyph[se],B[ne*3]=K.iRing[se*3],B[ne*3+1]=K.iRing[se*3+1],B[ne*3+2]=K.iRing[se*3+2],W[ne]=K.iFloor[se],N[ne]=K.iSection[se],te[ne]=K.iPhysicalSeat[se],X[ne]=se+1}ye(),M.attributes.iOffset.needsUpdate=!0,M.attributes.iRadius.needsUpdate=!0,M.attributes.iYaw.needsUpdate=!0,M.attributes.iGlyph.needsUpdate=!0,M.attributes.iRing.needsUpdate=!0,M.attributes.iFloor.needsUpdate=!0,M.attributes.iSection.needsUpdate=!0,M.attributes.iPhysicalSeat.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0,M.attributes.iPickIndex.needsUpdate=!0,M.instancedCount=q,P.parent||P.setParent(n),pe.drawCalls=4+(Y?1:0)},nearSeatCount(){return S},setSectionShellLit(U){c.uniforms.uSectionFilter.value=U===null?0:1;let ee=or(e.sectionSolidRanges,e.solids.color,A,L,U,R);if(!ee.length)return;let q=s.attributes.color,K=q.buffer;if(!K){q.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,K);for(let ne of ee){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(U){if(!U.length)return;S&&ye();for(let q of U)ir(u,e.seats.iState,q.start,q.length,m,d);let ee=D.buffer;if(!ee){D.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,ee);for(let q of U){let K=u.subarray(q.start*3,(q.start+q.length)*3);t.bufferSubData(t.ARRAY_BUFFER,q.start*3*Float32Array.BYTES_PER_ELEMENT,K)}},dispose(){Z=!0,l.dispose(),a.remove(),o.remove(),s.remove(),c.remove(),E.remove(),p.remove(),M.remove(),F.remove(),ge?.remove(),ce?.remove(),he?.texture&&t.deleteTexture(he.texture)}},$=e.productionElements.find(U=>U.contentImageUrl&&U.contentPlane);if($?.contentImageUrl&&$.contentPlane?.length===4&&typeof Image<"u"){let U=new Image;U.crossOrigin="anonymous",U.onload=()=>{if(Z)return;let ee=$.contentPlane;ge=new lt(t,{position:{size:3,data:new Float32Array(ee.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill($.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),he=new Ni(t,{image:U,generateMipmaps:!0,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,flipY:!1}),ce=new zi(t,{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
1218
+ in vec3 position;
1219
+ in float surface;
1220
+ in vec3 iOffset;
1221
+ in float iYaw;
1222
+ in float iChairWidth;
1223
+ in float iPhysicalSeat;
1224
+ uniform mat4 modelViewMatrix;
1225
+ uniform mat4 projectionMatrix;
1226
+ void main() {
1227
+ if (iPhysicalSeat < 0.5 || surface < 0.5) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
1228
+ vec3 p = position;
1229
+ if (surface < 1.5 && p.y < 0.40) p.y = 0.02;
1230
+ p.xz *= iChairWidth;
1231
+ float c = cos(iYaw), s = sin(iYaw);
1232
+ vec3 rotated = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
1233
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rotated, 1.0);
1234
+ }`,fragment:`#version 300 es
1235
+ precision highp float;
1236
+ out vec4 fragColor;
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
936
1295
  precision highp float;
937
1296
  in vec3 position; in vec2 uv; in float floorIndex;
938
1297
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
@@ -940,4 +1299,4 @@ void main() {
940
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
941
1300
  precision highp float;
942
1301
  in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
943
- void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:he},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let q=new ct(t,{geometry:ge,program:ce});q.frustumCulled=!1,q.setParent(n),pe.screenProgram=ce,Y=!0,pe.drawCalls=3+(S?1:0)+1},U.src=$.contentImageUrl}return pe}import{Mesh as mn,RenderTarget as Wi,Transform as hn}from"ogl";function Bi(t,e,n){let r=t+(e<<8)+(n<<16);return r===0?-1:r-1}function lr(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,p=Bi(t[f],t[f+1],t[f+2]);if(p<0||p>=o)continue;let u=c-r,m=l-a,d=u*u+m*m;d<s&&(s=d,i=p)}return i}function cr(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 Ui=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Et=class{constructor(e,n,r,a,o){this.seatScene=new hn;this.chairScene=new hn;this.solidScene=new hn;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=o,this.seatProg=jo(this.gl),this.chairProg=$o(this.gl),this.depthProg=Ko(this.gl);let i=new mn(this.gl,{geometry:n,program:this.seatProg});i.frustumCulled=!1,i.setParent(this.seatScene);let s=new mn(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let l=new mn(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 Ui)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 Wi(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),p=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,p,u);let[m,d,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(m,d,y,1),o.disable(o.SCISSOR_TEST);let v=new Uint8Array(p*u*4);return this.renderer.bindFramebuffer(i),o.readPixels(c,f,p,u,o.RGBA,o.UNSIGNED_BYTE,v),this.renderer.bindFramebuffer(),lr(v,p,u,n-c,r-f,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function ur(t,e){let n=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,Qn(r.state)):n.push(r);return n}function dr(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 ut,Vec3 as qi}from"ogl";function Yi(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function mr(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function Xi(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function hr(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 pn(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function fn(t,e){return Math.max(0,Math.min(1,t+e))}function pr(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)],p=i*i,u=p*i,m=[0,0,0];for(let d=0;d<3;d++)m[d]=.5*(2*l[d]+(-s[d]+c[d])*i+(2*s[d]-5*l[d]+4*c[d]-f[d])*p+(-s[d]+3*l[d]-3*c[d]+f[d])*u);return m}function vn(t,e,n,r,a){let o=hr(Yi(e,n));o[0]===0&&o[1]===0&&o[2]===0&&(o=[0,0,1]);let i=mr(mr(e,Xi(o,2.5)),[0,1.5,0]),s=[e[0]-r[0],0,e[2]-r[2]],l=hr(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 bn(t,e,n=35,r=28){let a=pn(e),o=pr(t,a),i=pn(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:o,fov:n+(r-n)*i,eased:a}}function gr(t,e,n){let r=t.position.clone(),a=new ut().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new qi(n[0],n[1],n[2]));let o=new ut().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(a),o}var Tt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new ut;this.endQuat=new ut;this.outQuat=new ut;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}=bn(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,fn(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 yr=$n,ji=.12,$i=1.6,xr=.12;function Sr(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,p=1/0,u=null;for(let m=0;m*3<t.length;m++){if(m===e)continue;let d=t[m*3]-r,y=t[m*3+2]-o,v=d*c+y*f;v<.3||v>1.6||Math.abs(d*f-y*c)>.6||v<p&&(p=v,u=a-t[m*3+1])}return u}var Ki=.25,Qi=1.5;function wr(t,e,n=0,r,a,o=!1){let i=[e.x*ze,n+Qi,e.y*ze],s=a?[a[0],a[1],a[2]]:i,l=t[1],c=Number.isFinite(l)?l+(o?$i:yr):Number.isFinite(r)?n+r:n+yr,f=i[0]-t[0],p=i[2]-t[2],u=Math.hypot(f,p),m=u>.001?Math.min(ji,u*Ki):0,d=u>.001?f/u:0,y=u>.001?p/u:0;return{eye:[t[0]+d*m,c,t[2]+y*m],focal:s}}var Ee=Math.PI/180,Zi=45,gn=80,Rt=70,Ji=1,es=.99;function ts(t,e){if(!(t<Ji))return gn;if(!(Number.isFinite(e)&&e>0))return Rt;let n=2*Math.atan(e/(2*_t*es)/Math.max(.05,t))/Ee;return Math.max(Rt,Math.min(gn,n))}var ns=.25,_t=1,os=.25,rs=12*Ee,as=.2,is=1.5,Mr=.8,Ar=6,_r=1.9,ss=2/3,ls=.12,cs=.9,us=1.2,ds=2,Ir=.05,ms=6;function Dr(t,e,n=0){if(!t.length)return{min:[e[0]-6,n,e[2]-6],max:[e[0]+6,Math.max(n+Mr,e[1]),e[2]+6]};let r=1/0,a=-1/0,o=1/0,i=-1/0,s=n;for(let d of t)r=Math.min(r,d.cx-d.halfX),a=Math.max(a,d.cx+d.halfX),o=Math.min(o,d.cz-d.halfZ),i=Math.max(i,d.cz+d.halfZ),s=Math.max(s,d.y);let l=a-r,c=i-o,f=Math.max(l,Math.min(c,Ar))/2,p=Math.max(c,Math.min(l,Ar))/2,u=(r+a)/2,m=(o+i)/2;return{min:[u-f,n,m-p],max:[u+f,Math.max(n+Mr,s),m+p]}}function hs(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+_r,t.max[2]]}}function yn(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+is,e+as,e+_r*ss),(t.min[2]+t.max[2])/2]}function Fr(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 Pr(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,p=-1/0;for(let u=0;u<8;u++){let m=(u&1?n.max[0]:n.min[0])-t[0],d=(u&2?n.max[1]:n.min[1])-t[1],y=(u&4?n.max[2]:n.min[2])-t[2],v=Math.max(Ir,m*r+d*a+y*o),w=(m*s+y*l)/v;w<f&&(f=w),w>p&&(p=w)}return p-f}function Cr(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,p=l*r-s*o,u=s*a,m=1/0,d=-1/0;for(let y=0;y<8;y++){let v=(y&1?n.max[0]:n.min[0])-t[0],w=(y&2?n.max[1]:n.min[1])-t[1],E=(y&4?n.max[2]:n.min[2])-t[2],C=Math.max(Ir,v*r+w*a+E*o),D=(v*f+w*p+E*u)/C;D<m&&(m=D),D>d&&(d=D)}return d-m}function It(t,e){return Math.tan(t*Ee/2)*Math.max(.05,e)}function Er(t,e,n){let r=ts(n,t),a=l=>Math.max(Zi,Math.min(r,l)),o=l=>2*Math.atan(l)/Ee,i=Number.isFinite(t)&&t>0?a(o(t/(2*ns)/Math.max(.05,n))):r;if(!(Number.isFinite(e)&&e>0))return i;let s=Math.min(i,a(o(e/(2*ls))));return t/(2*It(s,n))>_t?i:s}function kr(t,e,n,r={}){let a=yn(e),o=[t[0],t[1],t[2]],i=0,s=0,l=d=>{if(!(d>0))return;let y=Fr(o,a);o[0]+=y.x*d,o[2]+=y.z*d,s+=d},c=r.preserveEye?0:e.max[1]+os-o[1];c>0&&(o[1]+=c,i=c,l(c/Math.tan(rs)));let f=hs(e),p=Pr(o,a,e),u=Er(p,Cr(o,a,f),n),m=p/(2*It(u,n));for(let d=0;!r.preserveEye&&d<ms&&m>_t;d++){let y=Math.max(1,Math.hypot(o[0]-a[0],o[2]-a[2])),v=Number.isFinite(m)?m/_t:2;l(Math.min(60,y*(Math.min(4,v)-1)+.5)),p=Pr(o,a,e),u=Er(p,Cr(o,a,f),n),m=p/(2*It(u,n))}return{eye:o,focal:a,fov:u,raisedM:i,pulledBackM:s,stageFrameWidth:m}}function ps(t,e,n){let r=Math.tan(e*Ee/2),a=It(e,n);return Math.max(1,t/Math.max(.05,Math.min(r,a)))}var fs=.7,Tr=.5,vs=.8;function Rr(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)))/Ee}function bs(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-Tr)+s[c]*Tr));return[t[0]+l[0]*o,t[1]+l[1]*o,t[2]+l[2]*o]}function Lr(t,e){let{aspect:n,venue:r}=e,a=t.focal,o=Fr(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=ds*(e.rowDepthM??cs),c=[t.eye[0]+o.x*l,t.eye[1]+us,t.eye[2]+o.z*l],f=[t.eye[0],t.eye[1]-fs,t.eye[2]],p=bs(c,a,f);s.push({name:"row",eye:c,focal:p,fov:Math.min(gn,Math.max(t.fov,2*Math.max(Rr(c,p,f),Rr(c,p,a))/vs))});let u=(y,v,w,E)=>{let C=ps(w,t.fov,n)*1.08,D=C*Math.sin(E*Ee),A=Number.isFinite(e.seatingTopY)?e.seatingTopY+2:-1/0,R=Math.max(D,A-v[1]),L=C*Math.cos(E*Ee);return{name:y,eye:[v[0]+o.x*L,v[1]+R,v[2]+o.z*L],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 m=[],d=-1/0;for(let y of s){let v=i(y.eye);m.length&&v<=d+.5||(m.push(y),d=v)}return m}import{Vec3 as gs}from"ogl";var mt=Math.PI/180,xn=320,Vr=70*mt,ys=32*mt,xs=24*mt,Or=.0026,Ss=.22,ws=.006,Ms=180,As=900,Ps=1100,Cs=4,ve=(t,e,n)=>Math.max(e,Math.min(n,t)),zr=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function Nr(t){let{canvas:e,camera:n}=t,r=[],a=!1,o=0,i=0,s=0,l=0,c=0,f=0,p=xn,u=null,m=()=>{u&&(clearTimeout(u),u=null)},d=!1,y=[0,0],v=0,w=!1,E=null,C=null,D=new Map,A=!1,R=0,L=0,b=0,F=0,x=()=>a&&r.length?r[ve(Math.round(o),0,r.length-1)].name:null,I=()=>{let M=x();M!==E&&(E=M,t.onStopChange?.(M))},z=()=>{if(!a||!r.length)return;let M=r[ve(Math.floor(o),0,r.length-1)],P=r[ve(Math.ceil(o),0,r.length-1)],S=ve(o-Math.floor(o),0,1),Y=(K,ne)=>K+(ne-K)*S,Z=[Y(M.eye[0],P.eye[0]),Y(M.eye[1],P.eye[1]),Y(M.eye[2],P.eye[2])],ge=[Y(M.focal[0],P.focal[0]),Y(M.focal[1],P.focal[1]),Y(M.focal[2],P.focal[2])],ce=ge[0]-Z[0],he=ge[1]-Z[1],oe=ge[2]-Z[2],ye=Math.hypot(ce,he,oe)||1,pe=Math.atan2(ce,oe),$=Math.asin(ve(he/ye,-1,1)),U=pe+i,ee=ve($+s,-80*mt,80*mt),q=Math.cos(ee)*ye;ce=Math.sin(U)*q,he=Math.sin(ee)*ye,oe=Math.cos(U)*q,n.position.set(Z[0],Z[1],Z[2]),n.fov=Y(M.fov,P.fov),n.updateProjectionMatrix(),n.lookAt(new gs(Z[0]+ce,Z[1]+he,Z[2]+oe)),t.onApplied?.()},_=()=>{if(!a||!r.length)return;let M=ve(Math.round(o),0,r.length-1);if(t.reducedMotion()){d=!1,o=M,z(),I(),t.requestRender();return}if(Math.abs(M-o)<.001){d=!1,I();return}l=o,c=M,f=performance.now(),p=xn,d=!0,t.requestRender()},O=M=>{!a||r.length<2||(m(),d=!1,o=ve(o+M,0,r.length-1),z(),I(),t.requestRender())},G=(M,P)=>{a&&(m(),d=!1,w=!1,i=ve(i-M*Or,-Vr,Vr),s=ve(s-P*Or,-xs,ys),z(),t.requestRender())},B=M=>{a&&(D.set(M.pointerId,{x:M.clientX,y:M.clientY}),D.size===1?(A=!0,F=0,R=M.clientX,L=M.clientY):D.size===2&&(A=!1,b=W()))},W=()=>{let M=[...D.values()];return M.length<2?0:Math.hypot(M[0].x-M[1].x,M[0].y-M[1].y)},N=M=>{if(!a||!D.has(M.pointerId))return;if(D.set(M.pointerId,{x:M.clientX,y:M.clientY}),D.size>=2){let Y=W();b>0&&O((b-Y)*ws),b=Y;return}if(!A)return;let P=M.clientX-R,S=M.clientY-L;R=M.clientX,L=M.clientY,F+=Math.abs(P)+Math.abs(S),!(F<=Cs)&&G(P,S)},te=M=>{D.delete(M.pointerId)&&(D.size<2&&(b=0),D.size===0&&(A=!1,_()))},X=M=>{if(!a)return;M.preventDefault();let P=M.deltaMode===1?16:M.deltaMode===2?100:1,S=ve(M.deltaY*P/100,-2,2);O(S*Ss),C&&clearTimeout(C),C=setTimeout(()=>{C=null,_()},Ms)},J=()=>{m(),a&&(a=!1,d=!1,w=!1,r=[],D.clear(),A=!1,C&&(clearTimeout(C),C=null),E!==null&&(E=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",B),e.addEventListener("pointermove",N),e.addEventListener("pointerup",te),e.addEventListener("pointercancel",te),e.addEventListener("wheel",X,{passive:!1}),{get active(){return a},enter(M,P=0){if(M.length<2){J();return}m(),r=M,a=!0,o=t.reducedMotion()?0:ve(P,0,M.length-1),o>0&&(u=setTimeout(()=>{u=null,a&&(l=o,c=0,f=performance.now(),p=Ps,d=!0,t.requestRender())},As)),i=0,s=0,d=!1,w=!1,E=null,z(),I(),t.requestRender()},exit:J,recentre(){return a?Math.abs(i)<1e-4&&Math.abs(s)<1e-4?!0:t.reducedMotion()?(w=!1,i=0,s=0,z(),t.requestRender(),!0):(y=[i,s],v=performance.now(),w=!0,t.requestRender(),!0):!1},update(M){if(!a)return!1;let P=!1;if(w){let S=ve((M-v)/xn,0,1),Y=1-zr(S);i=y[0]*Y,s=y[1]*Y,S>=1?(w=!1,i=0,s=0):P=!0}if(d){let S=ve((M-f)/p,0,1);o=l+(c-l)*zr(S),S>=1?(d=!1,o=c,I()):P=!0}return z(),P},currentStop:x,dispose(){J(),e.removeEventListener("pointerdown",B),e.removeEventListener("pointermove",N),e.removeEventListener("pointerup",te),e.removeEventListener("pointercancel",te),e.removeEventListener("wheel",X)}}}function Hr(t){return t.flying?"cinematic":t.panoramaMounted?"panorama":t.seatViewActive?"seatView":"orbit"}var Sn=null;function Gr(){return Sn??=import("../openPanorama-VD6PE3YZ.js").catch(t=>{throw Sn=null,t}),Sn}var Br=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Dt=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=Br(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(Br()-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 Wr(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function Ur(t){let{container:e,model:n,opts:r,expandedSeatById:a,seatIdsByRow:o,isNarrow:i}=t,s=null,l=()=>{if(!s)return;let p=i();Object.assign(s.style,p?{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:(p,u,m=!1)=>{if(c(),t.isDisposed())return null;let d=document.createElement("div");d.setAttribute("role","group"),Object.assign(d.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 w=a.get(p),E=w?.sectionId?n.sections.find(x=>x.id===w.sectionId):void 0,C=w?.label??p;d.setAttribute("aria-label",`Explore views near ${E?.label?`${E.label}, `:""}seat ${C}`);let D=document.createElement("span");D.textContent=r.seatViewCaption?.(p)??["Live 3D seat view",E?.label,C].filter(Boolean).join(" \xB7 "),Object.assign(D.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&&d.appendChild(D);let A=document.createElement("div");Object.assign(A.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),d.appendChild(A);let R=w?.rowId?o.get(w.rowId):void 0,L=R?.indexOf(p)??-1,b=L>=0?[R?.[L-1],R?.[L+1]]:[void 0,void 0],F=(x,I,z,_=!1)=>{let O=document.createElement("button");O.type="button",O.textContent=x,O.setAttribute("aria-label",I),Object.assign(O.style,{minHeight:"44px",padding:_?"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"}),_||(O.style.minWidth="44px"),_&&(O.dataset.panoramaTrigger=""),O.addEventListener("click",z),A.appendChild(O)};if(v&&b[0]){let x=a.get(b[0])?.label??b[0];F("\u2039",`View previous seat ${x}`,()=>{t.flyToSeat(b[0])})}if(v&&r.getSeatView){let x=r.seatViewActionLabel?.(p)??"Open 360\xB0 panorama";F(m?`\u21BB Retry ${x}`:`\u25C9 ${x}`,`${m?"Retry":x} from seat ${C}`,()=>{if(t.isDisposed()||u!==t.flightGen()){c();return}c(),t.openPanorama(p,400,u)},!0)}if(v&&b[1]){let x=a.get(b[1])?.label??b[1];F("\u203A",`View next seat ${x}`,()=>{t.flyToSeat(b[1])})}return!A.childElementCount&&!y?null:(e.appendChild(d),s=d,l(),d)},remove:c,layout:l}}var Es={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function Yr(t){let{container:e,orbit:n,isNarrow:r}=t,a={...Es,...t.labels??{}},o=(A,R)=>{A.setAttribute("aria-label",R),A.title=R},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 p=document.createElement("button");p.type="button",p.textContent="\u2725",o(p,a.move);let u=document.createElement("button");u.type="button",u.textContent="\u2212",o(u,a.zoomOut);let m=document.createElement("button");m.type="button",m.textContent="+",o(m,a.zoomIn);for(let A of[f,p,u,m])A.className="sl-3d-icon-control",Object.assign(A.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,p),c.append(m,u);let d=null,y=()=>{let A=n.dragAction();if(A===d)return;d=A;let R=A==="orbit";f.setAttribute("aria-pressed",String(R)),p.setAttribute("aria-pressed",String(!R)),f.style.background=R?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",p.style.background=R?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",i.title=R?`${a.rotate} \xB7 ${a.move} with Shift`:`${a.move} \xB7 ${a.rotate} with Shift`},v=A=>{n.setPrimaryDragMode(A),y()};f.addEventListener("click",()=>v("orbit")),p.addEventListener("click",()=>v("pan"));let w=()=>{let{atMin:A,atMax:R}=n.dollyLimitState();m.disabled!==A&&(m.disabled=A),u.disabled!==R&&(u.disabled=R)};u.addEventListener("click",()=>{n.zoomBy(ot),w()}),m.addEventListener("click",()=>{n.zoomBy(He),w()}),i.append(l,c),v("auto"),e.appendChild(i);let E=t.enabled!==!1,C=()=>{let A=r();i.style.display=s||!E?"none":"flex",i.style.right=A?"12px":"14px",i.style.bottom=A?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",l.style.display=A?"none":"flex",m.style.display=A?"none":"",u.style.display=A?"none":""};return C(),{element:i,utilityControls:c,setNavigationMode:v,syncNavigationMode:y,syncZoomLimits:w,setSeatViewLocked:A=>{s=A,n.setInteractionEnabled(!A),C()},seatViewLocked:()=>s,layout:C}}var Ts=.5,Xr=12,qr=20,Rs=28;function _s(t,e,n){return!(t>0)||!(n>0)?0:Ts*n/(2*t*Math.tan(e*Math.PI/360))}function jr(t){let{glctx:e,orbit:n,model:r,seats:a,opts:o,cinematic:i,analytics:s,seatIdByIndex:l,sectionIdBySeatId:c,tapSlop:f,tapMs:p,cancelFlight:u,focusSectionCamera:m,setSelection:d,ensureSeatView:y}=t,v=0,w=0,E=0,C=-1,D=!1,A=!1,R=_=>{t.seatViewLocked()||C===-1&&(C=_.pointerId,v=_.clientX,w=_.clientY,E=performance.now(),D=!1,A=i.active,i.active&&(s.cinematicCancelled(),u(),o.onViewTargetChange?.(null)))},L=_=>{_.pointerId===C&&Math.hypot(_.clientX-v,_.clientY-w)>f&&(D=!0)},b=(_,O,G,B,W)=>{let N=e.canvas.getBoundingClientRect(),te=e.canvas.clientWidth||N.width||1,X=e.canvas.clientHeight||N.height||1,J=_-N.left,M=O-N.top,P=B*B,S=-1,Y=P,Z=1/0;for(let ge of a){if(G&&ge.sectionId!==G)continue;let ce=r.seats.idToIndex.get(ge.id);if(ce===void 0)continue;if(W){let U=Math.round(r.seats.iState[ce]??0);if(U!==0&&U!==3)continue}let he=ce*3,oe=Ae(n.camera.projectionViewMatrix,[r.seats.iPosition[he],r.seats.iPosition[he+1]+.55,r.seats.iPosition[he+2]],te,X);if(!oe.visible)continue;let ye=oe.x-J,pe=oe.y-M,$=ye*ye+pe*pe;($<Y||Math.abs($-Y)<1&&oe.depth<Z)&&(S=ce,Y=$,Z=oe.depth)}return S},F=(_,O)=>{let G=t.gpu(),B=t.pick();if(!G||!B)return-1;B.syncFromSeatProgram(G.seatProgram);let W=e.canvas.getBoundingClientRect(),N=e.renderer.dpr,{x:te,y:X}=cr(_,O,W,N,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),J=Math.max(2,Math.round(8*N));return B.pick(n.camera,te,X,J)},x=()=>e.canvas.clientHeight||e.canvas.getBoundingClientRect().height,I=(_,O=Xr)=>{let G=n.camera?.position;if(!G)return!1;let B=_*3,W=Math.hypot(G.x-r.seats.iPosition[B],G.y-r.seats.iPosition[B+1],G.z-r.seats.iPosition[B+2]);return _s(W,n.fovY,x())>=O};return{onDown:R,onMove:L,onUp:_=>{if(_.pointerId!==C)return;let O=!D&&performance.now()-E<p;if(C=-1,A){A=!1;return}let G=t.gpu(),B=t.pick();if(!O||!G||!B)return;let W=F(_.clientX,_.clientY),N=_.pointerType==="touch"||_.pointerType==="pen",te=N?qr:Xr,X=W>=0&&I(W,te),J=!1;if(t.focusedSectionId()&&W>=0){let S=l[W],Y=S?c.get(S):void 0;if(Y&&Y!==t.focusedSectionId()&&m(Y,{keepCamera:X})){if(!X)return;J=!0}}if(t.focusedSectionId()&&W<0&&(W=b(_.clientX,_.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&W<0){let S=b(_.clientX,_.clientY,null,72,!1),Y=S>=0?l[S]:void 0,Z=Y?c.get(Y):void 0;if(Z&&Z!==t.focusedSectionId()&&m(Z))return}if(!t.focusedSectionId()){W<0&&(W=b(_.clientX,_.clientY,null,42,!1));let S=W>=0?l[W]:void 0,Y=S?c.get(S):void 0;if(Y&&m(Y,{keepCamera:X})){if(!X)return;J=!0}}if(W<0||W>=l.length){t.selection().size&&(d([]),o.onViewTargetChange?.(null));return}let M=l[W];if(N&&t.focusedSectionId()&&!J&&!I(W,qr)){t.focusSeatCamera(M,{seatPx:Rs,viewportHeightPx:x()});return}let P=Se[Math.round(r.seats.iState[W]??0)]??"available";if(P!=="available"&&P!=="selected"){o.onSeatInspect?.(M,P);return}if(t.selection().has(M)&&t.selection().size===1){d([]),o.onViewTargetChange?.(null),o.onSeatPick?.(M);return}d([M]),y(M),s.seatPicked(M,c.get(M)),o.onSeatPick?.(M)}}}var Ft=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 m=0;m<this.count;m++){let d=e[m*3],y=e[m*3+2];d<n&&(n=d),d>a&&(a=d),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=m=>{let d=Math.min(this.cols-1,Math.max(0,Math.floor((e[m*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[m*3+2]-r)/this.cell)))*this.cols+d};for(let m=0;m<this.count;m++)c[f(m)+1]++;for(let m=0;m<l;m++)c[m+1]+=c[m];let p=new Int32Array(this.count),u=c.slice(0,l);for(let m=0;m<this.count;m++)p[u[f(m)]++]=m;this.cellStart=c,this.cellItems=p}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),p=Math.floor((n-this.minZ)/this.cell),u=Math.ceil(r/this.cell)+1,m=this.iPosition,d=0;for(let y=0;y<=u&&d<l;y++){let v=p-y,w=p+y,E=f-y,C=f+y;for(let D=v;D<=w&&d<l;D++){if(D<0||D>=this.rows)continue;let A=D===v||D===w;for(let R=E;R<=C&&d<l;R++){if(!A&&R!==E&&R!==C){R=C-1;continue}if(R<0||R>=this.cols)continue;let L=D*this.cols+R;for(let b=i[L],F=i[L+1];b<F&&d<l;b++){let x=s[b],I=m[x*3]-e,z=m[x*3+2]-n,_=o===void 0?0:m[x*3+1]-o;I*I+_*_+z*z<=c&&(a[d++]=x)}}}}return d}};var kt=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(At);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new Ft(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)<rn)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>on){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(a.x,a.z,on,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 $r(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 Is,Vec3 as Ds}from"ogl";function Kr(){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 Qr(t){let{container:e,model:n,opts:r,orbit:a,cinematic:o,analytics:i,loop:s,labelOverlay:l,stageAzimuth:c,overviewFraming:f}=t,p=0,u=-1,m=(x,I,z=28)=>{a.camera.position.set(x[0],x[1],x[2]),a.camera.lookAt(new Ds(I[0],I[1],I[2])),a.camera.fov=z,a.camera.updateProjectionMatrix()},d=document.createElement("button");d.className="sl-3d-overview-control sl-3d-icon-control",d.type="button",d.replaceChildren(Kr());let y=r.navLabels?.fitView??"Show whole venue";d.setAttribute("aria-label",y),d.title=y,Object.assign(d.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=()=>{d.firstElementChild||d.replaceChildren(Kr())};v();let w=x=>{u=x;let I=t.gpu();I&&(I.seatProgram.uniforms.uFocusFloor.value=x,I.solidProgram.uniforms.uFocusFloor.value=x,I.chairProgram.uniforms.uFocusFloor.value=x),t.showSectionSeatLabels(null)},E=null,C=!1,D=()=>{if(E=null,C=!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(),d.style.display="",l.setVisible(!0),t.setFrozen(!1);let x=u>=0?n.floors[u]:null;if(t.setNearFieldDetailEnabled(!!x),t.setSeatViewLocked(!1),A(),t.removeArriveChip(),t.setNavigationMode("auto"),x){let I=x.focalWorld[0]-x.center[0],z=x.focalWorld[2]-x.center[2],_=Math.hypot(I,z)>x.radius*.12?Math.atan2(I,z):c,O={center:x.center,radius:x.radius,box:x.box},G={polarDeg:58,margin:1.12};t.reducedMotion()?a.frame(O,!1,_,!1,G):a.frameSoft(O,_,!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()},A=()=>{p++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),o.active&&(o.cancel(),a.resumeAfterFlight(n.focalWorld))},R=x=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let I=n.seats.idToIndex.get(x);if(I===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(x),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),d.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1);let z=t.inSeatView()&&r.arriveAtSeatEye===!0;t.setSeatStepping(z),t.setSeatViewLocked(!1);let _=++p;z?t.showArriveChip(x,_):t.removeArriveChip();let{eye:O,focal:G}=t.resolvedSeatViewPose(x,I),B=r.arriveAtSeatEye?t.seatViewArrival(x,I):null,W=B&&B.stops.length>1&&B.stops[1].name==="row"?B.stops[1]:null,N=B?B.focal:G,te=[a.camera.position.x,a.camera.position.y,a.camera.position.z],X=vn(te,B?.eye??O,N,n.bounds.center,n.bounds.radius),J=W?W.eye:B?B.eye:r.arriveAtSeatEye?O:X.finalPos,M=B?B.fov:r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?Rt:65:28,P=[X.waypoints[0],X.waypoints[1],J];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),m(J,N,M),s.requestRender(),i.cinematicSkipped(),t.isDisposed()||a.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),B&&t.enterSeatView(B.stops),t.showArriveChip(x,_),Promise.resolve();let S=new Is().copy(a.camera.quaternion),Y=gr(a.camera,J,N);s.requestRender();let Z=z?700:2500;return o.start(P,S,Y,Z,M).then(()=>{t.isDisposed()||_!==p||(t.setSeatStepping(!1),i.cinematicPlayed(Z),a.resumeAfterFlight(N),t.setSeatViewLocked(r.arriveAtSeatEye===!0),B&&t.enterSeatView(B.stops,W?1:0),s.requestRender(),t.showArriveChip(x,_))})},L=(x,I)=>{let z=n.sections.find(_=>_.id===x);if(!z||z.seatCount===0)return!1;if(E=x,C=!1,t.setSeeThrough?.(null),t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),o.cancel(),t.removeArriveChip(),n.floors.length>1&&u!==z.floorIndex&&w(z.floorIndex),t.setNavigationMode("auto"),t.panorama()||l.setVisible(!0),t.showSectionSeatLabels(x),!I?.keepCamera){let _=$r(z),O={polarDeg:_.polarDeg,margin:1.12};t.reducedMotion()?a.frame({center:_.center,radius:_.radius},!1,a.currentAzimuth,!1,O):a.glideTo({center:_.center,radius:_.radius},O)}return r.onSectionFocusChange?.(x),s.requestRender(),!0},b=(x,I)=>{if(t.isDisposed()||!t.gpu())return!1;let z=n.seats.idToIndex.get(x);if(z===void 0)return!1;let _=z*3,O=[n.seats.iPosition[_],n.seats.iPosition[_+1]+.55,n.seats.iPosition[_+2]],G=I?Fs(I,a.fovY,a.camera.aspect||1):Zr;return C=!0,t.setSeeThrough?.(O),t.reducedMotion()?a.frame({center:O,radius:G},!1,void 0,!1,wn):a.frameSoft({center:O,radius:G},void 0,!1,wn),s.requestRender(),!0},F=()=>{if(t.isNarrow?.()&&C&&E&&L(E)){s.requestRender();return}D()};return d.addEventListener("click",F),{overviewChip:d,layoutOverviewChip:v,flightGen:()=>p,focusedFloor:()=>u,applyFloorFocus:w,placeCameraFinal:m,cancelFlight:A,focusOverview:D,flyToSeat:R,focusSectionCamera:L,focusSeatCamera:b}}var Zr=4.5;function Fs(t,e,n){let r=Math.tan(e*Math.PI/360),a=r*Math.max(.001,n),i=ks*t.viewportHeightPx/(2*Math.max(1,t.seatPx)*r)*Math.min(r,a)/wn.margin;return Math.max(Ls,Math.min(Zr,i))}var ks=.5,Ls=1.5,wn={polarDeg:48,margin:1.25};function Mn(t,e,n,r,a,o,i,s,l=.5){let c=-1,f=s*s,p=1/0;for(let u=0;u<e;u++){let m=u*3,d=Ae(n,[t[m],t[m+1]+l,t[m+2]],r,a);if(!d.visible)continue;let y=d.x-o,v=d.y-i,w=y*y+v*v;(w<f-4||w<f+4&&d.depth<p)&&(c=u,f=Math.min(f,w),p=d.depth)}return c}function Jr(t){let e=performance.now(),{input:n,estimate:r}=ho(t);return{model:nt(n),buildMs:performance.now()-e,source:"main",...r?{estimate:r}:{}}}function Vs(t){let e=Wn(t.doc);return{...Jr({...t,seats:e}),seats:e}}function ea(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 p=n(f.data);p?s(p):l("bad_response")},a.postMessage(t)})}function Os(t){return ea(t,()=>Jr(t),({model:e,buildMs:n,estimate:r})=>({model:e,buildMs:n,source:"worker",...r?{estimate:r}:{}}))}function zs(t){return ea(t,()=>Vs(t),({model:e,buildMs:n,seats:r,estimate:a})=>r?{model:e,buildMs:n,seats:r,source:"worker",...a?{estimate:a}:{}}:null)}var Hs=40,Gs=48,Bs=Math.PI/180,Ws=6,Us=500,Ys=6;function gu(t,e,n={}){let r=performance.now(),a=e.prepared?e.prepared.estimate:e.estimate===!1?null:Qt(e.doc,e.seats);a&&(e={...e,doc:a.doc,seats:mo(e.seats,a)});let o=e.prepared?.model??nt(e),i=new Dt(n.onAnalytics),s=new Array(o.seats.count);for(let[h,g]of o.seats.idToIndex)s[g]=h;let l=new Map(e.seats.map(h=>[h.id,h])),c=new Map;for(let h of e.seats){if(!h.rowId)continue;let g=c.get(h.rowId);g?g.push(h.id):c.set(h.rowId,[h.id])}let f=new Map,p=[0,0,0,0];function u(){if(v)for(let h of[v.seatProgram,v.solidProgram,v.chairProgram])h.uniforms.uSeeThrough.value=p}e.seats.forEach((h,g)=>{f.set(h.id,o.seatSectionIds?.[g]??h.sectionId)});let m=new Map;for(let[h,g]of o.seats.idToIndex){let T=f.get(h);if(!T)continue;let V=m.get(T);V?V.push(g):m.set(T,[g])}let d=()=>{if(!v||!o.sectionSolidRanges.length)return;let{lit:h,anyUnlit:g}=nr(o.sectionSolidRanges,m,o.seats.iState);v.setSectionShellLit(g?h:null)},y=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)),v=null,w=null,E=null,C=!1,D=!1,A=!1,R=new Map,L=null,b=null,F=null,x=new Map,I=null,z=()=>{F===null&&(F=t.style.zIndex,t.style.zIndex="20")},_=()=>{F!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=F),F=null)},O=!1,G=()=>O?fe.focusedFloor():-1,B=()=>{v=sr(P.gl,o),w?.dispose(),w=Fo(P.gl,[1,1,1],o.theme.seatStates.selected),In(!1),d(),An(),E=new Et(P.renderer,v.seatGeometry,v.chairGeometry,v.solidGeometry,o.seats.count),P.setClearColor(o.theme.background.top),E.setRestoreClear(o.theme.background.top),E.setRoomCentre(o.room?.centre),v.seatProgram.uniforms.uSeatRadius.value=et*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(),N.forceRegather()},W=!1,N=new kt({model:o,orbit:()=>S,gpu:()=>v}),te=!1,X=new Map,J=24,M=h=>N.setDetailEnabled(h),P=new St(t,{onContextLost:()=>{A||i.contextLost(),C=!0,ie.stop(),v=null,E=null},onContextRestored:()=>{B(),C=!1,A||i.contextRestored(),ie.requestRender()}}),S=new wt(P.gl,P.canvas,()=>ie.requestRender(),()=>i.orbitEngaged());S.setAspect(P.aspect);let Y=(e.doc.floors?.flatMap(h=>h.objects)??e.doc.objects).some(h=>h.type==="section"&&h.physical3dProvenance?.surfaceKind?.status==="inferred"),Z=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(Y&&o.stages.length===0))return po(o.focalWorld,o.seats.iPosition,o.bounds)})(),ge=(e.doc.floors?.flatMap(h=>h.objects)??e.doc.objects).some(h=>h.type==="shape"&&h.stageKind?.startsWith("pitch-")),ce=o.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:ge?36:48,margin:1.05},he=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;S.frame(o.bounds,!he&&n.skipInitialOverviewAnimation!==!0,Z,n.portraitOverviewCrop===!0,ce);let oe=new Tt(S.camera),ye=Wr(t),pe=fo(t,o),$=new Pt(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),U=o.labels,ee=()=>to(U,o.floors.length,G());$.setLabels(ee()),$.setOverviewDistance(S.targetDistance);let q=()=>{let h=new Map,g=Se.indexOf("available");for(let T of U){if(!T.wheelchairSeats)continue;let V=0;for(let H of T.wheelchairSeats)o.seats.iState[H]===g&&V++;V>0&&h.set(T.id,V)}return $.setWheelchairFree(h)};q();let K=null,ne=()=>[...R.keys()].flatMap(h=>{let g=o.seats.idToIndex.get(h),T=g===void 0?void 0:e.seats[g];if(g===void 0||T?.id!==h)return[];let V=g*3;return[{id:`seat:${h}`,kind:"seat",seatWidthM:o.seats.iChairWidth[g]*2,text:T.displayLabel||T.label,anchor:[o.seats.iPosition[V],o.seats.iPosition[V+1]+1.05,o.seats.iPosition[V+2]],pinBase:Vt(V)}]}),se=-1,An=()=>{v&&(se=K?o.sections.findIndex(h=>h.id===K):-1,v.seatProgram.uniforms.uFocusSection.value=se,v.chairProgram.uniforms.uFocusSection.value=se)},ht=h=>{if(K=h,An(),$.setForcedDense(!!h),!h){let k=ne(),le=new Set(k.map(ae=>ae.id));$.setLabels([...ee().filter(ae=>!le.has(ae.id)),...k]);return}let g=e.seats.filter(k=>f.get(k.id)===h),T=new Set(g.map(k=>k.id)),V=new Set(g.map(k=>k.rowId)),H=new Set(R.keys()),Q=new Set(g.filter(k=>H.has(k.id)).map(k=>k.id)),j=ee().filter(k=>k.kind!=="row"&&k.kind!=="seat"&&k.kind!=="access"||k.kind==="access"&&T.has(k.id.slice(7))||(k.kind==="row"?V.has(k.id.slice(4)):T.has(k.id.slice(5))));if(o.seatCount<=6e3&&Q.size===0){$.setLabels(j);return}let re=g,me=new Set(re.map(k=>`seat:${k.id}`)),be=re.flatMap(k=>{let le=o.seats.idToIndex.get(k.id);if(le===void 0)return[];let ae=le*3;return[{id:`seat:${k.id}`,kind:"seat",seatWidthM:o.seats.iChairWidth[le]*2,rowId:k.rowId,text:H.has(k.id)?k.displayLabel||k.label:uo(k.displayLabel||k.label),anchor:[o.seats.iPosition[ae],o.seats.iPosition[ae+1]+(H.has(k.id)?1.05:.55),o.seats.iPosition[ae+2]],...H.has(k.id)?{pinBase:Vt(ae)}:{}}]});$.setLabels([...j.filter(k=>!me.has(k.id)),...be])};B();let we=null,Lt=null,Pn=new Ns,pt=h=>{if(C||!v||D)return!1;let g=Hr({flying:oe.active,panoramaMounted:L!==null,seatViewActive:we?.active===!0}),T=g==="orbit"?se:-1;v.seatProgram.uniforms.uFocusSection.value=T,v.chairProgram.uniforms.uFocusSection.value=T;let V=te?!1:g==="cinematic"?oe.update(performance.now()):g==="seatView"?we.update(performance.now()):g==="orbit"?S.update():!1;Lt?.syncZoomLimits(),Lt?.syncNavigationMode();let H=G()>=0?o.floors[G()]:null,Q=H?.radius??o.bounds.radius,j=Ro(S.currentDistance,Q),re=W?{center:[S.camera.position.x,S.camera.position.y,S.camera.position.z],radius:520}:o.clipBounds??o.renderBounds;S.updateClipping(re);let me=H?.center??o.renderBounds.center,be=H?.radius??o.renderBounds.radius,k=(ue,Xt)=>Math.hypot(S.camera.position.x-ue[0],S.camera.position.y-ue[1],S.camera.position.z-ue[2])<=Xt*(N.detailVisible?1.8:1.55),le=k(me,be);if(!le&&K){let ue=o.sections.find(Xt=>Xt.id===K);ue&&(le=k(ue.center,Math.max(12,ue.radius*2)))}N.detailVisible=le;let ae=v.seatProgram.uniforms;ae.uSeatScale.value=j.scale,ae.uSeatFade.value=j.fade;let xe=!!H&&_o(H.seatCount,P.canvas.clientWidth||1,P.canvas.clientHeight||1),_e=Io(o.seats.count,Q,S.currentDistance,S.camera.fov,P.canvas.clientHeight||1),Ke=N.detailVisible||xe||_e?1:0,Qe=N.detailVisible||G()>=0||o.floors.length>1?1:0;N.ease(h,Ke,Qe),ae.uSeatDetail.value=N.seatDetailMix;let bt=Ke===0&&N.seatDetailMix<.01;v.seatGeometry.setDrawRange(bt?Zt:0,bt?vo:Zt),v.solidProgram.uniforms.uStructureDetail.value=N.structureDetailMix,ae.uMinPixels.value=j.minPixels,ae.uPixelToWorld.value=2*Math.tan(S.camera.fov*Bs/2)/Math.max(1,P.pixelHeight),N.update(N.detailVisible),o.outdoor&&(Pn.copy(S.camera.projectionViewMatrix).inverse(),v.backgroundProgram.uniforms.uInvViewProj.value.set(Pn)),P.renderer.render({scene:v.background,clear:!0}),P.renderer.render({scene:v.main,camera:S.camera,clear:!1});let Ze=w?w.update(performance.now(),[S.camera.position.x,S.camera.position.y,S.camera.position.z],L!==null,g==="seatView"):!1;if(w&&P.renderer.render({scene:w.root,camera:S.camera,clear:!1}),pe){let ue=S.camera.worldMatrix;pe.update(g==="seatView"?[S.camera.position.x,S.camera.position.y,S.camera.position.z]:null,[-ue[8],-ue[9],-ue[10]])}$.update(S.camera.projectionViewMatrix,P.canvas.clientWidth||1,P.canvas.clientHeight||1,S.currentDistance,Q,[S.camera.position.x,S.camera.position.y,S.camera.position.z]);let Oe=V||Ze||N.seatDetailMix!==Ke||N.structureDetailMix!==Qe;return Cn(!Oe),Oe},Cn=Ao(t),ie=new Mt(pt),En=typeof ResizeObserver<"u"?new ResizeObserver(()=>Yt.resize()):null;En?.observe(t),S.setZoomPointResolver((h,g)=>{let T=P.canvas.getBoundingClientRect(),V=P.canvas.clientWidth||T.width,H=P.canvas.clientHeight||T.height;if(!(V>0)||!(H>0))return null;S.camera.updateMatrixWorld();let Q=Mn(o.seats.iPosition,o.seats.count,S.camera.projectionViewMatrix,V,H,h-T.left,g-T.top,Hs);if(Q<0)return null;let j=Q*3;return[o.seats.iPosition[j],o.seats.iPosition[j+1]+.5,o.seats.iPosition[j+2]]});function Vt(h){return[o.seats.iPosition[h],o.seats.iPosition[h+1]+.5,o.seats.iPosition[h+2]]}$.setSeatNumberRow(null);let Me=null,Te=0,Ot=null,Tn=()=>{Te=0;let h=null,g=null;if(Me&&!we?.active&&!oe.active){let H=P.canvas.getBoundingClientRect(),Q=P.canvas.clientWidth||H.width,j=P.canvas.clientHeight||H.height;if(Q>0&&j>0){let re=Mn(o.seats.iPosition,o.seats.count,S.camera.projectionViewMatrix,Q,j,Me.x-H.left,Me.y-H.top,Gs);h=re>=0?e.seats[re]?.rowId??null:null;let me=re>=0?e.seats[re]?.id??null:null;if(g=me,Me.mouse&&!Me.pressing&&!!K&&!!me&&f.get(me)===K){let k=t.getBoundingClientRect();Ot=me,n.onSeatHover?.(me,{x:Me.x-k.left,y:Me.y-k.top})}else Rn()}}else Rn();let T=Me?.mouse?g:null,V=$.setSeatNumberSeat(T);($.setSeatNumberRow(h)||V)&&ie.requestRender()};function Rn(){Ot!==null&&(Ot=null,n.onSeatHover?.(null,null))}let ft=h=>{Me={x:h.clientX,y:h.clientY,mouse:h.pointerType==="mouse",pressing:h.type==="pointerdown"},Te||(Te=requestAnimationFrame(Tn))},_n=h=>{h.pointerType==="mouse"&&(Me=null,Te||(Te=requestAnimationFrame(Tn)))};P.canvas.addEventListener("pointermove",ft),P.canvas.addEventListener("pointerdown",ft),P.canvas.addEventListener("pointerleave",_n);function In(h){if(!w)return;let g=[];for(let T of R.keys()){let V=o.seats.idToIndex.get(T);if(V===void 0)continue;let H=V*3;g.push({id:T,position:Vt(H)})}w.setSeats(g,performance.now(),h)}let Dn=h=>{let g=H=>{let Q=o.seats.idToIndex.get(H);return Q===void 0?void 0:o.seats.iState[Q]},{updates:T,next:V}=dr(R,h,g);if(R=V,$.setSelectedSeatIds(R.keys()),In(!qe()),ie.requestRender(),ht(K),T.length){let H=$t(o.seats,T);v&&v.uploadSeatStateRuns(H),d(),ie.requestRender()}},qe=()=>I!==null?I:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ta=8,Fn=h=>{if(!n.getSeatView)return null;let g=x.get(h);if(!g)for(g=Promise.resolve(n.getSeatView(h)),x.set(h,g),g.catch(()=>{x.get(h)===g&&x.delete(h)});x.size>ta;){let T=x.keys().next().value;if(T===void 0)break;x.delete(T)}return g},kn=Dr(o.stages,o.focalWorld,o.bounds.groundY??0),Ln=yn(kn),zt=(h,g)=>{let T=l.get(h),V=Math.max(0,Math.round(o.seats.iFloor[g]??0)),H=e.doc.floors?.[V],Q=o.floors[V],j=H?.focalPoint??e.doc.focalPoint,re=Q?{x:Q.focalWorld[0]/ze,y:Q.focalWorld[2]/ze}:j,me=T?.focalPoint?{x:T.focalPoint.x+re.x-j.x,y:T.focalPoint.y+re.y-j.y}:re,be=[o.seats.iPosition[g*3],o.seats.iPosition[g*3+1],o.seats.iPosition[g*3+2]],k=Sr(o.seats.iPosition,g,Ln),le=k!==null&&Math.abs(k)<xr;return wr(be,me,H?.baseHeightM??0,T?.eyeHeightM,Ln,le)},Nt=()=>(t.clientWidth||P.canvas.clientWidth)<=520,Ht=null,Vn=null,na=async(h,g,T)=>{if(!n.getSeatView||A||T!==fe.flightGen())return;let V;try{V=await Gr()}catch{if(i.panoramaFailed(h,"mount"),!A&&T===fe.flightGen()){let H=Bt(h,T,!0);requestAnimationFrame(()=>H?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(A||T!==fe.flightGen()||!Ht))return Vn??=V.createOpenPanorama(Ht),Vn(h,g,T)},Gt=Ur({container:t,model:o,opts:n,expandedSeatById:l,seatIdsByRow:c,isNarrow:Nt,isDisposed:()=>A,flightGen:()=>fe.flightGen(),flyToSeat:h=>Gn(h),openPanorama:(h,g,T)=>na(h,g,T)}),Bt=Gt.show,Wt=Gt.remove,oa=Gt.layout,Re=Yr({container:t,orbit:S,isNarrow:Nt,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});Lt=Re;let ra=Re.element,je=Re.setNavigationMode,aa=Re.layout,ia=Re.utilityControls,$e=null,On=!1,vt=h=>{Re.setSeatViewLocked(h),h||we?.exit()};we=Nr({canvas:P.canvas,camera:S.camera,requestRender:()=>ie.requestRender(),reducedMotion:qe,onStopChange:h=>{let g=h??(On?"seat":null);$e=g;try{n.onSeatViewStopChange?.(g)}catch{}},onApplied:()=>{A||S.syncFromCamera()}});let zn=o.sections.reduce((h,g)=>g.seatCount>0&&g.box?Math.max(h,g.box.max[1]):h,-1/0),Nn=(h,g)=>{let{eye:T}=zt(h,g),V=(t.clientWidth||P.canvas.clientWidth||1)/Math.max(1,t.clientHeight||P.canvas.clientHeight||1),H=kr(T,kn,V,{preserveEye:!0});if(n.seatViewStops===!1)return{...H,stops:[]};let Q=f.get(h),j=Q?o.sections.find(re=>re.id===Q):void 0;return{...H,stops:Lr(H,{aspect:V,seatingTopY:Number.isFinite(zn)?zn:o.bounds.box.max[1],section:j&&j.seatCount>0?{center:j.center,radius:j.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},fe=Qr({isNarrow:Nt,setSeeThrough:h=>{p=h?[h[0],h[1],h[2],Ys]:[0,0,0,0],u(),ie.requestRender()},container:t,model:o,opts:n,orbit:S,cinematic:oe,analytics:i,loop:ie,labelOverlay:$,stageAzimuth:Z,overviewFraming:ce,gpu:()=>v,isDisposed:()=>A,panorama:()=>L,setPanorama:h=>{L=h},setPanoramaSphereVisible:h=>{W=h},panoramaLoadAbort:()=>b,setPanoramaLoadAbort:h=>{b=h},setFrozen:h=>{D=h},restorePanoramaLayer:_,reducedMotion:qe,resolvedSeatViewPose:zt,showSectionSeatLabels:ht,setNearFieldDetailEnabled:M,setSeatViewLocked:vt,setNavigationMode:je,showArriveChip:Bt,removeArriveChip:Wt,inSeatView:()=>$e!==null,setSeatStepping:h=>{On=h},seatViewArrival:(h,g)=>n.arriveAtSeatEye?Nn(h,g):null,enterSeatView:(h,g)=>we?.enter(h,g)});O=!0;let Ut=fe.overviewChip,sa=fe.layoutOverviewChip,la=fe.applyFloorFocus,ca=fe.focusOverview,Hn=fe.cancelFlight,Gn=fe.flyToSeat,Bn=fe.focusSectionCamera;ia.appendChild(Ut),Ht={container:t,model:o,opts:n,analytics:i,orbit:S,loop:ie,seatsById:l,ensureSeatView:Fn,resolvedSeatViewPose:zt,gpu:()=>v,gl:P.gl,isContextLost:()=>C,isDisposed:()=>A,flightGen:()=>fe.flightGen(),setPanorama:h=>{L=h},getLoadAbort:()=>b,setLoadAbort:h=>{b=h},setPanoramaSphereVisible:h=>{W=h,h&&we?.exit()},setFrozen:h=>{D=h},raisePanoramaLayer:z,restorePanoramaLayer:_,getOverviewChip:()=>Ut,labelOverlay:$,reducedMotion:qe,removeArriveChip:Wt,showArriveChip:Bt};let Ce=jr({glctx:P,orbit:S,model:o,seats:e.seats,opts:n,cinematic:oe,analytics:i,seatIdByIndex:s,sectionIdBySeatId:f,tapSlop:Ws,tapMs:Us,gpu:()=>v,pick:()=>E,seatViewLocked:()=>Re.seatViewLocked(),focusedSectionId:()=>K,selection:()=>R,cancelFlight:Hn,focusSectionCamera:Bn,focusSeatCamera:fe.focusSeatCamera,setSelection:Dn,ensureSeatView:Fn});P.canvas.addEventListener("pointerdown",Ce.onDown),P.canvas.addEventListener("pointermove",Ce.onMove),P.canvas.addEventListener("pointerup",Ce.onUp),P.canvas.addEventListener("pointercancel",Ce.onUp),ie.requestRender();let Yt={setAvailability(h){let g=ur(R,h),T=$t(o.seats,g);T.length&&v&&v.uploadSeatStateRuns(T),d(),T.length&&q(),ie.requestRender()},setSelection:Dn,setNavigationMode:je,zoomIn(){S.zoomBy(He),ie.requestRender()},zoomOut(){S.zoomBy(ot),ie.requestRender()},flyToSeat:Gn,focusOverview:ca,seatViewStop:()=>$e,recentreSeatView:()=>we?.recentre()??!1,resize(){let{width:h,height:g}=P.resize();S.setAspect(h/Math.max(1,g)),oa(),aa(),sa(),ie.requestRender()},stats(){return{...ie.stats(),drawCalls:v?v.drawCalls:0,fallbackTriangles:v?v.seatGeometry.drawRange.count/3*o.seats.count:0,seatCount:o.seatCount}},captureImage(h=1280){if(C||!v||typeof document>"u")return null;pt(0);let g=P.canvas,T=Math.min(1,h/Math.max(g.width,g.height,1)),V=document.createElement("canvas");V.width=Math.max(1,Math.round(g.width*T)),V.height=Math.max(1,Math.round(g.height*T));let H=V.getContext("2d");return H?(H.drawImage(g,0,0,V.width,V.height),V.toDataURL("image/jpeg",.82)):null},captureSeatView(h,g=480){if(C||!v||D||typeof document>"u"||oe.active||L!==null||we?.active)return null;let T=X.get(h);if(T)return T;let V=o.seats.idToIndex.get(h);if(V===void 0)return null;let{eye:H,focal:Q,fov:j}=Nn(h,V),re=S.snapshot(),me=[N.seatDetailMix,N.structureDetailMix],be=null;try{te=!0,S.camera.position.set(H[0],H[1],H[2]),S.camera.perspective({fov:j,aspect:S.camera.aspect}),S.camera.lookAt(Q),S.camera.updateMatrixWorld(),S.syncFromCamera(),N.seatDetailMix=1,N.structureDetailMix=1,N.forceRegather(),pt(0);let k=P.canvas,le=Math.min(k.width,Math.round(k.height*16/9)),ae=Math.round(le*9/16),xe=document.createElement("canvas");xe.width=Math.max(1,Math.round(g)),xe.height=Math.max(1,Math.round(g*9/16));let _e=xe.getContext("2d");_e&&(_e.drawImage(k,(k.width-le)/2,(k.height-ae)/2,le,ae,0,0,xe.width,xe.height),be=xe.toDataURL("image/jpeg",.8))}finally{te=!1,re(),N.seatDetailMix=me[0],N.structureDetailMix=me[1],N.forceRegather(),pt(0)}if(be)for(X.set(h,be);X.size>J;)X.delete(X.keys().next().value);return be},getQualityEvidence(){let h=ie.stats(),g=P.canvas.clientWidth||1,T=P.canvas.clientHeight||1,V=o.bounds.center,H=Ae(S.camera.projectionViewMatrix,[V[0],o.bounds.box.min[1],V[2]],g,T),Q=Ae(S.camera.projectionViewMatrix,[V[0],o.bounds.box.max[1],V[2]],g,T),j=o.bounds.box,re=[j.min[0],j.max[0]].flatMap(k=>[j.min[1],j.max[1]].flatMap(le=>[j.min[2],j.max[2]].map(ae=>Ae(S.camera.projectionViewMatrix,[k,le,ae],g,T)))).filter(k=>Number.isFinite(k.x)&&Number.isFinite(k.y)&&Number.isFinite(k.depth)),me=re.length?(()=>{let k=Math.min(...re.map(ue=>ue.x)),le=Math.max(...re.map(ue=>ue.x)),ae=Math.min(...re.map(ue=>ue.y)),xe=Math.max(...re.map(ue=>ue.y)),_e=Math.max(0,k),Ke=Math.min(g,le),Qe=Math.max(0,ae),bt=Math.min(T,xe),Ze=Math.max(0,Ke-_e),Oe=Math.max(0,bt-Qe);return{box:{x:_e,y:Qe,width:Ze,height:Oe},horizontalFillRatio:Ze/g,verticalFillRatio:Oe/T,visibleAreaRatio:Ze*Oe/(g*T),clippedEdges:[...ae<0?["top"]:[],...le>g?["right"]:[],...xe>T?["bottom"]:[],...k<0?["left"]:[]]}})():void 0,be=String(P.gl.getParameter(P.gl.VERSION)??"");return{viewport:{width:g,height:T},context:{webgl2:/webgl\s*2/i.test(be),lost:C},frame:{rendered:h.rendered,idle:h.idle},camera:{position:[S.camera.position.x,S.camera.position.y,S.camera.position.z],distance:S.currentDistance,verticalFovDeg:S.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:H.visible&&Q.visible?Math.abs(H.y-Q.y):0},labels:$.qualityEvidence(),framing:me,...$e?{seatView:{fovDeg:S.camera.fov,stop:$e}}:{}}},getQualityReport(){return un(Yt.getQualityEvidence())},loseContextForTest(){P.simulateContextLossCycle()},floors(){return o.floors},focusFloor(h){if(h!==null&&!o.floors.some(T=>T.index===h))return!1;let g=h??-1;if(M(h!==null),vt(!1),la(g),je("orbit"),h===null)oe.cancel(),qe()?S.frame(o.bounds,!1,Z,n.portraitOverviewCrop===!0,ce):S.frameSoft(o.bounds,Z,n.portraitOverviewCrop===!0,ce),$.setOverviewDistance(S.targetDistance);else{let T=o.floors[h];if(T.seatCount>0){oe.cancel();let V=T.focalWorld[0]-T.center[0],H=T.focalWorld[2]-T.center[2],Q=Math.hypot(V,H)>T.radius*.12?Math.atan2(V,H):Z;S.frame({center:T.center,radius:T.radius,box:T.box},!1,Q,!1,{polarDeg:58,margin:1.12}),$.setOverviewDistance(S.targetDistance)}}return ie.requestRender(),!0},zones(){return o.zones},focusZone(h){let g=o.zones.find(Q=>Q.id===h);if(!g||g.seatCount===0)return!1;M(!1),vt(!1),oe.cancel(),je("orbit"),ht(null),n.onSectionFocusChange?.(null);let T=g.focalWorld[0]-g.center[0],V=g.focalWorld[2]-g.center[2],H=Math.hypot(T,V)>g.radius*.12?Math.atan2(T,V):void 0;return S.frame({center:g.center,radius:g.radius*1.25},!1,H),ie.requestRender(),!0},sections(){return o.sections},focusSection(h){return Bn(h)},rows(h){return h?o.rows.filter(g=>g.sectionId===h):o.rows},seatsInRow(h){return e.seats.filter(g=>g.rowId===h).map(g=>({id:g.id,label:g.displayLabel||g.label}))},focusRow(h){let g=o.rows.find(T=>T.id===h);return!g||g.seatCount===0?!1:(M(!0),vt(!1),oe.cancel(),je("pan"),g.sectionId&&(ht(g.sectionId),n.onSectionFocusChange?.(g.sectionId)),S.frame({center:g.center,radius:Math.max(2.5,g.radius*.65)}),ie.requestRender(),!0)},setReducedMotionForTest(h){I=h},dispose(){A=!0,pe?.dispose(),Cn(!1),Wt(),Ut.remove(),ra.remove(),Hn(),we?.dispose(),ie.stop(),$.dispose(),En?.disconnect(),L&&(L.dispose(),L=null),_(),ye(),P.canvas.removeEventListener("pointerdown",Ce.onDown),P.canvas.removeEventListener("pointermove",Ce.onMove),P.canvas.removeEventListener("pointerup",Ce.onUp),P.canvas.removeEventListener("pointercancel",Ce.onUp),P.canvas.removeEventListener("pointermove",ft),P.canvas.removeEventListener("pointerdown",ft),P.canvas.removeEventListener("pointerleave",_n),Te&&cancelAnimationFrame(Te),S.dispose(),E&&E.dispose(),v&&v.dispose(),v=null,w?.dispose(),w=null,E=null,P.dispose()}};return i.opened(o.seatCount,y,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),Yt}export{ui as VENUE3D_QUALITY_REPORT_VERSION,ua as autoVenue3d,nt as buildSceneModel,Qt as estimateVenue3D,un as inspectVenue3DQualityEvidence,gu as mountVenue3D,Os as prepareVenue3D,zs 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};