@seatlayer/core 0.96.0 → 0.98.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 (123) hide show
  1. package/dist/ar-Q44JP5JY.js +1 -0
  2. package/dist/be-CGFFSIQL.js +1 -0
  3. package/dist/bg-WOYK6OLH.js +1 -0
  4. package/dist/ca-77ZVI3X5.js +1 -0
  5. package/dist/chunk-2MXDWZQ4.js +1 -0
  6. package/dist/chunk-2P72QUJR.js +1 -0
  7. package/dist/chunk-5N4H3KMR.js +1 -0
  8. package/dist/chunk-ASIIXY5M.js +1 -0
  9. package/dist/{chunk-O3DGXAIC.js → chunk-CUACREZL.js} +1 -1
  10. package/dist/{chunk-CEIVHWRB.js → chunk-FLMKHAUT.js} +1 -1
  11. package/dist/{chunk-TKYTTEJ2.js → chunk-IW7QZIMF.js} +1 -1
  12. package/dist/chunk-M5VINTGE.js +1 -0
  13. package/dist/{chunk-U7CVRE4P.js → chunk-OLGPAFXW.js} +1 -1
  14. package/dist/{chunk-M5X6G7FD.js → chunk-P4C24CIZ.js} +1 -1
  15. package/dist/{chunk-A3ZL3R75.js → chunk-QEPYNCBJ.js} +1 -1
  16. package/dist/chunk-VAI2VDQR.js +1 -0
  17. package/dist/{chunk-Q3MSDG4S.js → chunk-YPESNMTC.js} +1 -1
  18. package/dist/chunk-Z43H6AWN.js +1 -0
  19. package/dist/core/chart-ops/index.cjs +1 -1
  20. package/dist/core/chart-ops/index.d.cts +40 -18
  21. package/dist/core/chart-ops/index.d.ts +40 -18
  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.js +1 -1
  25. package/dist/core/layout/index.cjs +1 -1
  26. package/dist/core/layout/index.js +1 -1
  27. package/dist/core/quality/index.js +1 -1
  28. package/dist/core/render-assets/index.js +1 -1
  29. package/dist/core/sections/index.js +1 -1
  30. package/dist/cs-OSBZYCSR.js +1 -0
  31. package/dist/cy-ZCOJW2WH.js +1 -0
  32. package/dist/da-2PDK6JTR.js +1 -0
  33. package/dist/de-R5LLVFUU.js +1 -0
  34. package/dist/el-ZPFVDCWA.js +1 -0
  35. package/dist/es-7YASJP32.js +1 -0
  36. package/dist/et-J4TV6KQL.js +1 -0
  37. package/dist/fa-4TEO7UGM.js +1 -0
  38. package/dist/fi-GIUDDKMH.js +1 -0
  39. package/dist/fr-J5J2XJLA.js +1 -0
  40. package/dist/he-OCEHSVUJ.js +1 -0
  41. package/dist/hi-EK5CTBW5.js +1 -0
  42. package/dist/hr-SLDTQOYC.js +1 -0
  43. package/dist/hu-2QNE77NO.js +1 -0
  44. package/dist/id-LGDAFQJK.js +1 -0
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.d.cts +8 -16
  47. package/dist/index.d.ts +8 -16
  48. package/dist/index.js +1 -1
  49. package/dist/it-DT4Y3IYB.js +1 -0
  50. package/dist/ja-D5EY2XCQ.js +1 -0
  51. package/dist/ko-DD2NV45Q.js +1 -0
  52. package/dist/ku-KZCMVLBE.js +1 -0
  53. package/dist/localeLoaders-GGAKX22E.js +1 -0
  54. package/dist/lt-QWGTJ47Y.js +1 -0
  55. package/dist/lv-LYAIG3VK.js +1 -0
  56. package/dist/ms-XTF4KNGD.js +1 -0
  57. package/dist/nl-QEXY6XHS.js +1 -0
  58. package/dist/no-HCOXN2CN.js +1 -0
  59. package/dist/pl-BWY53TSD.js +1 -0
  60. package/dist/pt-2UJUBCPL.js +1 -0
  61. package/dist/ro-GGXOLTED.js +1 -0
  62. package/dist/ru-ZTFK3WCU.js +1 -0
  63. package/dist/sk-KU543Y2U.js +1 -0
  64. package/dist/sl-FT576R7A.js +1 -0
  65. package/dist/sr-WE3J46JE.js +1 -0
  66. package/dist/stage-CKb7aNoH.d.cts +18 -0
  67. package/dist/stage-CKb7aNoH.d.ts +18 -0
  68. package/dist/sv-YEAOPSEB.js +1 -0
  69. package/dist/th-BEBRDHJA.js +1 -0
  70. package/dist/tr-LOAHUPSH.js +1 -0
  71. package/dist/uk-2GMICSHN.js +1 -0
  72. package/dist/vi-TC5B6AUR.js +1 -0
  73. package/dist/view3d/index.cjs +283 -78
  74. package/dist/view3d/index.d.cts +152 -78
  75. package/dist/view3d/index.d.ts +152 -78
  76. package/dist/view3d/index.js +281 -76
  77. package/dist/view3d/scene/scene.worker.cjs +1 -1
  78. package/dist/view3d/scene/scene.worker.js +1 -1
  79. package/dist/zh-Hans-TSZWTZQY.js +1 -0
  80. package/dist/zh-Hant-TLB4FZYM.js +1 -0
  81. package/package.json +1 -1
  82. package/dist/ar-3S65PDDG.js +0 -1
  83. package/dist/be-WJKGEBTI.js +0 -1
  84. package/dist/bg-TZUF36MP.js +0 -1
  85. package/dist/ca-WLW64J7W.js +0 -1
  86. package/dist/chunk-F2EXXZSZ.js +0 -1
  87. package/dist/chunk-F7TP67LK.js +0 -1
  88. package/dist/chunk-LAX7F5ML.js +0 -1
  89. package/dist/chunk-LFJUXTIO.js +0 -1
  90. package/dist/chunk-M7JA4BGP.js +0 -1
  91. package/dist/cs-HQXANWJA.js +0 -1
  92. package/dist/cy-EG5BJOG7.js +0 -1
  93. package/dist/da-5XEBRUEE.js +0 -1
  94. package/dist/de-SCVAU32D.js +0 -1
  95. package/dist/el-KBW7YAF5.js +0 -1
  96. package/dist/es-IFLC65KX.js +0 -1
  97. package/dist/et-OXB22VMP.js +0 -1
  98. package/dist/fa-GFAZXHP6.js +0 -1
  99. package/dist/fi-AI67VYYH.js +0 -1
  100. package/dist/fr-V3RG2KYP.js +0 -1
  101. package/dist/he-J3I6MRUR.js +0 -1
  102. package/dist/hr-SA4WZ3AG.js +0 -1
  103. package/dist/hu-TM35NZ4U.js +0 -1
  104. package/dist/it-E4QYIYC4.js +0 -1
  105. package/dist/ja-S5M7EINH.js +0 -1
  106. package/dist/ku-DNZQIUUG.js +0 -1
  107. package/dist/localeLoaders-JTNNRDK2.js +0 -1
  108. package/dist/lt-ETQDX2HL.js +0 -1
  109. package/dist/lv-FYFIWI4F.js +0 -1
  110. package/dist/nl-XOG5SBZQ.js +0 -1
  111. package/dist/no-7UGUTFXW.js +0 -1
  112. package/dist/pl-5HR7DQIK.js +0 -1
  113. package/dist/pt-L4CCONDZ.js +0 -1
  114. package/dist/ro-KZVPOCZ6.js +0 -1
  115. package/dist/ru-CD7HYORB.js +0 -1
  116. package/dist/sk-AQZOHJYW.js +0 -1
  117. package/dist/sl-XYRITXI6.js +0 -1
  118. package/dist/sr-6VTXFVHT.js +0 -1
  119. package/dist/sv-EJWP7WJV.js +0 -1
  120. package/dist/tr-VKVADTIZ.js +0 -1
  121. package/dist/uk-QSJV3LDS.js +0 -1
  122. package/dist/zh-Hans-2FN4LFAW.js +0 -1
  123. package/dist/zh-Hant-5T2AB4FR.js +0 -1
@@ -1,12 +1,40 @@
1
- import{a as me,b as $t,c as Zt,d as qe,e as Me,f as gt,g as yt,h as Jt,i as eo,j as _e,k as to,l as xt,m as oo,n as no,o as ro,p as io,q as fe,r as ao,s as so,t as lo,u as co,v as St,w as uo,x as Ve}from"../chunk-LFJUXTIO.js";import"../chunk-U7CVRE4P.js";import"../chunk-QJXSZT3H.js";import"../chunk-M5X6G7FD.js";import"../chunk-F2EXXZSZ.js";import"../chunk-4N5CHKHD.js";import{Sa as jt}from"../chunk-F7TP67LK.js";import"../chunk-5ITK5236.js";import{d as Kt,l as Qt}from"../chunk-JBOTRSMY.js";import"../chunk-CRCGO52K.js";import{Renderer as Hn}from"ogl";function Un(){let t=typeof window<"u"&&window.devicePixelRatio||1,e=navigator.deviceMemory,o=typeof e=="number"&&e<=4?1.5:2;return Math.min(t,o)}var je=class{constructor(e,o){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 Hn({canvas:this.canvas,dpr:Un(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[qe.top[0],qe.top[1],qe.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),e.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),o.onContextLost()},this.restoredHandler=()=>o.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),o=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(e,o),{width:e,height:o}}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 Wn,Vec3 as wt}from"ogl";var ie=Math.PI/180,Mt=15*ie,Pt=80*ie,Pe=.12,mo=35,po=1.25,ho=.006,Yn=4,Ce=.82,Le=1/Ce,Xn=.12,qn=2;function jn(t,e){return{azimuth:t*ho,polar:-e*ho}}function Kn(t,e,o){let r=Math.max(qn,Math.max(1,e)*Xn),n=o*Yn;return{minDist:t?Math.min(t.minDist,r):r,maxDist:t?Math.max(t.maxDist,n):n}}var Ke=class{constructor(e,o,r,n){this.fovY=mo;this.target=new wt;this.azimuth=-30*ie;this.polar=55*ie;this.distance=10;this.azT=-30*ie;this.polT=55*ie;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 wt;this.panAnchor=new wt;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new Wn(e,{fov:mo,near:.1,far:5e3,aspect:1}),this.canvas=o,this.requestRender=r,this.onGesture=n,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let s=i.button===2||i.button===1,a=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=s||a,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let s=this.pinchCentroid();this.pinchCx=s.x,this.pinchCy=s.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let d=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-d)*.005)),this.fireGesture()),this.pinchDist=d;let p=this.pinchCentroid();this.panBy(p.x-this.pinchCx,p.y-this.pinchCy),this.pinchCx=p.x,this.pinchCy=p.y;return}let s=i.clientX-this.lastX,a=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(s!==0||a!==0)&&(this.panBy(s,a),this.fireGesture());return}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(s!==0||a!==0)&&this.fireGesture();let l=jn(s,a);this.azT+=l.azimuth,this.polT=Math.max(Mt,Math.min(Pt,this.polT+l.polar)),this.requestRender()},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let s=i.deltaMode===1?16:i.deltaMode===2?100:1,a=Math.max(-2,Math.min(2,i.deltaY*s/100));this.dollyBy(Math.exp(a*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let s=7*ie;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-s:s;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(Mt,Math.min(Pt,this.polT+(i.key==="ArrowUp"?-s:s)));else if(i.key==="+"||i.key==="=")this.dollyBy(Ce);else if(i.key==="-"||i.key==="_")this.dollyBy(Le);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},o.addEventListener("pointerdown",this.onPointerDown),o.addEventListener("pointermove",this.onPointerMove),o.addEventListener("pointerup",this.onPointerUp),o.addEventListener("pointercancel",this.onPointerUp),o.addEventListener("wheel",this.onWheel,{passive:!1}),o.addEventListener("keydown",this.onKeyDown),o.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let e=[...this.activePointers.values()];if(!e.length)return{x:0,y:0};let o=0,r=0;for(let n of e)o+=n.x,r+=n.y;return{x:o/e.length,y:r/e.length}}panBy(e,o){let r=this.canvas.clientHeight||1,n=2*this.distance*Math.tan(this.fovY*ie/2)/r,i=Math.sin(this.azimuth),s=Math.cos(this.azimuth),a=s,l=-i,d=Math.cos(this.polar),p=Math.sin(this.polar),h=-i*d,b=-s*d;this.targetT.x+=(-e*a+o*h)*n,this.targetT.z+=(-e*l+o*b)*n,this.targetT.y+=o*p*n,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let e=this.panLimit,o=this.panAnchor.x,r=this.panAnchor.y,n=this.panAnchor.z;this.targetT.x=Math.max(o-e,Math.min(o+e,this.targetT.x)),this.targetT.z=Math.max(n-e,Math.min(n+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?.())}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()}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,o=!1,r,n=!1,i){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,e.radius)*1.5;let s=Math.max(1,e.radius),a=this.fovY*ie/2,l=n?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,d=Math.atan(Math.tan(a)*l);this.azT=r??-30*ie,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*ie;let p=this.fitDistance(e,a,d,this.azT,this.polT);this.distT=p*Math.max(1.05,Math.min(2,i?.margin??po)),this.envelope=Kn(this.envelope,s,p),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,o?(this.azimuth=this.azT,this.polar=12*ie,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(e){this.camera.perspective({aspect:e})}frameSoft(e,o,r=!1,n){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,e.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*ie/2,s=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,a=Math.atan(Math.tan(i)*s);this.azT=o??this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*ie;let l=this.fitDistance(e,i,a,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,n?.margin??po))}fitDistance(e,o,r,n,i){let s=Math.max(1,e.radius),a=Math.max(s/Math.tan(o),s/Math.tan(r)),l=e.box;if(!l)return a;let d=Math.sin(i),p=-d*Math.sin(n),h=-Math.cos(i),b=-d*Math.cos(n);if(Math.abs(h)>.999)return a;let c=-b,u=p,P=Math.hypot(c,u);c/=P,u/=P;let F=-u*h,A=u*p-c*b,k=c*h,f=Math.tan(r),M=Math.tan(o),C=1;for(let O=0;O<8;O++){let x=(O&1?l.max[0]:l.min[0])-e.center[0],w=(O&2?l.max[1]:l.min[1])-e.center[1],D=(O&4?l.max[2]:l.min[2])-e.center[2],L=x*p+w*h+D*b,R=Math.abs(x*c+D*u),K=Math.abs(x*F+w*A+D*k);C=Math.max(C,R/f-L,K/M-L)}return Math.min(a,Math.max(C,s*.35))}updateClipping(e){let o=this.camera.position.x-e.center[0],r=this.camera.position.y-e.center[1],n=this.camera.position.z-e.center[2],i=Math.hypot(o,r,n),s=Math.max(1,e.radius)*1.18,a=Math.max(.05,i-s),l=Math.max(a+10,i+s);this.camera.perspective({near:a,far:l,aspect:this.camera.aspect})}update(){let e=this.azT-this.azimuth,o=this.polT-this.polar,r=this.distT-this.distance,n=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,s=this.targetT.z-this.target.z,a=Math.max(1e-4,this.distance*1e-4),l=Math.abs(e)>1e-4||Math.abs(o)>1e-4||Math.abs(r)>1e-4||Math.abs(n)>a||Math.abs(i)>a||Math.abs(s)>a;return this.azimuth+=e*Pe,this.polar+=o*Pe,this.distance+=r*Pe,this.target.x+=n*Pe,this.target.y+=i*Pe,this.target.z+=s*Pe,l&&this.applyPosition(),l}get currentDistance(){return this.distance}syncFromCamera(){let e=this.camera.position.x-this.target.x,o=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,n=Math.hypot(e,o,r)||1,i=Math.max(Mt,Math.min(Pt,Math.acos(Math.max(-1,Math.min(1,o/n)))));this.distance=this.distT=n,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(e,r)}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),o=this.target.x+this.distance*e*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),n=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(o,r,n),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()}};var Qe=class{constructor(e){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=e=>{let o=this.lastTime?(e-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=e,o>0){let n=1/o;this.fpsEma=this.fpsEma?this.fpsEma*.9+n*.1:n}this.rendered++,this.frame(o)?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}};var Ae=2.5,Qn=1.15,ke=6,Ee=10,fo=6,vo=9.5,bo=.9,go=2.2,Ct=30,At=4,$e=8192;var Ti=Ee+At;function yo(t,e){let o=e*1.4,r=e*3.2;if(t<=o)return{scale:1,fade:0,minPixels:Ae};let n=Math.min(1,(t-o)/Math.max(.001,r-o));return{scale:1-n*.4,fade:n*.55,minPixels:Ae+n*(Qn-Ae)}}function xo(t,e,o){return!(t>0)||!(e>0)||!(o>0)?!1:e*o/t>=64}function So(t,e,o,r,n){if(!(t>0)||!(e>0)||!(o>0)||!(r>0)||!(n>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let s=e/(o*i)*(n/2);return Math.PI*s*s/t>=64}var $n=88,Zn=20,wo={floor:{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},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}},Jn=640,er=.8,tr=11,or="3px 7px",nr="2px 5px",Mo="rgba(10,14,22,.62)",rr="#f4f7fb",Po=5,Co=2,ir=6,Oe=new Set(["row","seat"]),Ao={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Ze={row:{x:66,y:20},seat:{x:52,y:22}},Rt=Kt,Et=t=>Qt(t);function Dt(t,e){let o=Et(t),r=Et(e);return(Math.max(o,r)+.05)/(Math.min(o,r)+.05)}function Ft(t,e){let o=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(t.replace(/\s/g,""));if(!o)return e;let r=Math.max(0,Math.min(1,Number(o[4])));return[1,2,3].map(n=>Number(o[n])/255*r+e[n-1]*(1-r))}function ar(t,e=[.04,.06,.1],o=!0){let r=Et(e)<.42,n=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",s=o?Ft(i,e):e,a=Rt(t),l=o?7:4.5,d=a&&Dt(a,s)>=l?t:n;return r?{ink:d,backing:i,border:"rgba(210,222,245,.24)"}:{ink:d,backing:i,border:"rgba(11,18,32,.22)"}}function sr(t,e=[.04,.06,.1]){let o=Ft(Mo,e),r=Rt(t);return{ink:r&&Dt(r,o)>=4.5?t:rr,backing:Mo}}var lr='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Je=class{constructor(e,o={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.opts=o,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=o.fontFamily||lr,e.appendChild(this.root)}setVisible(e){this.root.style.visibility=e?"":"hidden"}setLabels(e){this.labels=e;for(let[o,r]of this.nodes)e.some(n=>n.id===o)||(r.remove(),this.nodes.delete(o))}setForcedDense(e){this.forcedDense=e}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,o=>`seat:${o}`))}sizeFor(e){let o=wo[e].size;return!this.narrowStage||Oe.has(e)?o:Math.max(tr,o*er)}qualityEvidence(){let e=this.root.getBoundingClientRect(),o=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let n=this.nodes.get(r.id),i=n?.getBoundingClientRect(),s=!!(o&&n&&n.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:s,renderedFontPx:n&&Number.parseFloat(n.style.fontSize)||0,contrast:n?Number(n.dataset.qualityContrast??0):0,...s&&i?{screenBox:{x:i.x-e.x,y:i.y-e.y,width:i.width,height:i.height}}:{}}})}update(e,o,r,n,i,s){if(!this.labels.length)return;this.narrowStage=o>0&&o<Jn;let a=ro(n,i,{hasZoneLabels:this.labels.some(f=>f.kind==="zone")});this.forcedDense&&(a.add("row"),a.add("seat"));let l=[];for(let f of this.labels){if(!a.has(f.kind))continue;let M=fe(e,f.anchor,o,r);if(!M.visible)continue;let C=Oe.has(f.kind),O=this.sizeFor(f.kind),x=so(f.text,O,!C)+(C?Po*2:0),w=io(M,x/2,O/2+(C?Co:4),o,r),D=s?Math.hypot(f.anchor[0]-s[0],f.anchor[1]-s[1],f.anchor[2]-s[2]):1;l.push({label:f,screen:w,focus:co(w,D,o,r),halfWidth:x/2,...this.selectedSeatLabelIds.has(f.id)?{priority:1}:{}})}let d=no(l.filter(f=>f.label.kind==="floor"),o),p=[...l.filter(f=>!Oe.has(f.label.kind)&&f.label.kind!=="floor"),...d],h=ao(p,$n,Zn),b=lo(o),c=St(l.filter(f=>f.label.kind==="row"),Ze.row.x,Ze.row.y,b.row,h),u=St(l.filter(f=>f.label.kind==="seat"),Ze.seat.x,Ze.seat.y,b.seat,[...h,...c]),P=[...h,...c,...u],F=new Set(P.map(f=>f.label.id));for(let{label:f,screen:M}of P){let O=this.nodeFor(f).style;O.display="",O.transform=`translate(-50%, -50%) translate(${M.x.toFixed(1)}px, ${M.y.toFixed(1)}px)`}let A=P.filter(({label:f})=>!Oe.has(f.kind)).sort((f,M)=>Ao[M.label.kind]-Ao[f.label.kind]||f.screen.depth-M.screen.depth||f.focus-M.focus),k=[];for(let{label:f}of A){let M=this.nodes.get(f.id);if(!M||M.style.display==="none")continue;let C=M.getBoundingClientRect();k.some(x=>C.left<x.right+3&&C.right+3>x.left&&C.top<x.bottom+3&&C.bottom+3>x.top)?M.style.display="none":k.push(C)}for(let[f,M]of this.nodes)F.has(f)||(M.style.display="none")}nodeFor(e){let o=this.nodes.get(e.id);if(!o){o=document.createElement("div");let u=o.style;u.position="absolute",u.left="0",u.top="0",u.whiteSpace="nowrap",u.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",u.display="none",this.root.appendChild(o),this.nodes.set(e.id,o)}o.textContent=e.text,o.setAttribute("data-label-kind",e.kind);let r=this.selectedSeatLabelIds.has(e.id);o.toggleAttribute("data-selected-seat",r);let n=wo[e.kind],i=o.style;i.fontSize=`${this.sizeFor(e.kind)}px`,i.fontWeight=r?"800":n.weight,i.opacity=r?"1":String(n.opacity);let s=Oe.has(e.kind),a=!s,l=ar(e.color??this.opts.ink,this.opts.backgroundRgb,!0),d=s?sr(e.color??this.opts.ink,this.opts.backgroundRgb):l;i.color=r?"#ecf8ff":d.ink,i.background=r?"rgba(10,28,45,.9)":d.backing,i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${l.border}`:"",i.borderRadius=r||a?"999px":`${ir}px`;let p=this.narrowStage?nr:or;i.padding=r||a?p:`${Co}px ${Po}px`,i.lineHeight=s?"1.1":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",i.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let h=this.opts.backgroundRgb??[.04,.06,.1],b=Rt(r?"#ecf8ff":d.ink)??[1,1,1],c=Ft(r?"rgba(10,28,45,.9)":d.backing,h);return o.dataset.qualityContrast=Dt(b,c).toFixed(3),(e.kind==="zone"||e.kind==="floor")&&(i.textTransform="uppercase"),o}dispose(){this.root.remove(),this.nodes.clear()}};var cr=1;var ur=new Set(["floor","zone","section","ga","booth","annotation"]);function dr(t){return t.every(e=>Number.isFinite(e))}function mr(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 Eo(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function xe(t){return Math.round(t*1e4)/1e4}function pr(t){if(t)return{box:{x:xe(t.box.x),y:xe(t.box.y),width:xe(t.box.width),height:xe(t.box.height)},horizontalFillRatio:xe(t.horizontalFillRatio),verticalFillRatio:xe(t.verticalFillRatio),visibleAreaRatio:xe(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function de(t,e,o){return o.length?{code:t,message:e,count:o.length,samples:o.slice(0,20)}:null}function Tt(t){let e=t.labels.filter(a=>a.visible&&a.screenBox),o=e.filter(a=>ur.has(a.kind)),r=t.scene.floorCount>1?t.scene.floorCount:t.scene.zoneCount||t.scene.sectionCount,n=[];for(let a=0;a<o.length;a+=1)for(let l=0;l<a;l+=1)mr(o[a].screenBox,o[l].screenBox)&&n.push({primaryId:o[a].id,primaryLabel:o[a].text,secondaryId:o[l].id});let i=[...t.camera.position,t.camera.distance,t.camera.verticalFovDeg],s=[de("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),de("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),de("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),de("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}`}]),de("camera-invalid","The capture camera must have a finite physical pose",dr(i)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),de("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}]),de("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||o.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),de("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",o.filter(a=>a.renderedFontPx<11).map(a=>({primaryId:a.id,primaryLabel:a.text,measured:a.renderedFontPx,minimum:11}))),de("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",o.filter(a=>a.contrast<4.5).map(a=>({primaryId:a.id,primaryLabel:a.text,measured:a.contrast,minimum:4.5}))),de("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",n)].filter(a=>!!a);return{version:1,state:"venue3d",passed:s.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:a,kind:l,text:d})=>({id:a,kind:l,text:d})).sort((a,l)=>a.kind.localeCompare(l.kind)||a.id.localeCompare(l.id)),framing:pr(t.framing)},metrics:{minimumHierarchyFontPx:Eo(o.map(a=>a.renderedFontPx)),minimumHierarchyContrast:Eo(o.map(a=>a.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:s}}import{Geometry as ze,Mesh as Ne,Program as Tr,Texture as Ir,Transform as No}from"ogl";import{Program as Se}from"ogl";var et=`
1
+ import{A as zn,B as Nn,C as Ye,D as Vt,E as Hn,F as Gn,a as We,b as Ce,c as st,d as _t,e as An,f as Pn,g as be,h as Cn,i as En,j as lt,k as Te,l as Ue,m as Rn,n as It,o as Lr,p as Tn,q as Dn,r as Fn,s as _n,t as ge,u as In,v as Vn,w as Ln,x as kn,y as On,z as ct}from"../chunk-2MXDWZQ4.js";import"../chunk-2P72QUJR.js";import"../chunk-OLGPAFXW.js";import"../chunk-QJXSZT3H.js";import"../chunk-ASIIXY5M.js";import"../chunk-M5VINTGE.js";import"../chunk-P4C24CIZ.js";import"../chunk-IW7QZIMF.js";import"../chunk-Z43H6AWN.js";import"../chunk-4N5CHKHD.js";import"../chunk-TQN2VWQO.js";import"../chunk-5BMXWOE7.js";import"../chunk-FLMKHAUT.js";import{Va as Sn}from"../chunk-VAI2VDQR.js";import"../chunk-5ITK5236.js";import{d as wn,l as Mn}from"../chunk-JBOTRSMY.js";import"../chunk-CRCGO52K.js";function Bn(t,e,n){let r=Math.floor(e.length/3),i=n.center[0],o=n.center[2];if(r>0){let l=Math.max(1,Math.floor(r/4e3)),u=0,m=0,d=0;for(let p=0;p<r;p+=l)u+=e[p*3],m+=e[p*3+2],d++;i=u/d,o=m/d}let a=t[0]-i,s=t[2]-o;return Math.hypot(a,s)>n.radius*.12?Math.atan2(a,s):void 0}var Lt=78,Wn=18;function Un(){let t=[],e=[],n=[],r=[],i=[],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,Ce,-1],max:[1,st,-.72]}])for(let l of o){let u=t.length/3,m=l.n[1]+(s.part===2?Math.abs(l.n[0])*(1-_t)/(st-Ce):0),d=Math.hypot(l.n[0],m,l.n[2]),p=[l.n[0]/d,m/d,l.n[2]/d];for(let[f,c]of l.c.entries()){let g=c.map((S,w)=>s.min[w]+S*(s.max[w]-s.min[w]));s.part===2&&(g[0]*=1-c[1]*(1-_t)),t.push(...g),e.push(...p),n.push(s.part),r.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][f])}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),r.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(r),index:new Uint16Array(i)}}import{Renderer as kr}from"ogl";function Or(){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 ut=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 kr({canvas:this.canvas,dpr:Or(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[lt.top[0],lt.top[1],lt.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 zr,Vec3 as kt}from"ogl";var se=Math.PI/180,Ot=15*se,zt=80*se,De=.12,Yn=35,Nt=1.25,Xn=.006,Nr=4,Fe=.82,Xe=1/Fe,Hr=.12,Gr=2;function Br(t,e){return{azimuth:t*Xn,polar:-e*Xn}}function Wr(t,e,n){if(!n)return 1;let r=e[0]-t[0],i=e[2]-t[2];return(n[0]-e[0])*r+(n[2]-e[2])*i<0?-1:1}function qn(t,e,n){let r=Math.max(Gr,Math.max(1,e)*Hr),i=n*Nr;return{minDist:t?Math.min(t.minDist,r):r,maxDist:t?Math.max(t.maxDist,i):i}}var Ur=1.5;function Yr(t,e,n){let r=Math.max(1,n)*Ur;if(!t)return{anchor:[e[0],e[1],e[2]],limit:r};let[i,o,a]=t.anchor,s=e[1]-o,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+r)}}function jn(t,e,n,r,i,o,a,s){let l=Math.sin(n),u=[l*Math.sin(e),Math.cos(n),l*Math.cos(e)],m=[t[0]+r*u[0],t[1]+r*u[1],t[2]+r*u[2]],d=[-u[0],-u[1],-u[2]],p=[-d[2],0,d[0]],f=Math.hypot(p[0],p[2])||1;p=[p[0]/f,0,p[2]/f];let c=[p[1]*d[2]-p[2]*d[1],p[2]*d[0]-p[0]*d[2],p[0]*d[1]-p[1]*d[0]],g=Math.tan(i*se/2),S=g*(o>0?o:1),w=[0,1,2].map(E=>d[E]+a*S*p[E]+s*g*c[E]);if(w[1]>=-1e-6)return null;let I=(t[1]-m[1])/w[1],P=Math.hypot(w[0],w[1],w[2]);return!(I>0)||I*P>r*Xr?null:[m[0]+w[0]*I,t[1],m[2]+w[2]*I]}var Kn=3,Xr=4,dt=class{constructor(e,n,r,i){this.fovY=Yn;this.target=new kt;this.azimuth=-30*se;this.polar=55*se;this.distance=10;this.azT=-30*se;this.polT=55*se;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 kt;this.panAnchor=new kt;this.panLimit=0;this.panBox=null;this.grabSign=1;this.zoomPointResolver=null;this.primaryDragMode="orbit";this.camera=new zr(e,{fov:Yn,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=i,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 a=o.button===2||o.button===1,s=o.button===0&&(o.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.dragging&&(this.grabSign=this.grabSignAt(o.clientX,o.clientY)),this.lastX=o.clientX,this.lastY=o.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.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 u=this.currentPinchDistance(),m=this.pinchCentroid();this.pinchDist>0&&(this.dollyAt(Math.exp((this.pinchDist-u)*.005),m.x,m.y),this.fireGesture()),this.pinchDist=u,this.panBy(m.x-this.pinchCx,m.y-this.pinchCy),this.pinchCx=m.x,this.pinchCy=m.y;return}let a=o.clientX-this.lastX,s=o.clientY-this.lastY;if(this.panning){this.lastX=o.clientX,this.lastY=o.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=o.clientX,this.lastY=o.clientY,(a!==0||s!==0)&&this.fireGesture();let l=Br(a,s);this.azT+=l.azimuth*this.grabSign,this.polT=Math.max(Ot,Math.min(zt,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 a=o.deltaMode===1?16:o.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,o.deltaY*a/100));this.dollyAt(Math.exp(s*.22),o.clientX,o.clientY),this.fireGesture()},this.onKeyDown=o=>{if(!this.interactionEnabled)return;let a=7*se;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"?-a:a;else if(o.key==="ArrowUp"||o.key==="ArrowDown")this.polT=Math.max(Ot,Math.min(zt,this.polT+(o.key==="ArrowUp"?-a:a)));else if(o.key==="+"||o.key==="=")this.dollyBy(Fe);else if(o.key==="-"||o.key==="_")this.dollyBy(Xe);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 i of e)n+=i.x,r+=i.y;return{x:n/e.length,y:r/e.length}}panBy(e,n){let r=this.canvas.clientHeight||1,i=2*this.distance*Math.tan(this.fovY*se/2)/r,o=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,l=-o,u=Math.cos(this.polar),m=Math.sin(this.polar),d=-o*u,p=-a*u;this.targetT.x+=(-e*s+n*d)*i,this.targetT.z+=(-e*l+n*p)*i,this.targetT.y+=n*m*i,this.clampPan(),this.requestRender()}widenPanBox(e){this.panBox=Yr(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,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(r-e*.5,Math.min(r+e,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}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 i=this.distT,o=this.canvas.getBoundingClientRect?.(),a=this.zoomPointResolver?.(n,r)??null;if(a){this.distT=Math.max(Kn,Math.min(this.maxDist,this.distT*e)),this.minDist=Math.min(this.minDist,Math.max(Kn,this.distT)),this.requestRender(),this.scaleTargetAbout(a,this.distT/i);return}let s=o&&o.width>0&&o.height>0?jn([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/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())}grabSignAt(e,n){let r=this.canvas.getBoundingClientRect?.(),i=this.zoomPointResolver?.(e,n)??(r&&r.width>0&&r.height>0?jn([this.target.x,this.target.y,this.target.z],this.azimuth,this.polar,this.distance,this.fovY,this.camera.aspect||r.width/r.height,(e-r.left)/r.width*2-1,1-(n-r.top)/r.height*2):null),o=this.camera.position;return Wr([o.x,o.y,o.z],[this.target.x,this.target.y,this.target.z],i)}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,i=!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 a=Math.max(1,e.radius),s=this.fovY*se/2,l=i?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*l);this.azT=r??-30*se,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*se;let m=this.fitDistance(e,s,u,this.azT,this.polT);this.distT=m*Math.max(1.05,Math.min(2,o?.margin??Nt)),this.envelope=qn(this.envelope,a,m),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*se,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.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*se/2,i=Math.atan(Math.tan(r)*(this.camera.aspect||1));this.azT=this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*se;let o=this.fitDistance(e,r,i,this.azT,this.polT);this.distT=o*Math.max(1.05,Math.min(2,n?.margin??Nt)),this.envelope=qn(this.envelope,Math.max(1,e.radius),o),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.requestRender()}frameSoft(e,n,r=!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 o=this.fovY*se/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(o)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*se;let l=this.fitDistance(e,o,s,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,i?.margin??Nt))}fitDistance(e,n,r,i,o){let a=Math.max(1,e.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),l=e.box;if(!l)return s;let u=Math.sin(o),m=-u*Math.sin(i),d=-Math.cos(o),p=-u*Math.cos(i);if(Math.abs(d)>.999)return s;let f=-p,c=m,g=Math.hypot(f,c);f/=g,c/=g;let S=-c*d,w=c*m-f*p,I=f*d,P=Math.tan(r),E=Math.tan(n),W=1;for(let H=0;H<8;H++){let v=(H&1?l.max[0]:l.min[0])-e.center[0],y=(H&2?l.max[1]:l.min[1])-e.center[1],T=(H&4?l.max[2]:l.min[2])-e.center[2],R=v*m+y*d+T*p,U=Math.abs(v*f+T*c),F=Math.abs(v*S+y*w+T*I);W=Math.max(W,U/P-R,F/E-R)}return Math.min(s,Math.max(W,a*.35))}updateClipping(e){let n=this.camera.position.x-e.center[0],r=this.camera.position.y-e.center[1],i=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),a=this.interactionEnabled&&Math.abs(o-this.distance)<=this.distance*.01,{near:s,far:l}=Kr(Math.hypot(n,r,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,r=this.distT-this.distance,i=this.targetT.x-this.target.x,o=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(r)>1e-4||Math.abs(i)>s||Math.abs(o)>s||Math.abs(a)>s;return this.azimuth+=e*De,this.polar+=n*De,this.distance+=r*De,this.target.x+=i*De,this.target.y+=o*De,this.target.z+=a*De,l&&this.applyPosition(),l}get currentAzimuth(){return this.azimuth}get currentDistance(){return this.distance}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,i=Math.hypot(e,n,r)||1,o=Math.max(Ot,Math.min(zt,Math.acos(Math.max(-1,Math.min(1,n/i)))));this.distance=this.distT=i,this.polar=this.polT=o,this.azimuth=this.azT=Math.atan2(e,r)}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),i=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(n,r,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()}},qr=.1,jr=.25;function Kr(t,e,n){let r=Math.max(1,e)*1.18,i=n==null?jr:Math.max(.05,n*qr),o=Math.max(i,t-r),a=Math.max(o+10,t+r);return{near:o,far:a}}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 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}};var _e=2.5,$r=1.15,qe=12,Ie=22,$n=6,Qn=9.5,Zn=.9,Jn=2.2,Ht=30,Gt=4,ht=8192;var ms=Ie+Gt;function eo(t,e){let n=e*1.4,r=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:_e};let i=Math.min(1,(t-n)/Math.max(.001,r-n));return{scale:1-i*.4,fade:i*.55,minPixels:_e+i*($r-_e)}}function to(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}var Qr=12;function no(t,e,n,r,i){if(!(t>0)||!(e>0)||!(n>0)||!(r>0)||!(i>0))return!1;let o=Math.tan(r/2*Math.PI/180);if(!(o>0))return!1;let a=e/(n*o)*(i/2);return Math.PI*a*a/t>=Qr}import{Geometry as Zr,Mesh as Jr,Program as ei,Transform as ti}from"ogl";var ni=.05,oi=.6,ri=12,ii=1.6,ai=1,si=2.5,li=650,oo=24;function ci(t){let e=[],n=[],r=[],i=(d,p,f)=>{e.push(...d),n.push(...p),r.push(f)};for(let d=0;d<16;d++){let p=d/16*Math.PI*2,f=(d+1)/16*Math.PI*2,c=P=>[Math.cos(P),0,Math.sin(P)],g=[Math.cos(p)*.012,0,Math.sin(p)*.012],S=[Math.cos(f)*.012,0,Math.sin(f)*.012],w=[Math.cos(p)*.03,1,Math.sin(p)*.03],I=[Math.cos(f)*.03,1,Math.sin(f)*.03];i(g,c(p),0),i(w,c(p),0),i(I,c(f),0),i(g,c(p),0),i(I,c(f),0),i(S,c(f),0)}let l=.16,u=.24,m=.01;for(let d=0;d<48;d++){let p=d/48*Math.PI*2,f=(d+1)/48*Math.PI*2,c=[Math.cos(p)*l,m,Math.sin(p)*l],g=[Math.cos(p)*u,m,Math.sin(p)*u],S=[Math.cos(f)*u,m,Math.sin(f)*u],w=[Math.cos(f)*l,m,Math.sin(f)*l];for(let I of[c,g,S,c,S,w])i(I,[0,1,0],1)}return new Zr(t,{position:{size:3,data:new Float32Array(e)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(r)}})}var ui=`#version 300 es
2
+ precision highp float;
3
+ in vec3 position; in vec3 normal; in float part;
4
+ uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform mat3 normalMatrix;
5
+ uniform vec3 uSeat; uniform float uHeight; uniform float uLift; uniform float uRingScale;
6
+ out vec3 vNormal; out float vPart;
7
+ void main() {
8
+ vNormal = normalize(normalMatrix * normal);
9
+ vPart = part;
10
+ // The stem rises out of the ring as the pin lands (uLift runs 1 \u2192 0).
11
+ float grow = part > 0.5 ? 1.0 : 1.0 - uLift;
12
+ // The ring is the seat's own size, not the stem's: grown with the stem it
13
+ // spread over the neighbouring seats and read as a horseshoe from afar.
14
+ float scale = part > 0.5 ? uRingScale : uHeight;
15
+ vec3 world = uSeat + vec3(position.x, position.y * grow, position.z) * scale;
16
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(world, 1.0);
17
+ }`,di=`#version 300 es
18
+ precision highp float;
19
+ in vec3 vNormal; in float vPart;
20
+ uniform vec3 uColor; uniform float uRingAlpha;
21
+ out vec4 fragColor;
22
+ void main() {
23
+ if (vPart > 0.5) { fragColor = vec4(uColor, uRingAlpha); return; }
24
+ // View-space light from the upper left: a lit, round stem reads as an
25
+ // object standing in the venue rather than a line drawn on the screen.
26
+ float key = max(dot(normalize(vNormal), normalize(vec3(-0.4, 0.7, 0.6))), 0.0);
27
+ vec3 c = uColor * (0.55 + 0.5 * key) + vec3(0.12) * pow(key, 12.0);
28
+ fragColor = vec4(c, 1.0);
29
+ }`;function mi(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 Bt(t){return Math.max(oi,Math.min(ri,t*ni))}function ro(t,e){let n=new ti,r=ci(t),i=new Map,o=(a,s)=>{let l=new ei(t,{vertex:ui,fragment:di,uniforms:{uSeat:{value:a},uHeight:{value:1},uLift:{value:0},uRingScale:{value:1},uColor:{value:e},uRingAlpha:{value:.85}},transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1}),u=new Jr(t,{geometry:r,program:l});return u.frustumCulled=!1,u.setParent(n),{mesh:u,program:l,seat:a,start:s}};return{root:n,setSeats(a,s,l){let u=new Set(a.slice(0,oo).map(m=>m.id));for(let[m,d]of i)u.has(m)||(d.mesh.setParent(null),i.delete(m));for(let m of a.slice(0,oo))i.has(m.id)||i.set(m.id,o(m.position,l?s:-1/0))},update(a,s,l,u=!1){let m=!1;for(let d of i.values()){let p=s[0]-d.seat[0],f=s[1]-d.seat[1],c=s[2]-d.seat[2],g=Math.hypot(p,f,c);d.mesh.visible=!l&&g>(u?ai:si);let S=Bt(g),w=Math.max(0,Math.min(1,(a-d.start)/li));w<1&&(m=!0),d.program.uniforms.uHeight.value=S,d.program.uniforms.uRingScale.value=Math.min(S,ii),d.program.uniforms.uLift.value=u?1:1-mi(w),d.program.uniforms.uRingAlpha.value=.55+.4*(w<1?Math.sin(w*Math.PI):0)}return m},dispose(){for(let a of i.values())a.mesh.setParent(null);i.clear(),r.remove()}}}var je="#ffffff",io="#0b1220",Ke=6,hi=80,ao=14,so=88,lo=20,co={floor:{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},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}},pi=640,fi=.8,vi=11,bi="3px 7px",gi="2px 5px",uo="rgba(10,14,22,.62)",yi="#f4f7fb",mo=5,ho=2,xi=6,$e=new Set(["row","seat"]),po={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Ve={row:{x:66,y:20},seat:{x:52,y:22}},Ut=wn,Wt=t=>Mn(t);function Yt(t,e){let n=Wt(t),r=Wt(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Xt(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(i=>Number(n[i])/255*r+e[i-1]*(1-r))}function Si(t,e=[.04,.06,.1],n=!0){let r=Wt(e)<.42,i=r?"#f4f7fb":"#0b1220",o=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Xt(o,e):e,s=Ut(t),l=n?7:4.5,u=s&&Yt(s,a)>=l?t:i;return r?{ink:u,backing:o,border:"rgba(210,222,245,.24)"}:{ink:u,backing:o,border:"rgba(11,18,32,.22)"}}function wi(t,e=[.04,.06,.1]){let n=Xt(uo,e),r=Ut(t);return{ink:r&&Yt(r,n)>=4.5?t:yi,backing:uo}}var Mi='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',pt=class{constructor(e,n={}){this.nodes=new Map;this.labels=[];this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.seatNumberRow=void 0;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||Mi,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,i]of this.nodes)n.has(r)||(i.remove(),this.nodes.delete(r))}setForcedDense(e){this.forcedDense=e}setSeatNumberRow(e){return e===this.seatNumberRow?!1:(this.seatNumberRow=e,!0)}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,n=>`seat:${n}`))}sizeFor(e){let n=co[e].size;return!this.narrowStage||$e.has(e)?n:Math.max(vi,n*fi)}qualityEvidence(){let e=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let i=this.nodes.get(r.id),o=i?.getBoundingClientRect(),a=!!(n&&i&&i.style.display!=="none"&&o&&o.width>0&&o.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:i&&Number.parseFloat(i.style.fontSize)||0,contrast:i?Number(i.dataset.qualityContrast??0):0,...a&&o?{screenBox:{x:o.x-e.x,y:o.y-e.y,width:o.width,height:o.height}}:{}}})}update(e,n,r,i,o,a){if(!this.labels.length)return;this.narrowStage=n>0&&n<pi;let s=Fn(i,o,{hasZoneLabels:this.labels.some(v=>v.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let l=[];for(let v of this.labels){if(!s.has(v.kind)&&!(v.kind==="seat"&&this.selectedSeatLabelIds.has(v.id)))continue;let y=v.kind==="seat"&&a&&this.selectedSeatLabelIds.has(v.id)?v.pinBase:void 0,T=y&&a?[y[0],y[1]+Bt(Math.hypot(y[0]-a[0],y[1]-a[1],y[2]-a[2])),y[2]]:v.anchor,R=ge(e,T,n,r);if(!R.visible)continue;let U=$e.has(v.kind),F=this.sizeFor(v.kind),D=Ln(v.text,F,!U)+(U?mo*2:0);if(v.kind==="seat"&&v.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(v.id)&&zn(e,v.anchor,v.seatWidthM,n)<Math.max(22,D))continue;let Y=_n(R,D/2,F/2+(U?ho:4),n,r),q=a?Math.hypot(v.anchor[0]-a[0],v.anchor[1]-a[1],v.anchor[2]-a[2]):1;l.push({label:v,screen:Y,focus:On(Y,q,n,r),halfWidth:D/2,...this.selectedSeatLabelIds.has(v.id)?{priority:1}:{}})}let u=Dn(l.filter(v=>v.label.kind==="floor"),n),m=[...l.filter(v=>!$e.has(v.label.kind)&&v.label.kind!=="floor"),...u],d=kn(n),p=l.filter(v=>v.label.kind==="seat"&&this.selectedSeatLabelIds.has(v.label.id)),f=ct(p,Ve.seat.x,Ve.seat.y,d.seat);this.placePinHeads(p.filter(v=>v.label.pinBase&&!f.includes(v)).map(v=>v.screen));let c=In(m,so,lo).filter(v=>!f.some(y=>Vn(v,y,so,lo))),g=ct(l.filter(v=>v.label.kind==="row"),Ve.row.x,Ve.row.y,d.row,[...c,...f]),S=this.seatNumberRow!==void 0,w=ct(l.filter(v=>v.label.kind==="seat"&&!this.selectedSeatLabelIds.has(v.label.id)&&(!S||this.seatNumberRow!==null&&v.label.rowId===this.seatNumberRow)),Ve.seat.x,Ve.seat.y,S?hi:d.seat-f.length,[...c,...f,...g]),I=[...c,...g,...f,...w],P=new Set(I.map(v=>v.label.id));for(let{label:v,screen:y}of I){let R=this.nodeFor(v).style;R.display="";let U=!!v.pinBase&&this.selectedSeatLabelIds.has(v.id);R.transform=U?`translate(-50%, -100%) translate(${y.x.toFixed(1)}px, ${(y.y-Ke).toFixed(1)}px)`:`translate(-50%, -50%) translate(${y.x.toFixed(1)}px, ${y.y.toFixed(1)}px)`}let W=I.filter(({label:v})=>!$e.has(v.kind)).sort((v,y)=>po[y.label.kind]-po[v.label.kind]||v.screen.depth-y.screen.depth||v.focus-y.focus).flatMap(({label:v})=>{let y=this.nodes.get(v.id);return y&&y.style.display!=="none"?[{node:y,box:y.getBoundingClientRect()}]:[]}),H=[];for(let{node:v,box:y}of W)H.some(R=>y.left<R.right+3&&y.right+3>R.left&&y.top<R.bottom+3&&y.bottom+3>R.top)?v.style.display="none":H.push(y);for(let[v,y]of this.nodes)P.has(v)||(y.style.display="none")}nodeFor(e){let n=this.nodes.get(e.id);if(!n){n=document.createElement("div");let g=n.style;g.position="absolute",g.left="0",g.top="0",g.whiteSpace="nowrap",g.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",g.display="none",this.root.appendChild(n),this.nodes.set(e.id,n)}let r=this.selectedSeatLabelIds.has(e.id),i=this.nodeAppearance.get(n);if(i&&i.text===e.text&&i.kind===e.kind&&i.color===e.color&&i.selected===r&&i.narrow===this.narrowStage)return n;if(this.nodeAppearance.set(n,{text:e.text,kind:e.kind,color:e.color,selected:r,narrow:this.narrowStage}),n.textContent=e.text,r){let g=document.createElement("span"),S=g.style;S.position="absolute",S.left="50%",S.bottom=`-${Ke}px`,S.transform="translateX(-50%)",S.borderLeft=`${Ke}px solid transparent`,S.borderRight=`${Ke}px solid transparent`,S.borderTop=`${Ke}px solid ${je}`,n.appendChild(g)}n.setAttribute("data-label-kind",e.kind),n.toggleAttribute("data-selected-seat",r);let o=co[e.kind],a=n.style;a.fontSize=`${this.sizeFor(e.kind)}px`,a.fontWeight=r?"800":o.weight,a.opacity=r?"1":String(o.opacity);let s=$e.has(e.kind),l=!s,u=Si(e.color??this.opts.ink,this.opts.backgroundRgb,!0),m=s?wi(e.color??this.opts.ink,this.opts.backgroundRgb):u;a.color=r?io:m.ink,a.background=r?je:m.backing,a.border=r?`1px solid ${je}`:l?`1px solid ${u.border}`:"",a.borderRadius=r||l?"999px":`${xi}px`;let d=this.narrowStage?gi:bi;a.padding=r||l?d:`${ho}px ${mo}px`,a.lineHeight=s?"1.1":"",a.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)":l?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",a.textShadow=r?"none":"0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",a.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let p=this.opts.backgroundRgb??[.04,.06,.1],f=Ut(r?io:m.ink)??[1,1,1],c=Xt(r?je:m.backing,p);return n.dataset.qualityContrast=Yt(f,c).toFixed(3),a.textTransform=e.kind==="zone"||e.kind==="floor"?"uppercase":"",n}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=`${ao}px`,r.height=`${ao}px`,r.borderRadius="50%",r.background=je,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 i=e[r];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 Ai=1;var Pi=new Set(["floor","zone","section","ga","booth","annotation"]);function Ci(t){return t.every(e=>Number.isFinite(e))}function Ei(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 fo(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function Ee(t){return Math.round(t*1e4)/1e4}function Ri(t){if(t)return{box:{x:Ee(t.box.x),y:Ee(t.box.y),width:Ee(t.box.width),height:Ee(t.box.height)},horizontalFillRatio:Ee(t.horizontalFillRatio),verticalFillRatio:Ee(t.verticalFillRatio),visibleAreaRatio:Ee(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function ye(t,e,n){return n.length?{code:t,message:e,count:n.length,samples:n.slice(0,20)}:null}function qt(t){let e=t.labels.filter(s=>s.visible&&s.screenBox),n=e.filter(s=>Pi.has(s.kind)),r=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)Ei(n[s].screenBox,n[l].screenBox)&&i.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[l].id});let o=[...t.camera.position,t.camera.distance,t.camera.verticalFovDeg],a=[ye("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),ye("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),ye("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),ye("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}`}]),ye("camera-invalid","The capture camera must have a finite physical pose",Ci(o)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),ye("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}]),ye("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`}]),ye("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}))),ye("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}))),ye("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:Ri(t.framing)},metrics:{minimumHierarchyFontPx:fo(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:fo(n.map(s=>s.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:a}}function vo(t,e,n){t.fill(0);for(let r=0;r<Math.min(n,e.length);r++)t[e[r]]=1}import{Geometry as Qe,Mesh as Ze,Program as Zi,Texture as Ji,Transform as Do}from"ogl";import{Program as Re}from"ogl";var ft=`
2
30
  float chairWeight(float depth) {
3
31
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
4
- }`,Ro=`
32
+ }`,bo=`
5
33
  float occupantWeight(float depth) {
6
- float nearWeight = smoothstep(${bo.toFixed(1)}, ${go.toFixed(1)}, depth);
7
- float farWeight = 1.0 - smoothstep(${fo.toFixed(1)}, ${vo.toFixed(1)}, depth);
34
+ float nearWeight = smoothstep(${Zn.toFixed(1)}, ${Jn.toFixed(1)}, depth);
35
+ float farWeight = 1.0 - smoothstep(${$n.toFixed(1)}, ${Qn.toFixed(1)}, depth);
8
36
  return nearWeight * farWeight;
9
- }`,Do=`
37
+ }`,jt=`
10
38
  float glyphEq(float glyph, float expected) {
11
39
  return 1.0 - step(0.25, abs(glyph - expected));
12
40
  }
@@ -55,7 +83,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
55
83
  p.y += 0.16;
56
84
  }
57
85
  return p;
58
- }`,hr=`#version 300 es
86
+ }`,Ti=`#version 300 es
59
87
  precision highp float;
60
88
  in vec3 position;
61
89
  in vec3 normal;
@@ -93,7 +121,7 @@ void main() {
93
121
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
94
122
  vColor = color;
95
123
  gl_Position = projectionMatrix * mv;
96
- }`,fr=`#version 300 es
124
+ }`,Di=`#version 300 es
97
125
  precision highp float;
98
126
  in vec3 vColor;
99
127
  in vec3 vNormalWorld;
@@ -105,7 +133,48 @@ in float vMaterial;
105
133
  uniform vec3 uKeyDir; // WORLD space, unit, points at the light
106
134
  uniform float uStructureDetail;
107
135
  uniform float uRoughness;
136
+ uniform vec3 uDeckColor;
137
+ uniform float uSectionFilter;
138
+ uniform float uFocusFloor;
139
+ uniform sampler2D tVenueShadow;
140
+ uniform mat4 uShadowMatrix;
108
141
  out vec4 fragColor;
142
+ // Stable world-space variation; no textures or per-frame random grain.
143
+ float turfHash(vec2 p) {
144
+ vec3 q = fract(vec3(p.xyx) * 0.1031);
145
+ q += dot(q, q.yzx + 33.33);
146
+ return fract((q.x + q.y) * q.z);
147
+ }
148
+ float turfNoise(vec2 p) {
149
+ vec2 cell = floor(p), f = fract(p);
150
+ f = f * f * (3.0 - 2.0 * f);
151
+ return mix(mix(turfHash(cell), turfHash(cell + vec2(1.0, 0.0)), f.x),
152
+ mix(turfHash(cell + vec2(0.0, 1.0)), turfHash(cell + vec2(1.0)), f.x), f.y);
153
+ }
154
+ float architecturalLight(vec3 normal) {
155
+ // Whole-venue static bake only: hidden floors must never leave ghost shadows.
156
+ if (uFocusFloor >= -0.5) return 1.0;
157
+ vec4 clip = uShadowMatrix * vec4(vPosWorld, 1.0);
158
+ vec3 p = clip.xyz / clip.w * 0.5 + 0.5;
159
+ if (any(lessThan(p, vec3(0.0))) || any(greaterThan(p, vec3(1.0)))) return 1.0;
160
+ float bias = max(0.001, 0.003 * (1.0 - max(dot(normal, uKeyDir), 0.0)));
161
+ // Interpolate depth comparisons, not depth values. Fixed nearest samples
162
+ // produced four visible shade bands as an edge crossed a shadow texel.
163
+ // A small tent filter softens those edges with continuous coverage.
164
+ // Sixteen depth reads; no extra shadow render pass or larger texture.
165
+ vec2 size = vec2(textureSize(tVenueShadow, 0));
166
+ vec2 texel = p.xy * size - 0.5;
167
+ vec2 cell = floor(texel);
168
+ vec2 fraction = fract(texel);
169
+ float lit = 0.0;
170
+ for (int x = -1; x < 3; x++) for (int y = -1; y < 3; y++) {
171
+ vec2 corner = vec2(float(x), float(y));
172
+ vec2 weight = max(vec2(0.0), vec2(2.0) - abs(corner - fraction));
173
+ float depth = texture(tVenueShadow, (cell + corner + 0.5) / size).r;
174
+ lit += step(p.z - bias, depth) * weight.x * weight.y;
175
+ }
176
+ return mix(0.65, 1.0, lit / 16.0);
177
+ }
109
178
  void main() {
110
179
  if (vDim > 0.5) discard;
111
180
  // Row treads (material 3) and risers (material 2) are chart truth: the
@@ -125,22 +194,48 @@ void main() {
125
194
  // Risers are baked at 0.72 of their tread (see tiers.ts bandColors); lift
126
195
  // them back to the tread colour as detail fades out.
127
196
  vec3 vColorRung = vColor * mix(mix(1.0 / 0.72, 1.0, uStructureDetail), 1.0, 1.0 - riser);
128
- vec3 N = normalize(vNormalWorld);
197
+ // Concrete remains visible at overview instead of painting the entire
198
+ // seating deck like upholstery. Keep a category tint for navigation;
199
+ // filtering retains its existing shell color cues.
200
+ float tread = 1.0 - step(0.5, abs(vMaterial - 3.0));
201
+ float concreteWeight = max(tread, riser) * mix(0.38, 1.0, uStructureDetail) * (1.0 - uSectionFilter);
202
+ vec3 concrete = uDeckColor * mix(1.0, 0.72, riser * uStructureDetail);
203
+ vColorRung = mix(vColorRung, concrete, concreteWeight * 0.82);
204
+ if (abs(vMaterial - 4.5) < 1.0) {
205
+ // Turf and generated concrete share the same two noise evaluations. Fine
206
+ // fibres/aggregate fade as they become sub-pixel, avoiding distant grain.
207
+ float concreteSurface = step(4.5, vMaterial);
208
+ vec2 surface = vPosWorld.xz + concreteSurface * vPosWorld.y * vec2(0.73, 0.41);
209
+ float pixelSize = max(length(dFdx(surface)), length(dFdy(surface)));
210
+ float fine = 1.0 - smoothstep(mix(0.04, 0.015, concreteSurface),
211
+ mix(0.16, 0.065, concreteSurface), pixelSize);
212
+ float variation = (turfNoise(surface * mix(0.32, 0.65, concreteSurface)) - 0.5)
213
+ * mix(0.13, 0.075, concreteSurface)
214
+ + (turfNoise(surface * mix(9.0, 23.0, concreteSurface)) - 0.5)
215
+ * mix(0.10, 0.055, concreteSurface) * fine;
216
+ vColorRung *= 1.0 + variation;
217
+ }
218
+ // Unresolved row faces need the same lighting, not merely the same paint:
219
+ // alternating vertical/horizontal normals otherwise recreate a moire comb.
220
+ float rowOverview = max(tread, riser) * (1.0 - uStructureDetail);
221
+ vec3 N = normalize(mix(vNormalWorld, vec3(0.0, 1.0, 0.0), rowOverview));
129
222
  vec3 V = normalize(-vPosView);
130
223
  float hemi = 0.5 + 0.5 * N.y; // sky/ground gradient about WORLD up
131
- float key = max(dot(N, uKeyDir), 0.0); // fixed key \u2014 does not orbit with you
224
+ float visibility = architecturalLight(N);
225
+ float key = max(dot(N, uKeyDir), 0.0) * visibility; // fixed key \u2014 does not orbit with you
132
226
  // Low opposite fill so faces turned away from the key keep their form instead
133
227
  // of crushing to a single flat value.
134
228
  vec3 fillDir = normalize(vec3(-uKeyDir.x, 0.25, -uKeyDir.z));
135
229
  float fill = max(dot(N, fillDir), 0.0);
136
- vec3 base = vColorRung * (0.52 + 0.34 * hemi) + vColorRung * key * 0.34 + vColorRung * fill * 0.10;
230
+ vec3 base = vColorRung * (0.40 + 0.28 * hemi) * mix(0.76, 1.0, visibility) + vColorRung * key * 0.46 + vColorRung * fill * 0.12;
137
231
  float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
138
232
  // Material 1 is a powered display and keeps its authored emission treatment.
139
233
  // Every architectural material uses the venue roughness token; 0.78 maps to
140
234
  // exactly the historical rim strength so an unthemed chart does not shift.
141
235
  float poweredMaterial = 1.0 - step(0.5, abs(vMaterial - 1.0));
142
236
  float sheen = mix(clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0), 1.0, poweredMaterial);
143
- base += vec3(0.26, 0.31, 0.38) * fres * 0.35 * sheen; // cool rim, restrained
237
+ float concreteSheen = abs(vMaterial - 5.0) < 0.5 ? 0.45 : 1.0;
238
+ base += vec3(0.26, 0.31, 0.38) * fres * 0.16 * sheen * (1.0 - rowOverview) * concreteSheen; // cool rim, restrained
144
239
  // Bright, saturated authored screen faces should read as powered displays,
145
240
  // not painted slabs. Vertex colour is deliberately the material signal here:
146
241
  // muted tiers and structure never cross these thresholds. The broad waves
@@ -166,15 +261,43 @@ void main() {
166
261
  + vec3(0.20, 0.10, 0.34) * focalHalo;
167
262
  base = mix(base, display, poweredDisplay * verticalFace * 0.92);
168
263
  fragColor = vec4(base, 1.0);
169
- }`,vr=`#version 300 es
264
+ }`,go=`
265
+ ${jt}
266
+ vec4 seatSurface(vec3 source, float radius) {
267
+ vec4 origin = modelViewMatrix * vec4(iOffset, 1.0);
268
+ if (iPhysicalSeat < 0.5) {
269
+ if (surface > 0.5) return origin;
270
+ // Empty bays are markings on the deck, not upright camera-facing panels.
271
+ float c = cos(iYaw), s = sin(iYaw);
272
+ vec3 bay = vec3(source.x * c + source.y * s, 0.0, -source.x * s + source.y * c) * radius;
273
+ bay.y = 0.015;
274
+ return modelViewMatrix * vec4(iOffset + bay, 1.0);
275
+ }
276
+ if (surface < 0.5) return origin;
277
+ vec3 p = glyphChairPosition(source, surface, iGlyph);
278
+ p.xz *= iChairWidth;
279
+ if (surface > 1.5) p.z -= max(p.y - ${Ce.toFixed(2)}, 0.0) * ${We.toFixed(2)} * glyphBackRake(iGlyph);
280
+ float c = cos(iYaw), s = sin(iYaw);
281
+ vec3 rotated = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
282
+ return modelViewMatrix * vec4(iOffset + rotated, 1.0);
283
+ }
284
+ `,Fi=`#version 300 es
170
285
  precision highp float;
171
- in vec2 position; // quad corner in [-1,1]
286
+ in float surface;
287
+ in float iYaw;
288
+ in float iChairWidth;
289
+ in float iGlyph;
290
+ in vec3 position;
291
+ in vec3 normal;
292
+ in vec2 uv; // quad corner in [-1,1]
172
293
  in vec3 iOffset; // per-instance world position
173
294
  in vec3 iColor; // per-instance state colour (resolved CPU-side)
174
295
  in float iMaxRadius; // per-instance world-radius ceiling (seat pitch derived)
296
+ in float iHasChair;
175
297
  in float iPhysicalSeat;// 1 = chair; 0 = empty wheelchair bay
176
298
  in vec3 iRing; // accommodation ring colour; (0,0,0) = not accessible
177
299
  in float iFloor; // owning floor index
300
+ in float iSection; // owning section index, -1 = none
178
301
  uniform mat4 modelViewMatrix;
179
302
  uniform mat4 projectionMatrix;
180
303
  uniform float uSeatRadius;
@@ -182,25 +305,31 @@ uniform float uSeatScale;
182
305
  uniform float uMinPixels;
183
306
  uniform float uPixelToWorld; // (2*tan(fovY/2)) / viewportHeightPx
184
307
  uniform float uFocusFloor; // -1 = show every floor
308
+ uniform float uFocusSection; // -1 = no section entered
185
309
  uniform float uChairFull; // view depth at which the chair mesh is full size
186
310
  uniform float uChairNone; // ...and at which it has scaled away entirely
311
+ out vec3 vSeatNormal;
312
+ out float vSeatHeight;
313
+ out float vSeatSurface;
187
314
  out vec2 vUv;
188
315
  out vec3 vColor;
189
316
  out float vBudget; // 1 = dot holds its minimum pixel size, <1 = it cannot
190
317
  out vec3 vRing;
191
318
  out float vDim;
319
+ out float vSectionFade;
192
320
  out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
193
321
  out float vPhysicalSeat;
194
322
  out float vPixelRadius;
195
- ${et}
323
+ ${ft}
324
+ ${go}
196
325
  void main() {
197
326
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
198
327
  float depth = max(-mv.z, 0.001);
199
328
  // Hand the seat over to the chair mesh as it comes into range. Derived from
200
- // this instance's OWN depth rather than from a global uniform, so a row two
329
+ // this instance's spherical distance rather than from a global uniform, so a row two
201
330
  // metres away and the far side of the bowl resolve differently in the same
202
331
  // frame \u2014 which is the entire point of a ladder over a switch.
203
- vDotWeight = 1.0 - chairWeight(depth);
332
+ vDotWeight = 1.0 - iPhysicalSeat * iHasChair * chairWeight(length(mv.xyz));
204
333
  float minR = uMinPixels * depth * uPixelToWorld; // screen-space floor
205
334
  // Grow to hold the pixel floor, but never past this seat's own pitch ceiling:
206
335
  // unbounded growth is what merges neighbouring rows into one mass at range.
@@ -210,28 +339,39 @@ void main() {
210
339
  // it is losing legibility to distance, and the fragment stage dissolves it
211
340
  // toward the tier top rather than letting a sub-pixel dot alias and shimmer.
212
341
  vBudget = minR > 0.0 ? clamp(r / minR, 0.0, 1.0) : 1.0;
213
- mv.xy += position * r; // camera-facing billboard
214
- // Seat the dot ON the deck instead of centring it in the deck. iOffset is the
215
- // exact surface point, so half the billboard would otherwise sit below the cap
216
- // and be clipped by it \u2014 and because uMinPixels grows r with distance, no
217
- // constant world-space lift can prevent that at every range. Offsetting by r
218
- // along the screen projection of WORLD up is self-correcting: it is full at a
219
- // grazing view (where slicing happens) and vanishes looking straight down
220
- // (where the dot must stay centred on its seat).
221
- mv.xy += normalize(vec3(modelViewMatrix * vec4(0.0, 1.0, 0.0, 0.0))).xy * r;
222
- vUv = position;
342
+ mv = seatSurface(position, r);
343
+ // Match the shell's non-uniform width/depth scale before its back rake.
344
+ vec3 n = vec3(normal.x / iChairWidth, normal.y, normal.z / iChairWidth);
345
+ if (surface > 1.5) n.y += n.z * ${We.toFixed(2)} * glyphBackRake(iGlyph);
346
+ n = normalize(n);
347
+ vSeatNormal = vec3(n.x * cos(iYaw) + n.z * sin(iYaw), n.y, -n.x * sin(iYaw) + n.z * cos(iYaw));
348
+ vSeatHeight = position.y;
349
+ vSeatSurface = step(1.5, surface);
350
+ vUv = uv;
223
351
  vColor = iColor;
224
352
  vRing = iRing;
225
353
  vPhysicalSeat = iPhysicalSeat;
226
354
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
355
+ vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
227
356
  gl_Position = projectionMatrix * mv;
228
- }`,br=`#version 300 es
357
+ }`,yo=`
358
+ float seatSilhouette(vec2 uv, float physical) {
359
+ // Solid furniture owns its silhouette in geometry. Only empty bays need
360
+ // a fragment mask; cutting physical faces would open holes in the volume.
361
+ return mix(max(abs(uv.x), abs(uv.y)), 0.0, physical);
362
+ }
363
+ `,_i=`#version 300 es
229
364
  precision highp float;
365
+ in vec3 vSeatNormal;
366
+ in float vSeatHeight;
367
+ in float vSeatSurface;
368
+ uniform vec3 uKeyDir;
230
369
  in vec2 vUv;
231
370
  in vec3 vColor;
232
371
  in float vBudget;
233
372
  in vec3 vRing;
234
373
  in float vDim;
374
+ in float vSectionFade;
235
375
  in float vDotWeight;
236
376
  in float vPhysicalSeat;
237
377
  in float vPixelRadius;
@@ -240,25 +380,36 @@ uniform float uSeatDetail; // 0 for venue/area overview; 1 in section/row/sea
240
380
  uniform vec3 uFadeColor;
241
381
  uniform float uRoughness;
242
382
  out vec4 fragColor;
383
+ ${yo}
243
384
  void main() {
244
385
  if (vDim > 0.5) discard;
245
386
  // Same screen-door dissolve as the structure rung (uStructureDetail): the
246
387
  // dot layer develops over ~a quarter second instead of appearing at once.
247
388
  float stipple = fract(sin(dot(gl_FragCoord.xy, vec2(12.9898, 78.233))) * 43758.5453);
248
- if (stipple >= uSeatDetail) discard;
389
+ // At overview, faint physical-seat grain supplies scale without exposing
390
+ // inventory states. It dissolves before subpixel seats can alias.
391
+ float overviewGrain = (1.0 - uSeatDetail) * vPhysicalSeat * smoothstep(0.55, 1.15, vPixelRadius);
392
+ if (stipple >= uSeatDetail && overviewGrain <= 0.0) discard;
249
393
  // Empty wheelchair provision is a square bay, never a round chair marker.
250
- float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
394
+ float d = seatSilhouette(vUv, vPhysicalSeat);
251
395
  if (d > 1.0) discard;
252
396
  float alpha = smoothstep(1.0, 0.72, d);
253
- float shade = 0.80 + 0.28 * (0.5 - vUv.y * 0.5); // subtle top-lit
254
- vec3 c = vColor * shade;
397
+ vec3 N = normalize(vSeatNormal);
398
+ if (vSeatSurface > 0.5 && !gl_FrontFacing) N = -N;
399
+ float hemi = 0.5 + 0.5 * N.y;
400
+ float key = max(dot(N, uKeyDir), 0.0);
401
+ float fill = max(dot(N, normalize(vec3(-uKeyDir.x, 0.25, -uKeyDir.z))), 0.0);
402
+ float ao = mix(0.58, 1.0, clamp(vSeatHeight / 0.92, 0.0, 1.0));
403
+ float partShade = mix(1.10, 0.80, vSeatSurface);
404
+ vec3 c = vColor * (partShade * ao * (0.60 + 0.30 * hemi) + key * 0.28 + fill * 0.16);
255
405
  c = mix(c, uFadeColor, uSeatFade);
256
406
  // Accommodation ring \u2014 the 3D echo of the coloured ring 2D draws around every
257
407
  // accessible seat. Painted INSIDE the dot's own radius rather than outside it,
258
408
  // so an accessible seat still respects the row-pitch ceiling and cannot grow
259
409
  // into its neighbour just for carrying a ring.
260
410
  float ringMask = step(0.001, dot(vRing, vRing));
261
- float ring = smoothstep(0.58, 0.70, d) * (1.0 - smoothstep(0.90, 1.0, d));
411
+ float ringDistance = max(abs(vUv.x), abs(vUv.y));
412
+ float ring = smoothstep(0.58, 0.70, ringDistance) * (1.0 - smoothstep(0.90, 1.0, ringDistance));
262
413
  c = mix(c, vRing, ring * ringMask * 0.95);
263
414
  // A dot that can no longer afford its pixel floor dissolves instead of
264
415
  // aliasing; the tier cap underneath already carries the section's category
@@ -268,7 +419,13 @@ void main() {
268
419
  // seat rather than a sample in a dense screen-space pattern. This is based on
269
420
  // actual projected pixels, so it remains correct for unusually large or small
270
421
  // venues where a radius-normalised camera distance is misleading.
271
- alpha *= smoothstep(2.4, 3.2, vPixelRadius);
422
+ // Seats show from ~2 px across. At the old 2.4-3.2 px radius a stadium's
423
+ // whole-venue view hid every seat behind its tier tint and read as a flat
424
+ // 2D map (owner, 2026-09-23); below ~1 px they still dissolve, not alias.
425
+ float detailedAlpha = alpha * smoothstep(0.9, 1.5, vPixelRadius) * uSeatDetail;
426
+ float grainAlpha = smoothstep(1.0, 0.55, d) * overviewGrain * 0.42;
427
+ c = mix(vec3(0.27, 0.31, 0.32), c, uSeatDetail);
428
+ alpha = max(detailedAlpha, grainAlpha);
272
429
  // Inventory states are a section-level decision aid. At whole-venue/area
273
430
  // scale the category-tinted structural surface is the honest, stable signal;
274
431
  // thousands of enlarged status dots only form a moir\xE9 pattern. The journey
@@ -278,13 +435,17 @@ void main() {
278
435
  // while zooming. uSeatFade already measures this exact LOD transition: let
279
436
  // the category-tinted tier carry the overview, then reveal individual live
280
437
  // availability as the buyer approaches a section.
281
- // Yield to the chair. The chair grows out of this exact point, so through the
282
- // band the dot is always at least as big as the chair inside it and the seat
283
- // never thins out to nothing in between.
284
- alpha *= vDotWeight;
438
+ // Exactly one representation owns this seat at the detail boundary.
439
+ if (vDotWeight <= 0.99) discard;
285
440
  if (alpha <= 0.0) discard;
441
+ // Outside the entered section: quieter, still visible and pickable. Not the
442
+ // strong grey of a filtered seat, which means nothing to buy there.
443
+ if (vSectionFade > 0.5) {
444
+ float lum = dot(c, vec3(0.299, 0.587, 0.114));
445
+ c = mix(c, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
446
+ }
286
447
  fragColor = vec4(c, alpha);
287
- }`,gr=`#version 300 es
448
+ }`,Ii=`#version 300 es
288
449
  precision highp float;
289
450
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
290
451
  in vec3 normal;
@@ -295,6 +456,7 @@ in float iRadius; // per-instance horizontal half-width, world metres
295
456
  in float iYaw; // per-instance facing, radians (local +Z -> facing dir)
296
457
  in vec3 iRing; // accommodation ring colour; (0,0,0) = not accessible
297
458
  in float iFloor;
459
+ in float iSection; // owning section index, -1 = none
298
460
  in float iSeed; // <0 = seat is empty; else per-person hash in [0,1)
299
461
  in float iPhysicalSeat;// 1 = chair; 0 = empty wheelchair bay
300
462
  in float iGlyph; // stable SEAT_GLYPH_ORDER index
@@ -303,21 +465,25 @@ uniform mat4 projectionMatrix;
303
465
  uniform float uChairFull;
304
466
  uniform float uChairNone;
305
467
  uniform float uFocusFloor;
468
+ uniform float uFocusSection; // -1 = no section entered
306
469
  uniform float uBackRake; // metres of z per metre of rise, above uBackBase
307
470
  uniform float uBackBase; // local height at which the back starts
308
471
  out vec3 vColor;
309
472
  out vec3 vNormalWorld;
310
473
  out vec3 vNormalView;
311
474
  out vec3 vPosView;
475
+ out float vChairWeight;
312
476
  out float vPart;
313
477
  out float vHeight; // local height in metres, for the vertical occlusion ramp
314
478
  out vec3 vRing;
315
479
  out float vDim;
480
+ out float vSectionFade;
316
481
  out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
317
482
  out vec3 vOccupantTint;
318
- ${et}
319
- ${Ro}
320
- ${Do}
483
+ out float vTaken; // 1 = sold or held: not for sale
484
+ ${ft}
485
+ ${bo}
486
+ ${jt}
321
487
  void main() {
322
488
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
323
489
  float viewDepth = -anchor.z;
@@ -325,7 +491,7 @@ void main() {
325
491
  // A stale near-field gather can contain seats now behind the camera after a
326
492
  // row\u2192overview move. Treating negative depth as 0.001 made those chairs full
327
493
  // size across the near plane, producing the long black zoom streaks.
328
- float w = viewDepth > 0.05 ? chairWeight(depth) : 0.0;
494
+ float w = viewDepth > 0.05 ? chairWeight(length(anchor.xyz)) : 0.0;
329
495
  // 1. Local units -> world metres. Only x/z scale: narrow rows get narrow
330
496
  // chairs, but nobody gets a short one (people are the same height at every
331
497
  // seat pitch).
@@ -339,6 +505,7 @@ void main() {
339
505
  // rasteriser discards, exactly as the chair itself collapses at w=0.
340
506
  float occupant = step(9.5, part);
341
507
  float taken = step(0.0, iSeed);
508
+ vTaken = taken;
342
509
  vOccupant = occupant;
343
510
  p = glyphChairPosition(p, part, iGlyph);
344
511
  if (iPhysicalSeat < 0.5) {
@@ -369,11 +536,9 @@ void main() {
369
536
  float resolvedRake = uBackRake * glyphBackRake(iGlyph);
370
537
  float rake = (part > 1.5 && part < 2.5) ? max(p.y - uBackBase, 0.0) * resolvedRake : 0.0;
371
538
  p.z -= rake;
372
- // 3. Scale-in. At w=0 the chair is a point at the seat, under a dot at full
373
- // opacity \u2014 which is what makes the handover invisible. sqrt front-loads
374
- // the growth so the chair is already near full size while the dot is still
375
- // half there; see chairScale() in lod.ts.
376
- p *= sqrt(w);
539
+ // Fixed-size detail swap: no miniature chair inside a larger fallback.
540
+ p *= step(0.01, w);
541
+ vChairWeight = w;
377
542
  float c = cos(iYaw), s = sin(iYaw);
378
543
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
379
544
  // Normals under the same two transforms, in reverse and inverted-transposed.
@@ -402,8 +567,9 @@ void main() {
402
567
  vHeight = localHeight;
403
568
  vRing = iRing;
404
569
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
570
+ vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
405
571
  gl_Position = projectionMatrix * mv;
406
- }`,yr=`#version 300 es
572
+ }`,Vi=`#version 300 es
407
573
  precision highp float;
408
574
  in vec3 vColor;
409
575
  in vec3 vNormalWorld;
@@ -413,14 +579,18 @@ in float vPart;
413
579
  in float vHeight;
414
580
  in vec3 vRing;
415
581
  in float vDim;
582
+ in float vSectionFade;
416
583
  in float vOccupant;
417
584
  in vec3 vOccupantTint;
585
+ in float vTaken;
418
586
  uniform vec3 uKeyDir;
419
587
  uniform vec3 uFadeColor;
420
588
  uniform float uRoughness;
589
+ in float vChairWeight;
421
590
  out vec4 fragColor;
422
591
  void main() {
423
592
  if (vDim > 0.5) discard;
593
+ if (vChairWeight < 0.01) discard;
424
594
  vec3 N = normalize(vNormalWorld);
425
595
  vec3 V = normalize(-vPosView);
426
596
  // The solids' rig, unchanged, so the chairs sit in the venue's light.
@@ -453,21 +623,35 @@ void main() {
453
623
  // Occupants rise above the 0.92 m chair back, so their ramp uses their own
454
624
  // height or every head would clamp to full brightness and float.
455
625
  float ao = mix(0.58, 1.0, clamp(vHeight / (vOccupant > 0.5 ? 1.30 : 0.92), 0.0, 1.0));
456
- vec3 base = tint * partShade * ao * (0.52 + 0.40 * hemi) + tint * key * 0.38 + tint * fill * 0.10;
626
+ vec3 base = tint * partShade * ao * (0.60 + 0.30 * hemi) + tint * key * 0.28 + tint * fill * 0.16;
457
627
  float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
458
- // A brighter rim than the solids get: it picks out every chair's own edge,
459
- // which is what stops a block of them merging into one mass up close.
628
+ // A restrained furniture rim keeps the low-poly edges from looking outlined.
629
+ // Occupant silhouettes retain their existing stronger separation.
460
630
  float sheen = clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0);
461
- base += vec3(0.26, 0.31, 0.38) * fres * 0.55 * mix(sheen, 1.0, vOccupant);
631
+ base += vec3(0.26, 0.31, 0.38) * fres * mix(0.24, 0.55, vOccupant) * mix(sheen, 1.0, vOccupant);
632
+ // Not for sale: the chair and the person in it go one muted grey, a step
633
+ // toward the venue. Their own clothing and the chair's category tint made a
634
+ // taken seat look like any other at a glance (owner report, 2026-09-23);
635
+ // now only the seats a buyer can take wear full colour.
636
+ if (vTaken > 0.5) {
637
+ float takenLum = dot(base, vec3(0.299, 0.587, 0.114));
638
+ base = mix(vec3(takenLum), uFadeColor, 0.35) * 0.92;
639
+ }
640
+ // Outside the entered section: quieter, still visible and pickable. Not the
641
+ // strong grey of a filtered seat, which means nothing to buy there.
642
+ if (vSectionFade > 0.5) {
643
+ float lum = dot(base, vec3(0.299, 0.587, 0.114));
644
+ base = mix(base, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
645
+ }
462
646
  fragColor = vec4(base, 1.0);
463
- }`,xr=`#version 300 es
647
+ }`,Li=`#version 300 es
464
648
  precision highp float;
465
649
  in vec2 position;
466
650
  out vec2 vUv;
467
651
  void main() {
468
652
  vUv = position * 0.5 + 0.5;
469
653
  gl_Position = vec4(position, 0.999, 1.0);
470
- }`,Sr=`#version 300 es
654
+ }`,ki=`#version 300 es
471
655
  precision highp float;
472
656
  in vec2 vUv;
473
657
  uniform vec3 uTop;
@@ -476,13 +660,20 @@ out vec4 fragColor;
476
660
  void main() {
477
661
  vec3 col = mix(uBottom, uTop, vUv.y);
478
662
  vec2 c = vUv - 0.5;
479
- float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
663
+ float vig = 1.0 - dot(c, c) * 0.16; // soft vignette
480
664
  fragColor = vec4(col * vig, 1.0);
481
- }`,wr=`#version 300 es
665
+ }`,Oi=`#version 300 es
482
666
  precision highp float;
483
- in vec2 position;
667
+ in float surface;
668
+ in float iYaw;
669
+ in float iChairWidth;
670
+ in float iGlyph;
671
+ in vec3 position;
672
+ in vec3 normal;
673
+ in vec2 uv;
484
674
  in vec3 iOffset;
485
675
  in float iMaxRadius;
676
+ in float iHasChair;
486
677
  in float iPhysicalSeat;
487
678
  in float iFloor;
488
679
  uniform mat4 modelViewMatrix;
@@ -499,23 +690,22 @@ out float vPhysicalSeat;
499
690
  out float vDotWeight;
500
691
  out float vHidden;
501
692
  flat out vec3 vPick;
502
- ${et}
693
+ ${ft}
694
+ ${go}
503
695
  void main() {
504
696
  int id = gl_InstanceID + 1; // 0 reserved for no-hit
505
697
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
506
698
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
507
699
  float depth = max(-mv.z, 0.001);
508
- vDotWeight = 1.0 - chairWeight(depth);
700
+ vDotWeight = 1.0 - iPhysicalSeat * iHasChair * chairWeight(length(mv.xyz));
509
701
  float minR = uMinPixels * depth * uPixelToWorld;
510
702
  float r = min(max(uSeatRadius * uSeatScale, minR), iMaxRadius);
511
- mv.xy += position * r;
512
- // Must match SEAT_VERT exactly, or the hit mask drifts off the drawn dot.
513
- mv.xy += normalize(vec3(modelViewMatrix * vec4(0.0, 1.0, 0.0, 0.0))).xy * r;
514
- vUv = position;
703
+ mv = seatSurface(position, r);
704
+ vUv = uv;
515
705
  vPhysicalSeat = iPhysicalSeat;
516
706
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
517
707
  gl_Position = projectionMatrix * mv;
518
- }`,Mr=`#version 300 es
708
+ }`,zi=`#version 300 es
519
709
  precision highp float;
520
710
  in vec2 vUv;
521
711
  in float vPhysicalSeat;
@@ -523,13 +713,15 @@ in float vDotWeight;
523
713
  in float vHidden;
524
714
  flat in vec3 vPick;
525
715
  out vec4 fragColor;
716
+ ${yo}
526
717
  void main() {
527
718
  if (vHidden > 0.5) discard;
719
+ if (vDotWeight <= 0.99) discard;
528
720
  if (vDotWeight <= 0.02) discard; // invisible dot cannot steal a chair tap
529
- float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
721
+ float d = seatSilhouette(vUv, vPhysicalSeat);
530
722
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
531
723
  fragColor = vec4(vPick, 1.0);
532
- }`,Pr=`#version 300 es
724
+ }`,Ni=`#version 300 es
533
725
  precision highp float;
534
726
  in vec3 position;
535
727
  in float part;
@@ -549,10 +741,11 @@ uniform float uBackRake;
549
741
  uniform float uBackBase;
550
742
  uniform float uFocusFloor;
551
743
  flat out vec3 vPick;
744
+ out float vChairWeight;
552
745
  out float vHidden;
553
- ${et}
554
- ${Ro}
555
- ${Do}
746
+ ${ft}
747
+ ${bo}
748
+ ${jt}
556
749
  void main() {
557
750
  int id = int(iPickIndex + 0.5); // already global index + 1
558
751
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -560,7 +753,7 @@ void main() {
560
753
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
561
754
  float viewDepth = -anchor.z;
562
755
  float depth = max(viewDepth, 0.001);
563
- float w = viewDepth > 0.05 ? chairWeight(depth) : 0.0;
756
+ float w = viewDepth > 0.05 ? chairWeight(length(anchor.xyz)) : 0.0;
564
757
  vec3 p = position;
565
758
  float occupant = step(9.5, part);
566
759
  float taken = step(0.0, iSeed);
@@ -581,19 +774,22 @@ void main() {
581
774
  ? max(p.y - uBackBase, 0.0) * uBackRake * glyphBackRake(iGlyph)
582
775
  : 0.0;
583
776
  p.z -= rake;
584
- p *= sqrt(w);
777
+ p *= step(0.01, w);
778
+ vChairWeight = w;
585
779
  float c = cos(iYaw), s = sin(iYaw);
586
780
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
587
781
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
588
- }`,Cr=`#version 300 es
782
+ }`,Hi=`#version 300 es
589
783
  precision highp float;
590
784
  flat in vec3 vPick;
591
785
  in float vHidden;
786
+ in float vChairWeight;
592
787
  out vec4 fragColor;
593
788
  void main() {
594
789
  if (vHidden > 0.5) discard;
790
+ if (vChairWeight < 0.01) discard;
595
791
  fragColor = vec4(vPick, 1.0);
596
- }`,Ar=`#version 300 es
792
+ }`,Gi=`#version 300 es
597
793
  precision highp float;
598
794
  in vec3 position;
599
795
  in float floorIndex;
@@ -604,14 +800,23 @@ out float vHidden;
604
800
  void main() {
605
801
  vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
606
802
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
607
- }`,Er=`#version 300 es
803
+ }`,Bi=`#version 300 es
608
804
  precision highp float;
609
805
  in float vHidden;
610
806
  out vec4 fragColor;
611
807
  void main() {
612
808
  if (vHidden > 0.5) discard;
613
809
  fragColor = vec4(0.0, 0.0, 0.0, 1.0);
614
- }`;function Fo(t){return new Se(t,{vertex:wr,fragment:Mr,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:_e},uSeatScale:{value:1},uMinPixels:{value:Ae},uPixelToWorld:{value:.002},uChairFull:{value:ke},uChairNone:{value:Ee},uFocusFloor:{value:-1}}})}function To(t){return new Se(t,{vertex:Pr,fragment:Cr,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:ke},uChairNone:{value:Ee},uBackRake:{value:gt},uBackBase:{value:yt},uFocusFloor:{value:-1}}})}function Io(t){return new Se(t,{vertex:Ar,fragment:Er,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function _o(t,e=.78){return new Se(t,{vertex:hr,fragment:fr,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:e}}})}function Vo(t){return new Se(t,{vertex:vr,fragment:br,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:_e},uSeatScale:{value:1},uMinPixels:{value:Ae},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:ke},uChairNone:{value:Ee}}})}function Lo(t,e=.78){return new Se(t,{vertex:gr,fragment:yr,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:ke},uChairNone:{value:Ee},uBackRake:{value:gt},uBackBase:{value:yt},uFocusFloor:{value:-1},uRoughness:{value:e}}})}function ko(t,e,o){return new Se(t,{vertex:xr,fragment:Sr,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(o)}}})}var Rr=.65,Dr=new Set(["dimmed","sold"]),Fr=new Set(["dimmed","sold","held"]);function Oo(t,e,o){let r=new Set,n=!1,i=me.indexOf("dimmed"),s=!1;for(let l=0;l<o.length;l+=1)if(o[l]===i){s=!0;break}let a=s?Fr:Dr;for(let l of t){let d=e.get(l.sectionId);if(!d||!d.length){r.add(l.sectionId);continue}let p=!1;for(let h of d){let b=me[o[h]]??"available";if(!a.has(b)){p=!0;break}}p?r.add(l.sectionId):n=!0}return{lit:r,anyUnlit:n}}function zo(t,e,o,r,n,i){let s=[];for(let a of t){let l=n===null||n.has(a.sectionId);if(r.get(a.sectionId)===l)continue;r.set(a.sectionId,l);let d=(a.start+a.count)*3;for(let p=a.start*3;p<d;p++)e[p]=l?o[p]:o[p]+(i[p%3]-o[p])*Rr;s.push(a)}return s}function Bo(t,e,o,r,n,i){for(let s=o;s<o+r;s++){let l=i&&e[s]===0?null:n[e[s]]??n[0];t[s*3]=l?l[0]:i[s*3],t[s*3+1]=l?l[1]:i[s*3+1],t[s*3+2]=l?l[2]:i[s*3+2]}}var _r=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Vr=new Float32Array([-1,-1,3,-1,-1,3]);function Go(t,e){let o=new No,r=new No,n=new ze(t,{position:{size:2,data:Vr}}),i=ko(t,e.theme.background.top,e.theme.background.bottom),s=new Ne(t,{geometry:n,program:i});s.frustumCulled=!1,s.setParent(r);let a=new ze(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=_o(t,e.theme.materials.roughness),d=new Ne(t,{geometry:a,program:l});d.frustumCulled=!1,d.setParent(o);let p=Vo(t),h=new Float32Array(e.seats.count*3),b=me.map(I=>e.theme.seatStates[I]);Bo(h,e.seats.iState,0,e.seats.count,b,e.seats.iCategory);let c=new ze(t,{position:{size:2,data:_r},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:h,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,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}}),u=new Ne(t,{geometry:c,program:p});u.frustumCulled=!1,e.seats.count>0&&u.setParent(o);let P=c.attributes.iColor,F=e.solids.color.slice(),A=e.theme.structure.ground,k=new Map(e.sectionSolidRanges.map(I=>[I.sectionId,!0])),f=eo(),M=Lo(t,e.theme.materials.roughness),C=$e,O=new Float32Array(C*3),x=new Float32Array(C*3),w=new Float32Array(C),D=new Float32Array(C),L=new Float32Array(C),R=new Float32Array(C*3),K=new Float32Array(C),H=new Float32Array(C),V=new Float32Array(C),Y=new Float32Array(C),y=new ze(t,{position:{size:3,data:f.position},normal:{size:3,data:f.normal},part:{size:1,data:f.part},index:{data:f.index},iOffset:{size:3,data:O,instanced:1},iColor:{size:3,data:x,instanced:1},iRadius:{size:1,data:w,instanced:1},iYaw:{size:1,data:D,instanced:1},iGlyph:{size:1,data:L,instanced:1},iRing:{size:3,data:R,instanced:1},iFloor:{size:1,data:K,instanced:1},iPhysicalSeat:{size:1,data:H,instanced:1},iSeed:{size:1,data:Y,instanced:1},iPickIndex:{size:1,data:V,instanced:1}}),S=new Ne(t,{geometry:y,program:M});S.frustumCulled=!1;let X=0,g=!1,z=!1,$=null,U=null,ee=null,Z=new Int32Array(0),le=()=>{let I=e.seats;for(let N=0;N<X;N++){let B=Z[N];Y[N]=to(I.iState[B],B);let G=I.iCategory&&I.iState[B]===0?null:b[I.iState[B]]??b[0];if(G)x[N*3]=G[0],x[N*3+1]=G[1],x[N*3+2]=G[2];else{let Q=e.theme.materials.seat??Zt([I.iCategory[B*3],I.iCategory[B*3+1],I.iCategory[B*3+2]]);x[N*3]=Q[0],x[N*3+1]=Q[1],x[N*3+2]=Q[2]}}y.attributes.iColor.needsUpdate=!0,y.attributes.iSeed.needsUpdate=!0},oe={main:o,background:r,seatProgram:p,solidProgram:l,chairProgram:M,seatGeometry:c,chairGeometry:y,solidGeometry:a,drawCalls:3,setNearSeats(I,N){let B=Math.min(N,C);if(Z=I,X=B,B===0){S.parent&&S.setParent(null),y.instancedCount=0,oe.drawCalls=3+(g?1:0);return}let _=e.seats;for(let G=0;G<B;G++){let Q=I[G];O[G*3]=_.iPosition[Q*3],O[G*3+1]=_.iPosition[Q*3+1],O[G*3+2]=_.iPosition[Q*3+2],w[G]=_.iChairWidth[Q],D[G]=_.iYaw[Q],L[G]=_.iGlyph[Q],R[G*3]=_.iRing[Q*3],R[G*3+1]=_.iRing[Q*3+1],R[G*3+2]=_.iRing[Q*3+2],K[G]=_.iFloor[Q],H[G]=_.iPhysicalSeat[Q],V[G]=Q+1}le(),y.attributes.iOffset.needsUpdate=!0,y.attributes.iRadius.needsUpdate=!0,y.attributes.iYaw.needsUpdate=!0,y.attributes.iGlyph.needsUpdate=!0,y.attributes.iRing.needsUpdate=!0,y.attributes.iFloor.needsUpdate=!0,y.attributes.iPhysicalSeat.needsUpdate=!0,y.attributes.iSeed.needsUpdate=!0,y.attributes.iPickIndex.needsUpdate=!0,y.instancedCount=B,S.parent||S.setParent(o),oe.drawCalls=4+(g?1:0)},nearSeatCount(){return X},setSectionShellLit(I){let N=zo(e.sectionSolidRanges,e.solids.color,F,k,I,A);if(!N.length)return;let B=a.attributes.color,_=B.buffer;if(!_){B.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,_);for(let G of N){let Q=e.solids.color.subarray(G.start*3,(G.start+G.count)*3);t.bufferSubData(t.ARRAY_BUFFER,G.start*3*Float32Array.BYTES_PER_ELEMENT,Q)}},uploadSeatStateRuns(I){if(!I.length)return;X&&le();for(let B of I)Bo(h,e.seats.iState,B.start,B.length,b,e.seats.iCategory);let N=P.buffer;if(!N){P.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,N);for(let B of I){let _=h.subarray(B.start*3,(B.start+B.length)*3);t.bufferSubData(t.ARRAY_BUFFER,B.start*3*Float32Array.BYTES_PER_ELEMENT,_)}},dispose(){z=!0,n.remove(),i.remove(),a.remove(),l.remove(),c.remove(),p.remove(),y.remove(),M.remove(),$?.remove(),U?.remove(),ee?.texture&&t.deleteTexture(ee.texture)}},J=e.productionElements.find(I=>I.contentImageUrl&&I.contentPlane);if(J?.contentImageUrl&&J.contentPlane?.length===4&&typeof Image<"u"){let I=new Image;I.crossOrigin="anonymous",I.onload=()=>{if(z)return;let N=J.contentPlane;$=new ze(t,{position:{size:3,data:new Float32Array(N.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(J.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),ee=new Ir(t,{image:I,generateMipmaps:!0,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,flipY:!1}),U=new Tr(t,{vertex:`#version 300 es
810
+ }`;function xo(t){return new Re(t,{vertex:Oi,fragment:zi,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Ue},uSeatScale:{value:1},uMinPixels:{value:_e},uPixelToWorld:{value:.002},uChairFull:{value:qe},uChairNone:{value:Ie},uFocusFloor:{value:-1}}})}function So(t){return new Re(t,{vertex:Ni,fragment:Hi,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:qe},uChairNone:{value:Ie},uBackRake:{value:We},uBackBase:{value:Ce},uFocusFloor:{value:-1}}})}function wo(t){return new Re(t,{vertex:Gi,fragment:Bi,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function Mo(t,e=.78,n=[.63,.66,.65]){return new Re(t,{vertex:Ti,fragment:Di,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:e}}})}function Ao(t){return new Re(t,{vertex:Fi,fragment:_i,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uSeatRadius:{value:Ue},uSeatScale:{value:1},uMinPixels:{value:_e},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:qe},uChairNone:{value:Ie}}})}function Po(t,e=.78){return new Re(t,{vertex:Ii,fragment:Vi,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:qe},uChairNone:{value:Ie},uBackRake:{value:We},uBackBase:{value:Ce},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:e}}})}function Co(t,e,n){return new Re(t,{vertex:Li,fragment:ki,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(n)}}})}import{Camera as Wi,Mat4 as Ui,Mesh as Yi,Program as Xi,RenderTarget as qi,Transform as ji}from"ogl";function Eo(t,e,n){let i=Math.max(3,n.radius*1.04),[o,a,s]=n.center,l=new Wi(t,{left:-i,right:i,bottom:-i,top:i,near:.1,far:i*6});l.position.set(o-i*1.44,a+i*2.34,s+i*1.2),l.lookAt([o,a,s]);let u=new qi(t,{width:1024,height:1024,depthTexture:!0,minFilter:t.NEAREST,magFilter:t.NEAREST}),m=new Xi(t,{cullFace:!1,vertex:`#version 300 es
811
+ in vec3 position;
812
+ uniform mat4 modelViewMatrix;
813
+ uniform mat4 projectionMatrix;
814
+ void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`,fragment:`#version 300 es
815
+ precision highp float;
816
+ out vec4 fragColor;
817
+ void main() {
818
+ fragColor = vec4(1.0);
819
+ }`}),d=new ji,p=new Yi(t,{geometry:e,program:m});p.frustumCulled=!1,p.setParent(d);let f=t.getParameter(t.COLOR_CLEAR_VALUE),c=t.isEnabled(t.DITHER);try{t.disable(t.DITHER),t.clearColor(1,1,1,1),t.renderer.render({scene:d,camera:l,target:u})}finally{c&&t.enable(t.DITHER),t.clearColor(f[0],f[1],f[2],f[3]),m.remove()}let g=new Ui().multiply(l.projectionMatrix,l.viewMatrix);return{texture:u.depthTexture,matrix:g,dispose(){for(let S of u.textures)t.deleteTexture(S.texture);t.deleteTexture(u.depthTexture.texture),t.deleteFramebuffer(u.buffer),u.depthBuffer&&t.deleteRenderbuffer(u.depthBuffer)}}}var Ki=.65,$i=new Set(["dimmed","sold"]),Qi=new Set(["dimmed","sold","held"]);function Ro(t,e,n){let r=new Set,i=!1,o=be.indexOf("dimmed"),a=!1;for(let l=0;l<n.length;l+=1)if(n[l]===o){a=!0;break}let s=a?Qi:$i;for(let l of t){let u=e.get(l.sectionId);if(!u||!u.length){r.add(l.sectionId);continue}let m=!1;for(let d of u){let p=be[n[d]]??"available";if(!s.has(p)){m=!0;break}}m?r.add(l.sectionId):i=!0}return{lit:r,anyUnlit:i}}function To(t,e,n,r,i,o){let a=[];for(let s of t){let l=i===null||i.has(s.sectionId);if(r.get(s.sectionId)===l)continue;r.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]+(o[m%3]-n[m])*Ki;a.push(s)}return a}var Fo=be.indexOf("selected");function ea(t,e){return[0,1,2].map(n=>t[n]*.15+.75+e[n]*.1)}function _o(t,e,n,r,i,o){for(let a=n;a<n+r;a++){let s=o&&e[a]===0,l=o&&e[a]===Fo?ea([o[a*3],o[a*3+1],o[a*3+2]],i[Fo]??i[0]):s?null:i[e[a]]??i[0];t[a*3]=l?l[0]:o[a*3],t[a*3+1]=l?l[1]:o[a*3+1],t[a*3+2]=l?l[2]:o[a*3+2]}}var ta=new Float32Array([-1,-1,3,-1,-1,3]);function Io(t,e){let n=new Do,r=new Do,i=new Qe(t,{position:{size:2,data:ta}}),o=Co(t,e.theme.background.top,e.theme.background.bottom),a=new Ze(t,{geometry:i,program:o});a.frustumCulled=!1,a.setParent(r);let s=new Qe(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=Eo(t,s,e.renderBounds),u=Mo(t,e.theme.materials.roughness,e.theme.structure.tierTop);u.uniforms.tVenueShadow={value:l.texture},u.uniforms.uShadowMatrix={value:l.matrix};let m=new Ze(t,{geometry:s,program:u});m.frustumCulled=!1,m.setParent(n);let d=Ao(t),p=new Float32Array(e.seats.count*3),f=be.map(N=>e.theme.seatStates[N]),c=e.seats.iCategory.slice();for(let N=0;N<e.seats.count;N++){if(e.seats.iPhysicalSeat[N]<.5)continue;let $=e.theme.materials.seat??En([c[N*3],c[N*3+1],c[N*3+2]]);c.set($,N*3)}_o(p,e.seats.iState,0,e.seats.count,f,c);let g=Un(),S=new Uint8Array(e.seats.count),w=new Qe(t,{position:{size:3,data:g.position},normal:{size:3,data:g.normal},uv:{size:2,data:g.uv},index:{size:1,data:g.index},surface:{size:1,data:g.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:p,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,instanced:1},iHasChair:{size:1,data:S,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}}),I=new Ze(t,{geometry:w,program:d});I.frustumCulled=!1,e.seats.count>0&&I.setParent(n);let P=w.attributes.iColor,E=e.solids.color.slice(),W=e.theme.structure.ground,H=new Map(e.sectionSolidRanges.map(N=>[N.sectionId,!0])),v=Pn(),y=Po(t,e.theme.materials.roughness),T=ht,R=new Float32Array(T*3),U=new Float32Array(T*3),F=new Float32Array(T),D=new Float32Array(T),Y=new Float32Array(T),q=new Float32Array(T*3),V=new Float32Array(T),j=new Float32Array(T),C=new Float32Array(T),x=new Float32Array(T),ie=new Float32Array(T),k=new Qe(t,{position:{size:3,data:v.position},normal:{size:3,data:v.normal},part:{size:1,data:v.part},index:{data:v.index},iOffset:{size:3,data:R,instanced:1},iColor:{size:3,data:U,instanced:1},iRadius:{size:1,data:F,instanced:1},iYaw:{size:1,data:D,instanced:1},iGlyph:{size:1,data:Y,instanced:1},iRing:{size:3,data:q,instanced:1},iFloor:{size:1,data:V,instanced:1},iSection:{size:1,data:j,instanced:1},iPhysicalSeat:{size:1,data:C,instanced:1},iSeed:{size:1,data:ie,instanced:1},iPickIndex:{size:1,data:x,instanced:1}}),M=new Ze(t,{geometry:k,program:y});M.frustumCulled=!1;let z=0,te=!1,X=!1,oe=null,K=null,ue=null,ae=new Int32Array(0),re=()=>{let N=e.seats;for(let $=0;$<z;$++){let G=ae[$];ie[$]=Rn(N.iState[G],G),U[$*3]=p[G*3],U[$*3+1]=p[G*3+1],U[$*3+2]=p[G*3+2]}k.attributes.iColor.needsUpdate=!0,k.attributes.iSeed.needsUpdate=!0},de={main:n,background:r,seatProgram:d,solidProgram:u,chairProgram:y,seatGeometry:w,chairGeometry:k,solidGeometry:s,drawCalls:3,setNearSeats(N,$){let G=Math.min($,T,N.length);if(vo(S,N,G),w.attributes.iHasChair.needsUpdate=!0,ae=N,z=G,G===0){M.parent&&M.setParent(null),k.instancedCount=0,de.drawCalls=3+(te?1:0);return}let ee=e.seats;for(let Q=0;Q<G;Q++){let B=N[Q];R[Q*3]=ee.iPosition[B*3],R[Q*3+1]=ee.iPosition[B*3+1],R[Q*3+2]=ee.iPosition[B*3+2],F[Q]=ee.iChairWidth[B],D[Q]=ee.iYaw[B],Y[Q]=ee.iGlyph[B],q[Q*3]=ee.iRing[B*3],q[Q*3+1]=ee.iRing[B*3+1],q[Q*3+2]=ee.iRing[B*3+2],V[Q]=ee.iFloor[B],j[Q]=ee.iSection[B],C[Q]=ee.iPhysicalSeat[B],x[Q]=B+1}re(),k.attributes.iOffset.needsUpdate=!0,k.attributes.iRadius.needsUpdate=!0,k.attributes.iYaw.needsUpdate=!0,k.attributes.iGlyph.needsUpdate=!0,k.attributes.iRing.needsUpdate=!0,k.attributes.iFloor.needsUpdate=!0,k.attributes.iSection.needsUpdate=!0,k.attributes.iPhysicalSeat.needsUpdate=!0,k.attributes.iSeed.needsUpdate=!0,k.attributes.iPickIndex.needsUpdate=!0,k.instancedCount=G,M.parent||M.setParent(n),de.drawCalls=4+(te?1:0)},nearSeatCount(){return z},setSectionShellLit(N){u.uniforms.uSectionFilter.value=N===null?0:1;let $=To(e.sectionSolidRanges,e.solids.color,E,H,N,W);if(!$.length)return;let G=s.attributes.color,ee=G.buffer;if(!ee){G.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,ee);for(let Q of $){let B=e.solids.color.subarray(Q.start*3,(Q.start+Q.count)*3);t.bufferSubData(t.ARRAY_BUFFER,Q.start*3*Float32Array.BYTES_PER_ELEMENT,B)}},uploadSeatStateRuns(N){if(!N.length)return;z&&re();for(let G of N)_o(p,e.seats.iState,G.start,G.length,f,c);let $=P.buffer;if(!$){P.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,$);for(let G of N){let ee=p.subarray(G.start*3,(G.start+G.length)*3);t.bufferSubData(t.ARRAY_BUFFER,G.start*3*Float32Array.BYTES_PER_ELEMENT,ee)}},dispose(){X=!0,l.dispose(),i.remove(),o.remove(),s.remove(),u.remove(),w.remove(),d.remove(),k.remove(),y.remove(),oe?.remove(),K?.remove(),ue?.texture&&t.deleteTexture(ue.texture)}},le=e.productionElements.find(N=>N.contentImageUrl&&N.contentPlane);if(le?.contentImageUrl&&le.contentPlane?.length===4&&typeof Image<"u"){let N=new Image;N.crossOrigin="anonymous",N.onload=()=>{if(X)return;let $=le.contentPlane;oe=new Qe(t,{position:{size:3,data:new Float32Array($.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(le.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),ue=new Ji(t,{image:N,generateMipmaps:!0,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,flipY:!1}),K=new Zi(t,{vertex:`#version 300 es
615
820
  precision highp float;
616
821
  in vec3 position; in vec2 uv; in float floorIndex;
617
822
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
@@ -619,4 +824,4 @@ void main() {
619
824
  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
620
825
  precision highp float;
621
826
  in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
622
- void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:ee},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let B=new Ne(t,{geometry:$,program:U});B.frustumCulled=!1,B.setParent(o),oe.screenProgram=U,g=!0,oe.drawCalls=3+(X?1:0)+1},I.src=J.contentImageUrl}return oe}import{Mesh as It,RenderTarget as kr,Transform as _t}from"ogl";function Lr(t,e,o){let r=t+(e<<8)+(o<<16);return r===0?-1:r-1}function Ho(t,e,o,r,n,i){let s=-1,a=1/0;for(let l=0;l<o;l++)for(let d=0;d<e;d++){let p=(l*e+d)*4,h=Lr(t[p],t[p+1],t[p+2]);if(h<0||h>=i)continue;let b=d-r,c=l-n,u=b*b+c*c;u<a&&(a=u,s=h)}return s}function Uo(t,e,o,r,n,i){let s=t-o.left,a=e-o.top,l=Math.round(s*r),d=Math.round((o.height-a)*r);return{x:Math.max(0,Math.min(n-1,l)),y:Math.max(0,Math.min(i-1,d))}}var Or=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],tt=class{constructor(e,o,r,n,i){this.seatScene=new _t;this.chairScene=new _t;this.solidScene=new _t;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=i,this.seatProg=Fo(this.gl),this.chairProg=To(this.gl),this.depthProg=Io(this.gl);let s=new It(this.gl,{geometry:o,program:this.seatProg});s.frustumCulled=!1,s.setParent(this.seatScene);let a=new It(this.gl,{geometry:r,program:this.chairProg});a.frustumCulled=!1,a.setParent(this.chairScene);let l=new It(this.gl,{geometry:n,program:this.depthProg});l.frustumCulled=!1,l.setParent(this.solidScene)}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let r of Or)this.seatProg.uniforms[r].value=e.uniforms[r].value;let o=e.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=o,this.chairProg.uniforms.uFocusFloor.value=o,this.depthProg.uniforms.uFocusFloor.value=o}ensureTarget(){let e=this.gl.drawingBufferWidth,o=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==e||this.target.height!==o)&&this.destroyTarget(),this.target||(this.target=new kr(this.gl,{width:e,height:o,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let e=this.gl;this.target.buffer&&e.deleteFramebuffer(this.target.buffer);for(let o of this.target.textures??[])o.texture&&e.deleteTexture(o.texture);this.target.depthBuffer&&e.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(e,o,r,n){let i=this.gl,s=this.ensureTarget(),a=i.drawingBufferWidth,l=i.drawingBufferHeight,d=Math.max(0,o-n),p=Math.max(0,r-n),h=Math.max(1,Math.min(a,o+n+1)-d),b=Math.max(1,Math.min(l,r+n+1)-p);i.enable(i.SCISSOR_TEST),i.scissor(d,p,h,b);let[c,u,P]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:e,target:s,clear:!0}),this.renderer.render({scene:this.seatScene,camera:e,target:s,clear:!1}),this.renderer.render({scene:this.chairScene,camera:e,target:s,clear:!1}),i.clearColor(c,u,P,1),i.disable(i.SCISSOR_TEST);let F=new Uint8Array(h*b*4);return this.renderer.bindFramebuffer(s),i.readPixels(d,p,h,b,i.RGBA,i.UNSIGNED_BYTE,F),this.renderer.bindFramebuffer(),Ho(F,h,b,o-d,r-p,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Wo(t,e){let o=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,$t(r.state)):o.push(r);return o}function Yo(t,e,o){let r=new Set;for(let s of e)(t.has(s)||o(s)!==void 0)&&r.add(s);let n=new Map(t),i=[];for(let[s,a]of t)r.has(s)||(i.push({seatId:s,state:me[a]??"available"}),n.delete(s));for(let s of r){if(n.has(s))continue;let a=o(s);a!==void 0&&(n.set(s,a),i.push({seatId:s,state:"selected"}))}return{updates:i,next:n}}import{Quat as Be,Vec3 as Br}from"ogl";function zr(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function Xo(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function Nr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function qo(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 Vt(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function Lt(t,e){return Math.max(0,Math.min(1,t+e))}function jo(t,e){let o=t.length;if(o===0)return[0,0,0];if(o===1)return[...t[0]];let r=Math.max(0,Math.min(1,e)),n=o-1,i=Math.floor(r*n);i>=n&&(i=n-1);let s=r*n-i,a=t[Math.max(0,i-1)],l=t[i],d=t[i+1],p=t[Math.min(o-1,i+2)],h=s*s,b=h*s,c=[0,0,0];for(let u=0;u<3;u++)c[u]=.5*(2*l[u]+(-a[u]+d[u])*s+(2*a[u]-5*l[u]+4*d[u]-p[u])*h+(-a[u]+3*l[u]-3*d[u]+p[u])*b);return c}function kt(t,e,o,r,n){let i=qo(zr(e,o));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let s=Xo(Xo(e,Nr(i,2.5)),[0,1.5,0]),a=[e[0]-r[0],0,e[2]-r[2]],l=qo(a);l[0]===0&&l[2]===0&&(l=[i[0],0,i[2]]);let d=Math.max(1,n),p=[r[0]+l[0]*d*1.3,r[1]+d*.75,r[2]+l[2]*d*1.3];return{waypoints:[t,p,s],finalPos:s}}function Ot(t,e,o=35,r=28){let n=Vt(e),i=jo(t,n),s=Vt(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:i,fov:o+(r-o)*s,eased:n}}function Zo(t,e,o){let r=t.position.clone(),n=new Be().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new Br(o[0],o[1],o[2]));let i=new Be().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(n),i}var ot=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new Be;this.endQuat=new Be;this.outQuat=new Be;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,o,r,n=2500,i=28){return this.settle(),this.waypoints=e,this.startQuat.copy(o),this.endQuat.copy(r),this.duration=n,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(s=>{this.resolveFn=s})}update(e){if(!this.active)return!1;let o=Math.min(1,(e-this.startTime)/this.duration),{pos:r,fov:n,eased:i}=Ot(this.waypoints,o,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Lt(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=n,this.camera.updateProjectionMatrix(),o>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let e=this.resolveFn;this.resolveFn=null,e&&e()}};var Jo=Jt,Gr=.12,Hr=.25,Ur=1.5;function en(t,e,o=0,r,n){let i=[e.x*Me,o+Ur,e.y*Me],s=n?[n[0],n[1],n[2]]:i,a=t[1],l=Number.isFinite(a)?a+Jo:Number.isFinite(r)?o+r:o+Jo,d=i[0]-t[0],p=i[2]-t[2],h=Math.hypot(d,p),b=h>.001?Math.min(Gr,h*Hr):0,c=h>.001?d/h:0,u=h>.001?p/h:0;return{eye:[t[0]+c*b,l,t[2]+u*b],focal:s}}var we=Math.PI/180,Wr=45,tn=80,nt=70,Yr=1,Xr=.99;function qr(t,e){if(!(t<Yr))return tn;if(!(Number.isFinite(e)&&e>0))return nt;let o=2*Math.atan(e/(2*rt*Xr)/Math.max(.05,t))/we;return Math.max(nt,Math.min(tn,o))}var jr=.25,rt=1,Kr=.25,Qr=12*we,$r=.2,Zr=1.5,on=.8,nn=6,ln=1.9,Jr=2/3,ei=.12,ti=.9,oi=1.2,ni=2,cn=.05,ri=6;function un(t,e,o=0){if(!t.length)return{min:[e[0]-6,o,e[2]-6],max:[e[0]+6,Math.max(o+on,e[1]),e[2]+6]};let r=1/0,n=-1/0,i=1/0,s=-1/0,a=o;for(let u of t)r=Math.min(r,u.cx-u.halfX),n=Math.max(n,u.cx+u.halfX),i=Math.min(i,u.cz-u.halfZ),s=Math.max(s,u.cz+u.halfZ),a=Math.max(a,u.y);let l=n-r,d=s-i,p=Math.max(l,Math.min(d,nn))/2,h=Math.max(d,Math.min(l,nn))/2,b=(r+n)/2,c=(i+s)/2;return{min:[b-p,o,c-h],max:[b+p,Math.max(o+on,a),c+h]}}function ii(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+ln,t.max[2]]}}function zt(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+Zr,e+$r,e+ln*Jr),(t.min[2]+t.max[2])/2]}function dn(t,e){let o=t[0]-e[0],r=t[2]-e[2],n=Math.hypot(o,r);return n<.001?{x:0,z:1}:{x:o/n,z:r/n}}function rn(t,e,o){let r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],s=Math.hypot(r,n,i)||1;r/=s,n/=s,i/=s;let a=-i,l=r,d=Math.hypot(a,l);if(d<1e-6)return 1/0;a/=d,l/=d;let p=1/0,h=-1/0;for(let b=0;b<8;b++){let c=(b&1?o.max[0]:o.min[0])-t[0],u=(b&2?o.max[1]:o.min[1])-t[1],P=(b&4?o.max[2]:o.min[2])-t[2],F=Math.max(cn,c*r+u*n+P*i),A=(c*a+P*l)/F;A<p&&(p=A),A>h&&(h=A)}return h-p}function an(t,e,o){let r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],s=Math.hypot(r,n,i)||1;r/=s,n/=s,i/=s;let a=-i,l=r,d=Math.hypot(a,l);if(d<1e-6)return 1/0;a/=d,l/=d;let p=-l*n,h=l*r-a*i,b=a*n,c=1/0,u=-1/0;for(let P=0;P<8;P++){let F=(P&1?o.max[0]:o.min[0])-t[0],A=(P&2?o.max[1]:o.min[1])-t[1],k=(P&4?o.max[2]:o.min[2])-t[2],f=Math.max(cn,F*r+A*n+k*i),M=(F*p+A*h+k*b)/f;M<c&&(c=M),M>u&&(u=M)}return u-c}function it(t,e){return Math.tan(t*we/2)*Math.max(.05,e)}function sn(t,e,o){let r=qr(o,t),n=l=>Math.max(Wr,Math.min(r,l)),i=l=>2*Math.atan(l)/we,s=Number.isFinite(t)&&t>0?n(i(t/(2*jr)/Math.max(.05,o))):r;if(!(Number.isFinite(e)&&e>0))return s;let a=Math.min(s,n(i(e/(2*ei))));return t/(2*it(a,o))>rt?s:a}function mn(t,e,o){let r=zt(e),n=[t[0],t[1],t[2]],i=0,s=0,a=c=>{if(!(c>0))return;let u=dn(n,r);n[0]+=u.x*c,n[2]+=u.z*c,s+=c},l=e.max[1]+Kr-n[1];l>0&&(n[1]+=l,i=l,a(l/Math.tan(Qr)));let d=ii(e),p=rn(n,r,e),h=sn(p,an(n,r,d),o),b=p/(2*it(h,o));for(let c=0;c<ri&&b>rt;c++){let u=Math.max(1,Math.hypot(n[0]-r[0],n[2]-r[2])),P=Number.isFinite(b)?b/rt:2;a(Math.min(60,u*(Math.min(4,P)-1)+.5)),p=rn(n,r,e),h=sn(p,an(n,r,d),o),b=p/(2*it(h,o))}return{eye:n,focal:r,fov:h,raisedM:i,pulledBackM:s,stageFrameWidth:b}}function ai(t,e,o){let r=Math.tan(e*we/2),n=it(e,o);return Math.max(1,t/Math.max(.05,Math.min(r,n)))}function pn(t,e){let{aspect:o,venue:r}=e,n=t.focal,i=dn(t.eye,n),s=b=>(b[0]-n[0])*i.x+(b[2]-n[2])*i.z,a=[{name:"seat",eye:t.eye,focal:n,fov:t.fov}],l=ni*(e.rowDepthM??ti);a.push({name:"row",eye:[t.eye[0]+i.x*l,t.eye[1]+oi,t.eye[2]+i.z*l],focal:n,fov:t.fov});let d=(b,c,u,P)=>{let F=ai(u,t.fov,o)*1.08,A=F*Math.sin(P*we),k=F*Math.cos(P*we);return{name:b,eye:[c[0]+i.x*k,c[1]+A,c[2]+i.z*k],focal:c,fov:t.fov}};e.section&&e.section.radius>0&&a.push(d("section",e.section.center,e.section.radius,14)),a.push(d("venue",r.center,Math.max(1,r.radius),26));let p=[],h=-1/0;for(let b of a){let c=s(b.eye);p.length&&c<=h+.5||(p.push(b),h=c)}return p}import{Vec3 as si}from"ogl";var He=Math.PI/180,hn=320,fn=70*He,li=32*He,ci=24*He,vn=.0026,ui=.22,di=.006,mi=180,pi=4,se=(t,e,o)=>Math.max(e,Math.min(o,t)),bn=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function gn(t){let{canvas:e,camera:o}=t,r=[],n=!1,i=0,s=0,a=0,l=0,d=0,p=0,h=!1,b=[0,0],c=0,u=!1,P=null,F=null,A=new Map,k=!1,f=0,M=0,C=0,O=0,x=()=>n&&r.length?r[se(Math.round(i),0,r.length-1)].name:null,w=()=>{let g=x();g!==P&&(P=g,t.onStopChange?.(g))},D=()=>{if(!n||!r.length)return;let g=r[se(Math.floor(i),0,r.length-1)],z=r[se(Math.ceil(i),0,r.length-1)],$=se(i-Math.floor(i),0,1),U=(ve,ct)=>ve+(ct-ve)*$,ee=[U(g.eye[0],z.eye[0]),U(g.eye[1],z.eye[1]),U(g.eye[2],z.eye[2])],Z=[U(g.focal[0],z.focal[0]),U(g.focal[1],z.focal[1]),U(g.focal[2],z.focal[2])],le=Z[0]-ee[0],oe=Z[1]-ee[1],J=Z[2]-ee[2],I=Math.hypot(le,oe,J)||1,N=Math.atan2(le,J),B=Math.asin(se(oe/I,-1,1)),_=N+s,G=se(B+a,-80*He,80*He),Q=Math.cos(G)*I;le=Math.sin(_)*Q,oe=Math.sin(G)*I,J=Math.cos(_)*Q,o.position.set(ee[0],ee[1],ee[2]),o.fov=U(g.fov,z.fov),o.updateProjectionMatrix(),o.lookAt(new si(ee[0]+le,ee[1]+oe,ee[2]+J)),t.onApplied?.()},L=()=>{if(!n||!r.length)return;let g=se(Math.round(i),0,r.length-1);if(t.reducedMotion()){h=!1,i=g,D(),w(),t.requestRender();return}if(Math.abs(g-i)<.001){h=!1,w();return}l=i,d=g,p=performance.now(),h=!0,t.requestRender()},R=g=>{!n||r.length<2||(h=!1,i=se(i+g,0,r.length-1),D(),w(),t.requestRender())},K=(g,z)=>{n&&(h=!1,u=!1,s=se(s-g*vn,-fn,fn),a=se(a-z*vn,-ci,li),D(),t.requestRender())},H=g=>{n&&(A.set(g.pointerId,{x:g.clientX,y:g.clientY}),A.size===1?(k=!0,O=0,f=g.clientX,M=g.clientY):A.size===2&&(k=!1,C=V()))},V=()=>{let g=[...A.values()];return g.length<2?0:Math.hypot(g[0].x-g[1].x,g[0].y-g[1].y)},Y=g=>{if(!n||!A.has(g.pointerId))return;if(A.set(g.pointerId,{x:g.clientX,y:g.clientY}),A.size>=2){let U=V();C>0&&R((C-U)*di),C=U;return}if(!k)return;let z=g.clientX-f,$=g.clientY-M;f=g.clientX,M=g.clientY,O+=Math.abs(z)+Math.abs($),!(O<=pi)&&K(z,$)},y=g=>{A.delete(g.pointerId)&&(A.size<2&&(C=0),A.size===0&&(k=!1,L()))},S=g=>{if(!n)return;g.preventDefault();let z=g.deltaMode===1?16:g.deltaMode===2?100:1,$=se(g.deltaY*z/100,-2,2);R($*ui),F&&clearTimeout(F),F=setTimeout(()=>{F=null,L()},mi)},X=()=>{n&&(n=!1,h=!1,u=!1,r=[],A.clear(),k=!1,F&&(clearTimeout(F),F=null),P!==null&&(P=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",H),e.addEventListener("pointermove",Y),e.addEventListener("pointerup",y),e.addEventListener("pointercancel",y),e.addEventListener("wheel",S,{passive:!1}),{get active(){return n},enter(g){if(g.length<2){X();return}r=g,n=!0,i=0,s=0,a=0,h=!1,u=!1,P=null,D(),w(),t.requestRender()},exit:X,recentre(){return n?Math.abs(s)<1e-4&&Math.abs(a)<1e-4?!0:t.reducedMotion()?(u=!1,s=0,a=0,D(),t.requestRender(),!0):(b=[s,a],c=performance.now(),u=!0,t.requestRender(),!0):!1},update(g){if(!n)return!1;let z=!1;if(u){let $=se((g-c)/hn,0,1),U=1-bn($);s=b[0]*U,a=b[1]*U,$>=1?(u=!1,s=0,a=0):z=!0}if(h){let $=se((g-p)/hn,0,1);i=l+(d-l)*bn($),$>=1?(h=!1,i=d,w()):z=!0}return D(),z},currentStop:x,dispose(){X(),e.removeEventListener("pointerdown",H),e.removeEventListener("pointermove",Y),e.removeEventListener("pointerup",y),e.removeEventListener("pointercancel",y),e.removeEventListener("wheel",S)}}}function yn(t){return t.flying?"cinematic":t.panoramaMounted?"panorama":t.seatViewActive?"seatView":"orbit"}var Nt=null;function xn(){return Nt??=import("../openPanorama-6FMXAJ6O.js").catch(t=>{throw Nt=null,t}),Nt}var Sn=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),at=class{constructor(e){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=e}emit(e,o){if(this.cb)try{this.cb(e,o)}catch{}}opened(e,o,r,n){this.emit("3d_opened",{seats:e,hasHeights:o,...r===void 0?{}:{buildMs:Math.round(r)},...n===void 0?{}:{prepSource:n}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(e,o){this.emit("3d_seat_picked",{seatId:e,sectionId:o})}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=Sn(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(Sn()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:e})}panoramaFailed(e,o){this.emit("3d_panorama_failed",{seatId:e,phase:o})}panoramaFallback(e){this.emit("3d_panorama_fallback",{seatId:e})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function wn(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function Mn(t){let{container:e,model:o,opts:r,expandedSeatById:n,seatIdsByRow:i,isNarrow:s}=t,a=null,l=()=>{if(!a)return;let h=s();Object.assign(a.style,h?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},d=()=>{a?.remove(),a=null};return{show:(h,b,c=!1)=>{if(d(),t.isDisposed())return null;let u=document.createElement("div");u.setAttribute("role","group"),Object.assign(u.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let P=r.chrome?.caption!==!1,F=r.chrome?.seatStepper!==!1;if(!P&&!F)return null;let A=n.get(h),k=A?.sectionId?o.sections.find(L=>L.id===A.sectionId):void 0,f=A?.label??h;u.setAttribute("aria-label",`Explore views near ${k?.label?`${k.label}, `:""}seat ${f}`);let M=document.createElement("span");M.textContent=r.seatViewCaption?.(h)??["Live 3D seat view",k?.label,f].filter(Boolean).join(" \xB7 "),Object.assign(M.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)"}),P&&u.appendChild(M);let C=document.createElement("div");Object.assign(C.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),u.appendChild(C);let O=A?.rowId?i.get(A.rowId):void 0,x=O?.indexOf(h)??-1,w=x>=0?[O?.[x-1],O?.[x+1]]:[void 0,void 0],D=(L,R,K,H=!1)=>{let V=document.createElement("button");V.type="button",V.textContent=L,V.setAttribute("aria-label",R),Object.assign(V.style,{minHeight:"44px",padding:H?"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"}),H||(V.style.minWidth="44px"),H&&(V.dataset.panoramaTrigger=""),V.addEventListener("click",K),C.appendChild(V)};if(F&&w[0]){let L=n.get(w[0])?.label??w[0];D("\u2039",`View previous seat ${L}`,()=>{t.flyToSeat(w[0])})}if(F&&r.getSeatView){let L=r.seatViewActionLabel?.(h)??"Open 360\xB0 panorama";D(c?`\u21BB Retry ${L}`:`\u25C9 ${L}`,`${c?"Retry":L} from seat ${f}`,()=>{if(t.isDisposed()||b!==t.flightGen()){d();return}d(),t.openPanorama(h,400,b)},!0)}if(F&&w[1]){let L=n.get(w[1])?.label??w[1];D("\u203A",`View next seat ${L}`,()=>{t.flyToSeat(w[1])})}return!C.childElementCount&&!P?null:(e.appendChild(u),a=u,l(),u)},remove:d,layout:l}}var hi={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function Pn(t){let{container:e,orbit:o,isNarrow:r}=t,n={...hi,...t.labels??{}},i=(f,M)=>{f.setAttribute("aria-label",M),f.title=M},s=document.createElement("div"),a=!1;s.className="sl-3d-navigation-controls",Object.assign(s.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 d=document.createElement("div");d.setAttribute("role","group"),d.setAttribute("aria-label","3D view controls"),Object.assign(d.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let p=document.createElement("button");p.type="button",p.textContent="\u21BB",i(p,n.rotate);let h=document.createElement("button");h.type="button",h.textContent="\u2725",i(h,n.move);let b=document.createElement("button");b.type="button",b.textContent="\u2212",i(b,n.zoomOut);let c=document.createElement("button");c.type="button",c.textContent="+",i(c,n.zoomIn);for(let f of[p,h,b,c])f.className="sl-3d-icon-control",Object.assign(f.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(p,h),d.append(c,b);let u=f=>{o.setPrimaryDragMode(f);let M=f==="orbit";p.setAttribute("aria-pressed",String(M)),h.setAttribute("aria-pressed",String(!M)),p.style.background=M?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",h.style.background=M?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",s.title=M?`${n.rotate} \xB7 ${n.move} with Shift`:`${n.move} \xB7 ${n.rotate} with Shift`};p.addEventListener("click",()=>u("orbit")),h.addEventListener("click",()=>u("pan"));let P=()=>{let{atMin:f,atMax:M}=o.dollyLimitState();c.disabled!==f&&(c.disabled=f),b.disabled!==M&&(b.disabled=M)};b.addEventListener("click",()=>{o.zoomBy(Le),P()}),c.addEventListener("click",()=>{o.zoomBy(Ce),P()}),s.append(l,d),u("orbit"),e.appendChild(s);let F=t.enabled!==!1,A=()=>{let f=r();s.style.display=a||!F?"none":"flex",s.style.right=f?"12px":"14px",s.style.bottom=f?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",l.style.display=f?"none":"flex",c.style.display=f?"none":"",b.style.display=f?"none":""};return A(),{element:s,utilityControls:d,setNavigationMode:u,syncZoomLimits:P,setSeatViewLocked:f=>{a=f,o.setInteractionEnabled(!f),A()},seatViewLocked:()=>a,layout:A}}var fi=12;function vi(t,e){if(!t)return!1;let o=t.x-e[0],r=t.y-e[1],n=t.z-e[2];return Math.hypot(o,r,n)>fi}function Cn(t){let{glctx:e,orbit:o,model:r,seats:n,opts:i,cinematic:s,analytics:a,seatIdByIndex:l,sectionIdBySeatId:d,tapSlop:p,tapMs:h,cancelFlight:b,focusSectionCamera:c,setSelection:u,ensureSeatView:P}=t,F=0,A=0,k=0,f=-1,M=!1,C=!1,O=R=>{t.seatViewLocked()||f===-1&&(f=R.pointerId,F=R.clientX,A=R.clientY,k=performance.now(),M=!1,C=s.active,s.active&&(a.cinematicCancelled(),b(),i.onViewTargetChange?.(null)))},x=R=>{R.pointerId===f&&Math.hypot(R.clientX-F,R.clientY-A)>p&&(M=!0)},w=(R,K,H,V,Y)=>{let y=e.canvas.getBoundingClientRect(),S=e.canvas.clientWidth||y.width||1,X=e.canvas.clientHeight||y.height||1,g=R-y.left,z=K-y.top,$=V*V,U=-1,ee=$,Z=1/0;for(let le of n){if(H&&le.sectionId!==H)continue;let oe=r.seats.idToIndex.get(le.id);if(oe===void 0)continue;if(Y){let G=Math.round(r.seats.iState[oe]??0);if(G!==0&&G!==3)continue}let J=oe*3,I=fe(o.camera.projectionViewMatrix,[r.seats.iPosition[J],r.seats.iPosition[J+1]+.55,r.seats.iPosition[J+2]],S,X);if(!I.visible)continue;let N=I.x-g,B=I.y-z,_=N*N+B*B;(_<ee||Math.abs(_-ee)<1&&I.depth<Z)&&(U=oe,ee=_,Z=I.depth)}return U},D=(R,K)=>{let H=t.gpu(),V=t.pick();if(!H||!V)return-1;V.syncFromSeatProgram(H.seatProgram);let Y=e.canvas.getBoundingClientRect(),y=e.renderer.dpr,{x:S,y:X}=Uo(R,K,Y,y,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),g=Math.max(2,Math.round(8*y));return V.pick(o.camera,S,X,g)};return{onDown:O,onMove:x,onUp:R=>{if(R.pointerId!==f)return;let K=!M&&performance.now()-k<h;if(f=-1,C){C=!1;return}let H=t.gpu(),V=t.pick();if(!K||!H||!V)return;let Y=D(R.clientX,R.clientY);if(t.focusedSectionId()&&Y>=0){let X=l[Y],g=X?d.get(X):void 0;if(g&&g!==t.focusedSectionId()&&c(g))return}if(t.focusedSectionId()&&Y<0&&(Y=w(R.clientX,R.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&Y<0){let X=w(R.clientX,R.clientY,null,72,!1),g=X>=0?l[X]:void 0,z=g?d.get(g):void 0;if(z&&z!==t.focusedSectionId()&&c(z))return}if(!t.focusedSectionId()){Y<0&&(Y=w(R.clientX,R.clientY,null,42,!1));let X=Y>=0?l[Y]:void 0,g=X?d.get(X):void 0;if(g&&c(g))return}if(Y<0||Y>=l.length){t.selection().size&&(u([]),i.onViewTargetChange?.(null));return}let y=l[Y],S=me[Math.round(r.seats.iState[Y]??0)]??"available";if(S!=="available"&&S!=="selected"){i.onSeatInspect?.(y,S);return}if(t.selection().has(y)&&t.selection().size===1){u([]),i.onViewTargetChange?.(null),i.onSeatPick?.(y);return}if(u([y]),P(y),a.seatPicked(y,d.get(y)),i.onSeatPick?.(y),t.focusedSectionId()){let X=Y*3,g=[r.seats.iPosition[X],r.seats.iPosition[X+1],r.seats.iPosition[X+2]];vi(o.camera?.position,g)&&t.focusSeatCamera(y)}}}}var st=class{constructor(e,o){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=o}ensureGrid(){if(this.cellStart||this.count===0)return;let e=this.iPosition,o=1/0,r=1/0,n=-1/0,i=-1/0;for(let c=0;c<this.count;c++){let u=e[c*3],P=e[c*3+2];u<o&&(o=u),u>n&&(n=u),P<r&&(r=P),P>i&&(i=P)}let s=Math.max(n-o,.001),a=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(s*a*4/this.count),.25),this.cols=Math.max(1,Math.ceil(s/this.cell)+1),this.rows=Math.max(1,Math.ceil(a/this.cell)+1),this.minX=o,this.minZ=r;let l=this.cols*this.rows,d=new Int32Array(l+1),p=c=>{let u=Math.min(this.cols-1,Math.max(0,Math.floor((e[c*3]-o)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[c*3+2]-r)/this.cell)))*this.cols+u};for(let c=0;c<this.count;c++)d[p(c)+1]++;for(let c=0;c<l;c++)d[c+1]+=d[c];let h=new Int32Array(this.count),b=d.slice(0,l);for(let c=0;c<this.count;c++)h[b[p(c)]++]=c;this.cellStart=d,this.cellItems=h}gather(e,o,r,n){this.ensureGrid();let i=this.cellStart,s=this.cellItems;if(!i||!s)return 0;let a=n.length,l=r*r,d=Math.floor((e-this.minX)/this.cell),p=Math.floor((o-this.minZ)/this.cell),h=Math.ceil(r/this.cell)+1,b=this.iPosition,c=0;for(let u=0;u<=h&&c<a;u++){let P=p-u,F=p+u,A=d-u,k=d+u;for(let f=P;f<=F&&c<a;f++){if(f<0||f>=this.rows)continue;let M=f===P||f===F;for(let C=A;C<=k&&c<a;C++){if(!M&&C!==A&&C!==k){C=k-1;continue}if(C<0||C>=this.cols)continue;let O=f*this.cols+C;for(let x=i[O],w=i[O+1];x<w&&c<a;x++){let D=s[x],L=b[D*3]-e,R=b[D*3+2]-o;L*L+R*R<=l&&(n[c++]=D)}}}}return c}};var lt=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array($e);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new st(e.model.seats.iPosition,e.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(e){let o=this.ctx.gpu();e||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!e&&o?.nearSeatCount()&&o.setNearSeats(this.nearBuf,0)}update(e){let{model:o}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!e){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let n=this.ctx.orbit().camera.position;if(Math.hypot(n.x-this.lastGatherX,n.z-this.lastGatherZ)<At)return;if(this.lastGatherX=n.x,this.lastGatherZ=n.z,Math.hypot(n.x-o.bounds.center[0],n.z-o.bounds.center[2])-o.bounds.radius>Ct){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let a=this.nearIndex.gather(n.x,n.z,Ct,this.nearBuf);a===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,a)}ease(e,o,r){let n=1-Math.exp(-e*9),i=1-Math.exp(-e*20);this.seatDetailMix+=(o-this.seatDetailMix)*(o>this.seatDetailMix?n:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?n:i),Math.abs(o-this.seatDetailMix)<.01&&(this.seatDetailMix=o),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};import{Quat as bi,Vec3 as gi}from"ogl";function An(){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 o=document.createElementNS(t,"path");return o.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(o),e}function Dn(t){let{container:e,model:o,opts:r,orbit:n,cinematic:i,analytics:s,loop:a,labelOverlay:l,stageAzimuth:d,overviewFraming:p}=t,h=0,b=-1,c=(x,w,D=28)=>{n.camera.position.set(x[0],x[1],x[2]),n.camera.lookAt(new gi(w[0],w[1],w[2])),n.camera.fov=D,n.camera.updateProjectionMatrix()},u=document.createElement("button");u.className="sl-3d-overview-control sl-3d-icon-control",u.type="button",u.replaceChildren(An());let P=r.navLabels?.fitView??"Show whole venue";u.setAttribute("aria-label",P),u.title=P,Object.assign(u.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 F=()=>{u.firstElementChild||u.replaceChildren(An())};F();let A=x=>{b=x;let w=t.gpu();w&&(w.seatProgram.uniforms.uFocusFloor.value=x,w.solidProgram.uniforms.uFocusFloor.value=x,w.chairProgram.uniforms.uFocusFloor.value=x),t.showSectionSeatLabels(null)},k=()=>{if(t.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),s.panoramaClosed()),t.setPanoramaSphereVisible(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.restorePanoramaLayer(),u.style.display="",l.setVisible(!0),t.setFrozen(!1);let x=b>=0?o.floors[b]:null;if(t.setNearFieldDetailEnabled(!!x),t.setSeatViewLocked(!1),f(),t.removeArriveChip(),t.setNavigationMode("orbit"),x){let w=x.focalWorld[0]-x.center[0],D=x.focalWorld[2]-x.center[2],L=Math.hypot(w,D)>x.radius*.12?Math.atan2(w,D):d,R={center:x.center,radius:x.radius,box:x.box},K={polarDeg:58,margin:1.12};t.reducedMotion()?n.frame(R,!1,L,!1,K):n.frameSoft(R,L,!1,K)}else t.reducedMotion()?n.frame(o.bounds,!1,d,r.portraitOverviewCrop===!0,p):n.frameSoft(o.bounds,d,r.portraitOverviewCrop===!0,p);t.showSectionSeatLabels(null),a.requestRender()},f=()=>{h++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),i.active&&(i.cancel(),n.resumeAfterFlight(o.focalWorld))},M=x=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let w=o.seats.idToIndex.get(x);if(w===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(x),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),u.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1);let D=t.inSeatView()&&r.arriveAtSeatEye===!0;t.setSeatStepping(D),t.setSeatViewLocked(!1);let L=++h;D?t.showArriveChip(x,L):t.removeArriveChip();let{eye:R,focal:K}=t.resolvedSeatViewPose(x,w),H=r.arriveAtSeatEye?t.seatViewArrival(x,w):null,V=H?H.focal:K,Y=[n.camera.position.x,n.camera.position.y,n.camera.position.z],y=kt(Y,H?.eye??R,V,o.bounds.center,o.bounds.radius),S=H?H.eye:r.arriveAtSeatEye?R:y.finalPos,X=H?H.fov:r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?nt:65:28,g=[y.waypoints[0],y.waypoints[1],S];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),c(S,V,X),a.requestRender(),s.cinematicSkipped(),t.isDisposed()||n.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),H&&t.enterSeatView(H.stops),t.showArriveChip(x,L),Promise.resolve();let z=new bi().copy(n.camera.quaternion),$=Zo(n.camera,S,V);a.requestRender();let U=D?700:2500;return i.start(g,z,$,U,X).then(()=>{t.isDisposed()||L!==h||(t.setSeatStepping(!1),s.cinematicPlayed(U),n.resumeAfterFlight(V),t.setSeatViewLocked(r.arriveAtSeatEye===!0),H&&t.enterSeatView(H.stops),a.requestRender(),t.showArriveChip(x,L))})},C=x=>{let w=o.sections.find(K=>K.id===x);if(!w||w.seatCount===0)return!1;t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),i.cancel(),t.removeArriveChip(),o.floors.length>1&&b!==w.floorIndex&&A(w.floorIndex),t.setNavigationMode("pan"),t.showSectionSeatLabels(x);let D=w.focalWorld[0]-w.center[0],L=w.focalWorld[2]-w.center[2],R=Math.hypot(D,L)>w.radius*.12?Math.atan2(D,L):void 0;return n.frame({center:w.center,radius:Math.max(5,w.radius*.5)},!1,R),r.onSectionFocusChange?.(x),a.requestRender(),!0},O=x=>{if(t.isDisposed()||!t.gpu())return!1;let w=o.seats.idToIndex.get(x);if(w===void 0)return!1;let D=w*3,L=[o.seats.iPosition[D],o.seats.iPosition[D+1]+.55,o.seats.iPosition[D+2]];return t.reducedMotion()?n.frame({center:L,radius:En},!1,void 0,!1,Rn):n.frameSoft({center:L,radius:En},void 0,!1,Rn),a.requestRender(),!0};return u.addEventListener("click",k),{overviewChip:u,layoutOverviewChip:F,flightGen:()=>h,focusedFloor:()=>b,applyFloorFocus:A,placeCameraFinal:c,cancelFlight:f,focusOverview:k,flyToSeat:M,focusSectionCamera:C,focusSeatCamera:O}}var En=4.5,Rn={polarDeg:48,margin:1.25};function Fn(t){let e=performance.now();return{model:Ve(t),buildMs:performance.now()-e,source:"main"}}function yi(t){let e=jt(t.doc);return{...Fn({...t,seats:e}),seats:e}}function Tn(t,e,o){if(typeof Worker>"u")return Promise.resolve(e());let r;try{r=new Worker(new URL("./scene/scene.worker.js",import.meta.url),{type:"module"})}catch{return Promise.resolve(e())}return new Promise(n=>{let i=!1,s=d=>{i||(i=!0,clearTimeout(l),r.terminate(),n(d))},a=()=>s(e()),l=window.setTimeout(a,15e3);r.onerror=a,r.onmessage=d=>{let p=o(d.data);p?s(p):a()},r.postMessage(t)})}function xi(t){return Tn(t,()=>Fn(t),({model:e,buildMs:o})=>({model:e,buildMs:o,source:"worker"}))}function Si(t){return Tn(t,()=>yi(t),({model:e,buildMs:o,seats:r})=>r?{model:e,buildMs:o,seats:r,source:"worker"}:null)}var wi=Math.PI/180,Mi=6,Pi=500;function Ss(t,e,o={}){let r=performance.now(),n=e.prepared?.model??Ve(e),i=new at(o.onAnalytics),s=new Array(n.seats.count);for(let[m,v]of n.seats.idToIndex)s[v]=m;let a=new Map(e.seats.map(m=>[m.id,m])),l=new Map;for(let m of e.seats){if(!m.rowId)continue;let v=l.get(m.rowId);v?v.push(m.id):l.set(m.rowId,[m.id])}let d=new Map;for(let m of e.seats)d.set(m.id,m.sectionId);let p=new Map;for(let[m,v]of n.seats.idToIndex){let E=d.get(m);if(!E)continue;let W=p.get(E);W?W.push(v):p.set(E,[v])}let h=()=>{if(!c||!n.sectionSolidRanges.length)return;let{lit:m,anyUnlit:v}=Oo(n.sectionSolidRanges,p,n.seats.iState);c.setSectionShellLit(v?m:null)},b=e.doc.floors?.some(v=>(v.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(v=>v.objects)??e.doc.objects).some(v=>v.type==="section"&&((v.height??0)>0||(v.rake??0)>0)),c=null,u=null,P=!1,F=!1,A=!1,k=new Map,f=null,M=null,C=null,O=new Map,x=null,w=()=>{C===null&&(C=t.style.zIndex,t.style.zIndex="20")},D=()=>{C!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=C),C=null)},L=!1,R=()=>L?re.focusedFloor():-1,K=()=>{c=Go(y.gl,n),h(),u=new tt(y.renderer,c.seatGeometry,c.chairGeometry,c.solidGeometry,n.seats.count),y.setClearColor(n.theme.background.top),u.setRestoreClear(n.theme.background.top),c.seatProgram.uniforms.uSeatRadius.value=_e*n.theme.seatScale,c.seatProgram.uniforms.uFocusFloor.value=R(),c.solidProgram.uniforms.uFocusFloor.value=R(),c.chairProgram.uniforms.uFocusFloor.value=R(),c.screenProgram&&(c.screenProgram.uniforms.uFocusFloor.value=R()),V.forceRegather()},H=!1,V=new lt({model:n,orbit:()=>S,gpu:()=>c}),Y=m=>V.setDetailEnabled(m),y=new je(t,{onContextLost:()=>{A||i.contextLost(),P=!0,_.stop(),c=null,u=null},onContextRestored:()=>{K(),P=!1,A||i.contextRestored(),_.requestRender()}}),S=new Ke(y.gl,y.canvas,()=>_.requestRender(),()=>i.orbitEngaged());S.setAspect(y.aspect);let X=(e.doc.floors?.flatMap(m=>m.objects)??e.doc.objects).some(m=>m.type==="section"&&m.physical3dProvenance?.surfaceKind?.status==="inferred"),g=(()=>{if(X&&n.stages.length===0)return;let m=n.focalWorld[0]-n.bounds.center[0],v=n.focalWorld[2]-n.bounds.center[2];return Math.hypot(m,v)>n.bounds.radius*.12?Math.atan2(m,v):void 0})(),z=n.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},$=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;S.frame(n.bounds,!$&&o.skipInitialOverviewAnimation!==!0,g,o.portraitOverviewCrop===!0,z);let U=new ot(S.camera),ee=wn(t),Z=new Je(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:n.theme.background.top}),le=n.labels,oe=()=>oo(le,n.floors.length,R());Z.setLabels(oe());let J=null,I=m=>{if(J=m,Z.setForcedDense(!!m),!m){Z.setLabels(oe());return}let v=e.seats.filter(T=>T.sectionId===m),E=new Set(v.map(T=>T.id)),W=new Set(v.map(T=>T.rowId)),q=new Set(k.keys()),j=new Set(v.filter(T=>q.has(T.id)).map(T=>T.id)),te=oe().filter(T=>T.kind!=="row"&&T.kind!=="seat"||(T.kind==="row"?W.has(T.id.slice(4)):E.has(T.id.slice(5))&&(j.size===0||j.has(T.id.slice(5)))));if(n.seatCount<=6e3&&j.size===0){Z.setLabels(te);return}let ne=j.size?v.filter(T=>j.has(T.id)):v,ge=new Set(ne.map(T=>`seat:${T.id}`)),he=ne.flatMap(T=>{let ae=n.seats.idToIndex.get(T.id);if(ae===void 0)return[];let ce=ae*3;return[{id:`seat:${T.id}`,kind:"seat",text:q.has(T.id)?T.displayLabel||T.label:uo(T.displayLabel||T.label),anchor:[n.seats.iPosition[ce],n.seats.iPosition[ce+1]+(q.has(T.id)?1.05:.55),n.seats.iPosition[ce+2]]}]});Z.setLabels([...te.filter(T=>!ge.has(T.id)),...he])};K();let N=null,B=null,_=new Qe(m=>{if(P||!c||F)return!1;let v=yn({flying:U.active,panoramaMounted:f!==null,seatViewActive:N?.active===!0}),E=v==="cinematic"?U.update(performance.now()):v==="seatView"?N.update(performance.now()):v==="orbit"?S.update():!1;B?.syncZoomLimits();let W=R()>=0?n.floors[R()]:null,q=W?.radius??n.bounds.radius,j=yo(S.currentDistance,q),te=H?{center:[S.camera.position.x,S.camera.position.y,S.camera.position.z],radius:520}:n.renderBounds;S.updateClipping(te);let ne=W?.center??n.renderBounds.center,ge=W?.radius??n.renderBounds.radius,he=(ue,Ie)=>Math.hypot(S.camera.position.x-ue[0],S.camera.position.y-ue[1],S.camera.position.z-ue[2])<=Ie*(V.detailVisible?1.8:1.55),T=he(ne,ge);if(!T&&J){let ue=n.sections.find(Ie=>Ie.id===J);ue&&(T=he(ue.center,Math.max(12,ue.radius*2)))}V.detailVisible=T;let ae=c.seatProgram.uniforms;ae.uSeatScale.value=j.scale,ae.uSeatFade.value=j.fade;let ce=!!W&&xo(W.seatCount,y.canvas.clientWidth||1,y.canvas.clientHeight||1),We=So(n.seats.count,q,S.currentDistance,S.camera.fov,y.canvas.clientHeight||1),Te=V.detailVisible||ce||We?1:0,Ye=V.detailVisible||R()>=0||n.floors.length>1?1:0;return V.ease(m,Te,Ye),ae.uSeatDetail.value=V.seatDetailMix,c.solidProgram.uniforms.uStructureDetail.value=V.structureDetailMix,ae.uMinPixels.value=j.minPixels,ae.uPixelToWorld.value=2*Math.tan(S.camera.fov*wi/2)/Math.max(1,y.pixelHeight),V.update(V.detailVisible),y.renderer.render({scene:c.background,clear:!0}),y.renderer.render({scene:c.main,camera:S.camera,clear:!1}),Z.update(S.camera.projectionViewMatrix,y.canvas.clientWidth||1,y.canvas.clientHeight||1,S.currentDistance,q,[S.camera.position.x,S.camera.position.y,S.camera.position.z]),E||V.seatDetailMix!==Te||V.structureDetailMix!==Ye}),G=typeof ResizeObserver<"u"?new ResizeObserver(()=>vt.resize()):null;G?.observe(t);let Q=m=>{let v=q=>{let j=n.seats.idToIndex.get(q);return j===void 0?void 0:n.seats.iState[j]},{updates:E,next:W}=Yo(k,m,v);if(k=W,Z.setSelectedSeatIds(k.keys()),J&&I(J),E.length){let q=xt(n.seats,E);c&&c.uploadSeatStateRuns(q),h(),_.requestRender()}},ve=()=>x!==null?x:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ct=8,Bt=m=>{if(!o.getSeatView)return null;let v=O.get(m);if(!v)for(v=Promise.resolve(o.getSeatView(m)),O.set(m,v),v.catch(()=>{O.get(m)===v&&O.delete(m)});O.size>ct;){let E=O.keys().next().value;if(E===void 0)break;O.delete(E)}return v},Gt=un(n.stages,n.focalWorld,n.bounds.groundY??0),In=zt(Gt),ut=(m,v)=>{let E=a.get(m),W=Math.max(0,Math.round(n.seats.iFloor[v]??0)),q=e.doc.floors?.[W],j=n.floors[W],te=q?.focalPoint??e.doc.focalPoint,ne=j?{x:j.focalWorld[0]/Me,y:j.focalWorld[2]/Me}:te,ge=E?.focalPoint?{x:E.focalPoint.x+ne.x-te.x,y:E.focalPoint.y+ne.y-te.y}:ne,he=[n.seats.iPosition[v*3],n.seats.iPosition[v*3+1],n.seats.iPosition[v*3+2]];return en(he,ge,q?.baseHeightM??0,E?.eyeHeightM,In)},Ht=()=>(t.clientWidth||y.canvas.clientWidth)<=520,dt=null,Ut=null,_n=async(m,v,E)=>{if(!o.getSeatView||A||E!==re.flightGen())return;let W;try{W=await xn()}catch{if(i.panoramaFailed(m,"mount"),!A&&E===re.flightGen()){let q=pt(m,E,!0);requestAnimationFrame(()=>q?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(A||E!==re.flightGen()||!dt))return Ut??=W.createOpenPanorama(dt),Ut(m,v,E)},mt=Mn({container:t,model:n,opts:o,expandedSeatById:a,seatIdsByRow:l,isNarrow:Ht,isDisposed:()=>A,flightGen:()=>re.flightGen(),flyToSeat:m=>Xt(m),openPanorama:(m,v,E)=>_n(m,v,E)}),pt=mt.show,ht=mt.remove,Vn=mt.layout,be=Pn({container:t,orbit:S,isNarrow:Ht,enabled:o.chrome?.controlDock!==!1,...o.navLabels?{labels:o.navLabels}:{}});B=be;let Ln=be.element,De=be.setNavigationMode,kn=be.layout,On=be.utilityControls,Fe=null,Wt=!1,Ue=m=>{be.setSeatViewLocked(m),m||N?.exit()};N=gn({canvas:y.canvas,camera:S.camera,requestRender:()=>_.requestRender(),reducedMotion:ve,onStopChange:m=>{let v=m??(Wt?"seat":null);Fe=v;try{o.onSeatViewStopChange?.(v)}catch{}},onApplied:()=>{A||S.syncFromCamera()}});let zn=(m,v)=>{let{eye:E}=ut(m,v),W=(t.clientWidth||y.canvas.clientWidth||1)/Math.max(1,t.clientHeight||y.canvas.clientHeight||1),q=mn(E,Gt,W);if(o.seatViewStops===!1)return{...q,stops:[]};let j=d.get(m),te=j?n.sections.find(ne=>ne.id===j):void 0;return{...q,stops:pn(q,{aspect:W,section:te&&te.seatCount>0?{center:te.center,radius:te.radius}:null,venue:{center:n.bounds.center,radius:n.bounds.radius}})}},re=Dn({container:t,model:n,opts:o,orbit:S,cinematic:U,analytics:i,loop:_,labelOverlay:Z,stageAzimuth:g,overviewFraming:z,gpu:()=>c,isDisposed:()=>A,panorama:()=>f,setPanorama:m=>{f=m},setPanoramaSphereVisible:m=>{H=m},panoramaLoadAbort:()=>M,setPanoramaLoadAbort:m=>{M=m},setFrozen:m=>{F=m},restorePanoramaLayer:D,reducedMotion:ve,resolvedSeatViewPose:ut,showSectionSeatLabels:I,setNearFieldDetailEnabled:Y,setSeatViewLocked:Ue,setNavigationMode:De,showArriveChip:pt,removeArriveChip:ht,inSeatView:()=>Fe!==null,setSeatStepping:m=>{Wt=m},seatViewArrival:(m,v)=>o.arriveAtSeatEye?zn(m,v):null,enterSeatView:m=>N?.enter(m)});L=!0;let ft=re.overviewChip,Nn=re.layoutOverviewChip,Bn=re.applyFloorFocus,Gn=re.focusOverview,Yt=re.cancelFlight,Xt=re.flyToSeat,qt=re.focusSectionCamera;On.appendChild(ft),dt={container:t,model:n,opts:o,analytics:i,orbit:S,loop:_,seatsById:a,ensureSeatView:Bt,resolvedSeatViewPose:ut,gpu:()=>c,gl:y.gl,isContextLost:()=>P,isDisposed:()=>A,flightGen:()=>re.flightGen(),setPanorama:m=>{f=m},getLoadAbort:()=>M,setLoadAbort:m=>{M=m},setPanoramaSphereVisible:m=>{H=m,m&&N?.exit()},setFrozen:m=>{F=m},raisePanoramaLayer:w,restorePanoramaLayer:D,getOverviewChip:()=>ft,labelOverlay:Z,reducedMotion:ve,removeArriveChip:ht,showArriveChip:pt};let pe=Cn({glctx:y,orbit:S,model:n,seats:e.seats,opts:o,cinematic:U,analytics:i,seatIdByIndex:s,sectionIdBySeatId:d,tapSlop:Mi,tapMs:Pi,gpu:()=>c,pick:()=>u,seatViewLocked:()=>be.seatViewLocked(),focusedSectionId:()=>J,selection:()=>k,cancelFlight:Yt,focusSectionCamera:qt,focusSeatCamera:re.focusSeatCamera,setSelection:Q,ensureSeatView:Bt});y.canvas.addEventListener("pointerdown",pe.onDown),y.canvas.addEventListener("pointermove",pe.onMove),y.canvas.addEventListener("pointerup",pe.onUp),y.canvas.addEventListener("pointercancel",pe.onUp),_.requestRender();let vt={setAvailability(m){let v=Wo(k,m),E=xt(n.seats,v);E.length&&c&&c.uploadSeatStateRuns(E),h(),_.requestRender()},setSelection:Q,setNavigationMode:De,zoomIn(){S.zoomBy(Ce),_.requestRender()},zoomOut(){S.zoomBy(Le),_.requestRender()},flyToSeat:Xt,focusOverview:Gn,seatViewStop:()=>Fe,recentreSeatView:()=>N?.recentre()??!1,resize(){let{width:m,height:v}=y.resize();S.setAspect(m/Math.max(1,v)),Vn(),kn(),Nn(),_.requestRender()},stats(){return{..._.stats(),drawCalls:c?c.drawCalls:0,seatCount:n.seatCount}},getQualityEvidence(){let m=_.stats(),v=y.canvas.clientWidth||1,E=y.canvas.clientHeight||1,W=n.bounds.center,q=fe(S.camera.projectionViewMatrix,[W[0],n.bounds.box.min[1],W[2]],v,E),j=fe(S.camera.projectionViewMatrix,[W[0],n.bounds.box.max[1],W[2]],v,E),te=n.bounds.box,ne=[te.min[0],te.max[0]].flatMap(T=>[te.min[1],te.max[1]].flatMap(ae=>[te.min[2],te.max[2]].map(ce=>fe(S.camera.projectionViewMatrix,[T,ae,ce],v,E)))).filter(T=>Number.isFinite(T.x)&&Number.isFinite(T.y)&&Number.isFinite(T.depth)),ge=ne.length?(()=>{let T=Math.min(...ne.map(ye=>ye.x)),ae=Math.max(...ne.map(ye=>ye.x)),ce=Math.min(...ne.map(ye=>ye.y)),We=Math.max(...ne.map(ye=>ye.y)),Te=Math.max(0,T),Ye=Math.min(v,ae),ue=Math.max(0,ce),Ie=Math.min(E,We),Xe=Math.max(0,Ye-Te),bt=Math.max(0,Ie-ue);return{box:{x:Te,y:ue,width:Xe,height:bt},horizontalFillRatio:Xe/v,verticalFillRatio:bt/E,visibleAreaRatio:Xe*bt/(v*E),clippedEdges:[...ce<0?["top"]:[],...ae>v?["right"]:[],...We>E?["bottom"]:[],...T<0?["left"]:[]]}})():void 0,he=String(y.gl.getParameter(y.gl.VERSION)??"");return{viewport:{width:v,height:E},context:{webgl2:/webgl\s*2/i.test(he),lost:P},frame:{rendered:m.rendered,idle:m.idle},camera:{position:[S.camera.position.x,S.camera.position.y,S.camera.position.z],distance:S.currentDistance,verticalFovDeg:S.fovY},scene:{seatCount:n.seatCount,floorCount:n.floors.length,zoneCount:n.zones.length,sectionCount:n.sections.length,authoredRelief:b,renderedVerticalSpanM:Math.max(0,n.bounds.box.max[1]-n.bounds.box.min[1]),projectedReliefPx:q.visible&&j.visible?Math.abs(q.y-j.y):0},labels:Z.qualityEvidence(),framing:ge,...Fe?{seatView:{fovDeg:S.camera.fov,stop:Fe}}:{}}},getQualityReport(){return Tt(vt.getQualityEvidence())},loseContextForTest(){y.simulateContextLossCycle()},floors(){return n.floors},focusFloor(m){if(m!==null&&!n.floors.some(E=>E.index===m))return!1;let v=m??-1;if(Y(m!==null),Ue(!1),Bn(v),De("orbit"),m===null)U.cancel(),ve()?S.frame(n.bounds,!1,g,o.portraitOverviewCrop===!0,z):S.frameSoft(n.bounds,g,o.portraitOverviewCrop===!0,z);else{let E=n.floors[m];if(E.seatCount>0){U.cancel();let W=E.focalWorld[0]-E.center[0],q=E.focalWorld[2]-E.center[2],j=Math.hypot(W,q)>E.radius*.12?Math.atan2(W,q):g;S.frame({center:E.center,radius:E.radius,box:E.box},!1,j,!1,{polarDeg:58,margin:1.12})}}return _.requestRender(),!0},zones(){return n.zones},focusZone(m){let v=n.zones.find(j=>j.id===m);if(!v||v.seatCount===0)return!1;Y(!1),Ue(!1),U.cancel(),De("orbit"),I(null),o.onSectionFocusChange?.(null);let E=v.focalWorld[0]-v.center[0],W=v.focalWorld[2]-v.center[2],q=Math.hypot(E,W)>v.radius*.12?Math.atan2(E,W):void 0;return S.frame({center:v.center,radius:v.radius*1.25},!1,q),_.requestRender(),!0},sections(){return n.sections},focusSection(m){return qt(m)},rows(m){return m?n.rows.filter(v=>v.sectionId===m):n.rows},seatsInRow(m){return e.seats.filter(v=>v.rowId===m).map(v=>({id:v.id,label:v.displayLabel||v.label}))},focusRow(m){let v=n.rows.find(E=>E.id===m);return!v||v.seatCount===0?!1:(Y(!0),Ue(!1),U.cancel(),De("pan"),v.sectionId&&(I(v.sectionId),o.onSectionFocusChange?.(v.sectionId)),S.frame({center:v.center,radius:Math.max(2.5,v.radius*.65)}),_.requestRender(),!0)},setReducedMotionForTest(m){x=m},dispose(){A=!0,ht(),ft.remove(),Ln.remove(),Yt(),N?.dispose(),_.stop(),Z.dispose(),G?.disconnect(),f&&(f.dispose(),f=null),D(),ee(),y.canvas.removeEventListener("pointerdown",pe.onDown),y.canvas.removeEventListener("pointermove",pe.onMove),y.canvas.removeEventListener("pointerup",pe.onUp),y.canvas.removeEventListener("pointercancel",pe.onUp),S.dispose(),u&&u.dispose(),c&&c.dispose(),c=null,u=null,y.dispose()}};return i.opened(n.seatCount,b,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),vt}export{cr as VENUE3D_QUALITY_REPORT_VERSION,Ve as buildSceneModel,Tt as inspectVenue3DQualityEvidence,Ss as mountVenue3D,xi as prepareVenue3D,Si as prepareVenue3DFromChart};
827
+ void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:ue},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let G=new Ze(t,{geometry:oe,program:K});G.frustumCulled=!1,G.setParent(n),de.screenProgram=K,te=!0,de.drawCalls=3+(z?1:0)+1},N.src=le.contentImageUrl}return de}import{Mesh as Kt,RenderTarget as oa,Transform as $t}from"ogl";function na(t,e,n){let r=t+(e<<8)+(n<<16);return r===0?-1:r-1}function Vo(t,e,n,r,i,o){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,d=na(t[m],t[m+1],t[m+2]);if(d<0||d>=o)continue;let p=u-r,f=l-i,c=p*p+f*f;c<s&&(s=c,a=d)}return a}function Lo(t,e,n,r,i,o){let a=t-n.left,s=e-n.top,l=Math.round(a*r),u=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(i-1,l)),y:Math.max(0,Math.min(o-1,u))}}var ra=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],vt=class{constructor(e,n,r,i,o){this.seatScene=new $t;this.chairScene=new $t;this.solidScene=new $t;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=o,this.seatProg=xo(this.gl),this.chairProg=So(this.gl),this.depthProg=wo(this.gl);let a=new Kt(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Kt(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let l=new Kt(this.gl,{geometry:i,program:this.depthProg});l.frustumCulled=!1,l.setParent(this.solidScene)}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let r of ra)this.seatProg.uniforms[r].value=e.uniforms[r].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}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 oa(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,i){let o=this.gl,a=this.ensureTarget(),s=o.drawingBufferWidth,l=o.drawingBufferHeight,u=Math.max(0,n-i),m=Math.max(0,r-i),d=Math.max(1,Math.min(s,n+i+1)-u),p=Math.max(1,Math.min(l,r+i+1)-m);o.enable(o.SCISSOR_TEST),o.scissor(u,m,d,p);let[f,c,g]=this.restoreClear;o.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}),o.clearColor(f,c,g,1),o.disable(o.SCISSOR_TEST);let S=new Uint8Array(d*p*4);return this.renderer.bindFramebuffer(a),o.readPixels(u,m,d,p,o.RGBA,o.UNSIGNED_BYTE,S),this.renderer.bindFramebuffer(),Vo(S,d,p,n-u,r-m,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function ko(t,e){let n=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,Cn(r.state)):n.push(r);return n}function Oo(t,e,n){let r=new Set;for(let a of e)(t.has(a)||n(a)!==void 0)&&r.add(a);let i=new Map(t),o=[];for(let[a,s]of t)r.has(a)||(o.push({seatId:a,state:be[s]??"available"}),i.delete(a));for(let a of r){if(i.has(a))continue;let s=n(a);s!==void 0&&(i.set(a,s),o.push({seatId:a,state:"selected"}))}return{updates:o,next:i}}import{Quat as Je,Vec3 as sa}from"ogl";function ia(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function zo(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function aa(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function No(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 Qt(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function Zt(t,e){return Math.max(0,Math.min(1,t+e))}function Ho(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)),i=n-1,o=Math.floor(r*i);o>=i&&(o=i-1);let a=r*i-o,s=t[Math.max(0,o-1)],l=t[o],u=t[o+1],m=t[Math.min(n-1,o+2)],d=a*a,p=d*a,f=[0,0,0];for(let c=0;c<3;c++)f[c]=.5*(2*l[c]+(-s[c]+u[c])*a+(2*s[c]-5*l[c]+4*u[c]-m[c])*d+(-s[c]+3*l[c]-3*u[c]+m[c])*p);return f}function Jt(t,e,n,r,i){let o=No(ia(e,n));o[0]===0&&o[1]===0&&o[2]===0&&(o=[0,0,1]);let a=zo(zo(e,aa(o,2.5)),[0,1.5,0]),s=[e[0]-r[0],0,e[2]-r[2]],l=No(s);l[0]===0&&l[2]===0&&(l=[o[0],0,o[2]]);let u=Math.max(1,i),m=[r[0]+l[0]*u*1.3,r[1]+u*.75,r[2]+l[2]*u*1.3];return{waypoints:[t,m,a],finalPos:a}}function en(t,e,n=35,r=28){let i=Qt(e),o=Ho(t,i),a=Qt(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:o,fov:n+(r-n)*a,eased:i}}function Uo(t,e,n){let r=t.position.clone(),i=new Je().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new sa(n[0],n[1],n[2]));let o=new Je().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(i),o}var bt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new Je;this.endQuat=new Je;this.outQuat=new Je;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,n,r,i=2500,o=28){return this.settle(),this.waypoints=e,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=i,this.endFov=o,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:r,fov:i,eased:o}=en(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,Zt(o,.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 Yo=An,la=.12,ca=.25,ua=1.5;function Xo(t,e,n=0,r,i){let o=[e.x*Te,n+ua,e.y*Te],a=i?[i[0],i[1],i[2]]:o,s=t[1],l=Number.isFinite(s)?s+Yo:Number.isFinite(r)?n+r:n+Yo,u=o[0]-t[0],m=o[2]-t[2],d=Math.hypot(u,m),p=d>.001?Math.min(la,d*ca):0,f=d>.001?u/d:0,c=d>.001?m/d:0;return{eye:[t[0]+f*p,l,t[2]+c*p],focal:a}}var Se=Math.PI/180,da=45,tn=80,gt=70,ma=1,ha=.99;function pa(t,e){if(!(t<ma))return tn;if(!(Number.isFinite(e)&&e>0))return gt;let n=2*Math.atan(e/(2*yt*ha)/Math.max(.05,t))/Se;return Math.max(gt,Math.min(tn,n))}var fa=.25,yt=1,va=.25,ba=12*Se,ga=.2,ya=1.5,qo=.8,jo=6,er=1.9,xa=2/3,Sa=.12,wa=.9,Ma=1.2,Aa=2,tr=.05,Pa=6;function nr(t,e,n=0){if(!t.length)return{min:[e[0]-6,n,e[2]-6],max:[e[0]+6,Math.max(n+qo,e[1]),e[2]+6]};let r=1/0,i=-1/0,o=1/0,a=-1/0,s=n;for(let c of t)r=Math.min(r,c.cx-c.halfX),i=Math.max(i,c.cx+c.halfX),o=Math.min(o,c.cz-c.halfZ),a=Math.max(a,c.cz+c.halfZ),s=Math.max(s,c.y);let l=i-r,u=a-o,m=Math.max(l,Math.min(u,jo))/2,d=Math.max(u,Math.min(l,jo))/2,p=(r+i)/2,f=(o+a)/2;return{min:[p-m,n,f-d],max:[p+m,Math.max(n+qo,s),f+d]}}function Ca(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+er,t.max[2]]}}function nn(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+ya,e+ga,e+er*xa),(t.min[2]+t.max[2])/2]}function or(t,e){let n=t[0]-e[0],r=t[2]-e[2],i=Math.hypot(n,r);return i<.001?{x:0,z:1}:{x:n/i,z:r/i}}function Ko(t,e,n){let r=e[0]-t[0],i=e[1]-t[1],o=e[2]-t[2],a=Math.hypot(r,i,o)||1;r/=a,i/=a,o/=a;let s=-o,l=r,u=Math.hypot(s,l);if(u<1e-6)return 1/0;s/=u,l/=u;let m=1/0,d=-1/0;for(let p=0;p<8;p++){let f=(p&1?n.max[0]:n.min[0])-t[0],c=(p&2?n.max[1]:n.min[1])-t[1],g=(p&4?n.max[2]:n.min[2])-t[2],S=Math.max(tr,f*r+c*i+g*o),w=(f*s+g*l)/S;w<m&&(m=w),w>d&&(d=w)}return d-m}function $o(t,e,n){let r=e[0]-t[0],i=e[1]-t[1],o=e[2]-t[2],a=Math.hypot(r,i,o)||1;r/=a,i/=a,o/=a;let s=-o,l=r,u=Math.hypot(s,l);if(u<1e-6)return 1/0;s/=u,l/=u;let m=-l*i,d=l*r-s*o,p=s*i,f=1/0,c=-1/0;for(let g=0;g<8;g++){let S=(g&1?n.max[0]:n.min[0])-t[0],w=(g&2?n.max[1]:n.min[1])-t[1],I=(g&4?n.max[2]:n.min[2])-t[2],P=Math.max(tr,S*r+w*i+I*o),E=(S*m+w*d+I*p)/P;E<f&&(f=E),E>c&&(c=E)}return c-f}function xt(t,e){return Math.tan(t*Se/2)*Math.max(.05,e)}function Qo(t,e,n){let r=pa(n,t),i=l=>Math.max(da,Math.min(r,l)),o=l=>2*Math.atan(l)/Se,a=Number.isFinite(t)&&t>0?i(o(t/(2*fa)/Math.max(.05,n))):r;if(!(Number.isFinite(e)&&e>0))return a;let s=Math.min(a,i(o(e/(2*Sa))));return t/(2*xt(s,n))>yt?a:s}function rr(t,e,n,r={}){let i=nn(e),o=[t[0],t[1],t[2]],a=0,s=0,l=c=>{if(!(c>0))return;let g=or(o,i);o[0]+=g.x*c,o[2]+=g.z*c,s+=c},u=r.preserveEye?0:e.max[1]+va-o[1];u>0&&(o[1]+=u,a=u,l(u/Math.tan(ba)));let m=Ca(e),d=Ko(o,i,e),p=Qo(d,$o(o,i,m),n),f=d/(2*xt(p,n));for(let c=0;!r.preserveEye&&c<Pa&&f>yt;c++){let g=Math.max(1,Math.hypot(o[0]-i[0],o[2]-i[2])),S=Number.isFinite(f)?f/yt:2;l(Math.min(60,g*(Math.min(4,S)-1)+.5)),d=Ko(o,i,e),p=Qo(d,$o(o,i,m),n),f=d/(2*xt(p,n))}return{eye:o,focal:i,fov:p,raisedM:a,pulledBackM:s,stageFrameWidth:f}}function Ea(t,e,n){let r=Math.tan(e*Se/2),i=xt(e,n);return Math.max(1,t/Math.max(.05,Math.min(r,i)))}var Ra=.7,Zo=.5,Ta=.8;function Jo(t,e,n){let r=[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]],o=r[0]*i[0]+r[1]*i[1]+r[2]*i[2],a=Math.hypot(r[0],r[1],r[2])*Math.hypot(i[0],i[1],i[2])||1;return Math.acos(Math.max(-1,Math.min(1,o/a)))/Se}function Da(t,e,n){let r=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]],o=Math.hypot(i[0],i[1],i[2]),a=r(i),s=r([n[0]-t[0],n[1]-t[1],n[2]-t[2]]),l=r([0,1,2].map(u=>a[u]*(1-Zo)+s[u]*Zo));return[t[0]+l[0]*o,t[1]+l[1]*o,t[2]+l[2]*o]}function ir(t,e){let{aspect:n,venue:r}=e,i=t.focal,o=or(t.eye,i),a=g=>(g[0]-i[0])*o.x+(g[2]-i[2])*o.z,s=[{name:"seat",eye:t.eye,focal:i,fov:t.fov}],l=Aa*(e.rowDepthM??wa),u=[t.eye[0]+o.x*l,t.eye[1]+Ma,t.eye[2]+o.z*l],m=[t.eye[0],t.eye[1]-Ra,t.eye[2]],d=Da(u,i,m);s.push({name:"row",eye:u,focal:d,fov:Math.min(tn,Math.max(t.fov,2*Math.max(Jo(u,d,m),Jo(u,d,i))/Ta))});let p=(g,S,w,I)=>{let P=Ea(w,t.fov,n)*1.08,E=P*Math.sin(I*Se),W=Number.isFinite(e.seatingTopY)?e.seatingTopY+2:-1/0,H=Math.max(E,W-S[1]),v=P*Math.cos(I*Se);return{name:g,eye:[S[0]+o.x*v,S[1]+H,S[2]+o.z*v],focal:S,fov:t.fov}};e.section&&e.section.radius>0&&s.push(p("section",e.section.center,e.section.radius,35)),s.push(p("venue",r.center,Math.max(1,r.radius),40));let f=[],c=-1/0;for(let g of s){let S=a(g.eye);f.length&&S<=c+.5||(f.push(g),c=S)}return f}import{Vec3 as Fa}from"ogl";var tt=Math.PI/180,on=320,ar=70*tt,_a=32*tt,Ia=24*tt,sr=.0026,Va=.22,La=.006,ka=180,Oa=900,za=1100,Na=4,pe=(t,e,n)=>Math.max(e,Math.min(n,t)),lr=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function cr(t){let{canvas:e,camera:n}=t,r=[],i=!1,o=0,a=0,s=0,l=0,u=0,m=0,d=on,p=null,f=()=>{p&&(clearTimeout(p),p=null)},c=!1,g=[0,0],S=0,w=!1,I=null,P=null,E=new Map,W=!1,H=0,v=0,y=0,T=0,R=()=>i&&r.length?r[pe(Math.round(o),0,r.length-1)].name:null,U=()=>{let M=R();M!==I&&(I=M,t.onStopChange?.(M))},F=()=>{if(!i||!r.length)return;let M=r[pe(Math.floor(o),0,r.length-1)],z=r[pe(Math.ceil(o),0,r.length-1)],te=pe(o-Math.floor(o),0,1),X=(Q,B)=>Q+(B-Q)*te,oe=[X(M.eye[0],z.eye[0]),X(M.eye[1],z.eye[1]),X(M.eye[2],z.eye[2])],K=[X(M.focal[0],z.focal[0]),X(M.focal[1],z.focal[1]),X(M.focal[2],z.focal[2])],ue=K[0]-oe[0],ae=K[1]-oe[1],re=K[2]-oe[2],de=Math.hypot(ue,ae,re)||1,le=Math.atan2(ue,re),N=Math.asin(pe(ae/de,-1,1)),$=le+a,G=pe(N+s,-80*tt,80*tt),ee=Math.cos(G)*de;ue=Math.sin($)*ee,ae=Math.sin(G)*de,re=Math.cos($)*ee,n.position.set(oe[0],oe[1],oe[2]),n.fov=X(M.fov,z.fov),n.updateProjectionMatrix(),n.lookAt(new Fa(oe[0]+ue,oe[1]+ae,oe[2]+re)),t.onApplied?.()},D=()=>{if(!i||!r.length)return;let M=pe(Math.round(o),0,r.length-1);if(t.reducedMotion()){c=!1,o=M,F(),U(),t.requestRender();return}if(Math.abs(M-o)<.001){c=!1,U();return}l=o,u=M,m=performance.now(),d=on,c=!0,t.requestRender()},Y=M=>{!i||r.length<2||(f(),c=!1,o=pe(o+M,0,r.length-1),F(),U(),t.requestRender())},q=(M,z)=>{i&&(f(),c=!1,w=!1,a=pe(a-M*sr,-ar,ar),s=pe(s-z*sr,-Ia,_a),F(),t.requestRender())},V=M=>{i&&(E.set(M.pointerId,{x:M.clientX,y:M.clientY}),E.size===1?(W=!0,T=0,H=M.clientX,v=M.clientY):E.size===2&&(W=!1,y=j()))},j=()=>{let M=[...E.values()];return M.length<2?0:Math.hypot(M[0].x-M[1].x,M[0].y-M[1].y)},C=M=>{if(!i||!E.has(M.pointerId))return;if(E.set(M.pointerId,{x:M.clientX,y:M.clientY}),E.size>=2){let X=j();y>0&&Y((y-X)*La),y=X;return}if(!W)return;let z=M.clientX-H,te=M.clientY-v;H=M.clientX,v=M.clientY,T+=Math.abs(z)+Math.abs(te),!(T<=Na)&&q(z,te)},x=M=>{E.delete(M.pointerId)&&(E.size<2&&(y=0),E.size===0&&(W=!1,D()))},ie=M=>{if(!i)return;M.preventDefault();let z=M.deltaMode===1?16:M.deltaMode===2?100:1,te=pe(M.deltaY*z/100,-2,2);Y(te*Va),P&&clearTimeout(P),P=setTimeout(()=>{P=null,D()},ka)},k=()=>{f(),i&&(i=!1,c=!1,w=!1,r=[],E.clear(),W=!1,P&&(clearTimeout(P),P=null),I!==null&&(I=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",V),e.addEventListener("pointermove",C),e.addEventListener("pointerup",x),e.addEventListener("pointercancel",x),e.addEventListener("wheel",ie,{passive:!1}),{get active(){return i},enter(M,z=0){if(M.length<2){k();return}f(),r=M,i=!0,o=t.reducedMotion()?0:pe(z,0,M.length-1),o>0&&(p=setTimeout(()=>{p=null,i&&(l=o,u=0,m=performance.now(),d=za,c=!0,t.requestRender())},Oa)),a=0,s=0,c=!1,w=!1,I=null,F(),U(),t.requestRender()},exit:k,recentre(){return i?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:t.reducedMotion()?(w=!1,a=0,s=0,F(),t.requestRender(),!0):(g=[a,s],S=performance.now(),w=!0,t.requestRender(),!0):!1},update(M){if(!i)return!1;let z=!1;if(w){let te=pe((M-S)/on,0,1),X=1-lr(te);a=g[0]*X,s=g[1]*X,te>=1?(w=!1,a=0,s=0):z=!0}if(c){let te=pe((M-m)/d,0,1);o=l+(u-l)*lr(te),te>=1?(c=!1,o=u,U()):z=!0}return F(),z},currentStop:R,dispose(){k(),e.removeEventListener("pointerdown",V),e.removeEventListener("pointermove",C),e.removeEventListener("pointerup",x),e.removeEventListener("pointercancel",x),e.removeEventListener("wheel",ie)}}}function ur(t){return t.flying?"cinematic":t.panoramaMounted?"panorama":t.seatViewActive?"seatView":"orbit"}var rn=null;function dr(){return rn??=import("../openPanorama-6FMXAJ6O.js").catch(t=>{throw rn=null,t}),rn}var mr=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),St=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,i){this.emit("3d_opened",{seats:e,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...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=mr(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(mr()-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 hr(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function pr(t){let{container:e,model:n,opts:r,expandedSeatById:i,seatIdsByRow:o,isNarrow:a}=t,s=null,l=()=>{if(!s)return;let d=a();Object.assign(s.style,d?{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:(d,p,f=!1)=>{if(u(),t.isDisposed())return null;let c=document.createElement("div");c.setAttribute("role","group"),Object.assign(c.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let g=r.chrome?.caption!==!1,S=r.chrome?.seatStepper!==!1;if(!g&&!S)return null;let w=i.get(d),I=w?.sectionId?n.sections.find(R=>R.id===w.sectionId):void 0,P=w?.label??d;c.setAttribute("aria-label",`Explore views near ${I?.label?`${I.label}, `:""}seat ${P}`);let E=document.createElement("span");E.textContent=r.seatViewCaption?.(d)??["Live 3D seat view",I?.label,P].filter(Boolean).join(" \xB7 "),Object.assign(E.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)"}),g&&c.appendChild(E);let W=document.createElement("div");Object.assign(W.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),c.appendChild(W);let H=w?.rowId?o.get(w.rowId):void 0,v=H?.indexOf(d)??-1,y=v>=0?[H?.[v-1],H?.[v+1]]:[void 0,void 0],T=(R,U,F,D=!1)=>{let Y=document.createElement("button");Y.type="button",Y.textContent=R,Y.setAttribute("aria-label",U),Object.assign(Y.style,{minHeight:"44px",padding:D?"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"}),D||(Y.style.minWidth="44px"),D&&(Y.dataset.panoramaTrigger=""),Y.addEventListener("click",F),W.appendChild(Y)};if(S&&y[0]){let R=i.get(y[0])?.label??y[0];T("\u2039",`View previous seat ${R}`,()=>{t.flyToSeat(y[0])})}if(S&&r.getSeatView){let R=r.seatViewActionLabel?.(d)??"Open 360\xB0 panorama";T(f?`\u21BB Retry ${R}`:`\u25C9 ${R}`,`${f?"Retry":R} from seat ${P}`,()=>{if(t.isDisposed()||p!==t.flightGen()){u();return}u(),t.openPanorama(d,400,p)},!0)}if(S&&y[1]){let R=i.get(y[1])?.label??y[1];T("\u203A",`View next seat ${R}`,()=>{t.flyToSeat(y[1])})}return!W.childElementCount&&!g?null:(e.appendChild(c),s=c,l(),c)},remove:u,layout:l}}var Ha={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function fr(t){let{container:e,orbit:n,isNarrow:r}=t,i={...Ha,...t.labels??{}},o=(P,E)=>{P.setAttribute("aria-label",E),P.title=E},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",o(m,i.rotate);let d=document.createElement("button");d.type="button",d.textContent="\u2725",o(d,i.move);let p=document.createElement("button");p.type="button",p.textContent="\u2212",o(p,i.zoomOut);let f=document.createElement("button");f.type="button",f.textContent="+",o(f,i.zoomIn);for(let P of[m,d,p,f])P.className="sl-3d-icon-control",Object.assign(P.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,d),u.append(f,p);let c=P=>{n.setPrimaryDragMode(P);let E=P==="orbit";m.setAttribute("aria-pressed",String(E)),d.setAttribute("aria-pressed",String(!E)),m.style.background=E?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",d.style.background=E?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=E?`${i.rotate} \xB7 ${i.move} with Shift`:`${i.move} \xB7 ${i.rotate} with Shift`};m.addEventListener("click",()=>c("orbit")),d.addEventListener("click",()=>c("pan"));let g=()=>{let{atMin:P,atMax:E}=n.dollyLimitState();f.disabled!==P&&(f.disabled=P),p.disabled!==E&&(p.disabled=E)};p.addEventListener("click",()=>{n.zoomBy(Xe),g()}),f.addEventListener("click",()=>{n.zoomBy(Fe),g()}),a.append(l,u),c("orbit"),e.appendChild(a);let S=t.enabled!==!1,w=()=>{let P=r();a.style.display=s||!S?"none":"flex",a.style.right=P?"12px":"14px",a.style.bottom=P?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",l.style.display=P?"none":"flex",f.style.display=P?"none":"",p.style.display=P?"none":""};return w(),{element:a,utilityControls:u,setNavigationMode:c,syncZoomLimits:g,setSeatViewLocked:P=>{s=P,n.setInteractionEnabled(!P),w()},seatViewLocked:()=>s,layout:w}}var Ga=12;function Ba(t,e){if(!t)return!1;let n=t.x-e[0],r=t.y-e[1],i=t.z-e[2];return Math.hypot(n,r,i)>Ga}var Wa=.5,Ua=12;function Ya(t,e,n){return!(t>0)||!(n>0)?0:Wa*n/(2*t*Math.tan(e*Math.PI/360))}function vr(t){let{glctx:e,orbit:n,model:r,seats:i,opts:o,cinematic:a,analytics:s,seatIdByIndex:l,sectionIdBySeatId:u,tapSlop:m,tapMs:d,cancelFlight:p,focusSectionCamera:f,setSelection:c,ensureSeatView:g}=t,S=0,w=0,I=0,P=-1,E=!1,W=!1,H=F=>{t.seatViewLocked()||P===-1&&(P=F.pointerId,S=F.clientX,w=F.clientY,I=performance.now(),E=!1,W=a.active,a.active&&(s.cinematicCancelled(),p(),o.onViewTargetChange?.(null)))},v=F=>{F.pointerId===P&&Math.hypot(F.clientX-S,F.clientY-w)>m&&(E=!0)},y=(F,D,Y,q,V)=>{let j=e.canvas.getBoundingClientRect(),C=e.canvas.clientWidth||j.width||1,x=e.canvas.clientHeight||j.height||1,ie=F-j.left,k=D-j.top,M=q*q,z=-1,te=M,X=1/0;for(let oe of i){if(Y&&oe.sectionId!==Y)continue;let K=r.seats.idToIndex.get(oe.id);if(K===void 0)continue;if(V){let N=Math.round(r.seats.iState[K]??0);if(N!==0&&N!==3)continue}let ue=K*3,ae=ge(n.camera.projectionViewMatrix,[r.seats.iPosition[ue],r.seats.iPosition[ue+1]+.55,r.seats.iPosition[ue+2]],C,x);if(!ae.visible)continue;let re=ae.x-ie,de=ae.y-k,le=re*re+de*de;(le<te||Math.abs(le-te)<1&&ae.depth<X)&&(z=K,te=le,X=ae.depth)}return z},T=(F,D)=>{let Y=t.gpu(),q=t.pick();if(!Y||!q)return-1;q.syncFromSeatProgram(Y.seatProgram);let V=e.canvas.getBoundingClientRect(),j=e.renderer.dpr,{x:C,y:x}=Lo(F,D,V,j,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),ie=Math.max(2,Math.round(8*j));return q.pick(n.camera,C,x,ie)},R=F=>{let D=n.camera?.position;if(!D)return!1;let Y=F*3,q=Math.hypot(D.x-r.seats.iPosition[Y],D.y-r.seats.iPosition[Y+1],D.z-r.seats.iPosition[Y+2]),V=e.canvas.clientHeight||e.canvas.getBoundingClientRect().height;return Ya(q,n.fovY,V)>=Ua};return{onDown:H,onMove:v,onUp:F=>{if(F.pointerId!==P)return;let D=!E&&performance.now()-I<d;if(P=-1,W){W=!1;return}let Y=t.gpu(),q=t.pick();if(!D||!Y||!q)return;let V=T(F.clientX,F.clientY),j=V>=0&&R(V),C=!1;if(t.focusedSectionId()&&V>=0){let k=l[V],M=k?u.get(k):void 0;if(M&&M!==t.focusedSectionId()&&f(M,{keepCamera:j})){if(!j)return;C=!0}}if(t.focusedSectionId()&&V<0&&(V=y(F.clientX,F.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&V<0){let k=y(F.clientX,F.clientY,null,72,!1),M=k>=0?l[k]:void 0,z=M?u.get(M):void 0;if(z&&z!==t.focusedSectionId()&&f(z))return}if(!t.focusedSectionId()){V<0&&(V=y(F.clientX,F.clientY,null,42,!1));let k=V>=0?l[V]:void 0,M=k?u.get(k):void 0;if(M&&f(M,{keepCamera:j})){if(!j)return;C=!0}}if(V<0||V>=l.length){t.selection().size&&(c([]),o.onViewTargetChange?.(null));return}let x=l[V],ie=be[Math.round(r.seats.iState[V]??0)]??"available";if(ie!=="available"&&ie!=="selected"){o.onSeatInspect?.(x,ie);return}if(t.selection().has(x)&&t.selection().size===1){c([]),o.onViewTargetChange?.(null),o.onSeatPick?.(x);return}if(c([x]),g(x),s.seatPicked(x,u.get(x)),o.onSeatPick?.(x),t.focusedSectionId()&&!C){let k=V*3,M=[r.seats.iPosition[k],r.seats.iPosition[k+1],r.seats.iPosition[k+2]];Ba(n.camera?.position,M)&&t.focusSeatCamera(x)}}}}var wt=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,i=-1/0,o=-1/0;for(let f=0;f<this.count;f++){let c=e[f*3],g=e[f*3+2];c<n&&(n=c),c>i&&(i=c),g<r&&(r=g),g>o&&(o=g)}let a=Math.max(i-n,.001),s=Math.max(o-r,.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=r;let l=this.cols*this.rows,u=new Int32Array(l+1),m=f=>{let c=Math.min(this.cols-1,Math.max(0,Math.floor((e[f*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[f*3+2]-r)/this.cell)))*this.cols+c};for(let f=0;f<this.count;f++)u[m(f)+1]++;for(let f=0;f<l;f++)u[f+1]+=u[f];let d=new Int32Array(this.count),p=u.slice(0,l);for(let f=0;f<this.count;f++)d[p[m(f)]++]=f;this.cellStart=u,this.cellItems=d}gather(e,n,r,i,o){this.ensureGrid();let a=this.cellStart,s=this.cellItems;if(!a||!s)return 0;let l=i.length,u=r*r,m=Math.floor((e-this.minX)/this.cell),d=Math.floor((n-this.minZ)/this.cell),p=Math.ceil(r/this.cell)+1,f=this.iPosition,c=0;for(let g=0;g<=p&&c<l;g++){let S=d-g,w=d+g,I=m-g,P=m+g;for(let E=S;E<=w&&c<l;E++){if(E<0||E>=this.rows)continue;let W=E===S||E===w;for(let H=I;H<=P&&c<l;H++){if(!W&&H!==I&&H!==P){H=P-1;continue}if(H<0||H>=this.cols)continue;let v=E*this.cols+H;for(let y=a[v],T=a[v+1];y<T&&c<l;y++){let R=s[y],U=f[R*3]-e,F=f[R*3+2]-n,D=o===void 0?0:f[R*3+1]-o;U*U+D*D+F*F<=u&&(i[c++]=R)}}}}return c}};var Mt=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(ht);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new wt(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 i=this.ctx.orbit().camera.position;if(Math.hypot(i.x-this.lastGatherX,i.y-this.lastGatherY,i.z-this.lastGatherZ)<Gt)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>Ht){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(i.x,i.z,Ht,this.nearBuf,i.y);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(e,n,r){let i=1-Math.exp(-e*9),o=1-Math.exp(-e*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?i:o),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?i:o),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};function br(t){let e=Math.max(5,t.radius),n=t.focalWorld[0]-t.center[0],r=t.focalWorld[2]-t.center[2],i=Math.hypot(n,r);if(i<e*.12)return{center:t.center,radius:e,polarDeg:48};let o=Math.min(i*.25,e*.2);return{center:[t.center[0]+n/i*o,t.center[1],t.center[2]+r/i*o],radius:e+o,polarDeg:50}}import{Quat as Xa,Vec3 as qa}from"ogl";function gr(){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 Sr(t){let{container:e,model:n,opts:r,orbit:i,cinematic:o,analytics:a,loop:s,labelOverlay:l,stageAzimuth:u,overviewFraming:m}=t,d=0,p=-1,f=(v,y,T=28)=>{i.camera.position.set(v[0],v[1],v[2]),i.camera.lookAt(new qa(y[0],y[1],y[2])),i.camera.fov=T,i.camera.updateProjectionMatrix()},c=document.createElement("button");c.className="sl-3d-overview-control sl-3d-icon-control",c.type="button",c.replaceChildren(gr());let g=r.navLabels?.fitView??"Show whole venue";c.setAttribute("aria-label",g),c.title=g,Object.assign(c.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 S=()=>{c.firstElementChild||c.replaceChildren(gr())};S();let w=v=>{p=v;let y=t.gpu();y&&(y.seatProgram.uniforms.uFocusFloor.value=v,y.solidProgram.uniforms.uFocusFloor.value=v,y.chairProgram.uniforms.uFocusFloor.value=v),t.showSectionSeatLabels(null)},I=()=>{if(t.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),a.panoramaClosed()),t.setPanoramaSphereVisible(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.restorePanoramaLayer(),c.style.display="",l.setVisible(!0),t.setFrozen(!1);let v=p>=0?n.floors[p]:null;if(t.setNearFieldDetailEnabled(!!v),t.setSeatViewLocked(!1),P(),t.removeArriveChip(),t.setNavigationMode("orbit"),v){let y=v.focalWorld[0]-v.center[0],T=v.focalWorld[2]-v.center[2],R=Math.hypot(y,T)>v.radius*.12?Math.atan2(y,T):u,U={center:v.center,radius:v.radius,box:v.box},F={polarDeg:58,margin:1.12};t.reducedMotion()?i.frame(U,!1,R,!1,F):i.frameSoft(U,R,!1,F)}else t.reducedMotion()?i.frame(n.bounds,!1,u,r.portraitOverviewCrop===!0,m):i.frameSoft(n.bounds,u,r.portraitOverviewCrop===!0,m);t.showSectionSeatLabels(null),s.requestRender()},P=()=>{d++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),o.active&&(o.cancel(),i.resumeAfterFlight(n.focalWorld))},E=v=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let y=n.seats.idToIndex.get(v);if(y===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(v),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),c.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1);let T=t.inSeatView()&&r.arriveAtSeatEye===!0;t.setSeatStepping(T),t.setSeatViewLocked(!1);let R=++d;T?t.showArriveChip(v,R):t.removeArriveChip();let{eye:U,focal:F}=t.resolvedSeatViewPose(v,y),D=r.arriveAtSeatEye?t.seatViewArrival(v,y):null,Y=D&&D.stops.length>1&&D.stops[1].name==="row"?D.stops[1]:null,q=D?D.focal:F,V=[i.camera.position.x,i.camera.position.y,i.camera.position.z],j=Jt(V,D?.eye??U,q,n.bounds.center,n.bounds.radius),C=Y?Y.eye:D?D.eye:r.arriveAtSeatEye?U:j.finalPos,x=D?D.fov:r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?gt:65:28,ie=[j.waypoints[0],j.waypoints[1],C];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),f(C,q,x),s.requestRender(),a.cinematicSkipped(),t.isDisposed()||i.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),D&&t.enterSeatView(D.stops),t.showArriveChip(v,R),Promise.resolve();let k=new Xa().copy(i.camera.quaternion),M=Uo(i.camera,C,q);s.requestRender();let z=T?700:2500;return o.start(ie,k,M,z,x).then(()=>{t.isDisposed()||R!==d||(t.setSeatStepping(!1),a.cinematicPlayed(z),i.resumeAfterFlight(q),t.setSeatViewLocked(r.arriveAtSeatEye===!0),D&&t.enterSeatView(D.stops,Y?1:0),s.requestRender(),t.showArriveChip(v,R))})},W=(v,y)=>{let T=n.sections.find(R=>R.id===v);if(!T||T.seatCount===0)return!1;if(t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),o.cancel(),t.removeArriveChip(),n.floors.length>1&&p!==T.floorIndex&&w(T.floorIndex),t.setNavigationMode("pan"),t.panorama()||l.setVisible(!0),t.showSectionSeatLabels(v),!y?.keepCamera){let R=br(T),U={polarDeg:R.polarDeg,margin:1.12};t.reducedMotion()?i.frame({center:R.center,radius:R.radius},!1,i.currentAzimuth,!1,U):i.glideTo({center:R.center,radius:R.radius},U)}return r.onSectionFocusChange?.(v),s.requestRender(),!0},H=v=>{if(t.isDisposed()||!t.gpu())return!1;let y=n.seats.idToIndex.get(v);if(y===void 0)return!1;let T=y*3,R=[n.seats.iPosition[T],n.seats.iPosition[T+1]+.55,n.seats.iPosition[T+2]];return t.reducedMotion()?i.frame({center:R,radius:yr},!1,void 0,!1,xr):i.frameSoft({center:R,radius:yr},void 0,!1,xr),s.requestRender(),!0};return c.addEventListener("click",I),{overviewChip:c,layoutOverviewChip:S,flightGen:()=>d,focusedFloor:()=>p,applyFloorFocus:w,placeCameraFinal:f,cancelFlight:P,focusOverview:I,flyToSeat:E,focusSectionCamera:W,focusSeatCamera:H}}var yr=4.5,xr={polarDeg:48,margin:1.25};function an(t,e,n,r,i,o,a,s,l=.5){let u=-1,m=s*s,d=1/0;for(let p=0;p<e;p++){let f=p*3,c=ge(n,[t[f],t[f+1]+l,t[f+2]],r,i);if(!c.visible)continue;let g=c.x-o,S=c.y-a,w=g*g+S*S;(w<m-4||w<m+4&&c.depth<d)&&(u=p,m=Math.min(m,w),d=c.depth)}return u}function wr(t){let e=performance.now(),{input:n,estimate:r}=Gn(t);return{model:Ye(n),buildMs:performance.now()-e,source:"main",...r?{estimate:r}:{}}}function ja(t){let e=Sn(t.doc);return{...wr({...t,seats:e}),seats:e}}function Mr(t,e,n){if(typeof Worker>"u")return Promise.resolve(e());let r;try{r=new Worker(new URL("./scene/scene.worker.js",import.meta.url),{type:"module"})}catch{return Promise.resolve(e())}return new Promise(i=>{let o=!1,a=u=>{o||(o=!0,clearTimeout(l),r.terminate(),i(u))},s=()=>a(e()),l=window.setTimeout(s,15e3);r.onerror=s,r.onmessage=u=>{let m=n(u.data);m?a(m):s()},r.postMessage(t)})}function Ka(t){return Mr(t,()=>wr(t),({model:e,buildMs:n,estimate:r})=>({model:e,buildMs:n,source:"worker",...r?{estimate:r}:{}}))}function $a(t){return Mr(t,()=>ja(t),({model:e,buildMs:n,seats:r,estimate:i})=>r?{model:e,buildMs:n,seats:r,source:"worker",...i?{estimate:i}:{}}:null)}var Qa=40,Za=48,Ja=Math.PI/180,es=6,ts=500;function xc(t,e,n={}){let r=performance.now(),i=e.prepared?e.prepared.estimate:e.estimate===!1?null:Vt(e.doc,e.seats);i&&(e={...e,doc:i.doc,seats:Hn(e.seats,i)});let o=e.prepared?.model??Ye(e),a=new St(n.onAnalytics),s=new Array(o.seats.count);for(let[h,b]of o.seats.idToIndex)s[b]=h;let l=new Map(e.seats.map(h=>[h.id,h])),u=new Map;for(let h of e.seats){if(!h.rowId)continue;let b=u.get(h.rowId);b?b.push(h.id):u.set(h.rowId,[h.id])}let m=new Map;e.seats.forEach((h,b)=>{m.set(h.id,o.seatSectionIds?.[b]??h.sectionId)});let d=new Map;for(let[h,b]of o.seats.idToIndex){let A=m.get(h);if(!A)continue;let _=d.get(A);_?_.push(b):d.set(A,[b])}let p=()=>{if(!c||!o.sectionSolidRanges.length)return;let{lit:h,anyUnlit:b}=Ro(o.sectionSolidRanges,d,o.seats.iState);c.setSectionShellLit(b?h:null)},f=e.doc.floors?.some(b=>(b.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(b=>b.objects)??e.doc.objects).some(b=>b.type==="section"&&((b.height??0)>0||(b.rake??0)>0)),c=null,g=null,S=null,w=!1,I=!1,P=!1,E=new Map,W=null,H=null,v=null,y=new Map,T=null,R=()=>{v===null&&(v=t.style.zIndex,t.style.zIndex="20")},U=()=>{v!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=v),v=null)},F=!1,D=()=>F?me.focusedFloor():-1,Y=()=>{c=Io(C.gl,o),g?.dispose(),g=ro(C.gl,[1,1,1]),un(!1),p(),N(),S=new vt(C.renderer,c.seatGeometry,c.chairGeometry,c.solidGeometry,o.seats.count),C.setClearColor(o.theme.background.top),S.setRestoreClear(o.theme.background.top),c.seatProgram.uniforms.uSeatRadius.value=Ue*o.theme.seatScale,c.seatProgram.uniforms.uFocusFloor.value=D(),c.solidProgram.uniforms.uFocusFloor.value=D(),c.chairProgram.uniforms.uFocusFloor.value=D(),c.screenProgram&&(c.screenProgram.uniforms.uFocusFloor.value=D()),V.forceRegather()},q=!1,V=new Mt({model:o,orbit:()=>x,gpu:()=>c}),j=h=>V.setDetailEnabled(h),C=new ut(t,{onContextLost:()=>{P||a.contextLost(),w=!0,B.stop(),c=null,S=null},onContextRestored:()=>{Y(),w=!1,P||a.contextRestored(),B.requestRender()}}),x=new dt(C.gl,C.canvas,()=>B.requestRender(),()=>a.orbitEngaged());x.setAspect(C.aspect);let ie=(e.doc.floors?.flatMap(h=>h.objects)??e.doc.objects).some(h=>h.type==="section"&&h.physical3dProvenance?.surfaceKind?.status==="inferred"),k=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(ie&&o.stages.length===0))return Bn(o.focalWorld,o.seats.iPosition,o.bounds)})(),M=(e.doc.floors?.flatMap(h=>h.objects)??e.doc.objects).some(h=>h.type==="shape"&&h.stageKind?.startsWith("pitch-")),z=o.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:M?36:48,margin:1.05},te=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;x.frame(o.bounds,!te&&n.skipInitialOverviewAnimation!==!0,k,n.portraitOverviewCrop===!0,z);let X=new bt(x.camera),oe=hr(t),K=new pt(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),ue=o.labels,ae=()=>Tn(ue,o.floors.length,D());K.setLabels(ae());let re=null,de=()=>[...E.keys()].flatMap(h=>{let b=o.seats.idToIndex.get(h),A=b===void 0?void 0:e.seats[b];if(b===void 0||A?.id!==h)return[];let _=b*3;return[{id:`seat:${h}`,kind:"seat",seatWidthM:o.seats.iChairWidth[b]*2,text:A.displayLabel||A.label,anchor:[o.seats.iPosition[_],o.seats.iPosition[_+1]+1.05,o.seats.iPosition[_+2]],pinBase:At(_)}]}),le=-1,N=()=>{c&&(le=re?o.sections.findIndex(h=>h.id===re):-1,c.seatProgram.uniforms.uFocusSection.value=le,c.chairProgram.uniforms.uFocusSection.value=le)},$=h=>{if(re=h,N(),K.setForcedDense(!!h),!h){let L=de(),he=new Set(L.map(ne=>ne.id));K.setLabels([...ae().filter(ne=>!he.has(ne.id)),...L]);return}let b=e.seats.filter(L=>m.get(L.id)===h),A=new Set(b.map(L=>L.id)),_=new Set(b.map(L=>L.rowId)),O=new Set(E.keys()),J=new Set(b.filter(L=>O.has(L.id)).map(L=>L.id)),Z=ae().filter(L=>L.kind!=="row"&&L.kind!=="seat"||(L.kind==="row"?_.has(L.id.slice(4)):A.has(L.id.slice(5))));if(o.seatCount<=6e3&&J.size===0){K.setLabels(Z);return}let ce=b,Ae=new Set(ce.map(L=>`seat:${L.id}`)),Pe=ce.flatMap(L=>{let he=o.seats.idToIndex.get(L.id);if(he===void 0)return[];let ne=he*3;return[{id:`seat:${L.id}`,kind:"seat",seatWidthM:o.seats.iChairWidth[he]*2,rowId:L.rowId,text:O.has(L.id)?L.displayLabel||L.label:Nn(L.displayLabel||L.label),anchor:[o.seats.iPosition[ne],o.seats.iPosition[ne+1]+(O.has(L.id)?1.05:.55),o.seats.iPosition[ne+2]],...O.has(L.id)?{pinBase:At(ne)}:{}}]});K.setLabels([...Z.filter(L=>!Ae.has(L.id)),...Pe])};Y();let G=null,ee=null,Q=h=>{if(w||!c||I)return!1;let b=ur({flying:X.active,panoramaMounted:W!==null,seatViewActive:G?.active===!0}),A=b==="orbit"?le:-1;c.seatProgram.uniforms.uFocusSection.value=A,c.chairProgram.uniforms.uFocusSection.value=A;let _=b==="cinematic"?X.update(performance.now()):b==="seatView"?G.update(performance.now()):b==="orbit"?x.update():!1;ee?.syncZoomLimits();let O=D()>=0?o.floors[D()]:null,J=O?.radius??o.bounds.radius,Z=eo(x.currentDistance,J),ce=q?{center:[x.camera.position.x,x.camera.position.y,x.camera.position.z],radius:520}:o.clipBounds??o.renderBounds;x.updateClipping(ce);let Ae=O?.center??o.renderBounds.center,Pe=O?.radius??o.renderBounds.radius,L=(fe,ve)=>Math.hypot(x.camera.position.x-fe[0],x.camera.position.y-fe[1],x.camera.position.z-fe[2])<=ve*(V.detailVisible?1.8:1.55),he=L(Ae,Pe);if(!he&&re){let fe=o.sections.find(ve=>ve.id===re);fe&&(he=L(fe.center,Math.max(12,fe.radius*2)))}V.detailVisible=he;let ne=c.seatProgram.uniforms;ne.uSeatScale.value=Z.scale,ne.uSeatFade.value=Z.fade;let rt=!!O&&to(O.seatCount,C.canvas.clientWidth||1,C.canvas.clientHeight||1),it=no(o.seats.count,J,x.currentDistance,x.camera.fov,C.canvas.clientHeight||1),He=V.detailVisible||rt||it?1:0,Ge=V.detailVisible||D()>=0||o.floors.length>1?1:0;V.ease(h,He,Ge),ne.uSeatDetail.value=V.seatDetailMix;let at=He===0&&V.seatDetailMix<.01;c.seatGeometry.setDrawRange(at?Lt:0,at?Wn:Lt),c.solidProgram.uniforms.uStructureDetail.value=V.structureDetailMix,ne.uMinPixels.value=Z.minPixels,ne.uPixelToWorld.value=2*Math.tan(x.camera.fov*Ja/2)/Math.max(1,C.pixelHeight),V.update(V.detailVisible),C.renderer.render({scene:c.background,clear:!0}),C.renderer.render({scene:c.main,camera:x.camera,clear:!1});let Be=g?g.update(performance.now(),[x.camera.position.x,x.camera.position.y,x.camera.position.z],W!==null,b==="seatView"):!1;return g&&C.renderer.render({scene:g.root,camera:x.camera,clear:!1}),K.update(x.camera.projectionViewMatrix,C.canvas.clientWidth||1,C.canvas.clientHeight||1,x.currentDistance,J,[x.camera.position.x,x.camera.position.y,x.camera.position.z]),_||Be||V.seatDetailMix!==He||V.structureDetailMix!==Ge},B=new mt(Q),sn=typeof ResizeObserver<"u"?new ResizeObserver(()=>Ft.resize()):null;sn?.observe(t),x.setZoomPointResolver((h,b)=>{let A=C.canvas.getBoundingClientRect(),_=C.canvas.clientWidth||A.width,O=C.canvas.clientHeight||A.height;if(!(_>0)||!(O>0))return null;x.camera.updateMatrixWorld();let J=an(o.seats.iPosition,o.seats.count,x.camera.projectionViewMatrix,_,O,h-A.left,b-A.top,Qa);if(J<0)return null;let Z=J*3;return[o.seats.iPosition[Z],o.seats.iPosition[Z+1]+.5,o.seats.iPosition[Z+2]]});function At(h){return[o.seats.iPosition[h],o.seats.iPosition[h+1]+.5,o.seats.iPosition[h+2]]}K.setSeatNumberRow(null);let ke=null,we=0,ln=()=>{we=0;let h=null;if(ke&&!G?.active&&!X.active){let b=C.canvas.getBoundingClientRect(),A=C.canvas.clientWidth||b.width,_=C.canvas.clientHeight||b.height;if(A>0&&_>0){let O=an(o.seats.iPosition,o.seats.count,x.camera.projectionViewMatrix,A,_,ke.x-b.left,ke.y-b.top,Za);h=O>=0?e.seats[O]?.rowId??null:null}}K.setSeatNumberRow(h)&&B.requestRender()},nt=h=>{ke={x:h.clientX,y:h.clientY},we||(we=requestAnimationFrame(ln))},cn=h=>{h.pointerType==="mouse"&&(ke=null,we||(we=requestAnimationFrame(ln)))};C.canvas.addEventListener("pointermove",nt),C.canvas.addEventListener("pointerdown",nt),C.canvas.addEventListener("pointerleave",cn);function un(h){if(!g)return;let b=[];for(let A of E.keys()){let _=o.seats.idToIndex.get(A);if(_===void 0)continue;let O=_*3;b.push({id:A,position:At(O)})}g.setSeats(b,performance.now(),h)}let dn=h=>{let b=O=>{let J=o.seats.idToIndex.get(O);return J===void 0?void 0:o.seats.iState[J]},{updates:A,next:_}=Oo(E,h,b);if(E=_,K.setSelectedSeatIds(E.keys()),un(!Oe()),B.requestRender(),$(re),A.length){let O=It(o.seats,A);c&&c.uploadSeatStateRuns(O),p(),B.requestRender()}},Oe=()=>T!==null?T:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ar=8,mn=h=>{if(!n.getSeatView)return null;let b=y.get(h);if(!b)for(b=Promise.resolve(n.getSeatView(h)),y.set(h,b),b.catch(()=>{y.get(h)===b&&y.delete(h)});y.size>Ar;){let A=y.keys().next().value;if(A===void 0)break;y.delete(A)}return b},hn=nr(o.stages,o.focalWorld,o.bounds.groundY??0),Pr=nn(hn),Pt=(h,b)=>{let A=l.get(h),_=Math.max(0,Math.round(o.seats.iFloor[b]??0)),O=e.doc.floors?.[_],J=o.floors[_],Z=O?.focalPoint??e.doc.focalPoint,ce=J?{x:J.focalWorld[0]/Te,y:J.focalWorld[2]/Te}:Z,Ae=A?.focalPoint?{x:A.focalPoint.x+ce.x-Z.x,y:A.focalPoint.y+ce.y-Z.y}:ce,Pe=[o.seats.iPosition[b*3],o.seats.iPosition[b*3+1],o.seats.iPosition[b*3+2]];return Xo(Pe,Ae,O?.baseHeightM??0,A?.eyeHeightM,Pr)},pn=()=>(t.clientWidth||C.canvas.clientWidth)<=520,Ct=null,fn=null,Cr=async(h,b,A)=>{if(!n.getSeatView||P||A!==me.flightGen())return;let _;try{_=await dr()}catch{if(a.panoramaFailed(h,"mount"),!P&&A===me.flightGen()){let O=Rt(h,A,!0);requestAnimationFrame(()=>O?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(P||A!==me.flightGen()||!Ct))return fn??=_.createOpenPanorama(Ct),fn(h,b,A)},Et=pr({container:t,model:o,opts:n,expandedSeatById:l,seatIdsByRow:u,isNarrow:pn,isDisposed:()=>P,flightGen:()=>me.flightGen(),flyToSeat:h=>yn(h),openPanorama:(h,b,A)=>Cr(h,b,A)}),Rt=Et.show,Tt=Et.remove,Er=Et.layout,Me=fr({container:t,orbit:x,isNarrow:pn,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});ee=Me;let Rr=Me.element,ze=Me.setNavigationMode,Tr=Me.layout,Dr=Me.utilityControls,Ne=null,vn=!1,ot=h=>{Me.setSeatViewLocked(h),h||G?.exit()};G=cr({canvas:C.canvas,camera:x.camera,requestRender:()=>B.requestRender(),reducedMotion:Oe,onStopChange:h=>{let b=h??(vn?"seat":null);Ne=b;try{n.onSeatViewStopChange?.(b)}catch{}},onApplied:()=>{P||x.syncFromCamera()}});let bn=o.sections.reduce((h,b)=>b.seatCount>0&&b.box?Math.max(h,b.box.max[1]):h,-1/0),Fr=(h,b)=>{let{eye:A}=Pt(h,b),_=(t.clientWidth||C.canvas.clientWidth||1)/Math.max(1,t.clientHeight||C.canvas.clientHeight||1),O=rr(A,hn,_,{preserveEye:!0});if(n.seatViewStops===!1)return{...O,stops:[]};let J=m.get(h),Z=J?o.sections.find(ce=>ce.id===J):void 0;return{...O,stops:ir(O,{aspect:_,seatingTopY:Number.isFinite(bn)?bn:o.bounds.box.max[1],section:Z&&Z.seatCount>0?{center:Z.center,radius:Z.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},me=Sr({container:t,model:o,opts:n,orbit:x,cinematic:X,analytics:a,loop:B,labelOverlay:K,stageAzimuth:k,overviewFraming:z,gpu:()=>c,isDisposed:()=>P,panorama:()=>W,setPanorama:h=>{W=h},setPanoramaSphereVisible:h=>{q=h},panoramaLoadAbort:()=>H,setPanoramaLoadAbort:h=>{H=h},setFrozen:h=>{I=h},restorePanoramaLayer:U,reducedMotion:Oe,resolvedSeatViewPose:Pt,showSectionSeatLabels:$,setNearFieldDetailEnabled:j,setSeatViewLocked:ot,setNavigationMode:ze,showArriveChip:Rt,removeArriveChip:Tt,inSeatView:()=>Ne!==null,setSeatStepping:h=>{vn=h},seatViewArrival:(h,b)=>n.arriveAtSeatEye?Fr(h,b):null,enterSeatView:(h,b)=>G?.enter(h,b)});F=!0;let Dt=me.overviewChip,_r=me.layoutOverviewChip,Ir=me.applyFloorFocus,Vr=me.focusOverview,gn=me.cancelFlight,yn=me.flyToSeat,xn=me.focusSectionCamera;Dr.appendChild(Dt),Ct={container:t,model:o,opts:n,analytics:a,orbit:x,loop:B,seatsById:l,ensureSeatView:mn,resolvedSeatViewPose:Pt,gpu:()=>c,gl:C.gl,isContextLost:()=>w,isDisposed:()=>P,flightGen:()=>me.flightGen(),setPanorama:h=>{W=h},getLoadAbort:()=>H,setLoadAbort:h=>{H=h},setPanoramaSphereVisible:h=>{q=h,h&&G?.exit()},setFrozen:h=>{I=h},raisePanoramaLayer:R,restorePanoramaLayer:U,getOverviewChip:()=>Dt,labelOverlay:K,reducedMotion:Oe,removeArriveChip:Tt,showArriveChip:Rt};let xe=vr({glctx:C,orbit:x,model:o,seats:e.seats,opts:n,cinematic:X,analytics:a,seatIdByIndex:s,sectionIdBySeatId:m,tapSlop:es,tapMs:ts,gpu:()=>c,pick:()=>S,seatViewLocked:()=>Me.seatViewLocked(),focusedSectionId:()=>re,selection:()=>E,cancelFlight:gn,focusSectionCamera:xn,focusSeatCamera:me.focusSeatCamera,setSelection:dn,ensureSeatView:mn});C.canvas.addEventListener("pointerdown",xe.onDown),C.canvas.addEventListener("pointermove",xe.onMove),C.canvas.addEventListener("pointerup",xe.onUp),C.canvas.addEventListener("pointercancel",xe.onUp),B.requestRender();let Ft={setAvailability(h){let b=ko(E,h),A=It(o.seats,b);A.length&&c&&c.uploadSeatStateRuns(A),p(),B.requestRender()},setSelection:dn,setNavigationMode:ze,zoomIn(){x.zoomBy(Fe),B.requestRender()},zoomOut(){x.zoomBy(Xe),B.requestRender()},flyToSeat:yn,focusOverview:Vr,seatViewStop:()=>Ne,recentreSeatView:()=>G?.recentre()??!1,resize(){let{width:h,height:b}=C.resize();x.setAspect(h/Math.max(1,b)),Er(),Tr(),_r(),B.requestRender()},stats(){return{...B.stats(),drawCalls:c?c.drawCalls:0,fallbackTriangles:c?c.seatGeometry.drawRange.count/3*o.seats.count:0,seatCount:o.seatCount}},captureImage(h=1280){if(w||!c||typeof document>"u")return null;Q(0);let b=C.canvas,A=Math.min(1,h/Math.max(b.width,b.height,1)),_=document.createElement("canvas");_.width=Math.max(1,Math.round(b.width*A)),_.height=Math.max(1,Math.round(b.height*A));let O=_.getContext("2d");return O?(O.drawImage(b,0,0,_.width,_.height),_.toDataURL("image/jpeg",.82)):null},getQualityEvidence(){let h=B.stats(),b=C.canvas.clientWidth||1,A=C.canvas.clientHeight||1,_=o.bounds.center,O=ge(x.camera.projectionViewMatrix,[_[0],o.bounds.box.min[1],_[2]],b,A),J=ge(x.camera.projectionViewMatrix,[_[0],o.bounds.box.max[1],_[2]],b,A),Z=o.bounds.box,ce=[Z.min[0],Z.max[0]].flatMap(L=>[Z.min[1],Z.max[1]].flatMap(he=>[Z.min[2],Z.max[2]].map(ne=>ge(x.camera.projectionViewMatrix,[L,he,ne],b,A)))).filter(L=>Number.isFinite(L.x)&&Number.isFinite(L.y)&&Number.isFinite(L.depth)),Ae=ce.length?(()=>{let L=Math.min(...ce.map(ve=>ve.x)),he=Math.max(...ce.map(ve=>ve.x)),ne=Math.min(...ce.map(ve=>ve.y)),rt=Math.max(...ce.map(ve=>ve.y)),it=Math.max(0,L),He=Math.min(b,he),Ge=Math.max(0,ne),at=Math.min(A,rt),Be=Math.max(0,He-it),fe=Math.max(0,at-Ge);return{box:{x:it,y:Ge,width:Be,height:fe},horizontalFillRatio:Be/b,verticalFillRatio:fe/A,visibleAreaRatio:Be*fe/(b*A),clippedEdges:[...ne<0?["top"]:[],...he>b?["right"]:[],...rt>A?["bottom"]:[],...L<0?["left"]:[]]}})():void 0,Pe=String(C.gl.getParameter(C.gl.VERSION)??"");return{viewport:{width:b,height:A},context:{webgl2:/webgl\s*2/i.test(Pe),lost:w},frame:{rendered:h.rendered,idle:h.idle},camera:{position:[x.camera.position.x,x.camera.position.y,x.camera.position.z],distance:x.currentDistance,verticalFovDeg:x.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:f,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:O.visible&&J.visible?Math.abs(O.y-J.y):0},labels:K.qualityEvidence(),framing:Ae,...Ne?{seatView:{fovDeg:x.camera.fov,stop:Ne}}:{}}},getQualityReport(){return qt(Ft.getQualityEvidence())},loseContextForTest(){C.simulateContextLossCycle()},floors(){return o.floors},focusFloor(h){if(h!==null&&!o.floors.some(A=>A.index===h))return!1;let b=h??-1;if(j(h!==null),ot(!1),Ir(b),ze("orbit"),h===null)X.cancel(),Oe()?x.frame(o.bounds,!1,k,n.portraitOverviewCrop===!0,z):x.frameSoft(o.bounds,k,n.portraitOverviewCrop===!0,z);else{let A=o.floors[h];if(A.seatCount>0){X.cancel();let _=A.focalWorld[0]-A.center[0],O=A.focalWorld[2]-A.center[2],J=Math.hypot(_,O)>A.radius*.12?Math.atan2(_,O):k;x.frame({center:A.center,radius:A.radius,box:A.box},!1,J,!1,{polarDeg:58,margin:1.12})}}return B.requestRender(),!0},zones(){return o.zones},focusZone(h){let b=o.zones.find(J=>J.id===h);if(!b||b.seatCount===0)return!1;j(!1),ot(!1),X.cancel(),ze("orbit"),$(null),n.onSectionFocusChange?.(null);let A=b.focalWorld[0]-b.center[0],_=b.focalWorld[2]-b.center[2],O=Math.hypot(A,_)>b.radius*.12?Math.atan2(A,_):void 0;return x.frame({center:b.center,radius:b.radius*1.25},!1,O),B.requestRender(),!0},sections(){return o.sections},focusSection(h){return xn(h)},rows(h){return h?o.rows.filter(b=>b.sectionId===h):o.rows},seatsInRow(h){return e.seats.filter(b=>b.rowId===h).map(b=>({id:b.id,label:b.displayLabel||b.label}))},focusRow(h){let b=o.rows.find(A=>A.id===h);return!b||b.seatCount===0?!1:(j(!0),ot(!1),X.cancel(),ze("pan"),b.sectionId&&($(b.sectionId),n.onSectionFocusChange?.(b.sectionId)),x.frame({center:b.center,radius:Math.max(2.5,b.radius*.65)}),B.requestRender(),!0)},setReducedMotionForTest(h){T=h},dispose(){P=!0,Tt(),Dt.remove(),Rr.remove(),gn(),G?.dispose(),B.stop(),K.dispose(),sn?.disconnect(),W&&(W.dispose(),W=null),U(),oe(),C.canvas.removeEventListener("pointerdown",xe.onDown),C.canvas.removeEventListener("pointermove",xe.onMove),C.canvas.removeEventListener("pointerup",xe.onUp),C.canvas.removeEventListener("pointercancel",xe.onUp),C.canvas.removeEventListener("pointermove",nt),C.canvas.removeEventListener("pointerdown",nt),C.canvas.removeEventListener("pointerleave",cn),we&&cancelAnimationFrame(we),x.dispose(),S&&S.dispose(),c&&c.dispose(),c=null,g?.dispose(),g=null,S=null,C.dispose()}};return a.opened(o.seatCount,f,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),Ft}export{Ai as VENUE3D_QUALITY_REPORT_VERSION,Lr as autoVenue3d,Ye as buildSceneModel,Vt as estimateVenue3D,qt as inspectVenue3DQualityEvidence,xc as mountVenue3D,Ka as prepareVenue3D,$a as prepareVenue3DFromChart};