@seatlayer/core 0.71.1 → 0.71.3

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 (103) hide show
  1. package/dist/ar-WXDW7P4F.js +1 -0
  2. package/dist/be-OZ73MTYV.js +1 -0
  3. package/dist/bg-NXBQVQ7X.js +1 -0
  4. package/dist/ca-4J7PKGEP.js +1 -0
  5. package/dist/chunk-AB4ALUEW.js +1 -0
  6. package/dist/{chunk-UHPX2P7O.js → chunk-FBRBY6NE.js} +1 -1
  7. package/dist/{chunk-AWPHGLTU.js → chunk-GK4ILJFB.js} +1 -1
  8. package/dist/{chunk-5AHUGRHH.js → chunk-TQWKQGXF.js} +1 -1
  9. package/dist/core/chart-ops/index.js +1 -1
  10. package/dist/core/inventory/index.d.cts +2 -2
  11. package/dist/core/inventory/index.d.ts +2 -2
  12. package/dist/core/inventory/index.js +1 -1
  13. package/dist/core/layout/index.d.cts +2 -2
  14. package/dist/core/layout/index.d.ts +2 -2
  15. package/dist/core/quality/index.d.cts +2 -2
  16. package/dist/core/quality/index.d.ts +2 -2
  17. package/dist/core/sections/index.d.cts +1 -1
  18. package/dist/core/sections/index.d.ts +1 -1
  19. package/dist/cs-HOVL5PRG.js +1 -0
  20. package/dist/{cy-XWYNMRNE.js → cy-KJLPIGNL.js} +1 -1
  21. package/dist/da-4YKKGJN6.js +1 -0
  22. package/dist/de-QYK4NJIH.js +1 -0
  23. package/dist/el-XLXQE4YH.js +1 -0
  24. package/dist/es-IXMCGRNZ.js +1 -0
  25. package/dist/et-HK6GEAPP.js +1 -0
  26. package/dist/fa-RZT7N54K.js +1 -0
  27. package/dist/fi-NQN2STMX.js +1 -0
  28. package/dist/fr-AK5TYGQK.js +1 -0
  29. package/dist/he-CMVTS5LG.js +1 -0
  30. package/dist/{hr-AIG6RMUY.js → hr-LVOAM3F2.js} +1 -1
  31. package/dist/hu-KT2PFOAI.js +1 -0
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.d.cts +119 -28
  34. package/dist/index.d.ts +119 -28
  35. package/dist/index.js +1 -1
  36. package/dist/it-IWWDBW67.js +1 -0
  37. package/dist/ja-QUYO5TKQ.js +1 -0
  38. package/dist/ku-FVXFA2DX.js +1 -0
  39. package/dist/{layout-C6YaCOnZ.d.ts → layout-BjTtYIy8.d.ts} +1 -1
  40. package/dist/{layout-BxJIZjPm.d.cts → layout-CUiLkR8o.d.cts} +1 -1
  41. package/dist/localeLoaders-SZP47JPK.js +1 -0
  42. package/dist/lt-O5OARGHR.js +1 -0
  43. package/dist/{lv-NTO2456Y.js → lv-D5PW436N.js} +1 -1
  44. package/dist/nl-VDXV6VTH.js +1 -0
  45. package/dist/no-YS6QVD44.js +1 -0
  46. package/dist/pl-NP6YVWU6.js +1 -0
  47. package/dist/pt-YZLA6LO4.js +1 -0
  48. package/dist/{renderedQuality-CWwy14lb.d.ts → renderedQuality-DrOWtrO-.d.ts} +1 -1
  49. package/dist/{renderedQuality-CgBQYezj.d.cts → renderedQuality-ZDPLvzcZ.d.cts} +1 -1
  50. package/dist/{renderer-DmG3C8vD.d.cts → renderer-DIebhcYo.d.cts} +39 -0
  51. package/dist/{renderer-DIcDImOu.d.ts → renderer-DtR3EaF4.d.ts} +39 -0
  52. package/dist/ro-AOVPSQKL.js +1 -0
  53. package/dist/ru-4LGHGVZG.js +1 -0
  54. package/dist/sk-4FRMG7ZG.js +1 -0
  55. package/dist/sl-FYABQLPI.js +1 -0
  56. package/dist/sr-W4SGB5AT.js +1 -0
  57. package/dist/sv-4LK4WE4H.js +1 -0
  58. package/dist/{ticketRestrictions-B_qXQobd.d.ts → ticketRestrictions-Ch3ZKeMR.d.ts} +1 -1
  59. package/dist/{ticketRestrictions-Bj8PBX_x.d.cts → ticketRestrictions-NKWgOV-D.d.cts} +1 -1
  60. package/dist/tr-M5NWILAZ.js +1 -0
  61. package/dist/uk-REKJ4DVG.js +1 -0
  62. package/dist/view3d/index.cjs +31 -31
  63. package/dist/view3d/index.d.cts +34 -2
  64. package/dist/view3d/index.d.ts +34 -2
  65. package/dist/view3d/index.js +23 -23
  66. package/dist/view3d/scene/scene.worker.cjs +1 -1
  67. package/dist/view3d/scene/scene.worker.js +1 -1
  68. package/dist/{zh-Hans-ONBXTDHV.js → zh-Hans-F32F3VGF.js} +1 -1
  69. package/dist/{zh-Hant-LVTMHA6P.js → zh-Hant-NA3TGNDP.js} +1 -1
  70. package/package.json +1 -1
  71. package/dist/ar-R52D47QC.js +0 -1
  72. package/dist/be-P34NRZPF.js +0 -1
  73. package/dist/bg-4TEE6DSQ.js +0 -1
  74. package/dist/ca-V4A6DRPR.js +0 -1
  75. package/dist/chunk-WYXHD6J2.js +0 -1
  76. package/dist/cs-GR5H3ZRU.js +0 -1
  77. package/dist/da-NOYMEVP6.js +0 -1
  78. package/dist/de-LFHFC2XO.js +0 -1
  79. package/dist/el-AS3436E6.js +0 -1
  80. package/dist/es-IWBWYUHH.js +0 -1
  81. package/dist/et-VV7YGFEV.js +0 -1
  82. package/dist/fa-JYLN4BIM.js +0 -1
  83. package/dist/fi-TXRN726I.js +0 -1
  84. package/dist/fr-PKEU6NKI.js +0 -1
  85. package/dist/he-H53ZPEAF.js +0 -1
  86. package/dist/hu-KE64252D.js +0 -1
  87. package/dist/it-GVT7VIKV.js +0 -1
  88. package/dist/ja-WMRRUDVD.js +0 -1
  89. package/dist/ku-77V6NTW7.js +0 -1
  90. package/dist/localeLoaders-EMBA3SWS.js +0 -1
  91. package/dist/lt-7ICKT4ED.js +0 -1
  92. package/dist/nl-IYEEWC4A.js +0 -1
  93. package/dist/no-CKH6R5N2.js +0 -1
  94. package/dist/pl-ALK57HKB.js +0 -1
  95. package/dist/pt-EYFSXBVZ.js +0 -1
  96. package/dist/ro-EUFVCBVY.js +0 -1
  97. package/dist/ru-XAIYWENX.js +0 -1
  98. package/dist/sk-QIOFO4TV.js +0 -1
  99. package/dist/sl-37I57K2X.js +0 -1
  100. package/dist/sr-HE5DILFD.js +0 -1
  101. package/dist/sv-7SVBFLY3.js +0 -1
  102. package/dist/tr-JNA4YJEJ.js +0 -1
  103. package/dist/uk-2723G7DI.js +0 -1
@@ -1,12 +1,12 @@
1
- import{a as xe,b as Ht,c as Wt,d as Ye,e as we,f as pt,g as ht,h as Ut,i as Ie,j as Yt,k as ft,l as Xt,m as qt,n as jt,o as me,p as Qt,q as Kt,r as vt,s as $t,t as gt,u as Te}from"../chunk-WYXHD6J2.js";import"../chunk-7OJ6SB6V.js";import"../chunk-UHPX2P7O.js";import"../chunk-T2LWVOQ3.js";import"../chunk-AWPHGLTU.js";import"../chunk-UL5OIGIF.js";import"../chunk-X3K36XZM.js";import{d as Gt,k as Bt}from"../chunk-CXF32VPG.js";import"../chunk-CRCGO52K.js";import{Renderer as bn}from"ogl";function yn(){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 Xe=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 bn({canvas:this.canvas,dpr:yn(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ye.top[0],Ye.top[1],Ye.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),e.appendChild(this.canvas),this.lostHandler=i=>{i.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(e){this.clearRgb=[e[0],e[1],e[2]],this.gl.clearColor(e[0],e[1],e[2],1)}get clearColor(){return this.clearRgb}resize(){let e=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(e,n),{width:e,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let e=this.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let e=this.gl.getExtension("WEBGL_lose_context");e&&(e.loseContext(),setTimeout(()=>{e.restoreContext&&e.restoreContext()},300))}};import{Camera as xn,Vec3 as bt}from"ogl";var oe=Math.PI/180,yt=15*oe,xt=80*oe,Se=.12,Zt=35,Jt=1.25,qe=class{constructor(e,n,i,o){this.fovY=Zt;this.target=new bt;this.azimuth=-30*oe;this.polar=55*oe;this.distance=10;this.azT=-30*oe;this.polT=55*oe;this.distT=10;this.minDist=1;this.maxDist=100;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 bt;this.panAnchor=new bt;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new xn(e,{fov:Zt,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=i,this.onGesture=o,this.onPointerDown=r=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(r.pointerId)}catch{}if(this.activePointers.set(r.pointerId,{x:r.clientX,y:r.clientY}),this.activePointers.size===1){let s=r.button===2||r.button===1,a=r.button===0&&(r.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=s||a,this.dragging=!this.panning,this.lastX=r.clientX,this.lastY=r.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let s=this.pinchCentroid();this.pinchCx=s.x,this.pinchCy=s.y}}},this.onPointerMove=r=>{if(!this.interactionEnabled||!this.activePointers.has(r.pointerId))return;if(this.activePointers.set(r.pointerId,{x:r.clientX,y:r.clientY}),this.activePointers.size>=2){let l=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-l)*.005)),this.fireGesture()),this.pinchDist=l;let m=this.pinchCentroid();this.panBy(m.x-this.pinchCx,m.y-this.pinchCy),this.pinchCx=m.x,this.pinchCy=m.y;return}let s=r.clientX-this.lastX,a=r.clientY-this.lastY;if(this.panning){this.lastX=r.clientX,this.lastY=r.clientY,(s!==0||a!==0)&&(this.panBy(s,a),this.fireGesture());return}this.dragging&&(this.lastX=r.clientX,this.lastY=r.clientY,(s!==0||a!==0)&&this.fireGesture(),this.azT-=s*.006,this.polT=Math.max(yt,Math.min(xt,this.polT-a*.006)),this.requestRender())},this.onPointerUp=r=>{this.activePointers.delete(r.pointerId);try{this.canvas.releasePointerCapture?.(r.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=r=>{r.preventDefault()},this.onWheel=r=>{if(r.preventDefault(),!this.interactionEnabled)return;let s=r.deltaMode===1?16:r.deltaMode===2?100:1,a=Math.max(-2,Math.min(2,r.deltaY*s/100));this.dollyBy(Math.exp(a*.22)),this.fireGesture()},this.onKeyDown=r=>{if(!this.interactionEnabled)return;let s=7*oe;if(r.shiftKey&&(r.key==="ArrowLeft"||r.key==="ArrowRight"||r.key==="ArrowUp"||r.key==="ArrowDown"))this.panBy(r.key==="ArrowLeft"?-32:r.key==="ArrowRight"?32:0,r.key==="ArrowUp"?-32:r.key==="ArrowDown"?32:0);else if(r.key==="ArrowLeft"||r.key==="ArrowRight")this.azT+=r.key==="ArrowLeft"?-s:s;else if(r.key==="ArrowUp"||r.key==="ArrowDown")this.polT=Math.max(yt,Math.min(xt,this.polT+(r.key==="ArrowUp"?-s:s)));else if(r.key==="+"||r.key==="=")this.dollyBy(.82);else if(r.key==="-"||r.key==="_")this.dollyBy(1.22);else return;r.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let e=[...this.activePointers.values()];if(!e.length)return{x:0,y:0};let n=0,i=0;for(let o of e)n+=o.x,i+=o.y;return{x:n/e.length,y:i/e.length}}panBy(e,n){let i=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*oe/2)/i,r=Math.sin(this.azimuth),s=Math.cos(this.azimuth),a=s,l=-r,m=Math.cos(this.polar),b=Math.sin(this.polar),c=-r*m,f=-s*m;this.targetT.x+=(-e*a+n*c)*o,this.targetT.z+=(-e*l+n*f)*o,this.targetT.y+=n*b*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let e=this.panLimit,n=this.panAnchor.x,i=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-e,Math.min(n+e,this.targetT.x)),this.targetT.z=Math.max(o-e,Math.min(o+e,this.targetT.z)),this.targetT.y=Math.max(i-e*.5,Math.min(i+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())}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,i,o=!1,r){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*oe/2,l=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,m=Math.atan(Math.tan(a)*l);this.azT=i??-30*oe,this.polT=Math.max(15,Math.min(80,r?.polarDeg??55))*oe;let b=this.fitDistance(e,a,m,this.azT,this.polT);this.distT=b*Math.max(1.05,Math.min(2,r?.margin??Jt)),this.minDist=Math.max(2,s*.12),this.maxDist=b*4,n?(this.azimuth=this.azT,this.polar=12*oe,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,n,i=!1,o){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 r=this.fovY*oe/2,s=i?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,a=Math.atan(Math.tan(r)*s);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*oe;let l=this.fitDistance(e,r,a,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,o?.margin??Jt))}fitDistance(e,n,i,o,r){let s=Math.max(1,e.radius),a=Math.max(s/Math.tan(n),s/Math.tan(i)),l=e.box;if(!l)return a;let m=Math.sin(r),b=-m*Math.sin(o),c=-Math.cos(r),f=-m*Math.cos(o);if(Math.abs(c)>.999)return a;let p=-f,u=b,x=Math.hypot(p,u);p/=x,u/=x;let C=-u*c,F=u*b-p*f,v=p*c,M=Math.tan(i),R=Math.tan(n),w=1;for(let S=0;S<8;S++){let O=(S&1?l.max[0]:l.min[0])-e.center[0],D=(S&2?l.max[1]:l.min[1])-e.center[1],z=(S&4?l.max[2]:l.min[2])-e.center[2],j=O*b+D*c+z*f,E=Math.abs(O*p+z*u),_=Math.abs(O*C+D*F+z*v);w=Math.max(w,E/M-j,_/R-j)}return Math.min(a,Math.max(w,s*.35))}updateClipping(e){let n=this.camera.position.x-e.center[0],i=this.camera.position.y-e.center[1],o=this.camera.position.z-e.center[2],r=Math.hypot(n,i,o),s=Math.max(1,e.radius)*1.18,a=Math.max(.05,r-s),l=Math.max(a+10,r+s);this.camera.perspective({near:a,far:l,aspect:this.camera.aspect})}update(){let e=this.azT-this.azimuth,n=this.polT-this.polar,i=this.distT-this.distance,o=this.targetT.x-this.target.x,r=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(n)>1e-4||Math.abs(i)>1e-4||Math.abs(o)>a||Math.abs(r)>a||Math.abs(s)>a;return this.azimuth+=e*Se,this.polar+=n*Se,this.distance+=i*Se,this.target.x+=o*Se,this.target.y+=r*Se,this.target.z+=s*Se,l&&this.applyPosition(),l}get currentDistance(){return this.distance}syncFromCamera(){let e=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,i=this.camera.position.z-this.target.z,o=Math.hypot(e,n,i)||1,r=Math.max(yt,Math.min(xt,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=r,this.azimuth=this.azT=Math.atan2(e,i)}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),i=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(n,i,o),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 je=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 o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}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 Me=2.5,wn=1.15,ke=6,Pe=10,eo=6,to=9.5,oo=.9,no=2.2,wt=30,St=4,Qe=8192;var Lr=Pe+St;function ro(t,e){let n=e*1.4,i=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:Me};let o=Math.min(1,(t-n)/Math.max(.001,i-n));return{scale:1-o*.4,fade:o*.55,minPixels:Me+o*(wn-Me)}}function io(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}function ao(t,e,n,i,o){if(!(t>0)||!(e>0)||!(n>0)||!(i>0)||!(o>0))return!1;let r=Math.tan(i/2*Math.PI/180);if(!(r>0))return!1;let s=e/(n*r)*(o/2);return Math.PI*s*s/t>=64}var Sn=88,Mn=20,so={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:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},Ke=new Set(["row","seat"]),lo={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},$e={row:{x:62,y:16},seat:{x:46,y:18}},co=Gt,Mt=t=>Bt(t);function uo(t,e){let n=Mt(t),i=Mt(e);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}function Pt(t,e){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(t.replace(/\s/g,""));if(!n)return e;let i=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*i+e[o-1]*(1-i))}function Pn(t,e=[.04,.06,.1],n=!0){let i=Mt(e)<.42,o=i?"#f4f7fb":"#0b1220",r=i?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",s=n?Pt(r,e):e,a=co(t),l=n?7:4.5,m=a&&uo(a,s)>=l?t:o;return i?{ink:m,backing:r,border:"rgba(210,222,245,.24)"}:{ink:m,backing:r,border:"rgba(11,18,32,.22)"}}var Ze=class{constructor(e,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let i=this.root.style;i.position="absolute",i.inset="0",i.pointerEvents="none",i.overflow="hidden",n.fontFamily&&(i.fontFamily=n.fontFamily),e.appendChild(this.root)}setVisible(e){this.root.style.visibility=e?"":"hidden"}setLabels(e){this.labels=e;for(let[n,i]of this.nodes)e.some(o=>o.id===n)||(i.remove(),this.nodes.delete(n))}setForcedDense(e){this.forcedDense=e}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,n=>`seat:${n}`))}qualityEvidence(){let e=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(i=>{let o=this.nodes.get(i.id),r=o?.getBoundingClientRect(),s=!!(n&&o&&o.style.display!=="none"&&r&&r.width>0&&r.height>0);return{id:i.id,kind:i.kind,text:i.text,visible:s,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...s&&r?{screenBox:{x:r.x-e.x,y:r.y-e.y,width:r.width,height:r.height}}:{}}})}update(e,n,i,o,r,s){if(!this.labels.length)return;let a=jt(o,r,{hasZoneLabels:this.labels.some(v=>v.kind==="zone")});this.forcedDense&&(a.add("row"),a.add("seat"));let l=[];for(let v of this.labels){if(!a.has(v.kind))continue;let M=me(e,v.anchor,n,i);if(!M.visible)continue;let R=s?Math.hypot(v.anchor[0]-s[0],v.anchor[1]-s[1],v.anchor[2]-s[2]):1;l.push({label:v,screen:M,focus:$t(M,R,n,i),halfWidth:Kt(v.text,so[v.kind].size,!Ke.has(v.kind))/2,...this.selectedSeatLabelIds.has(v.id)?{priority:1}:{}})}let m=qt(l.filter(v=>v.label.kind==="floor"),n),b=[...l.filter(v=>!Ke.has(v.label.kind)&&v.label.kind!=="floor"),...m],c=Qt(b,Sn,Mn),f=gt(l.filter(v=>v.label.kind==="row"),$e.row.x,$e.row.y,vt.row,c),p=gt(l.filter(v=>v.label.kind==="seat"),$e.seat.x,$e.seat.y,vt.seat,[...c,...f]),u=[...c,...f,...p],x=new Set(u.map(v=>v.label.id));for(let{label:v,screen:M}of u){let w=this.nodeFor(v).style;w.display="",w.transform=`translate(-50%, -50%) translate(${M.x.toFixed(1)}px, ${M.y.toFixed(1)}px)`}let C=u.filter(({label:v})=>!Ke.has(v.kind)).sort((v,M)=>lo[M.label.kind]-lo[v.label.kind]||v.screen.depth-M.screen.depth||v.focus-M.focus),F=[];for(let{label:v}of C){let M=this.nodes.get(v.id);if(!M||M.style.display==="none")continue;let R=M.getBoundingClientRect();F.some(S=>R.left<S.right+3&&R.right+3>S.left&&R.top<S.bottom+3&&R.bottom+3>S.top)?M.style.display="none":F.push(R)}for(let[v,M]of this.nodes)x.has(v)||(M.style.display="none")}nodeFor(e){let n=this.nodes.get(e.id);if(!n){n=document.createElement("div");let c=n.style;c.position="absolute",c.left="0",c.top="0",c.whiteSpace="nowrap",c.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",c.display="none",this.root.appendChild(n),this.nodes.set(e.id,n)}n.textContent=e.text,n.setAttribute("data-label-kind",e.kind);let i=this.selectedSeatLabelIds.has(e.id);n.toggleAttribute("data-selected-seat",i);let o=so[e.kind],r=n.style;r.fontSize=`${o.size}px`,r.fontWeight=i?"800":o.weight,r.opacity=i?"1":String(o.opacity);let s=!Ke.has(e.kind),a=Pn(e.color??this.opts.ink,this.opts.backgroundRgb,s);r.color=i?"#ecf8ff":a.ink,r.background=i?"rgba(10,28,45,.9)":s?a.backing:"",r.border=i?"1px solid rgba(89,199,255,.92)":s?`1px solid ${a.border}`:"",r.borderRadius=i||s?"999px":"",r.padding=i||s?"3px 7px":"",r.boxShadow=i?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"",r.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let l=this.opts.backgroundRgb??[.04,.06,.1],m=co(i?"#ecf8ff":a.ink)??[1,1,1],b=i?Pt("rgba(10,28,45,.9)",l):s?Pt(a.backing,l):l;return n.dataset.qualityContrast=uo(m,b).toFixed(3),(e.kind==="zone"||e.kind==="floor")&&(r.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Cn=1;var An=new Set(["floor","zone","section","ga","booth","annotation"]);function En(t){return t.every(e=>Number.isFinite(e))}function Fn(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 mo(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function ve(t){return Math.round(t*1e4)/1e4}function Rn(t){if(t)return{box:{x:ve(t.box.x),y:ve(t.box.y),width:ve(t.box.width),height:ve(t.box.height)},horizontalFillRatio:ve(t.horizontalFillRatio),verticalFillRatio:ve(t.verticalFillRatio),visibleAreaRatio:ve(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function ce(t,e,n){return n.length?{code:t,message:e,count:n.length,samples:n.slice(0,20)}:null}function Ct(t){let e=t.labels.filter(a=>a.visible&&a.screenBox),n=e.filter(a=>An.has(a.kind)),i=t.scene.floorCount>1?t.scene.floorCount:t.scene.zoneCount||t.scene.sectionCount,o=[];for(let a=0;a<n.length;a+=1)for(let l=0;l<a;l+=1)Fn(n[a].screenBox,n[l].screenBox)&&o.push({primaryId:n[a].id,primaryLabel:n[a].text,secondaryId:n[l].id});let r=[...t.camera.position,t.camera.distance,t.camera.verticalFovDeg],s=[ce("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),ce("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),ce("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),ce("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}`}]),ce("camera-invalid","The capture camera must have a finite physical pose",En(r)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),ce("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}]),ce("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",i===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${i} expected hierarchy labels`}]),ce("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(a=>a.renderedFontPx<11).map(a=>({primaryId:a.id,primaryLabel:a.text,measured:a.renderedFontPx,minimum:11}))),ce("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(a=>a.contrast<4.5).map(a=>({primaryId:a.id,primaryLabel:a.text,measured:a.contrast,minimum:4.5}))),ce("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].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:m})=>({id:a,kind:l,text:m})).sort((a,l)=>a.kind.localeCompare(l.kind)||a.id.localeCompare(l.id)),framing:Rn(t.framing)},metrics:{minimumHierarchyFontPx:mo(n.map(a=>a.renderedFontPx)),minimumHierarchyContrast:mo(n.map(a=>a.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:s}}import{Geometry as _e,Mesh as Le,Program as Un,Texture as Yn,Transform as So}from"ogl";import{Program as ge}from"ogl";var Je=`
1
+ import{a as xe,b as Ht,c as Wt,d as qe,e as we,f as mt,g as ht,h as Ut,i as Ie,j as Yt,k as ft,l as qt,m as Xt,n as jt,o as Qt,p as pe,q as Kt,r as $t,s as Zt,t as Jt,u as vt,v as Te}from"../chunk-AB4ALUEW.js";import"../chunk-7OJ6SB6V.js";import"../chunk-FBRBY6NE.js";import"../chunk-T2LWVOQ3.js";import"../chunk-GK4ILJFB.js";import"../chunk-UL5OIGIF.js";import{Ia as Nt}from"../chunk-X3K36XZM.js";import{d as Gt,k as Bt}from"../chunk-CXF32VPG.js";import"../chunk-CRCGO52K.js";import{Renderer as wn}from"ogl";function Sn(){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 Xe=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 wn({canvas:this.canvas,dpr:Sn(),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 Mn,Vec3 as gt}from"ogl";var oe=Math.PI/180,bt=15*oe,yt=80*oe,Se=.12,eo=35,to=1.25,je=class{constructor(e,o,r,n){this.fovY=eo;this.target=new gt;this.azimuth=-30*oe;this.polar=55*oe;this.distance=10;this.azT=-30*oe;this.polT=55*oe;this.distT=10;this.minDist=1;this.maxDist=100;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 gt;this.panAnchor=new gt;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new Mn(e,{fov:eo,near:.1,far:5e3,aspect:1}),this.canvas=o,this.requestRender=r,this.onGesture=n,this.onPointerDown=a=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(a.pointerId)}catch{}if(this.activePointers.set(a.pointerId,{x:a.clientX,y:a.clientY}),this.activePointers.size===1){let s=a.button===2||a.button===1,i=a.button===0&&(a.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=s||i,this.dragging=!this.panning,this.lastX=a.clientX,this.lastY=a.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=a=>{if(!this.interactionEnabled||!this.activePointers.has(a.pointerId))return;if(this.activePointers.set(a.pointerId,{x:a.clientX,y:a.clientY}),this.activePointers.size>=2){let l=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-l)*.005)),this.fireGesture()),this.pinchDist=l;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=a.clientX-this.lastX,i=a.clientY-this.lastY;if(this.panning){this.lastX=a.clientX,this.lastY=a.clientY,(s!==0||i!==0)&&(this.panBy(s,i),this.fireGesture());return}this.dragging&&(this.lastX=a.clientX,this.lastY=a.clientY,(s!==0||i!==0)&&this.fireGesture(),this.azT-=s*.006,this.polT=Math.max(bt,Math.min(yt,this.polT-i*.006)),this.requestRender())},this.onPointerUp=a=>{this.activePointers.delete(a.pointerId);try{this.canvas.releasePointerCapture?.(a.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=a=>{a.preventDefault()},this.onWheel=a=>{if(a.preventDefault(),!this.interactionEnabled)return;let s=a.deltaMode===1?16:a.deltaMode===2?100:1,i=Math.max(-2,Math.min(2,a.deltaY*s/100));this.dollyBy(Math.exp(i*.22)),this.fireGesture()},this.onKeyDown=a=>{if(!this.interactionEnabled)return;let s=7*oe;if(a.shiftKey&&(a.key==="ArrowLeft"||a.key==="ArrowRight"||a.key==="ArrowUp"||a.key==="ArrowDown"))this.panBy(a.key==="ArrowLeft"?-32:a.key==="ArrowRight"?32:0,a.key==="ArrowUp"?-32:a.key==="ArrowDown"?32:0);else if(a.key==="ArrowLeft"||a.key==="ArrowRight")this.azT+=a.key==="ArrowLeft"?-s:s;else if(a.key==="ArrowUp"||a.key==="ArrowDown")this.polT=Math.max(bt,Math.min(yt,this.polT+(a.key==="ArrowUp"?-s:s)));else if(a.key==="+"||a.key==="=")this.dollyBy(.82);else if(a.key==="-"||a.key==="_")this.dollyBy(1.22);else return;a.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*oe/2)/r,a=Math.sin(this.azimuth),s=Math.cos(this.azimuth),i=s,l=-a,p=Math.cos(this.polar),v=Math.sin(this.polar),c=-a*p,f=-s*p;this.targetT.x+=(-e*i+o*c)*n,this.targetT.z+=(-e*l+o*f)*n,this.targetT.y+=o*v*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())}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,a){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),i=this.fovY*oe/2,l=n?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,p=Math.atan(Math.tan(i)*l);this.azT=r??-30*oe,this.polT=Math.max(15,Math.min(80,a?.polarDeg??55))*oe;let v=this.fitDistance(e,i,p,this.azT,this.polT);this.distT=v*Math.max(1.05,Math.min(2,a?.margin??to)),this.minDist=Math.max(2,s*.12),this.maxDist=v*4,o?(this.azimuth=this.azT,this.polar=12*oe,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 a=this.fovY*oe/2,s=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,i=Math.atan(Math.tan(a)*s);this.azT=o??this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*oe;let l=this.fitDistance(e,a,i,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,n?.margin??to))}fitDistance(e,o,r,n,a){let s=Math.max(1,e.radius),i=Math.max(s/Math.tan(o),s/Math.tan(r)),l=e.box;if(!l)return i;let p=Math.sin(a),v=-p*Math.sin(n),c=-Math.cos(a),f=-p*Math.cos(n);if(Math.abs(c)>.999)return i;let m=-f,u=v,M=Math.hypot(m,u);m/=M,u/=M;let S=-u*c,P=u*v-m*f,R=m*c,y=Math.tan(r),A=Math.tan(o),g=1;for(let C=0;C<8;C++){let V=(C&1?l.max[0]:l.min[0])-e.center[0],D=(C&2?l.max[1]:l.min[1])-e.center[1],L=(C&4?l.max[2]:l.min[2])-e.center[2],N=V*v+D*c+L*f,E=Math.abs(V*m+L*u),G=Math.abs(V*S+D*P+L*R);g=Math.max(g,E/y-N,G/A-N)}return Math.min(i,Math.max(g,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],a=Math.hypot(o,r,n),s=Math.max(1,e.radius)*1.18,i=Math.max(.05,a-s),l=Math.max(i+10,a+s);this.camera.perspective({near:i,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,a=this.targetT.y-this.target.y,s=this.targetT.z-this.target.z,i=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)>i||Math.abs(a)>i||Math.abs(s)>i;return this.azimuth+=e*Se,this.polar+=o*Se,this.distance+=r*Se,this.target.x+=n*Se,this.target.y+=a*Se,this.target.z+=s*Se,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,a=Math.max(bt,Math.min(yt,Math.acos(Math.max(-1,Math.min(1,o/n)))));this.distance=this.distT=n,this.polar=this.polT=a,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 Me=2.5,Pn=1.15,ke=6,Pe=10,oo=6,no=9.5,ro=.9,ao=2.2,xt=30,wt=4,Ke=8192;var Br=Pe+wt;function io(t,e){let o=e*1.4,r=e*3.2;if(t<=o)return{scale:1,fade:0,minPixels:Me};let n=Math.min(1,(t-o)/Math.max(.001,r-o));return{scale:1-n*.4,fade:n*.55,minPixels:Me+n*(Pn-Me)}}function so(t,e,o){return!(t>0)||!(e>0)||!(o>0)?!1:e*o/t>=64}function lo(t,e,o,r,n){if(!(t>0)||!(e>0)||!(o>0)||!(r>0)||!(n>0))return!1;let a=Math.tan(r/2*Math.PI/180);if(!(a>0))return!1;let s=e/(o*a)*(n/2);return Math.PI*s*s/t>=64}var Cn=88,An=20,St={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:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},_e=new Set(["row","seat"]),co={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},$e={row:{x:62,y:16},seat:{x:46,y:18}},uo=Gt,Mt=t=>Bt(t);function po(t,e){let o=Mt(t),r=Mt(e);return(Math.max(o,r)+.05)/(Math.min(o,r)+.05)}function Pt(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 Fn(t,e=[.04,.06,.1],o=!0){let r=Mt(e)<.42,n=r?"#f4f7fb":"#0b1220",a=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",s=o?Pt(a,e):e,i=uo(t),l=o?7:4.5,p=i&&po(i,s)>=l?t:n;return r?{ink:p,backing:a,border:"rgba(210,222,245,.24)"}:{ink:p,backing:a,border:"rgba(11,18,32,.22)"}}var Ze=class{constructor(e,o={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;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",o.fontFamily&&(r.fontFamily=o.fontFamily),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}`))}qualityEvidence(){let e=this.root.getBoundingClientRect(),o=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let n=this.nodes.get(r.id),a=n?.getBoundingClientRect(),s=!!(o&&n&&n.style.display!=="none"&&a&&a.width>0&&a.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&&a?{screenBox:{x:a.x-e.x,y:a.y-e.y,width:a.width,height:a.height}}:{}}})}update(e,o,r,n,a,s){if(!this.labels.length)return;let i=jt(n,a,{hasZoneLabels:this.labels.some(y=>y.kind==="zone")});this.forcedDense&&(i.add("row"),i.add("seat"));let l=[];for(let y of this.labels){if(!i.has(y.kind))continue;let A=pe(e,y.anchor,o,r);if(!A.visible)continue;let g=$t(y.text,St[y.kind].size,!_e.has(y.kind)),C=!_e.has(y.kind),V=Qt(A,g/2,St[y.kind].size/2+(C?4:1),o,r),D=s?Math.hypot(y.anchor[0]-s[0],y.anchor[1]-s[1],y.anchor[2]-s[2]):1;l.push({label:y,screen:V,focus:Jt(V,D,o,r),halfWidth:g/2,...this.selectedSeatLabelIds.has(y.id)?{priority:1}:{}})}let p=Xt(l.filter(y=>y.label.kind==="floor"),o),v=[...l.filter(y=>!_e.has(y.label.kind)&&y.label.kind!=="floor"),...p],c=Kt(v,Cn,An),f=Zt(o),m=vt(l.filter(y=>y.label.kind==="row"),$e.row.x,$e.row.y,f.row,c),u=vt(l.filter(y=>y.label.kind==="seat"),$e.seat.x,$e.seat.y,f.seat,[...c,...m]),M=[...c,...m,...u],S=new Set(M.map(y=>y.label.id));for(let{label:y,screen:A}of M){let C=this.nodeFor(y).style;C.display="",C.transform=`translate(-50%, -50%) translate(${A.x.toFixed(1)}px, ${A.y.toFixed(1)}px)`}let P=M.filter(({label:y})=>!_e.has(y.kind)).sort((y,A)=>co[A.label.kind]-co[y.label.kind]||y.screen.depth-A.screen.depth||y.focus-A.focus),R=[];for(let{label:y}of P){let A=this.nodes.get(y.id);if(!A||A.style.display==="none")continue;let g=A.getBoundingClientRect();R.some(V=>g.left<V.right+3&&g.right+3>V.left&&g.top<V.bottom+3&&g.bottom+3>V.top)?A.style.display="none":R.push(g)}for(let[y,A]of this.nodes)S.has(y)||(A.style.display="none")}nodeFor(e){let o=this.nodes.get(e.id);if(!o){o=document.createElement("div");let c=o.style;c.position="absolute",c.left="0",c.top="0",c.whiteSpace="nowrap",c.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",c.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=St[e.kind],a=o.style;a.fontSize=`${n.size}px`,a.fontWeight=r?"800":n.weight,a.opacity=r?"1":String(n.opacity);let s=!_e.has(e.kind),i=Fn(e.color??this.opts.ink,this.opts.backgroundRgb,s);a.color=r?"#ecf8ff":i.ink,a.background=r?"rgba(10,28,45,.9)":s?i.backing:"",a.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${i.border}`:"",a.borderRadius=r||s?"999px":"",a.padding=r||s?"3px 7px":"",a.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"",a.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let l=this.opts.backgroundRgb??[.04,.06,.1],p=uo(r?"#ecf8ff":i.ink)??[1,1,1],v=r?Pt("rgba(10,28,45,.9)",l):s?Pt(i.backing,l):l;return o.dataset.qualityContrast=po(p,v).toFixed(3),(e.kind==="zone"||e.kind==="floor")&&(a.textTransform="uppercase"),o}dispose(){this.root.remove(),this.nodes.clear()}};var En=1;var Rn=new Set(["floor","zone","section","ga","booth","annotation"]);function Dn(t){return t.every(e=>Number.isFinite(e))}function Vn(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 mo(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function ve(t){return Math.round(t*1e4)/1e4}function In(t){if(t)return{box:{x:ve(t.box.x),y:ve(t.box.y),width:ve(t.box.width),height:ve(t.box.height)},horizontalFillRatio:ve(t.horizontalFillRatio),verticalFillRatio:ve(t.verticalFillRatio),visibleAreaRatio:ve(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function ce(t,e,o){return o.length?{code:t,message:e,count:o.length,samples:o.slice(0,20)}:null}function Ct(t){let e=t.labels.filter(i=>i.visible&&i.screenBox),o=e.filter(i=>Rn.has(i.kind)),r=t.scene.floorCount>1?t.scene.floorCount:t.scene.zoneCount||t.scene.sectionCount,n=[];for(let i=0;i<o.length;i+=1)for(let l=0;l<i;l+=1)Vn(o[i].screenBox,o[l].screenBox)&&n.push({primaryId:o[i].id,primaryLabel:o[i].text,secondaryId:o[l].id});let a=[...t.camera.position,t.camera.distance,t.camera.verticalFovDeg],s=[ce("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),ce("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),ce("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),ce("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}`}]),ce("camera-invalid","The capture camera must have a finite physical pose",Dn(a)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),ce("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}]),ce("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`}]),ce("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",o.filter(i=>i.renderedFontPx<11).map(i=>({primaryId:i.id,primaryLabel:i.text,measured:i.renderedFontPx,minimum:11}))),ce("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",o.filter(i=>i.contrast<4.5).map(i=>({primaryId:i.id,primaryLabel:i.text,measured:i.contrast,minimum:4.5}))),ce("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",n)].filter(i=>!!i);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:i,kind:l,text:p})=>({id:i,kind:l,text:p})).sort((i,l)=>i.kind.localeCompare(l.kind)||i.id.localeCompare(l.id)),framing:In(t.framing)},metrics:{minimumHierarchyFontPx:mo(o.map(i=>i.renderedFontPx)),minimumHierarchyContrast:mo(o.map(i=>i.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:s}}import{Geometry as Le,Mesh as ze,Program as Xn,Texture as jn,Transform as Mo}from"ogl";import{Program as ge}from"ogl";var Je=`
2
2
  float chairWeight(float depth) {
3
3
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
4
- }`,po=`
4
+ }`,ho=`
5
5
  float occupantWeight(float depth) {
6
- float nearWeight = smoothstep(${oo.toFixed(1)}, ${no.toFixed(1)}, depth);
7
- float farWeight = 1.0 - smoothstep(${eo.toFixed(1)}, ${to.toFixed(1)}, depth);
6
+ float nearWeight = smoothstep(${ro.toFixed(1)}, ${ao.toFixed(1)}, depth);
7
+ float farWeight = 1.0 - smoothstep(${oo.toFixed(1)}, ${no.toFixed(1)}, depth);
8
8
  return nearWeight * farWeight;
9
- }`,ho=`
9
+ }`,fo=`
10
10
  float glyphEq(float glyph, float expected) {
11
11
  return 1.0 - step(0.25, abs(glyph - expected));
12
12
  }
@@ -55,7 +55,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
55
55
  p.y += 0.16;
56
56
  }
57
57
  return p;
58
- }`,Dn=`#version 300 es
58
+ }`,Tn=`#version 300 es
59
59
  precision highp float;
60
60
  in vec3 position;
61
61
  in vec3 normal;
@@ -93,7 +93,7 @@ void main() {
93
93
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
94
94
  vColor = color;
95
95
  gl_Position = projectionMatrix * mv;
96
- }`,Vn=`#version 300 es
96
+ }`,kn=`#version 300 es
97
97
  precision highp float;
98
98
  in vec3 vColor;
99
99
  in vec3 vNormalWorld;
@@ -166,7 +166,7 @@ void main() {
166
166
  + vec3(0.20, 0.10, 0.34) * focalHalo;
167
167
  base = mix(base, display, poweredDisplay * verticalFace * 0.92);
168
168
  fragColor = vec4(base, 1.0);
169
- }`,In=`#version 300 es
169
+ }`,_n=`#version 300 es
170
170
  precision highp float;
171
171
  in vec2 position; // quad corner in [-1,1]
172
172
  in vec3 iOffset; // per-instance world position
@@ -225,7 +225,7 @@ void main() {
225
225
  vPhysicalSeat = iPhysicalSeat;
226
226
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
227
227
  gl_Position = projectionMatrix * mv;
228
- }`,Tn=`#version 300 es
228
+ }`,Ln=`#version 300 es
229
229
  precision highp float;
230
230
  in vec2 vUv;
231
231
  in vec3 vColor;
@@ -284,7 +284,7 @@ void main() {
284
284
  alpha *= vDotWeight;
285
285
  if (alpha <= 0.0) discard;
286
286
  fragColor = vec4(c, alpha);
287
- }`,kn=`#version 300 es
287
+ }`,zn=`#version 300 es
288
288
  precision highp float;
289
289
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
290
290
  in vec3 normal;
@@ -316,8 +316,8 @@ out float vDim;
316
316
  out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
317
317
  out vec3 vOccupantTint;
318
318
  ${Je}
319
- ${po}
320
319
  ${ho}
320
+ ${fo}
321
321
  void main() {
322
322
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
323
323
  float viewDepth = -anchor.z;
@@ -403,7 +403,7 @@ void main() {
403
403
  vRing = iRing;
404
404
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
405
405
  gl_Position = projectionMatrix * mv;
406
- }`,_n=`#version 300 es
406
+ }`,On=`#version 300 es
407
407
  precision highp float;
408
408
  in vec3 vColor;
409
409
  in vec3 vNormalWorld;
@@ -460,14 +460,14 @@ void main() {
460
460
  float sheen = clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0);
461
461
  base += vec3(0.26, 0.31, 0.38) * fres * 0.55 * mix(sheen, 1.0, vOccupant);
462
462
  fragColor = vec4(base, 1.0);
463
- }`,Ln=`#version 300 es
463
+ }`,Nn=`#version 300 es
464
464
  precision highp float;
465
465
  in vec2 position;
466
466
  out vec2 vUv;
467
467
  void main() {
468
468
  vUv = position * 0.5 + 0.5;
469
469
  gl_Position = vec4(position, 0.999, 1.0);
470
- }`,zn=`#version 300 es
470
+ }`,Gn=`#version 300 es
471
471
  precision highp float;
472
472
  in vec2 vUv;
473
473
  uniform vec3 uTop;
@@ -478,7 +478,7 @@ void main() {
478
478
  vec2 c = vUv - 0.5;
479
479
  float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
480
480
  fragColor = vec4(col * vig, 1.0);
481
- }`,On=`#version 300 es
481
+ }`,Bn=`#version 300 es
482
482
  precision highp float;
483
483
  in vec2 position;
484
484
  in vec3 iOffset;
@@ -515,7 +515,7 @@ void main() {
515
515
  vPhysicalSeat = iPhysicalSeat;
516
516
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
517
517
  gl_Position = projectionMatrix * mv;
518
- }`,Nn=`#version 300 es
518
+ }`,Hn=`#version 300 es
519
519
  precision highp float;
520
520
  in vec2 vUv;
521
521
  in float vPhysicalSeat;
@@ -529,7 +529,7 @@ void main() {
529
529
  float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
530
530
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
531
531
  fragColor = vec4(vPick, 1.0);
532
- }`,Gn=`#version 300 es
532
+ }`,Wn=`#version 300 es
533
533
  precision highp float;
534
534
  in vec3 position;
535
535
  in float part;
@@ -551,8 +551,8 @@ uniform float uFocusFloor;
551
551
  flat out vec3 vPick;
552
552
  out float vHidden;
553
553
  ${Je}
554
- ${po}
555
554
  ${ho}
555
+ ${fo}
556
556
  void main() {
557
557
  int id = int(iPickIndex + 0.5); // already global index + 1
558
558
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -585,7 +585,7 @@ void main() {
585
585
  float c = cos(iYaw), s = sin(iYaw);
586
586
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
587
587
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
588
- }`,Bn=`#version 300 es
588
+ }`,Un=`#version 300 es
589
589
  precision highp float;
590
590
  flat in vec3 vPick;
591
591
  in float vHidden;
@@ -593,7 +593,7 @@ out vec4 fragColor;
593
593
  void main() {
594
594
  if (vHidden > 0.5) discard;
595
595
  fragColor = vec4(vPick, 1.0);
596
- }`,Hn=`#version 300 es
596
+ }`,Yn=`#version 300 es
597
597
  precision highp float;
598
598
  in vec3 position;
599
599
  in float floorIndex;
@@ -604,14 +604,14 @@ out float vHidden;
604
604
  void main() {
605
605
  vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
606
606
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
607
- }`,Wn=`#version 300 es
607
+ }`,qn=`#version 300 es
608
608
  precision highp float;
609
609
  in float vHidden;
610
610
  out vec4 fragColor;
611
611
  void main() {
612
612
  if (vHidden > 0.5) discard;
613
613
  fragColor = vec4(0.0, 0.0, 0.0, 1.0);
614
- }`;function fo(t){return new ge(t,{vertex:On,fragment:Nn,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Ie},uSeatScale:{value:1},uMinPixels:{value:Me},uPixelToWorld:{value:.002},uChairFull:{value:ke},uChairNone:{value:Pe},uFocusFloor:{value:-1}}})}function vo(t){return new ge(t,{vertex:Gn,fragment:Bn,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:ke},uChairNone:{value:Pe},uBackRake:{value:pt},uBackBase:{value:ht},uFocusFloor:{value:-1}}})}function go(t){return new ge(t,{vertex:Hn,fragment:Wn,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function bo(t,e=.78){return new ge(t,{vertex:Dn,fragment:Vn,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:e}}})}function yo(t){return new ge(t,{vertex:In,fragment:Tn,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Ie},uSeatScale:{value:1},uMinPixels:{value:Me},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:ke},uChairNone:{value:Pe}}})}function xo(t,e=.78){return new ge(t,{vertex:kn,fragment:_n,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:Pe},uBackRake:{value:pt},uBackBase:{value:ht},uFocusFloor:{value:-1},uRoughness:{value:e}}})}function wo(t,e,n){return new ge(t,{vertex:Ln,fragment:zn,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(n)}}})}function Mo(t,e,n,i,o,r){for(let s=n;s<n+i;s++){let l=r&&e[s]===0?null:o[e[s]]??o[0];t[s*3]=l?l[0]:r[s*3],t[s*3+1]=l?l[1]:r[s*3+1],t[s*3+2]=l?l[2]:r[s*3+2]}}var Xn=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),qn=new Float32Array([-1,-1,3,-1,-1,3]);function Po(t,e){let n=new So,i=new So,o=new _e(t,{position:{size:2,data:qn}}),r=wo(t,e.theme.background.top,e.theme.background.bottom),s=new Le(t,{geometry:o,program:r});s.frustumCulled=!1,s.setParent(i);let a=new _e(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=bo(t,e.theme.materials.roughness),m=new Le(t,{geometry:a,program:l});m.frustumCulled=!1,m.setParent(n);let b=yo(t),c=new Float32Array(e.seats.count*3),f=xe.map(L=>e.theme.seatStates[L]);Mo(c,e.seats.iState,0,e.seats.count,f,e.seats.iCategory);let p=new _e(t,{position:{size:2,data:Xn},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:c,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 Le(t,{geometry:p,program:b});u.frustumCulled=!1,e.seats.count>0&&u.setParent(n);let x=p.attributes.iColor,C=Ut(),F=xo(t,e.theme.materials.roughness),v=Qe,M=new Float32Array(v*3),R=new Float32Array(v*3),w=new Float32Array(v),S=new Float32Array(v),O=new Float32Array(v),D=new Float32Array(v*3),z=new Float32Array(v),j=new Float32Array(v),E=new Float32Array(v),_=new Float32Array(v),N=new _e(t,{position:{size:3,data:C.position},normal:{size:3,data:C.normal},part:{size:1,data:C.part},index:{data:C.index},iOffset:{size:3,data:M,instanced:1},iColor:{size:3,data:R,instanced:1},iRadius:{size:1,data:w,instanced:1},iYaw:{size:1,data:S,instanced:1},iGlyph:{size:1,data:O,instanced:1},iRing:{size:3,data:D,instanced:1},iFloor:{size:1,data:z,instanced:1},iPhysicalSeat:{size:1,data:j,instanced:1},iSeed:{size:1,data:_,instanced:1},iPickIndex:{size:1,data:E,instanced:1}}),P=new Le(t,{geometry:N,program:F});P.frustumCulled=!1;let g=0,H=!1,K=!1,Y=null,y=null,I=null,J=new Int32Array(0),B=()=>{let L=e.seats;for(let G=0;G<g;G++){let T=J[G];_[G]=Yt(L.iState[T],T);let U=L.iCategory&&L.iState[T]===0?null:f[L.iState[T]]??f[0];if(U)R[G*3]=U[0],R[G*3+1]=U[1],R[G*3+2]=U[2];else{let Q=e.theme.materials.seat??Wt([L.iCategory[T*3],L.iCategory[T*3+1],L.iCategory[T*3+2]]);R[G*3]=Q[0],R[G*3+1]=Q[1],R[G*3+2]=Q[2]}}N.attributes.iColor.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0},$={main:n,background:i,seatProgram:b,solidProgram:l,chairProgram:F,seatGeometry:p,chairGeometry:N,solidGeometry:a,drawCalls:3,setNearSeats(L,G){let T=Math.min(G,v);if(J=L,g=T,T===0){P.parent&&P.setParent(null),N.instancedCount=0,$.drawCalls=3+(H?1:0);return}let V=e.seats;for(let U=0;U<T;U++){let Q=L[U];M[U*3]=V.iPosition[Q*3],M[U*3+1]=V.iPosition[Q*3+1],M[U*3+2]=V.iPosition[Q*3+2],w[U]=V.iChairWidth[Q],S[U]=V.iYaw[Q],O[U]=V.iGlyph[Q],D[U*3]=V.iRing[Q*3],D[U*3+1]=V.iRing[Q*3+1],D[U*3+2]=V.iRing[Q*3+2],z[U]=V.iFloor[Q],j[U]=V.iPhysicalSeat[Q],E[U]=Q+1}B(),N.attributes.iOffset.needsUpdate=!0,N.attributes.iRadius.needsUpdate=!0,N.attributes.iYaw.needsUpdate=!0,N.attributes.iGlyph.needsUpdate=!0,N.attributes.iRing.needsUpdate=!0,N.attributes.iFloor.needsUpdate=!0,N.attributes.iPhysicalSeat.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0,N.attributes.iPickIndex.needsUpdate=!0,N.instancedCount=T,P.parent||P.setParent(n),$.drawCalls=4+(H?1:0)},nearSeatCount(){return g},uploadSeatStateRuns(L){if(!L.length)return;g&&B();for(let T of L)Mo(c,e.seats.iState,T.start,T.length,f,e.seats.iCategory);let G=x.buffer;if(!G){x.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,G);for(let T of L){let V=c.subarray(T.start*3,(T.start+T.length)*3);t.bufferSubData(t.ARRAY_BUFFER,T.start*3*Float32Array.BYTES_PER_ELEMENT,V)}},dispose(){K=!0,o.remove(),r.remove(),a.remove(),l.remove(),p.remove(),b.remove(),N.remove(),F.remove(),Y?.remove(),y?.remove(),I?.texture&&t.deleteTexture(I.texture)}},ee=e.productionElements.find(L=>L.contentImageUrl&&L.contentPlane);if(ee?.contentImageUrl&&ee.contentPlane?.length===4&&typeof Image<"u"){let L=new Image;L.crossOrigin="anonymous",L.onload=()=>{if(K)return;let G=ee.contentPlane;Y=new _e(t,{position:{size:3,data:new Float32Array(G.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(ee.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),I=new Yn(t,{image:L,generateMipmaps:!0,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,flipY:!1}),y=new Un(t,{vertex:`#version 300 es
614
+ }`;function vo(t){return new ge(t,{vertex:Bn,fragment:Hn,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Ie},uSeatScale:{value:1},uMinPixels:{value:Me},uPixelToWorld:{value:.002},uChairFull:{value:ke},uChairNone:{value:Pe},uFocusFloor:{value:-1}}})}function go(t){return new ge(t,{vertex:Wn,fragment:Un,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:ke},uChairNone:{value:Pe},uBackRake:{value:mt},uBackBase:{value:ht},uFocusFloor:{value:-1}}})}function bo(t){return new ge(t,{vertex:Yn,fragment:qn,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function yo(t,e=.78){return new ge(t,{vertex:Tn,fragment:kn,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:e}}})}function xo(t){return new ge(t,{vertex:_n,fragment:Ln,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Ie},uSeatScale:{value:1},uMinPixels:{value:Me},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:ke},uChairNone:{value:Pe}}})}function wo(t,e=.78){return new ge(t,{vertex:zn,fragment:On,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:Pe},uBackRake:{value:mt},uBackBase:{value:ht},uFocusFloor:{value:-1},uRoughness:{value:e}}})}function So(t,e,o){return new ge(t,{vertex:Nn,fragment:Gn,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(o)}}})}function Po(t,e,o,r,n,a){for(let s=o;s<o+r;s++){let l=a&&e[s]===0?null:n[e[s]]??n[0];t[s*3]=l?l[0]:a[s*3],t[s*3+1]=l?l[1]:a[s*3+1],t[s*3+2]=l?l[2]:a[s*3+2]}}var Qn=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Kn=new Float32Array([-1,-1,3,-1,-1,3]);function Co(t,e){let o=new Mo,r=new Mo,n=new Le(t,{position:{size:2,data:Kn}}),a=So(t,e.theme.background.top,e.theme.background.bottom),s=new ze(t,{geometry:n,program:a});s.frustumCulled=!1,s.setParent(r);let i=new Le(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=yo(t,e.theme.materials.roughness),p=new ze(t,{geometry:i,program:l});p.frustumCulled=!1,p.setParent(o);let v=xo(t),c=new Float32Array(e.seats.count*3),f=xe.map(z=>e.theme.seatStates[z]);Po(c,e.seats.iState,0,e.seats.count,f,e.seats.iCategory);let m=new Le(t,{position:{size:2,data:Qn},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:c,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 ze(t,{geometry:m,program:v});u.frustumCulled=!1,e.seats.count>0&&u.setParent(o);let M=m.attributes.iColor,S=Ut(),P=wo(t,e.theme.materials.roughness),R=Ke,y=new Float32Array(R*3),A=new Float32Array(R*3),g=new Float32Array(R),C=new Float32Array(R),V=new Float32Array(R),D=new Float32Array(R*3),L=new Float32Array(R),N=new Float32Array(R),E=new Float32Array(R),G=new Float32Array(R),O=new Le(t,{position:{size:3,data:S.position},normal:{size:3,data:S.normal},part:{size:1,data:S.part},index:{data:S.index},iOffset:{size:3,data:y,instanced:1},iColor:{size:3,data:A,instanced:1},iRadius:{size:1,data:g,instanced:1},iYaw:{size:1,data:C,instanced:1},iGlyph:{size:1,data:V,instanced:1},iRing:{size:3,data:D,instanced:1},iFloor:{size:1,data:L,instanced:1},iPhysicalSeat:{size:1,data:N,instanced:1},iSeed:{size:1,data:G,instanced:1},iPickIndex:{size:1,data:E,instanced:1}}),w=new ze(t,{geometry:O,program:P});w.frustumCulled=!1;let b=0,W=!1,K=!1,q=null,x=null,T=null,J=new Int32Array(0),H=()=>{let z=e.seats;for(let B=0;B<b;B++){let k=J[B];G[B]=Yt(z.iState[k],k);let Y=z.iCategory&&z.iState[k]===0?null:f[z.iState[k]]??f[0];if(Y)A[B*3]=Y[0],A[B*3+1]=Y[1],A[B*3+2]=Y[2];else{let Q=e.theme.materials.seat??Wt([z.iCategory[k*3],z.iCategory[k*3+1],z.iCategory[k*3+2]]);A[B*3]=Q[0],A[B*3+1]=Q[1],A[B*3+2]=Q[2]}}O.attributes.iColor.needsUpdate=!0,O.attributes.iSeed.needsUpdate=!0},$={main:o,background:r,seatProgram:v,solidProgram:l,chairProgram:P,seatGeometry:m,chairGeometry:O,solidGeometry:i,drawCalls:3,setNearSeats(z,B){let k=Math.min(B,R);if(J=z,b=k,k===0){w.parent&&w.setParent(null),O.instancedCount=0,$.drawCalls=3+(W?1:0);return}let I=e.seats;for(let Y=0;Y<k;Y++){let Q=z[Y];y[Y*3]=I.iPosition[Q*3],y[Y*3+1]=I.iPosition[Q*3+1],y[Y*3+2]=I.iPosition[Q*3+2],g[Y]=I.iChairWidth[Q],C[Y]=I.iYaw[Q],V[Y]=I.iGlyph[Q],D[Y*3]=I.iRing[Q*3],D[Y*3+1]=I.iRing[Q*3+1],D[Y*3+2]=I.iRing[Q*3+2],L[Y]=I.iFloor[Q],N[Y]=I.iPhysicalSeat[Q],E[Y]=Q+1}H(),O.attributes.iOffset.needsUpdate=!0,O.attributes.iRadius.needsUpdate=!0,O.attributes.iYaw.needsUpdate=!0,O.attributes.iGlyph.needsUpdate=!0,O.attributes.iRing.needsUpdate=!0,O.attributes.iFloor.needsUpdate=!0,O.attributes.iPhysicalSeat.needsUpdate=!0,O.attributes.iSeed.needsUpdate=!0,O.attributes.iPickIndex.needsUpdate=!0,O.instancedCount=k,w.parent||w.setParent(o),$.drawCalls=4+(W?1:0)},nearSeatCount(){return b},uploadSeatStateRuns(z){if(!z.length)return;b&&H();for(let k of z)Po(c,e.seats.iState,k.start,k.length,f,e.seats.iCategory);let B=M.buffer;if(!B){M.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,B);for(let k of z){let I=c.subarray(k.start*3,(k.start+k.length)*3);t.bufferSubData(t.ARRAY_BUFFER,k.start*3*Float32Array.BYTES_PER_ELEMENT,I)}},dispose(){K=!0,n.remove(),a.remove(),i.remove(),l.remove(),m.remove(),v.remove(),O.remove(),P.remove(),q?.remove(),x?.remove(),T?.texture&&t.deleteTexture(T.texture)}},ee=e.productionElements.find(z=>z.contentImageUrl&&z.contentPlane);if(ee?.contentImageUrl&&ee.contentPlane?.length===4&&typeof Image<"u"){let z=new Image;z.crossOrigin="anonymous",z.onload=()=>{if(K)return;let B=ee.contentPlane;q=new Le(t,{position:{size:3,data:new Float32Array(B.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(ee.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),T=new jn(t,{image:z,generateMipmaps:!0,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,flipY:!1}),x=new Xn(t,{vertex:`#version 300 es
615
615
  precision highp float;
616
616
  in vec3 position; in vec2 uv; in float floorIndex;
617
617
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
@@ -619,4 +619,4 @@ void main() {
619
619
  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
620
  precision highp float;
621
621
  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:I},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let T=new Le(t,{geometry:Y,program:y});T.frustumCulled=!1,T.setParent(n),$.screenProgram=y,H=!0,$.drawCalls=3+(g?1:0)+1},L.src=ee.contentImageUrl}return $}import{Mesh as At,RenderTarget as Qn,Transform as Et}from"ogl";function jn(t,e,n){let i=t+(e<<8)+(n<<16);return i===0?-1:i-1}function Co(t,e,n,i,o,r){let s=-1,a=1/0;for(let l=0;l<n;l++)for(let m=0;m<e;m++){let b=(l*e+m)*4,c=jn(t[b],t[b+1],t[b+2]);if(c<0||c>=r)continue;let f=m-i,p=l-o,u=f*f+p*p;u<a&&(a=u,s=c)}return s}function Ao(t,e,n,i,o,r){let s=t-n.left,a=e-n.top,l=Math.round(s*i),m=Math.round((n.height-a)*i);return{x:Math.max(0,Math.min(o-1,l)),y:Math.max(0,Math.min(r-1,m))}}var Kn=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],et=class{constructor(e,n,i,o,r){this.seatScene=new Et;this.chairScene=new Et;this.solidScene=new Et;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=r,this.seatProg=fo(this.gl),this.chairProg=vo(this.gl),this.depthProg=go(this.gl);let s=new At(this.gl,{geometry:n,program:this.seatProg});s.frustumCulled=!1,s.setParent(this.seatScene);let a=new At(this.gl,{geometry:i,program:this.chairProg});a.frustumCulled=!1,a.setParent(this.chairScene);let l=new At(this.gl,{geometry:o,program:this.depthProg});l.frustumCulled=!1,l.setParent(this.solidScene)}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let i of Kn)this.seatProg.uniforms[i].value=e.uniforms[i].value;let n=e.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}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 Qn(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,i,o){let r=this.gl,s=this.ensureTarget(),a=r.drawingBufferWidth,l=r.drawingBufferHeight,m=Math.max(0,n-o),b=Math.max(0,i-o),c=Math.max(1,Math.min(a,n+o+1)-m),f=Math.max(1,Math.min(l,i+o+1)-b);r.enable(r.SCISSOR_TEST),r.scissor(m,b,c,f);let[p,u,x]=this.restoreClear;r.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}),r.clearColor(p,u,x,1),r.disable(r.SCISSOR_TEST);let C=new Uint8Array(c*f*4);return this.renderer.bindFramebuffer(s),r.readPixels(m,b,c,f,r.RGBA,r.UNSIGNED_BYTE,C),this.renderer.bindFramebuffer(),Co(C,c,f,n-m,i-b,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Eo(t,e){let n=[];for(let i of e)t.has(i.seatId)?t.set(i.seatId,Ht(i.state)):n.push(i);return n}function Fo(t,e,n){let i=new Set;for(let s of e)(t.has(s)||n(s)!==void 0)&&i.add(s);let o=new Map(t),r=[];for(let[s,a]of t)i.has(s)||(r.push({seatId:s,state:xe[a]??"available"}),o.delete(s));for(let s of i){if(o.has(s))continue;let a=n(s);a!==void 0&&(o.set(s,a),r.push({seatId:s,state:"selected"}))}return{updates:r,next:o}}import{Quat as ze,Vec3 as Jn}from"ogl";function $n(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function Ro(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function Zn(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Do(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 Ft(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function Rt(t,e){return Math.max(0,Math.min(1,t+e))}function Vo(t,e){let n=t.length;if(n===0)return[0,0,0];if(n===1)return[...t[0]];let i=Math.max(0,Math.min(1,e)),o=n-1,r=Math.floor(i*o);r>=o&&(r=o-1);let s=i*o-r,a=t[Math.max(0,r-1)],l=t[r],m=t[r+1],b=t[Math.min(n-1,r+2)],c=s*s,f=c*s,p=[0,0,0];for(let u=0;u<3;u++)p[u]=.5*(2*l[u]+(-a[u]+m[u])*s+(2*a[u]-5*l[u]+4*m[u]-b[u])*c+(-a[u]+3*l[u]-3*m[u]+b[u])*f);return p}function Dt(t,e,n,i,o){let r=Do($n(e,n));r[0]===0&&r[1]===0&&r[2]===0&&(r=[0,0,1]);let s=Ro(Ro(e,Zn(r,2.5)),[0,1.5,0]),a=[e[0]-i[0],0,e[2]-i[2]],l=Do(a);l[0]===0&&l[2]===0&&(l=[r[0],0,r[2]]);let m=Math.max(1,o),b=[i[0]+l[0]*m*1.3,i[1]+m*.75,i[2]+l[2]*m*1.3];return{waypoints:[t,b,s],finalPos:s}}function Vt(t,e,n=35,i=28){let o=Ft(e),r=Vo(t,o),s=Ft(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:r,fov:n+(i-n)*s,eased:o}}function _o(t,e,n){let i=t.position.clone(),o=new ze().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new Jn(n[0],n[1],n[2]));let r=new ze().copy(t.quaternion);return t.position.copy(i),t.quaternion.copy(o),r}var tt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new ze;this.endQuat=new ze;this.outQuat=new ze;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,n,i,o=2500,r=28){return this.settle(),this.waypoints=e,this.startQuat.copy(n),this.endQuat.copy(i),this.duration=o,this.endFov=r,this.startTime=performance.now(),this.active=!0,new Promise(s=>{this.resolveFn=s})}update(e){if(!this.active)return!1;let n=Math.min(1,(e-this.startTime)/this.duration),{pos:i,fov:o,eased:r}=Vt(this.waypoints,n,35,this.endFov);return this.camera.position.set(i[0],i[1],i[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Rt(r,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,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 er=1.02,tr=1.5;function Lo(t,e,n=0,i){let o=Number.isFinite(i)?n+i:t[1]+er;return{eye:[t[0],o,t[2]],focal:[e.x*we,n+tr,e.y*we]}}var Ae=Math.PI/180,or=45,zo=80,nr=.25,It=1,rr=.25,ir=12*Ae,ar=.2,sr=1.5,Oo=.8,No=6,Wo=1.9,lr=2/3,cr=.12,ur=.9,dr=1.2,mr=2,Uo=.05,pr=6;function Yo(t,e,n=0){if(!t.length)return{min:[e[0]-6,n,e[2]-6],max:[e[0]+6,Math.max(n+Oo,e[1]),e[2]+6]};let i=1/0,o=-1/0,r=1/0,s=-1/0,a=n;for(let u of t)i=Math.min(i,u.cx-u.halfX),o=Math.max(o,u.cx+u.halfX),r=Math.min(r,u.cz-u.halfZ),s=Math.max(s,u.cz+u.halfZ),a=Math.max(a,u.y);let l=o-i,m=s-r,b=Math.max(l,Math.min(m,No))/2,c=Math.max(m,Math.min(l,No))/2,f=(i+o)/2,p=(r+s)/2;return{min:[f-b,n,p-c],max:[f+b,Math.max(n+Oo,a),p+c]}}function hr(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+Wo,t.max[2]]}}function fr(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+sr,e+ar,e+Wo*lr),(t.min[2]+t.max[2])/2]}function Xo(t,e){let n=t[0]-e[0],i=t[2]-e[2],o=Math.hypot(n,i);return o<.001?{x:0,z:1}:{x:n/o,z:i/o}}function Go(t,e,n){let i=e[0]-t[0],o=e[1]-t[1],r=e[2]-t[2],s=Math.hypot(i,o,r)||1;i/=s,o/=s,r/=s;let a=-r,l=i,m=Math.hypot(a,l);if(m<1e-6)return 1/0;a/=m,l/=m;let b=1/0,c=-1/0;for(let f=0;f<8;f++){let p=(f&1?n.max[0]:n.min[0])-t[0],u=(f&2?n.max[1]:n.min[1])-t[1],x=(f&4?n.max[2]:n.min[2])-t[2],C=Math.max(Uo,p*i+u*o+x*r),F=(p*a+x*l)/C;F<b&&(b=F),F>c&&(c=F)}return c-b}function Bo(t,e,n){let i=e[0]-t[0],o=e[1]-t[1],r=e[2]-t[2],s=Math.hypot(i,o,r)||1;i/=s,o/=s,r/=s;let a=-r,l=i,m=Math.hypot(a,l);if(m<1e-6)return 1/0;a/=m,l/=m;let b=-l*o,c=l*i-a*r,f=a*o,p=1/0,u=-1/0;for(let x=0;x<8;x++){let C=(x&1?n.max[0]:n.min[0])-t[0],F=(x&2?n.max[1]:n.min[1])-t[1],v=(x&4?n.max[2]:n.min[2])-t[2],M=Math.max(Uo,C*i+F*o+v*r),R=(C*b+F*c+v*f)/M;R<p&&(p=R),R>u&&(u=R)}return u-p}function ot(t,e){return Math.tan(t*Ae/2)*Math.max(.05,e)}function Ho(t,e,n){let i=a=>Math.max(or,Math.min(zo,a)),o=a=>2*Math.atan(a)/Ae,r=Number.isFinite(t)&&t>0?i(o(t/(2*nr)/Math.max(.05,n))):zo;if(!(Number.isFinite(e)&&e>0))return r;let s=Math.min(r,i(o(e/(2*cr))));return t/(2*ot(s,n))>It?r:s}function qo(t,e,n){let i=fr(e),o=[t[0],t[1],t[2]],r=0,s=0,a=p=>{if(!(p>0))return;let u=Xo(o,i);o[0]+=u.x*p,o[2]+=u.z*p,s+=p},l=e.max[1]+rr-o[1];l>0&&(o[1]+=l,r=l,a(l/Math.tan(ir)));let m=hr(e),b=Go(o,i,e),c=Ho(b,Bo(o,i,m),n),f=b/(2*ot(c,n));for(let p=0;p<pr&&f>It;p++){let u=Math.max(1,Math.hypot(o[0]-i[0],o[2]-i[2])),x=Number.isFinite(f)?f/It:2;a(Math.min(60,u*(Math.min(4,x)-1)+.5)),b=Go(o,i,e),c=Ho(b,Bo(o,i,m),n),f=b/(2*ot(c,n))}return{eye:o,focal:i,fov:c,raisedM:r,pulledBackM:s,stageFrameWidth:f}}function vr(t,e,n){let i=Math.tan(e*Ae/2),o=ot(e,n);return Math.max(1,t/Math.max(.05,Math.min(i,o)))}function jo(t,e){let{aspect:n,venue:i}=e,o=t.focal,r=Xo(t.eye,o),s=f=>(f[0]-o[0])*r.x+(f[2]-o[2])*r.z,a=[{name:"seat",eye:t.eye,focal:o,fov:t.fov}],l=mr*(e.rowDepthM??ur);a.push({name:"row",eye:[t.eye[0]+r.x*l,t.eye[1]+dr,t.eye[2]+r.z*l],focal:o,fov:t.fov});let m=(f,p,u,x)=>{let C=vr(u,t.fov,n)*1.08,F=C*Math.sin(x*Ae),v=C*Math.cos(x*Ae);return{name:f,eye:[p[0]+r.x*v,p[1]+F,p[2]+r.z*v],focal:p,fov:t.fov}};e.section&&e.section.radius>0&&a.push(m("section",e.section.center,e.section.radius,14)),a.push(m("venue",i.center,Math.max(1,i.radius),26));let b=[],c=-1/0;for(let f of a){let p=s(f.eye);b.length&&p<=c+.5||(b.push(f),c=p)}return b}import{Vec3 as gr}from"ogl";var Ne=Math.PI/180,Qo=320,Ko=70*Ne,br=32*Ne,yr=24*Ne,$o=.0026,xr=.22,wr=.006,Sr=180,Mr=4,ie=(t,e,n)=>Math.max(e,Math.min(n,t)),Zo=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function Jo(t){let{canvas:e,camera:n}=t,i=[],o=!1,r=0,s=0,a=0,l=0,m=0,b=0,c=!1,f=[0,0],p=0,u=!1,x=null,C=null,F=new Map,v=!1,M=0,R=0,w=0,S=0,O=()=>o&&i.length?i[ie(Math.round(r),0,i.length-1)].name:null,D=()=>{let y=O();y!==x&&(x=y,t.onStopChange?.(y))},z=()=>{if(!o||!i.length)return;let y=i[ie(Math.floor(r),0,i.length-1)],I=i[ie(Math.ceil(r),0,i.length-1)],J=ie(r-Math.floor(r),0,1),B=(be,Ge)=>be+(Ge-be)*J,$=[B(y.eye[0],I.eye[0]),B(y.eye[1],I.eye[1]),B(y.eye[2],I.eye[2])],ee=[B(y.focal[0],I.focal[0]),B(y.focal[1],I.focal[1]),B(y.focal[2],I.focal[2])],L=ee[0]-$[0],G=ee[1]-$[1],T=ee[2]-$[2],V=Math.hypot(L,G,T)||1,U=Math.atan2(L,T),Q=Math.asin(ie(G/V,-1,1)),ae=U+s,pe=ie(Q+a,-80*Ne,80*Ne),Ee=Math.cos(pe)*V;L=Math.sin(ae)*Ee,G=Math.sin(pe)*V,T=Math.cos(ae)*Ee,n.position.set($[0],$[1],$[2]),n.fov=B(y.fov,I.fov),n.updateProjectionMatrix(),n.lookAt(new gr($[0]+L,$[1]+G,$[2]+T)),t.onApplied?.()},j=()=>{if(!o||!i.length)return;let y=ie(Math.round(r),0,i.length-1);if(t.reducedMotion()){c=!1,r=y,z(),D(),t.requestRender();return}if(Math.abs(y-r)<.001){c=!1,D();return}l=r,m=y,b=performance.now(),c=!0,t.requestRender()},E=y=>{!o||i.length<2||(c=!1,r=ie(r+y,0,i.length-1),z(),D(),t.requestRender())},_=(y,I)=>{o&&(c=!1,u=!1,s=ie(s-y*$o,-Ko,Ko),a=ie(a-I*$o,-yr,br),z(),t.requestRender())},N=y=>{o&&(F.set(y.pointerId,{x:y.clientX,y:y.clientY}),F.size===1?(v=!0,S=0,M=y.clientX,R=y.clientY):F.size===2&&(v=!1,w=P()))},P=()=>{let y=[...F.values()];return y.length<2?0:Math.hypot(y[0].x-y[1].x,y[0].y-y[1].y)},g=y=>{if(!o||!F.has(y.pointerId))return;if(F.set(y.pointerId,{x:y.clientX,y:y.clientY}),F.size>=2){let B=P();w>0&&E((w-B)*wr),w=B;return}if(!v)return;let I=y.clientX-M,J=y.clientY-R;M=y.clientX,R=y.clientY,S+=Math.abs(I)+Math.abs(J),!(S<=Mr)&&_(I,J)},H=y=>{F.delete(y.pointerId)&&(F.size<2&&(w=0),F.size===0&&(v=!1,j()))},K=y=>{if(!o)return;y.preventDefault();let I=y.deltaMode===1?16:y.deltaMode===2?100:1,J=ie(y.deltaY*I/100,-2,2);E(J*xr),C&&clearTimeout(C),C=setTimeout(()=>{C=null,j()},Sr)},Y=()=>{o&&(o=!1,c=!1,u=!1,i=[],F.clear(),v=!1,C&&(clearTimeout(C),C=null),x!==null&&(x=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",N),e.addEventListener("pointermove",g),e.addEventListener("pointerup",H),e.addEventListener("pointercancel",H),e.addEventListener("wheel",K,{passive:!1}),{get active(){return o},enter(y){if(y.length<2){Y();return}i=y,o=!0,r=0,s=0,a=0,c=!1,u=!1,x=null,z(),D(),t.requestRender()},exit:Y,recentre(){return o?Math.abs(s)<1e-4&&Math.abs(a)<1e-4?!0:t.reducedMotion()?(u=!1,s=0,a=0,z(),t.requestRender(),!0):(f=[s,a],p=performance.now(),u=!0,t.requestRender(),!0):!1},update(y){if(!o)return!1;let I=!1;if(u){let J=ie((y-p)/Qo,0,1),B=1-Zo(J);s=f[0]*B,a=f[1]*B,J>=1?(u=!1,s=0,a=0):I=!0}if(c){let J=ie((y-b)/Qo,0,1);r=l+(m-l)*Zo(J),J>=1?(c=!1,r=m,D()):I=!0}return z(),I},currentStop:O,dispose(){Y(),e.removeEventListener("pointerdown",N),e.removeEventListener("pointermove",g),e.removeEventListener("pointerup",H),e.removeEventListener("pointercancel",H),e.removeEventListener("wheel",K)}}}var Tt=null;function en(){return Tt??=import("../openPanorama-HGRYMWKC.js").catch(t=>{throw Tt=null,t}),Tt}var tn=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),nt=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,i,o){this.emit("3d_opened",{seats:e,hasHeights:n,...i===void 0?{}:{buildMs:Math.round(i)},...o===void 0?{}:{prepSource:o}})}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=tn(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(tn()-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 on(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function nn(t){let{container:e,model:n,opts:i,expandedSeatById:o,seatIdsByRow:r,isNarrow:s}=t,a=null,l=()=>{if(!a)return;let c=s();Object.assign(a.style,c?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},m=()=>{a?.remove(),a=null};return{show:(c,f,p=!1)=>{if(m(),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 x=o.get(c),C=x?.sectionId?n.sections.find(D=>D.id===x.sectionId):void 0,F=x?.label??c;u.setAttribute("aria-label",`Explore views near ${C?.label?`${C.label}, `:""}seat ${F}`);let v=document.createElement("span");v.textContent=i.seatViewCaption?.(c)??["Live 3D seat view",C?.label,F].filter(Boolean).join(" \xB7 "),Object.assign(v.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)"}),u.appendChild(v);let M=document.createElement("div");Object.assign(M.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),u.appendChild(M);let R=x?.rowId?r.get(x.rowId):void 0,w=R?.indexOf(c)??-1,S=w>=0?[R?.[w-1],R?.[w+1]]:[void 0,void 0],O=(D,z,j,E=!1)=>{let _=document.createElement("button");_.type="button",_.textContent=D,_.setAttribute("aria-label",z),Object.assign(_.style,{minHeight:"44px",padding:E?"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"}),E||(_.style.minWidth="44px"),E&&(_.dataset.panoramaTrigger=""),_.addEventListener("click",j),M.appendChild(_)};if(S[0]){let D=o.get(S[0])?.label??S[0];O("\u2039",`View previous seat ${D}`,()=>{t.flyToSeat(S[0])})}if(i.getSeatView){let D=i.seatViewActionLabel?.(c)??"Open 360\xB0 panorama";O(p?`\u21BB Retry ${D}`:`\u25C9 ${D}`,`${p?"Retry":D} from seat ${F}`,()=>{if(t.isDisposed()||f!==t.flightGen()){m();return}m(),t.openPanorama(c,400,f)},!0)}if(S[1]){let D=o.get(S[1])?.label??S[1];O("\u203A",`View next seat ${D}`,()=>{t.flyToSeat(S[1])})}return M.childElementCount?(e.appendChild(u),a=u,l(),u):null},remove:m,layout:l}}function rn(t){let{container:e,orbit:n,isNarrow:i}=t,o=document.createElement("div"),r=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D drag mode"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D view controls"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let l=document.createElement("button");l.type="button",l.textContent="\u21BB",l.setAttribute("aria-label","Drag to rotate the 3D venue"),l.dataset.tooltip="Rotate venue";let m=document.createElement("button");m.type="button",m.textContent="\u2725",m.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),m.dataset.tooltip="Move venue";let b=document.createElement("button");b.type="button",b.textContent="\u2212",b.setAttribute("aria-label","Zoom out of the 3D venue"),b.dataset.tooltip="Zoom out";let c=document.createElement("button");c.type="button",c.textContent="+",c.setAttribute("aria-label","Zoom into the 3D venue"),c.dataset.tooltip="Zoom in";for(let x of[l,m,b,c])x.className="sl-3d-icon-control",Object.assign(x.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"});s.append(l,m),a.append(c,b);let f=x=>{n.setPrimaryDragMode(x);let C=x==="orbit";l.setAttribute("aria-pressed",String(C)),m.setAttribute("aria-pressed",String(!C)),l.style.background=C?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",m.style.background=C?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=C?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};l.addEventListener("click",()=>f("orbit")),m.addEventListener("click",()=>f("pan")),b.addEventListener("click",()=>n.zoomBy(1.22)),c.addEventListener("click",()=>n.zoomBy(.82)),o.append(s,a),f("orbit"),e.appendChild(o);let p=()=>{let x=i();o.style.display=r?"none":"flex",o.style.right=x?"12px":"14px",o.style.bottom=x?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",s.style.display=x?"none":"flex",c.style.display=x?"none":"",b.style.display=x?"none":""};return p(),{element:o,utilityControls:a,setNavigationMode:f,setSeatViewLocked:x=>{r=x,n.setInteractionEnabled(!x),p()},seatViewLocked:()=>r,layout:p}}function an(t){let{glctx:e,orbit:n,model:i,seats:o,opts:r,cinematic:s,analytics:a,seatIdByIndex:l,sectionIdBySeatId:m,tapSlop:b,tapMs:c,cancelFlight:f,focusSectionCamera:p,setSelection:u,ensureSeatView:x}=t,C=0,F=0,v=0,M=-1,R=!1,w=!1,S=E=>{t.seatViewLocked()||M===-1&&(M=E.pointerId,C=E.clientX,F=E.clientY,v=performance.now(),R=!1,w=s.active,s.active&&(a.cinematicCancelled(),f(),r.onViewTargetChange?.(null)))},O=E=>{E.pointerId===M&&Math.hypot(E.clientX-C,E.clientY-F)>b&&(R=!0)},D=(E,_,N,P,g)=>{let H=e.canvas.getBoundingClientRect(),K=e.canvas.clientWidth||H.width||1,Y=e.canvas.clientHeight||H.height||1,y=E-H.left,I=_-H.top,J=P*P,B=-1,$=J,ee=1/0;for(let L of o){if(N&&L.sectionId!==N)continue;let G=i.seats.idToIndex.get(L.id);if(G===void 0)continue;if(g){let pe=Math.round(i.seats.iState[G]??0);if(pe!==0&&pe!==3)continue}let T=G*3,V=me(n.camera.projectionViewMatrix,[i.seats.iPosition[T],i.seats.iPosition[T+1]+.55,i.seats.iPosition[T+2]],K,Y);if(!V.visible)continue;let U=V.x-y,Q=V.y-I,ae=U*U+Q*Q;(ae<$||Math.abs(ae-$)<1&&V.depth<ee)&&(B=G,$=ae,ee=V.depth)}return B},z=(E,_)=>{let N=t.gpu(),P=t.pick();if(!N||!P)return-1;P.syncFromSeatProgram(N.seatProgram);let g=e.canvas.getBoundingClientRect(),H=e.renderer.dpr,{x:K,y:Y}=Ao(E,_,g,H,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),y=Math.max(2,Math.round(8*H));return P.pick(n.camera,K,Y,y)};return{onDown:S,onMove:O,onUp:E=>{if(E.pointerId!==M)return;let _=!R&&performance.now()-v<c;if(M=-1,w){w=!1;return}let N=t.gpu(),P=t.pick();if(!_||!N||!P)return;let g=z(E.clientX,E.clientY);if(t.focusedSectionId()&&g>=0){let Y=l[g],y=Y?m.get(Y):void 0;if(y&&y!==t.focusedSectionId()&&p(y))return}if(t.focusedSectionId()&&g<0&&(g=D(E.clientX,E.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&g<0){let Y=D(E.clientX,E.clientY,null,72,!1),y=Y>=0?l[Y]:void 0,I=y?m.get(y):void 0;if(I&&I!==t.focusedSectionId()&&p(I))return}if(!t.focusedSectionId()){g<0&&(g=D(E.clientX,E.clientY,null,42,!1));let Y=g>=0?l[g]:void 0,y=Y?m.get(Y):void 0;if(y&&p(y))return}if(g<0||g>=l.length){t.selection().size&&(u([]),r.onViewTargetChange?.(null));return}let H=l[g],K=xe[Math.round(i.seats.iState[g]??0)]??"available";if(K!=="available"&&K!=="selected"){r.onSeatInspect?.(H,K);return}if(t.selection().has(H)&&t.selection().size===1){u([]),r.onViewTargetChange?.(null),r.onSeatPick?.(H);return}u([H]),x(H),a.seatPicked(H,m.get(H)),r.onSeatPick?.(H)}}}var rt=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,i=1/0,o=-1/0,r=-1/0;for(let p=0;p<this.count;p++){let u=e[p*3],x=e[p*3+2];u<n&&(n=u),u>o&&(o=u),x<i&&(i=x),x>r&&(r=x)}let s=Math.max(o-n,.001),a=Math.max(r-i,.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=n,this.minZ=i;let l=this.cols*this.rows,m=new Int32Array(l+1),b=p=>{let u=Math.min(this.cols-1,Math.max(0,Math.floor((e[p*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[p*3+2]-i)/this.cell)))*this.cols+u};for(let p=0;p<this.count;p++)m[b(p)+1]++;for(let p=0;p<l;p++)m[p+1]+=m[p];let c=new Int32Array(this.count),f=m.slice(0,l);for(let p=0;p<this.count;p++)c[f[b(p)]++]=p;this.cellStart=m,this.cellItems=c}gather(e,n,i,o){this.ensureGrid();let r=this.cellStart,s=this.cellItems;if(!r||!s)return 0;let a=o.length,l=i*i,m=Math.floor((e-this.minX)/this.cell),b=Math.floor((n-this.minZ)/this.cell),c=Math.ceil(i/this.cell)+1,f=this.iPosition,p=0;for(let u=0;u<=c&&p<a;u++){let x=b-u,C=b+u,F=m-u,v=m+u;for(let M=x;M<=C&&p<a;M++){if(M<0||M>=this.rows)continue;let R=M===x||M===C;for(let w=F;w<=v&&p<a;w++){if(!R&&w!==F&&w!==v){w=v-1;continue}if(w<0||w>=this.cols)continue;let S=M*this.cols+w;for(let O=r[S],D=r[S+1];O<D&&p<a;O++){let z=s[O],j=f[z*3]-e,E=f[z*3+2]-n;j*j+E*E<=l&&(o[p++]=z)}}}}return p}};var it=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Qe);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new rt(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,i=this.ctx.gpu();if(!i)return;if(!e){i.nearSeatCount()&&i.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<St)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>wt){i.nearSeatCount()&&i.setNearSeats(this.nearBuf,0);return}let a=this.nearIndex.gather(o.x,o.z,wt,this.nearBuf);a===0&&i.nearSeatCount()===0||i.setNearSeats(this.nearBuf,a)}ease(e,n,i){let o=1-Math.exp(-e*9),r=1-Math.exp(-e*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:r),this.structureDetailMix+=(i-this.structureDetailMix)*(i>this.structureDetailMix?o:r),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(i-this.structureDetailMix)<.01&&(this.structureDetailMix=i)}};import{Quat as Pr,Vec3 as Cr}from"ogl";function sn(t){let{container:e,model:n,opts:i,orbit:o,cinematic:r,analytics:s,loop:a,labelOverlay:l,stageAzimuth:m,overviewFraming:b}=t,c=0,f=-1,p=(w,S,O=28)=>{o.camera.position.set(w[0],w[1],w[2]),o.camera.lookAt(new Cr(S[0],S[1],S[2])),o.camera.fov=O,o.camera.updateProjectionMatrix()},u=document.createElement("button");u.className="sl-3d-overview-control sl-3d-icon-control",u.type="button",u.textContent="\u2302",u.setAttribute("aria-label","Fit the active level or whole venue in view"),u.dataset.tooltip="Fit view",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 x=()=>{u.textContent="\u2302"};x();let C=w=>{f=w;let S=t.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=w,S.solidProgram.uniforms.uFocusFloor.value=w,S.chairProgram.uniforms.uFocusFloor.value=w),t.showSectionSeatLabels(null)},F=()=>{if(t.isDisposed())return;i.onViewTargetChange?.(null),i.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 w=f>=0?n.floors[f]:null;if(t.setNearFieldDetailEnabled(!!w),t.setSeatViewLocked(!1),v(),t.removeArriveChip(),t.setNavigationMode("orbit"),w){let S=w.focalWorld[0]-w.center[0],O=w.focalWorld[2]-w.center[2],D=Math.hypot(S,O)>w.radius*.12?Math.atan2(S,O):m,z={center:w.center,radius:w.radius,box:w.box},j={polarDeg:58,margin:1.12};t.reducedMotion()?o.frame(z,!1,D,!1,j):o.frameSoft(z,D,!1,j)}else t.reducedMotion()?o.frame(n.bounds,!1,m,i.portraitOverviewCrop===!0,b):o.frameSoft(n.bounds,m,i.portraitOverviewCrop===!0,b);t.showSectionSeatLabels(null),a.requestRender()},v=()=>{c++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),r.active&&(r.cancel(),o.resumeAfterFlight(n.focalWorld))},M=w=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let S=n.seats.idToIndex.get(w);if(S===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),i.onViewTargetChange?.(w),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 O=t.inSeatView()&&i.arriveAtSeatEye===!0;t.setSeatStepping(O),t.setSeatViewLocked(!1);let D=++c;O?t.showArriveChip(w,D):t.removeArriveChip();let{eye:z,focal:j}=t.resolvedSeatViewPose(w,S),E=i.arriveAtSeatEye?t.seatViewArrival(w,S):null,_=E?E.focal:j,N=[o.camera.position.x,o.camera.position.y,o.camera.position.z],P=Dt(N,E?.eye??z,_,n.bounds.center,n.bounds.radius),g=E?E.eye:i.arriveAtSeatEye?z:P.finalPos,H=E?E.fov:i.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?90:65:28,K=[P.waypoints[0],P.waypoints[1],g];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),p(g,_,H),a.requestRender(),s.cinematicSkipped(),t.isDisposed()||o.syncFromCamera(),t.setSeatViewLocked(i.arriveAtSeatEye===!0),E&&t.enterSeatView(E.stops),t.showArriveChip(w,D),Promise.resolve();let Y=new Pr().copy(o.camera.quaternion),y=_o(o.camera,g,_);a.requestRender();let I=O?700:2500;return r.start(K,Y,y,I,H).then(()=>{t.isDisposed()||D!==c||(t.setSeatStepping(!1),s.cinematicPlayed(I),o.resumeAfterFlight(_),t.setSeatViewLocked(i.arriveAtSeatEye===!0),E&&t.enterSeatView(E.stops),a.requestRender(),t.showArriveChip(w,D))})},R=w=>{let S=n.sections.find(j=>j.id===w);if(!S||S.seatCount===0)return!1;t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),r.cancel(),t.removeArriveChip(),n.floors.length>1&&f!==S.floorIndex&&C(S.floorIndex),t.setNavigationMode("pan"),t.showSectionSeatLabels(w);let O=S.focalWorld[0]-S.center[0],D=S.focalWorld[2]-S.center[2],z=Math.hypot(O,D)>S.radius*.12?Math.atan2(O,D):void 0;return o.frame({center:S.center,radius:Math.max(5,S.radius*.5)},!1,z),i.onSectionFocusChange?.(w),a.requestRender(),!0};return u.addEventListener("click",F),{overviewChip:u,layoutOverviewChip:x,flightGen:()=>c,focusedFloor:()=>f,applyFloorFocus:C,placeCameraFinal:p,cancelFlight:v,focusOverview:F,flyToSeat:M,focusSectionCamera:R}}function kt(t){let e=performance.now();return{model:Te(t),buildMs:performance.now()-e,source:"main"}}function Ar(t){if(typeof Worker>"u")return Promise.resolve(kt(t));let e;try{e=new Worker(new URL("./scene/scene.worker.js",import.meta.url),{type:"module"})}catch{return Promise.resolve(kt(t))}return new Promise(n=>{let i=!1,o=a=>{i||(i=!0,clearTimeout(s),e.terminate(),n(a))},r=()=>o(kt(t)),s=window.setTimeout(r,15e3);e.onerror=r,e.onmessage=a=>{o({model:a.data.model,buildMs:a.data.buildMs,source:"worker"})},e.postMessage(t)})}var Er=Math.PI/180,Fr=6,Rr=500;function da(t,e,n={}){let i=performance.now(),o=e.prepared?.model??Te(e),r=new nt(n.onAnalytics),s=new Array(o.seats.count);for(let[d,h]of o.seats.idToIndex)s[h]=d;let a=new Map(e.seats.map(d=>[d.id,d])),l=new Map;for(let d of e.seats){if(!d.rowId)continue;let h=l.get(d.rowId);h?h.push(d.id):l.set(d.rowId,[d.id])}let m=new Map;for(let d of e.seats)m.set(d.id,d.sectionId);let b=e.doc.floors?.some(h=>(h.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(h=>h.objects)??e.doc.objects).some(h=>h.type==="section"&&((h.height??0)>0||(h.rake??0)>0)),c=null,f=null,p=!1,u=!1,x=!1,C=new Map,F=null,v=null,M=null,R=new Map,w=null,S=()=>{M===null&&(M=t.style.zIndex,t.style.zIndex="20")},O=()=>{M!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=M),M=null)},D=!1,z=()=>D?ne.focusedFloor():-1,j=()=>{c=Po(P.gl,o),f=new et(P.renderer,c.seatGeometry,c.chairGeometry,c.solidGeometry,o.seats.count),P.setClearColor(o.theme.background.top),f.setRestoreClear(o.theme.background.top),c.seatProgram.uniforms.uSeatRadius.value=Ie*o.theme.seatScale,c.seatProgram.uniforms.uFocusFloor.value=z(),c.solidProgram.uniforms.uFocusFloor.value=z(),c.chairProgram.uniforms.uFocusFloor.value=z(),c.screenProgram&&(c.screenProgram.uniforms.uFocusFloor.value=z()),_.forceRegather()},E=!1,_=new it({model:o,orbit:()=>g,gpu:()=>c}),N=d=>_.setDetailEnabled(d),P=new Xe(t,{onContextLost:()=>{x||r.contextLost(),p=!0,V.stop(),c=null,f=null},onContextRestored:()=>{j(),p=!1,x||r.contextRestored(),V.requestRender()}}),g=new qe(P.gl,P.canvas,()=>V.requestRender(),()=>r.orbitEngaged());g.setAspect(P.aspect);let H=(e.doc.floors?.flatMap(d=>d.objects)??e.doc.objects).some(d=>d.type==="section"&&d.physical3dProvenance?.surfaceKind?.status==="inferred"),K=(()=>{if(H&&o.stages.length===0)return;let d=o.focalWorld[0]-o.bounds.center[0],h=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(d,h)>o.bounds.radius*.12?Math.atan2(d,h):void 0})(),Y=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,y=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;g.frame(o.bounds,!y&&n.skipInitialOverviewAnimation!==!0,K,n.portraitOverviewCrop===!0,Y);let I=new tt(g.camera),J=on(t),B=new Ze(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),$=o.labels,ee=()=>Xt($,o.floors.length,z());B.setLabels(ee());let L=null,G=d=>{if(L=d,B.setForcedDense(!!d),!d){B.setLabels(ee());return}let h=e.seats.filter(k=>k.sectionId===d),A=new Set(h.map(k=>k.id)),W=new Set(h.map(k=>k.rowId)),X=new Set(C.keys()),q=new Set(h.filter(k=>X.has(k.id)).map(k=>k.id)),Z=ee().filter(k=>k.kind!=="row"&&k.kind!=="seat"||(k.kind==="row"?W.has(k.id.slice(4)):A.has(k.id.slice(5))&&(q.size===0||q.has(k.id.slice(5)))));if(o.seatCount<=6e3&&q.size===0){B.setLabels(Z);return}let te=q.size?h.filter(k=>q.has(k.id)):h,he=new Set(te.map(k=>`seat:${k.id}`)),de=te.flatMap(k=>{let re=o.seats.idToIndex.get(k.id);if(re===void 0)return[];let se=re*3;return[{id:`seat:${k.id}`,kind:"seat",text:k.displayLabel||k.label,anchor:[o.seats.iPosition[se],o.seats.iPosition[se+1]+(X.has(k.id)?1.05:.55),o.seats.iPosition[se+2]]}]});B.setLabels([...Z.filter(k=>!he.has(k.id)),...de])};j();let T=null,V=new je(d=>{if(p||!c||u)return!1;let A=I.active?I.update(performance.now()):T?.active?T.update(performance.now()):g.update(),W=z()>=0?o.floors[z()]:null,X=W?.radius??o.bounds.radius,q=ro(g.currentDistance,X),Z=E?{center:[g.camera.position.x,g.camera.position.y,g.camera.position.z],radius:520}:o.renderBounds;g.updateClipping(Z);let te=W?.center??o.renderBounds.center,he=W?.radius??o.renderBounds.radius,de=(le,Ve)=>Math.hypot(g.camera.position.x-le[0],g.camera.position.y-le[1],g.camera.position.z-le[2])<=Ve*(_.detailVisible?1.8:1.55),k=de(te,he);if(!k&&L){let le=o.sections.find(Ve=>Ve.id===L);le&&(k=de(le.center,Math.max(12,le.radius*2)))}_.detailVisible=k;let re=c.seatProgram.uniforms;re.uSeatScale.value=q.scale,re.uSeatFade.value=q.fade;let se=!!W&&io(W.seatCount,P.canvas.clientWidth||1,P.canvas.clientHeight||1),He=ao(o.seats.count,X,g.currentDistance,g.camera.fov,P.canvas.clientHeight||1),De=_.detailVisible||se||He?1:0,We=_.detailVisible||z()>=0||o.floors.length>1?1:0;return _.ease(d,De,We),re.uSeatDetail.value=_.seatDetailMix,c.solidProgram.uniforms.uStructureDetail.value=_.structureDetailMix,re.uMinPixels.value=q.minPixels,re.uPixelToWorld.value=2*Math.tan(g.camera.fov*Er/2)/Math.max(1,P.pixelHeight),_.update(_.detailVisible),P.renderer.render({scene:c.background,clear:!0}),P.renderer.render({scene:c.main,camera:g.camera,clear:!1}),B.update(g.camera.projectionViewMatrix,P.canvas.clientWidth||1,P.canvas.clientHeight||1,g.currentDistance,X,[g.camera.position.x,g.camera.position.y,g.camera.position.z]),A||_.seatDetailMix!==De||_.structureDetailMix!==We}),U=typeof ResizeObserver<"u"?new ResizeObserver(()=>dt.resize()):null;U?.observe(t);let Q=d=>{let h=X=>{let q=o.seats.idToIndex.get(X);return q===void 0?void 0:o.seats.iState[q]},{updates:A,next:W}=Fo(C,d,h);if(C=W,B.setSelectedSeatIds(C.keys()),L&&G(L),A.length){let X=ft(o.seats,A);c&&c.uploadSeatStateRuns(X),V.requestRender()}},ae=()=>w!==null?w:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,pe=8,Ee=d=>{if(!n.getSeatView)return null;let h=R.get(d);if(!h)for(h=Promise.resolve(n.getSeatView(d)),R.set(d,h),h.catch(()=>{R.get(d)===h&&R.delete(d)});R.size>pe;){let A=R.keys().next().value;if(A===void 0)break;R.delete(A)}return h},be=(d,h)=>{let A=a.get(d),W=Math.max(0,Math.round(o.seats.iFloor[h]??0)),X=e.doc.floors?.[W],q=o.floors[W],Z=X?.focalPoint??e.doc.focalPoint,te=q?{x:q.focalWorld[0]/we,y:q.focalWorld[2]/we}:Z,he=A?.focalPoint?{x:A.focalPoint.x+te.x-Z.x,y:A.focalPoint.y+te.y-Z.y}:te,de=[o.seats.iPosition[h*3],o.seats.iPosition[h*3+1],o.seats.iPosition[h*3+2]];return Lo(de,he,X?.baseHeightM??0,A?.eyeHeightM)},Ge=()=>(t.clientWidth||P.canvas.clientWidth)<=520,at=null,_t=null,ln=async(d,h,A)=>{if(!n.getSeatView||x||A!==ne.flightGen())return;let W;try{W=await en()}catch{if(r.panoramaFailed(d,"mount"),!x&&A===ne.flightGen()){let X=lt(d,A,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(x||A!==ne.flightGen()||!at))return _t??=W.createOpenPanorama(at),_t(d,h,A)},st=nn({container:t,model:o,opts:n,expandedSeatById:a,seatIdsByRow:l,isNarrow:Ge,isDisposed:()=>x,flightGen:()=>ne.flightGen(),flyToSeat:d=>Ot(d),openPanorama:(d,h,A)=>ln(d,h,A)}),lt=st.show,ct=st.remove,cn=st.layout,ye=rn({container:t,orbit:g,isNarrow:Ge}),un=ye.element,Fe=ye.setNavigationMode,dn=ye.layout,mn=ye.utilityControls,Re=null,Lt=!1,Be=d=>{ye.setSeatViewLocked(d),d||T?.exit()};T=Jo({canvas:P.canvas,camera:g.camera,requestRender:()=>V.requestRender(),reducedMotion:ae,onStopChange:d=>{let h=d??(Lt?"seat":null);Re=h;try{n.onSeatViewStopChange?.(h)}catch{}},onApplied:()=>{x||g.syncFromCamera()}});let pn=Yo(o.stages,o.focalWorld,o.bounds.groundY??0),hn=(d,h)=>{let{eye:A}=be(d,h),W=(t.clientWidth||P.canvas.clientWidth||1)/Math.max(1,t.clientHeight||P.canvas.clientHeight||1),X=qo(A,pn,W);if(n.seatViewStops===!1)return{...X,stops:[]};let q=m.get(d),Z=q?o.sections.find(te=>te.id===q):void 0;return{...X,stops:jo(X,{aspect:W,section:Z&&Z.seatCount>0?{center:Z.center,radius:Z.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},ne=sn({container:t,model:o,opts:n,orbit:g,cinematic:I,analytics:r,loop:V,labelOverlay:B,stageAzimuth:K,overviewFraming:Y,gpu:()=>c,isDisposed:()=>x,panorama:()=>F,setPanorama:d=>{F=d},setPanoramaSphereVisible:d=>{E=d},panoramaLoadAbort:()=>v,setPanoramaLoadAbort:d=>{v=d},setFrozen:d=>{u=d},restorePanoramaLayer:O,reducedMotion:ae,resolvedSeatViewPose:be,showSectionSeatLabels:G,setNearFieldDetailEnabled:N,setSeatViewLocked:Be,setNavigationMode:Fe,showArriveChip:lt,removeArriveChip:ct,inSeatView:()=>Re!==null,setSeatStepping:d=>{Lt=d},seatViewArrival:(d,h)=>n.arriveAtSeatEye?hn(d,h):null,enterSeatView:d=>T?.enter(d)});D=!0;let ut=ne.overviewChip,fn=ne.layoutOverviewChip,vn=ne.applyFloorFocus,gn=ne.focusOverview,zt=ne.cancelFlight,Ot=ne.flyToSeat,Nt=ne.focusSectionCamera;mn.appendChild(ut),at={container:t,model:o,opts:n,analytics:r,orbit:g,loop:V,seatsById:a,ensureSeatView:Ee,resolvedSeatViewPose:be,gpu:()=>c,gl:P.gl,isContextLost:()=>p,isDisposed:()=>x,flightGen:()=>ne.flightGen(),setPanorama:d=>{F=d},getLoadAbort:()=>v,setLoadAbort:d=>{v=d},setPanoramaSphereVisible:d=>{E=d,d&&T?.exit()},setFrozen:d=>{u=d},raisePanoramaLayer:S,restorePanoramaLayer:O,getOverviewChip:()=>ut,labelOverlay:B,reducedMotion:ae,removeArriveChip:ct,showArriveChip:lt};let ue=an({glctx:P,orbit:g,model:o,seats:e.seats,opts:n,cinematic:I,analytics:r,seatIdByIndex:s,sectionIdBySeatId:m,tapSlop:Fr,tapMs:Rr,gpu:()=>c,pick:()=>f,seatViewLocked:()=>ye.seatViewLocked(),focusedSectionId:()=>L,selection:()=>C,cancelFlight:zt,focusSectionCamera:Nt,setSelection:Q,ensureSeatView:Ee});P.canvas.addEventListener("pointerdown",ue.onDown),P.canvas.addEventListener("pointermove",ue.onMove),P.canvas.addEventListener("pointerup",ue.onUp),P.canvas.addEventListener("pointercancel",ue.onUp),V.requestRender();let dt={setAvailability(d){let h=Eo(C,d),A=ft(o.seats,h);A.length&&c&&c.uploadSeatStateRuns(A),V.requestRender()},setSelection:Q,setNavigationMode:Fe,zoomIn(){g.zoomBy(.82),V.requestRender()},zoomOut(){g.zoomBy(1.22),V.requestRender()},flyToSeat:Ot,focusOverview:gn,seatViewStop:()=>Re,recentreSeatView:()=>T?.recentre()??!1,resize(){let{width:d,height:h}=P.resize();g.setAspect(d/Math.max(1,h)),cn(),dn(),fn(),V.requestRender()},stats(){return{...V.stats(),drawCalls:c?c.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let d=V.stats(),h=P.canvas.clientWidth||1,A=P.canvas.clientHeight||1,W=o.bounds.center,X=me(g.camera.projectionViewMatrix,[W[0],o.bounds.box.min[1],W[2]],h,A),q=me(g.camera.projectionViewMatrix,[W[0],o.bounds.box.max[1],W[2]],h,A),Z=o.bounds.box,te=[Z.min[0],Z.max[0]].flatMap(k=>[Z.min[1],Z.max[1]].flatMap(re=>[Z.min[2],Z.max[2]].map(se=>me(g.camera.projectionViewMatrix,[k,re,se],h,A)))).filter(k=>Number.isFinite(k.x)&&Number.isFinite(k.y)&&Number.isFinite(k.depth)),he=te.length?(()=>{let k=Math.min(...te.map(fe=>fe.x)),re=Math.max(...te.map(fe=>fe.x)),se=Math.min(...te.map(fe=>fe.y)),He=Math.max(...te.map(fe=>fe.y)),De=Math.max(0,k),We=Math.min(h,re),le=Math.max(0,se),Ve=Math.min(A,He),Ue=Math.max(0,We-De),mt=Math.max(0,Ve-le);return{box:{x:De,y:le,width:Ue,height:mt},horizontalFillRatio:Ue/h,verticalFillRatio:mt/A,visibleAreaRatio:Ue*mt/(h*A),clippedEdges:[...se<0?["top"]:[],...re>h?["right"]:[],...He>A?["bottom"]:[],...k<0?["left"]:[]]}})():void 0,de=String(P.gl.getParameter(P.gl.VERSION)??"");return{viewport:{width:h,height:A},context:{webgl2:/webgl\s*2/i.test(de),lost:p},frame:{rendered:d.rendered,idle:d.idle},camera:{position:[g.camera.position.x,g.camera.position.y,g.camera.position.z],distance:g.currentDistance,verticalFovDeg:g.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:b,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:X.visible&&q.visible?Math.abs(X.y-q.y):0},labels:B.qualityEvidence(),framing:he,...Re?{seatView:{fovDeg:g.camera.fov,stop:Re}}:{}}},getQualityReport(){return Ct(dt.getQualityEvidence())},loseContextForTest(){P.simulateContextLossCycle()},floors(){return o.floors},focusFloor(d){if(d!==null&&!o.floors.some(A=>A.index===d))return!1;let h=d??-1;if(N(d!==null),Be(!1),vn(h),Fe("orbit"),d===null)I.cancel(),ae()?g.frame(o.bounds,!1,K,n.portraitOverviewCrop===!0,Y):g.frameSoft(o.bounds,K,n.portraitOverviewCrop===!0,Y);else{let A=o.floors[d];if(A.seatCount>0){I.cancel();let W=A.focalWorld[0]-A.center[0],X=A.focalWorld[2]-A.center[2],q=Math.hypot(W,X)>A.radius*.12?Math.atan2(W,X):K;g.frame({center:A.center,radius:A.radius,box:A.box},!1,q,!1,{polarDeg:58,margin:1.12})}}return V.requestRender(),!0},zones(){return o.zones},focusZone(d){let h=o.zones.find(q=>q.id===d);if(!h||h.seatCount===0)return!1;N(!1),Be(!1),I.cancel(),Fe("orbit"),G(null),n.onSectionFocusChange?.(null);let A=h.focalWorld[0]-h.center[0],W=h.focalWorld[2]-h.center[2],X=Math.hypot(A,W)>h.radius*.12?Math.atan2(A,W):void 0;return g.frame({center:h.center,radius:h.radius*1.25},!1,X),V.requestRender(),!0},sections(){return o.sections},focusSection(d){return Nt(d)},rows(d){return d?o.rows.filter(h=>h.sectionId===d):o.rows},seatsInRow(d){return e.seats.filter(h=>h.rowId===d).map(h=>({id:h.id,label:h.displayLabel||h.label}))},focusRow(d){let h=o.rows.find(A=>A.id===d);return!h||h.seatCount===0?!1:(N(!0),Be(!1),I.cancel(),Fe("pan"),h.sectionId&&(G(h.sectionId),n.onSectionFocusChange?.(h.sectionId)),g.frame({center:h.center,radius:Math.max(2.5,h.radius*.65)}),V.requestRender(),!0)},setReducedMotionForTest(d){w=d},dispose(){x=!0,ct(),ut.remove(),un.remove(),zt(),T?.dispose(),V.stop(),B.dispose(),U?.disconnect(),F&&(F.dispose(),F=null),O(),J(),P.canvas.removeEventListener("pointerdown",ue.onDown),P.canvas.removeEventListener("pointermove",ue.onMove),P.canvas.removeEventListener("pointerup",ue.onUp),P.canvas.removeEventListener("pointercancel",ue.onUp),g.dispose(),f&&f.dispose(),c&&c.dispose(),c=null,f=null,P.dispose()}};return r.opened(o.seatCount,b,e.prepared?.buildMs??performance.now()-i,e.prepared?.source??"inline"),dt}export{Cn as VENUE3D_QUALITY_REPORT_VERSION,Te as buildSceneModel,Ct as inspectVenue3DQualityEvidence,da as mountVenue3D,Ar as prepareVenue3D};
622
+ void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:T},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let k=new ze(t,{geometry:q,program:x});k.frustumCulled=!1,k.setParent(o),$.screenProgram=x,W=!0,$.drawCalls=3+(b?1:0)+1},z.src=ee.contentImageUrl}return $}import{Mesh as At,RenderTarget as Zn,Transform as Ft}from"ogl";function $n(t,e,o){let r=t+(e<<8)+(o<<16);return r===0?-1:r-1}function Ao(t,e,o,r,n,a){let s=-1,i=1/0;for(let l=0;l<o;l++)for(let p=0;p<e;p++){let v=(l*e+p)*4,c=$n(t[v],t[v+1],t[v+2]);if(c<0||c>=a)continue;let f=p-r,m=l-n,u=f*f+m*m;u<i&&(i=u,s=c)}return s}function Fo(t,e,o,r,n,a){let s=t-o.left,i=e-o.top,l=Math.round(s*r),p=Math.round((o.height-i)*r);return{x:Math.max(0,Math.min(n-1,l)),y:Math.max(0,Math.min(a-1,p))}}var Jn=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],et=class{constructor(e,o,r,n,a){this.seatScene=new Ft;this.chairScene=new Ft;this.solidScene=new Ft;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=a,this.seatProg=vo(this.gl),this.chairProg=go(this.gl),this.depthProg=bo(this.gl);let s=new At(this.gl,{geometry:o,program:this.seatProg});s.frustumCulled=!1,s.setParent(this.seatScene);let i=new At(this.gl,{geometry:r,program:this.chairProg});i.frustumCulled=!1,i.setParent(this.chairScene);let l=new At(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 Jn)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 Zn(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 a=this.gl,s=this.ensureTarget(),i=a.drawingBufferWidth,l=a.drawingBufferHeight,p=Math.max(0,o-n),v=Math.max(0,r-n),c=Math.max(1,Math.min(i,o+n+1)-p),f=Math.max(1,Math.min(l,r+n+1)-v);a.enable(a.SCISSOR_TEST),a.scissor(p,v,c,f);let[m,u,M]=this.restoreClear;a.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}),a.clearColor(m,u,M,1),a.disable(a.SCISSOR_TEST);let S=new Uint8Array(c*f*4);return this.renderer.bindFramebuffer(s),a.readPixels(p,v,c,f,a.RGBA,a.UNSIGNED_BYTE,S),this.renderer.bindFramebuffer(),Ao(S,c,f,o-p,r-v,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Eo(t,e){let o=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,Ht(r.state)):o.push(r);return o}function Ro(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),a=[];for(let[s,i]of t)r.has(s)||(a.push({seatId:s,state:xe[i]??"available"}),n.delete(s));for(let s of r){if(n.has(s))continue;let i=o(s);i!==void 0&&(n.set(s,i),a.push({seatId:s,state:"selected"}))}return{updates:a,next:n}}import{Quat as Oe,Vec3 as or}from"ogl";function er(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function Do(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function tr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Vo(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 Et(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function Rt(t,e){return Math.max(0,Math.min(1,t+e))}function Io(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,a=Math.floor(r*n);a>=n&&(a=n-1);let s=r*n-a,i=t[Math.max(0,a-1)],l=t[a],p=t[a+1],v=t[Math.min(o-1,a+2)],c=s*s,f=c*s,m=[0,0,0];for(let u=0;u<3;u++)m[u]=.5*(2*l[u]+(-i[u]+p[u])*s+(2*i[u]-5*l[u]+4*p[u]-v[u])*c+(-i[u]+3*l[u]-3*p[u]+v[u])*f);return m}function Dt(t,e,o,r,n){let a=Vo(er(e,o));a[0]===0&&a[1]===0&&a[2]===0&&(a=[0,0,1]);let s=Do(Do(e,tr(a,2.5)),[0,1.5,0]),i=[e[0]-r[0],0,e[2]-r[2]],l=Vo(i);l[0]===0&&l[2]===0&&(l=[a[0],0,a[2]]);let p=Math.max(1,n),v=[r[0]+l[0]*p*1.3,r[1]+p*.75,r[2]+l[2]*p*1.3];return{waypoints:[t,v,s],finalPos:s}}function Vt(t,e,o=35,r=28){let n=Et(e),a=Io(t,n),s=Et(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:a,fov:o+(r-o)*s,eased:n}}function Lo(t,e,o){let r=t.position.clone(),n=new Oe().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new or(o[0],o[1],o[2]));let a=new Oe().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(n),a}var tt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new Oe;this.endQuat=new Oe;this.outQuat=new Oe;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,o,r,n=2500,a=28){return this.settle(),this.waypoints=e,this.startQuat.copy(o),this.endQuat.copy(r),this.duration=n,this.endFov=a,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:a}=Vt(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,Rt(a,.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 nr=1.02,rr=1.5;function zo(t,e,o=0,r){let n=Number.isFinite(r)?o+r:t[1]+nr;return{eye:[t[0],n,t[2]],focal:[e.x*we,o+rr,e.y*we]}}var Ae=Math.PI/180,ar=45,Oo=80,ir=.25,It=1,sr=.25,lr=12*Ae,cr=.2,ur=1.5,No=.8,Go=6,Uo=1.9,dr=2/3,pr=.12,mr=.9,hr=1.2,fr=2,Yo=.05,vr=6;function qo(t,e,o=0){if(!t.length)return{min:[e[0]-6,o,e[2]-6],max:[e[0]+6,Math.max(o+No,e[1]),e[2]+6]};let r=1/0,n=-1/0,a=1/0,s=-1/0,i=o;for(let u of t)r=Math.min(r,u.cx-u.halfX),n=Math.max(n,u.cx+u.halfX),a=Math.min(a,u.cz-u.halfZ),s=Math.max(s,u.cz+u.halfZ),i=Math.max(i,u.y);let l=n-r,p=s-a,v=Math.max(l,Math.min(p,Go))/2,c=Math.max(p,Math.min(l,Go))/2,f=(r+n)/2,m=(a+s)/2;return{min:[f-v,o,m-c],max:[f+v,Math.max(o+No,i),m+c]}}function gr(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+Uo,t.max[2]]}}function br(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+ur,e+cr,e+Uo*dr),(t.min[2]+t.max[2])/2]}function Xo(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 Bo(t,e,o){let r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2],s=Math.hypot(r,n,a)||1;r/=s,n/=s,a/=s;let i=-a,l=r,p=Math.hypot(i,l);if(p<1e-6)return 1/0;i/=p,l/=p;let v=1/0,c=-1/0;for(let f=0;f<8;f++){let m=(f&1?o.max[0]:o.min[0])-t[0],u=(f&2?o.max[1]:o.min[1])-t[1],M=(f&4?o.max[2]:o.min[2])-t[2],S=Math.max(Yo,m*r+u*n+M*a),P=(m*i+M*l)/S;P<v&&(v=P),P>c&&(c=P)}return c-v}function Ho(t,e,o){let r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2],s=Math.hypot(r,n,a)||1;r/=s,n/=s,a/=s;let i=-a,l=r,p=Math.hypot(i,l);if(p<1e-6)return 1/0;i/=p,l/=p;let v=-l*n,c=l*r-i*a,f=i*n,m=1/0,u=-1/0;for(let M=0;M<8;M++){let S=(M&1?o.max[0]:o.min[0])-t[0],P=(M&2?o.max[1]:o.min[1])-t[1],R=(M&4?o.max[2]:o.min[2])-t[2],y=Math.max(Yo,S*r+P*n+R*a),A=(S*v+P*c+R*f)/y;A<m&&(m=A),A>u&&(u=A)}return u-m}function ot(t,e){return Math.tan(t*Ae/2)*Math.max(.05,e)}function Wo(t,e,o){let r=i=>Math.max(ar,Math.min(Oo,i)),n=i=>2*Math.atan(i)/Ae,a=Number.isFinite(t)&&t>0?r(n(t/(2*ir)/Math.max(.05,o))):Oo;if(!(Number.isFinite(e)&&e>0))return a;let s=Math.min(a,r(n(e/(2*pr))));return t/(2*ot(s,o))>It?a:s}function jo(t,e,o){let r=br(e),n=[t[0],t[1],t[2]],a=0,s=0,i=m=>{if(!(m>0))return;let u=Xo(n,r);n[0]+=u.x*m,n[2]+=u.z*m,s+=m},l=e.max[1]+sr-n[1];l>0&&(n[1]+=l,a=l,i(l/Math.tan(lr)));let p=gr(e),v=Bo(n,r,e),c=Wo(v,Ho(n,r,p),o),f=v/(2*ot(c,o));for(let m=0;m<vr&&f>It;m++){let u=Math.max(1,Math.hypot(n[0]-r[0],n[2]-r[2])),M=Number.isFinite(f)?f/It:2;i(Math.min(60,u*(Math.min(4,M)-1)+.5)),v=Bo(n,r,e),c=Wo(v,Ho(n,r,p),o),f=v/(2*ot(c,o))}return{eye:n,focal:r,fov:c,raisedM:a,pulledBackM:s,stageFrameWidth:f}}function yr(t,e,o){let r=Math.tan(e*Ae/2),n=ot(e,o);return Math.max(1,t/Math.max(.05,Math.min(r,n)))}function Qo(t,e){let{aspect:o,venue:r}=e,n=t.focal,a=Xo(t.eye,n),s=f=>(f[0]-n[0])*a.x+(f[2]-n[2])*a.z,i=[{name:"seat",eye:t.eye,focal:n,fov:t.fov}],l=fr*(e.rowDepthM??mr);i.push({name:"row",eye:[t.eye[0]+a.x*l,t.eye[1]+hr,t.eye[2]+a.z*l],focal:n,fov:t.fov});let p=(f,m,u,M)=>{let S=yr(u,t.fov,o)*1.08,P=S*Math.sin(M*Ae),R=S*Math.cos(M*Ae);return{name:f,eye:[m[0]+a.x*R,m[1]+P,m[2]+a.z*R],focal:m,fov:t.fov}};e.section&&e.section.radius>0&&i.push(p("section",e.section.center,e.section.radius,14)),i.push(p("venue",r.center,Math.max(1,r.radius),26));let v=[],c=-1/0;for(let f of i){let m=s(f.eye);v.length&&m<=c+.5||(v.push(f),c=m)}return v}import{Vec3 as xr}from"ogl";var Ge=Math.PI/180,Ko=320,$o=70*Ge,wr=32*Ge,Sr=24*Ge,Zo=.0026,Mr=.22,Pr=.006,Cr=180,Ar=4,ae=(t,e,o)=>Math.max(e,Math.min(o,t)),Jo=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function en(t){let{canvas:e,camera:o}=t,r=[],n=!1,a=0,s=0,i=0,l=0,p=0,v=0,c=!1,f=[0,0],m=0,u=!1,M=null,S=null,P=new Map,R=!1,y=0,A=0,g=0,C=0,V=()=>n&&r.length?r[ae(Math.round(a),0,r.length-1)].name:null,D=()=>{let x=V();x!==M&&(M=x,t.onStopChange?.(x))},L=()=>{if(!n||!r.length)return;let x=r[ae(Math.floor(a),0,r.length-1)],T=r[ae(Math.ceil(a),0,r.length-1)],J=ae(a-Math.floor(a),0,1),H=(be,Be)=>be+(Be-be)*J,$=[H(x.eye[0],T.eye[0]),H(x.eye[1],T.eye[1]),H(x.eye[2],T.eye[2])],ee=[H(x.focal[0],T.focal[0]),H(x.focal[1],T.focal[1]),H(x.focal[2],T.focal[2])],z=ee[0]-$[0],B=ee[1]-$[1],k=ee[2]-$[2],I=Math.hypot(z,B,k)||1,Y=Math.atan2(z,k),Q=Math.asin(ae(B/I,-1,1)),ie=Y+s,me=ae(Q+i,-80*Ge,80*Ge),Fe=Math.cos(me)*I;z=Math.sin(ie)*Fe,B=Math.sin(me)*I,k=Math.cos(ie)*Fe,o.position.set($[0],$[1],$[2]),o.fov=H(x.fov,T.fov),o.updateProjectionMatrix(),o.lookAt(new xr($[0]+z,$[1]+B,$[2]+k)),t.onApplied?.()},N=()=>{if(!n||!r.length)return;let x=ae(Math.round(a),0,r.length-1);if(t.reducedMotion()){c=!1,a=x,L(),D(),t.requestRender();return}if(Math.abs(x-a)<.001){c=!1,D();return}l=a,p=x,v=performance.now(),c=!0,t.requestRender()},E=x=>{!n||r.length<2||(c=!1,a=ae(a+x,0,r.length-1),L(),D(),t.requestRender())},G=(x,T)=>{n&&(c=!1,u=!1,s=ae(s-x*Zo,-$o,$o),i=ae(i-T*Zo,-Sr,wr),L(),t.requestRender())},O=x=>{n&&(P.set(x.pointerId,{x:x.clientX,y:x.clientY}),P.size===1?(R=!0,C=0,y=x.clientX,A=x.clientY):P.size===2&&(R=!1,g=w()))},w=()=>{let x=[...P.values()];return x.length<2?0:Math.hypot(x[0].x-x[1].x,x[0].y-x[1].y)},b=x=>{if(!n||!P.has(x.pointerId))return;if(P.set(x.pointerId,{x:x.clientX,y:x.clientY}),P.size>=2){let H=w();g>0&&E((g-H)*Pr),g=H;return}if(!R)return;let T=x.clientX-y,J=x.clientY-A;y=x.clientX,A=x.clientY,C+=Math.abs(T)+Math.abs(J),!(C<=Ar)&&G(T,J)},W=x=>{P.delete(x.pointerId)&&(P.size<2&&(g=0),P.size===0&&(R=!1,N()))},K=x=>{if(!n)return;x.preventDefault();let T=x.deltaMode===1?16:x.deltaMode===2?100:1,J=ae(x.deltaY*T/100,-2,2);E(J*Mr),S&&clearTimeout(S),S=setTimeout(()=>{S=null,N()},Cr)},q=()=>{n&&(n=!1,c=!1,u=!1,r=[],P.clear(),R=!1,S&&(clearTimeout(S),S=null),M!==null&&(M=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",O),e.addEventListener("pointermove",b),e.addEventListener("pointerup",W),e.addEventListener("pointercancel",W),e.addEventListener("wheel",K,{passive:!1}),{get active(){return n},enter(x){if(x.length<2){q();return}r=x,n=!0,a=0,s=0,i=0,c=!1,u=!1,M=null,L(),D(),t.requestRender()},exit:q,recentre(){return n?Math.abs(s)<1e-4&&Math.abs(i)<1e-4?!0:t.reducedMotion()?(u=!1,s=0,i=0,L(),t.requestRender(),!0):(f=[s,i],m=performance.now(),u=!0,t.requestRender(),!0):!1},update(x){if(!n)return!1;let T=!1;if(u){let J=ae((x-m)/Ko,0,1),H=1-Jo(J);s=f[0]*H,i=f[1]*H,J>=1?(u=!1,s=0,i=0):T=!0}if(c){let J=ae((x-v)/Ko,0,1);a=l+(p-l)*Jo(J),J>=1?(c=!1,a=p,D()):T=!0}return L(),T},currentStop:V,dispose(){q(),e.removeEventListener("pointerdown",O),e.removeEventListener("pointermove",b),e.removeEventListener("pointerup",W),e.removeEventListener("pointercancel",W),e.removeEventListener("wheel",K)}}}var Tt=null;function tn(){return Tt??=import("../openPanorama-HGRYMWKC.js").catch(t=>{throw Tt=null,t}),Tt}var on=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),nt=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=on(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(on()-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 nn(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function rn(t){let{container:e,model:o,opts:r,expandedSeatById:n,seatIdsByRow:a,isNarrow:s}=t,i=null,l=()=>{if(!i)return;let c=s();Object.assign(i.style,c?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},p=()=>{i?.remove(),i=null};return{show:(c,f,m=!1)=>{if(p(),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 M=r.chrome?.caption!==!1,S=r.chrome?.seatStepper!==!1;if(!M&&!S)return null;let P=n.get(c),R=P?.sectionId?o.sections.find(N=>N.id===P.sectionId):void 0,y=P?.label??c;u.setAttribute("aria-label",`Explore views near ${R?.label?`${R.label}, `:""}seat ${y}`);let A=document.createElement("span");A.textContent=r.seatViewCaption?.(c)??["Live 3D seat view",R?.label,y].filter(Boolean).join(" \xB7 "),Object.assign(A.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),M&&u.appendChild(A);let g=document.createElement("div");Object.assign(g.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),u.appendChild(g);let C=P?.rowId?a.get(P.rowId):void 0,V=C?.indexOf(c)??-1,D=V>=0?[C?.[V-1],C?.[V+1]]:[void 0,void 0],L=(N,E,G,O=!1)=>{let w=document.createElement("button");w.type="button",w.textContent=N,w.setAttribute("aria-label",E),Object.assign(w.style,{minHeight:"44px",padding:O?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),O||(w.style.minWidth="44px"),O&&(w.dataset.panoramaTrigger=""),w.addEventListener("click",G),g.appendChild(w)};if(S&&D[0]){let N=n.get(D[0])?.label??D[0];L("\u2039",`View previous seat ${N}`,()=>{t.flyToSeat(D[0])})}if(S&&r.getSeatView){let N=r.seatViewActionLabel?.(c)??"Open 360\xB0 panorama";L(m?`\u21BB Retry ${N}`:`\u25C9 ${N}`,`${m?"Retry":N} from seat ${y}`,()=>{if(t.isDisposed()||f!==t.flightGen()){p();return}p(),t.openPanorama(c,400,f)},!0)}if(S&&D[1]){let N=n.get(D[1])?.label??D[1];L("\u203A",`View next seat ${N}`,()=>{t.flyToSeat(D[1])})}return!g.childElementCount&&!M?null:(e.appendChild(u),i=u,l(),u)},remove:p,layout:l}}function an(t){let{container:e,orbit:o,isNarrow:r}=t,n=document.createElement("div"),a=!1;n.className="sl-3d-navigation-controls",Object.assign(n.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D drag mode"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let i=document.createElement("div");i.setAttribute("role","group"),i.setAttribute("aria-label","3D view controls"),Object.assign(i.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let l=document.createElement("button");l.type="button",l.textContent="\u21BB",l.setAttribute("aria-label","Drag to rotate the 3D venue"),l.dataset.tooltip="Rotate venue";let p=document.createElement("button");p.type="button",p.textContent="\u2725",p.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),p.dataset.tooltip="Move venue";let v=document.createElement("button");v.type="button",v.textContent="\u2212",v.setAttribute("aria-label","Zoom out of the 3D venue"),v.dataset.tooltip="Zoom out";let c=document.createElement("button");c.type="button",c.textContent="+",c.setAttribute("aria-label","Zoom into the 3D venue"),c.dataset.tooltip="Zoom in";for(let S of[l,p,v,c])S.className="sl-3d-icon-control",Object.assign(S.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});s.append(l,p),i.append(c,v);let f=S=>{o.setPrimaryDragMode(S);let P=S==="orbit";l.setAttribute("aria-pressed",String(P)),p.setAttribute("aria-pressed",String(!P)),l.style.background=P?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",p.style.background=P?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",n.title=P?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};l.addEventListener("click",()=>f("orbit")),p.addEventListener("click",()=>f("pan")),v.addEventListener("click",()=>o.zoomBy(1.22)),c.addEventListener("click",()=>o.zoomBy(.82)),n.append(s,i),f("orbit"),e.appendChild(n);let m=t.enabled!==!1,u=()=>{let S=r();n.style.display=a||!m?"none":"flex",n.style.right=S?"12px":"14px",n.style.bottom=S?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",s.style.display=S?"none":"flex",c.style.display=S?"none":"",v.style.display=S?"none":""};return u(),{element:n,utilityControls:i,setNavigationMode:f,setSeatViewLocked:S=>{a=S,o.setInteractionEnabled(!S),u()},seatViewLocked:()=>a,layout:u}}function sn(t){let{glctx:e,orbit:o,model:r,seats:n,opts:a,cinematic:s,analytics:i,seatIdByIndex:l,sectionIdBySeatId:p,tapSlop:v,tapMs:c,cancelFlight:f,focusSectionCamera:m,setSelection:u,ensureSeatView:M}=t,S=0,P=0,R=0,y=-1,A=!1,g=!1,C=E=>{t.seatViewLocked()||y===-1&&(y=E.pointerId,S=E.clientX,P=E.clientY,R=performance.now(),A=!1,g=s.active,s.active&&(i.cinematicCancelled(),f(),a.onViewTargetChange?.(null)))},V=E=>{E.pointerId===y&&Math.hypot(E.clientX-S,E.clientY-P)>v&&(A=!0)},D=(E,G,O,w,b)=>{let W=e.canvas.getBoundingClientRect(),K=e.canvas.clientWidth||W.width||1,q=e.canvas.clientHeight||W.height||1,x=E-W.left,T=G-W.top,J=w*w,H=-1,$=J,ee=1/0;for(let z of n){if(O&&z.sectionId!==O)continue;let B=r.seats.idToIndex.get(z.id);if(B===void 0)continue;if(b){let me=Math.round(r.seats.iState[B]??0);if(me!==0&&me!==3)continue}let k=B*3,I=pe(o.camera.projectionViewMatrix,[r.seats.iPosition[k],r.seats.iPosition[k+1]+.55,r.seats.iPosition[k+2]],K,q);if(!I.visible)continue;let Y=I.x-x,Q=I.y-T,ie=Y*Y+Q*Q;(ie<$||Math.abs(ie-$)<1&&I.depth<ee)&&(H=B,$=ie,ee=I.depth)}return H},L=(E,G)=>{let O=t.gpu(),w=t.pick();if(!O||!w)return-1;w.syncFromSeatProgram(O.seatProgram);let b=e.canvas.getBoundingClientRect(),W=e.renderer.dpr,{x:K,y:q}=Fo(E,G,b,W,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),x=Math.max(2,Math.round(8*W));return w.pick(o.camera,K,q,x)};return{onDown:C,onMove:V,onUp:E=>{if(E.pointerId!==y)return;let G=!A&&performance.now()-R<c;if(y=-1,g){g=!1;return}let O=t.gpu(),w=t.pick();if(!G||!O||!w)return;let b=L(E.clientX,E.clientY);if(t.focusedSectionId()&&b>=0){let q=l[b],x=q?p.get(q):void 0;if(x&&x!==t.focusedSectionId()&&m(x))return}if(t.focusedSectionId()&&b<0&&(b=D(E.clientX,E.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&b<0){let q=D(E.clientX,E.clientY,null,72,!1),x=q>=0?l[q]:void 0,T=x?p.get(x):void 0;if(T&&T!==t.focusedSectionId()&&m(T))return}if(!t.focusedSectionId()){b<0&&(b=D(E.clientX,E.clientY,null,42,!1));let q=b>=0?l[b]:void 0,x=q?p.get(q):void 0;if(x&&m(x))return}if(b<0||b>=l.length){t.selection().size&&(u([]),a.onViewTargetChange?.(null));return}let W=l[b],K=xe[Math.round(r.seats.iState[b]??0)]??"available";if(K!=="available"&&K!=="selected"){a.onSeatInspect?.(W,K);return}if(t.selection().has(W)&&t.selection().size===1){u([]),a.onViewTargetChange?.(null),a.onSeatPick?.(W);return}u([W]),M(W),i.seatPicked(W,p.get(W)),a.onSeatPick?.(W)}}}var rt=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,a=-1/0;for(let m=0;m<this.count;m++){let u=e[m*3],M=e[m*3+2];u<o&&(o=u),u>n&&(n=u),M<r&&(r=M),M>a&&(a=M)}let s=Math.max(n-o,.001),i=Math.max(a-r,.001);this.cell=Math.max(Math.sqrt(s*i*4/this.count),.25),this.cols=Math.max(1,Math.ceil(s/this.cell)+1),this.rows=Math.max(1,Math.ceil(i/this.cell)+1),this.minX=o,this.minZ=r;let l=this.cols*this.rows,p=new Int32Array(l+1),v=m=>{let u=Math.min(this.cols-1,Math.max(0,Math.floor((e[m*3]-o)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[m*3+2]-r)/this.cell)))*this.cols+u};for(let m=0;m<this.count;m++)p[v(m)+1]++;for(let m=0;m<l;m++)p[m+1]+=p[m];let c=new Int32Array(this.count),f=p.slice(0,l);for(let m=0;m<this.count;m++)c[f[v(m)]++]=m;this.cellStart=p,this.cellItems=c}gather(e,o,r,n){this.ensureGrid();let a=this.cellStart,s=this.cellItems;if(!a||!s)return 0;let i=n.length,l=r*r,p=Math.floor((e-this.minX)/this.cell),v=Math.floor((o-this.minZ)/this.cell),c=Math.ceil(r/this.cell)+1,f=this.iPosition,m=0;for(let u=0;u<=c&&m<i;u++){let M=v-u,S=v+u,P=p-u,R=p+u;for(let y=M;y<=S&&m<i;y++){if(y<0||y>=this.rows)continue;let A=y===M||y===S;for(let g=P;g<=R&&m<i;g++){if(!A&&g!==P&&g!==R){g=R-1;continue}if(g<0||g>=this.cols)continue;let C=y*this.cols+g;for(let V=a[C],D=a[C+1];V<D&&m<i;V++){let L=s[V],N=f[L*3]-e,E=f[L*3+2]-o;N*N+E*E<=l&&(n[m++]=L)}}}}return m}};var at=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Ke);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new rt(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)<wt)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>xt){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let i=this.nearIndex.gather(n.x,n.z,xt,this.nearBuf);i===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,i)}ease(e,o,r){let n=1-Math.exp(-e*9),a=1-Math.exp(-e*20);this.seatDetailMix+=(o-this.seatDetailMix)*(o>this.seatDetailMix?n:a),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?n:a),Math.abs(o-this.seatDetailMix)<.01&&(this.seatDetailMix=o),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};import{Quat as Fr,Vec3 as Er}from"ogl";function ln(t){let{container:e,model:o,opts:r,orbit:n,cinematic:a,analytics:s,loop:i,labelOverlay:l,stageAzimuth:p,overviewFraming:v}=t,c=0,f=-1,m=(g,C,V=28)=>{n.camera.position.set(g[0],g[1],g[2]),n.camera.lookAt(new Er(C[0],C[1],C[2])),n.camera.fov=V,n.camera.updateProjectionMatrix()},u=document.createElement("button");u.className="sl-3d-overview-control sl-3d-icon-control",u.type="button",u.textContent="\u2302",u.setAttribute("aria-label","Fit the active level or whole venue in view"),u.dataset.tooltip="Fit view",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 M=()=>{u.textContent="\u2302"};M();let S=g=>{f=g;let C=t.gpu();C&&(C.seatProgram.uniforms.uFocusFloor.value=g,C.solidProgram.uniforms.uFocusFloor.value=g,C.chairProgram.uniforms.uFocusFloor.value=g),t.showSectionSeatLabels(null)},P=()=>{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 g=f>=0?o.floors[f]:null;if(t.setNearFieldDetailEnabled(!!g),t.setSeatViewLocked(!1),R(),t.removeArriveChip(),t.setNavigationMode("orbit"),g){let C=g.focalWorld[0]-g.center[0],V=g.focalWorld[2]-g.center[2],D=Math.hypot(C,V)>g.radius*.12?Math.atan2(C,V):p,L={center:g.center,radius:g.radius,box:g.box},N={polarDeg:58,margin:1.12};t.reducedMotion()?n.frame(L,!1,D,!1,N):n.frameSoft(L,D,!1,N)}else t.reducedMotion()?n.frame(o.bounds,!1,p,r.portraitOverviewCrop===!0,v):n.frameSoft(o.bounds,p,r.portraitOverviewCrop===!0,v);t.showSectionSeatLabels(null),i.requestRender()},R=()=>{c++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),a.active&&(a.cancel(),n.resumeAfterFlight(o.focalWorld))},y=g=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let C=o.seats.idToIndex.get(g);if(C===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(g),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 V=t.inSeatView()&&r.arriveAtSeatEye===!0;t.setSeatStepping(V),t.setSeatViewLocked(!1);let D=++c;V?t.showArriveChip(g,D):t.removeArriveChip();let{eye:L,focal:N}=t.resolvedSeatViewPose(g,C),E=r.arriveAtSeatEye?t.seatViewArrival(g,C):null,G=E?E.focal:N,O=[n.camera.position.x,n.camera.position.y,n.camera.position.z],w=Dt(O,E?.eye??L,G,o.bounds.center,o.bounds.radius),b=E?E.eye:r.arriveAtSeatEye?L:w.finalPos,W=E?E.fov:r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?90:65:28,K=[w.waypoints[0],w.waypoints[1],b];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),m(b,G,W),i.requestRender(),s.cinematicSkipped(),t.isDisposed()||n.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),E&&t.enterSeatView(E.stops),t.showArriveChip(g,D),Promise.resolve();let q=new Fr().copy(n.camera.quaternion),x=Lo(n.camera,b,G);i.requestRender();let T=V?700:2500;return a.start(K,q,x,T,W).then(()=>{t.isDisposed()||D!==c||(t.setSeatStepping(!1),s.cinematicPlayed(T),n.resumeAfterFlight(G),t.setSeatViewLocked(r.arriveAtSeatEye===!0),E&&t.enterSeatView(E.stops),i.requestRender(),t.showArriveChip(g,D))})},A=g=>{let C=o.sections.find(N=>N.id===g);if(!C||C.seatCount===0)return!1;t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),a.cancel(),t.removeArriveChip(),o.floors.length>1&&f!==C.floorIndex&&S(C.floorIndex),t.setNavigationMode("pan"),t.showSectionSeatLabels(g);let V=C.focalWorld[0]-C.center[0],D=C.focalWorld[2]-C.center[2],L=Math.hypot(V,D)>C.radius*.12?Math.atan2(V,D):void 0;return n.frame({center:C.center,radius:Math.max(5,C.radius*.5)},!1,L),r.onSectionFocusChange?.(g),i.requestRender(),!0};return u.addEventListener("click",P),{overviewChip:u,layoutOverviewChip:M,flightGen:()=>c,focusedFloor:()=>f,applyFloorFocus:S,placeCameraFinal:m,cancelFlight:R,focusOverview:P,flyToSeat:y,focusSectionCamera:A}}function cn(t){let e=performance.now();return{model:Te(t),buildMs:performance.now()-e,source:"main"}}function Rr(t){let e=Nt(t.doc);return{...cn({...t,seats:e}),seats:e}}function un(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 a=!1,s=p=>{a||(a=!0,clearTimeout(l),r.terminate(),n(p))},i=()=>s(e()),l=window.setTimeout(i,15e3);r.onerror=i,r.onmessage=p=>{let v=o(p.data);v?s(v):i()},r.postMessage(t)})}function Dr(t){return un(t,()=>cn(t),({model:e,buildMs:o})=>({model:e,buildMs:o,source:"worker"}))}function Vr(t){return un(t,()=>Rr(t),({model:e,buildMs:o,seats:r})=>r?{model:e,buildMs:o,seats:r,source:"worker"}:null)}var Ir=Math.PI/180,Tr=6,kr=500;function gi(t,e,o={}){let r=performance.now(),n=e.prepared?.model??Te(e),a=new nt(o.onAnalytics),s=new Array(n.seats.count);for(let[d,h]of n.seats.idToIndex)s[h]=d;let i=new Map(e.seats.map(d=>[d.id,d])),l=new Map;for(let d of e.seats){if(!d.rowId)continue;let h=l.get(d.rowId);h?h.push(d.id):l.set(d.rowId,[d.id])}let p=new Map;for(let d of e.seats)p.set(d.id,d.sectionId);let v=e.doc.floors?.some(h=>(h.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(h=>h.objects)??e.doc.objects).some(h=>h.type==="section"&&((h.height??0)>0||(h.rake??0)>0)),c=null,f=null,m=!1,u=!1,M=!1,S=new Map,P=null,R=null,y=null,A=new Map,g=null,C=()=>{y===null&&(y=t.style.zIndex,t.style.zIndex="20")},V=()=>{y!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=y),y=null)},D=!1,L=()=>D?ne.focusedFloor():-1,N=()=>{c=Co(w.gl,n),f=new et(w.renderer,c.seatGeometry,c.chairGeometry,c.solidGeometry,n.seats.count),w.setClearColor(n.theme.background.top),f.setRestoreClear(n.theme.background.top),c.seatProgram.uniforms.uSeatRadius.value=Ie*n.theme.seatScale,c.seatProgram.uniforms.uFocusFloor.value=L(),c.solidProgram.uniforms.uFocusFloor.value=L(),c.chairProgram.uniforms.uFocusFloor.value=L(),c.screenProgram&&(c.screenProgram.uniforms.uFocusFloor.value=L()),G.forceRegather()},E=!1,G=new at({model:n,orbit:()=>b,gpu:()=>c}),O=d=>G.setDetailEnabled(d),w=new Xe(t,{onContextLost:()=>{M||a.contextLost(),m=!0,I.stop(),c=null,f=null},onContextRestored:()=>{N(),m=!1,M||a.contextRestored(),I.requestRender()}}),b=new je(w.gl,w.canvas,()=>I.requestRender(),()=>a.orbitEngaged());b.setAspect(w.aspect);let W=(e.doc.floors?.flatMap(d=>d.objects)??e.doc.objects).some(d=>d.type==="section"&&d.physical3dProvenance?.surfaceKind?.status==="inferred"),K=(()=>{if(W&&n.stages.length===0)return;let d=n.focalWorld[0]-n.bounds.center[0],h=n.focalWorld[2]-n.bounds.center[2];return Math.hypot(d,h)>n.bounds.radius*.12?Math.atan2(d,h):void 0})(),q=n.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},x=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;b.frame(n.bounds,!x&&o.skipInitialOverviewAnimation!==!0,K,o.portraitOverviewCrop===!0,q);let T=new tt(b.camera),J=nn(t),H=new Ze(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:n.theme.background.top}),$=n.labels,ee=()=>qt($,n.floors.length,L());H.setLabels(ee());let z=null,B=d=>{if(z=d,H.setForcedDense(!!d),!d){H.setLabels(ee());return}let h=e.seats.filter(_=>_.sectionId===d),F=new Set(h.map(_=>_.id)),U=new Set(h.map(_=>_.rowId)),X=new Set(S.keys()),j=new Set(h.filter(_=>X.has(_.id)).map(_=>_.id)),Z=ee().filter(_=>_.kind!=="row"&&_.kind!=="seat"||(_.kind==="row"?U.has(_.id.slice(4)):F.has(_.id.slice(5))&&(j.size===0||j.has(_.id.slice(5)))));if(n.seatCount<=6e3&&j.size===0){H.setLabels(Z);return}let te=j.size?h.filter(_=>j.has(_.id)):h,he=new Set(te.map(_=>`seat:${_.id}`)),de=te.flatMap(_=>{let re=n.seats.idToIndex.get(_.id);if(re===void 0)return[];let se=re*3;return[{id:`seat:${_.id}`,kind:"seat",text:_.displayLabel||_.label,anchor:[n.seats.iPosition[se],n.seats.iPosition[se+1]+(X.has(_.id)?1.05:.55),n.seats.iPosition[se+2]]}]});H.setLabels([...Z.filter(_=>!he.has(_.id)),...de])};N();let k=null,I=new Qe(d=>{if(m||!c||u)return!1;let F=T.active?T.update(performance.now()):k?.active?k.update(performance.now()):b.update(),U=L()>=0?n.floors[L()]:null,X=U?.radius??n.bounds.radius,j=io(b.currentDistance,X),Z=E?{center:[b.camera.position.x,b.camera.position.y,b.camera.position.z],radius:520}:n.renderBounds;b.updateClipping(Z);let te=U?.center??n.renderBounds.center,he=U?.radius??n.renderBounds.radius,de=(le,Ve)=>Math.hypot(b.camera.position.x-le[0],b.camera.position.y-le[1],b.camera.position.z-le[2])<=Ve*(G.detailVisible?1.8:1.55),_=de(te,he);if(!_&&z){let le=n.sections.find(Ve=>Ve.id===z);le&&(_=de(le.center,Math.max(12,le.radius*2)))}G.detailVisible=_;let re=c.seatProgram.uniforms;re.uSeatScale.value=j.scale,re.uSeatFade.value=j.fade;let se=!!U&&so(U.seatCount,w.canvas.clientWidth||1,w.canvas.clientHeight||1),We=lo(n.seats.count,X,b.currentDistance,b.camera.fov,w.canvas.clientHeight||1),De=G.detailVisible||se||We?1:0,Ue=G.detailVisible||L()>=0||n.floors.length>1?1:0;return G.ease(d,De,Ue),re.uSeatDetail.value=G.seatDetailMix,c.solidProgram.uniforms.uStructureDetail.value=G.structureDetailMix,re.uMinPixels.value=j.minPixels,re.uPixelToWorld.value=2*Math.tan(b.camera.fov*Ir/2)/Math.max(1,w.pixelHeight),G.update(G.detailVisible),w.renderer.render({scene:c.background,clear:!0}),w.renderer.render({scene:c.main,camera:b.camera,clear:!1}),H.update(b.camera.projectionViewMatrix,w.canvas.clientWidth||1,w.canvas.clientHeight||1,b.currentDistance,X,[b.camera.position.x,b.camera.position.y,b.camera.position.z]),F||G.seatDetailMix!==De||G.structureDetailMix!==Ue}),Y=typeof ResizeObserver<"u"?new ResizeObserver(()=>dt.resize()):null;Y?.observe(t);let Q=d=>{let h=X=>{let j=n.seats.idToIndex.get(X);return j===void 0?void 0:n.seats.iState[j]},{updates:F,next:U}=Ro(S,d,h);if(S=U,H.setSelectedSeatIds(S.keys()),z&&B(z),F.length){let X=ft(n.seats,F);c&&c.uploadSeatStateRuns(X),I.requestRender()}},ie=()=>g!==null?g:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,me=8,Fe=d=>{if(!o.getSeatView)return null;let h=A.get(d);if(!h)for(h=Promise.resolve(o.getSeatView(d)),A.set(d,h),h.catch(()=>{A.get(d)===h&&A.delete(d)});A.size>me;){let F=A.keys().next().value;if(F===void 0)break;A.delete(F)}return h},be=(d,h)=>{let F=i.get(d),U=Math.max(0,Math.round(n.seats.iFloor[h]??0)),X=e.doc.floors?.[U],j=n.floors[U],Z=X?.focalPoint??e.doc.focalPoint,te=j?{x:j.focalWorld[0]/we,y:j.focalWorld[2]/we}:Z,he=F?.focalPoint?{x:F.focalPoint.x+te.x-Z.x,y:F.focalPoint.y+te.y-Z.y}:te,de=[n.seats.iPosition[h*3],n.seats.iPosition[h*3+1],n.seats.iPosition[h*3+2]];return zo(de,he,X?.baseHeightM??0,F?.eyeHeightM)},Be=()=>(t.clientWidth||w.canvas.clientWidth)<=520,it=null,kt=null,dn=async(d,h,F)=>{if(!o.getSeatView||M||F!==ne.flightGen())return;let U;try{U=await tn()}catch{if(a.panoramaFailed(d,"mount"),!M&&F===ne.flightGen()){let X=lt(d,F,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(M||F!==ne.flightGen()||!it))return kt??=U.createOpenPanorama(it),kt(d,h,F)},st=rn({container:t,model:n,opts:o,expandedSeatById:i,seatIdsByRow:l,isNarrow:Be,isDisposed:()=>M,flightGen:()=>ne.flightGen(),flyToSeat:d=>zt(d),openPanorama:(d,h,F)=>dn(d,h,F)}),lt=st.show,ct=st.remove,pn=st.layout,ye=an({container:t,orbit:b,isNarrow:Be,enabled:o.chrome?.controlDock!==!1}),mn=ye.element,Ee=ye.setNavigationMode,hn=ye.layout,fn=ye.utilityControls,Re=null,_t=!1,He=d=>{ye.setSeatViewLocked(d),d||k?.exit()};k=en({canvas:w.canvas,camera:b.camera,requestRender:()=>I.requestRender(),reducedMotion:ie,onStopChange:d=>{let h=d??(_t?"seat":null);Re=h;try{o.onSeatViewStopChange?.(h)}catch{}},onApplied:()=>{M||b.syncFromCamera()}});let vn=qo(n.stages,n.focalWorld,n.bounds.groundY??0),gn=(d,h)=>{let{eye:F}=be(d,h),U=(t.clientWidth||w.canvas.clientWidth||1)/Math.max(1,t.clientHeight||w.canvas.clientHeight||1),X=jo(F,vn,U);if(o.seatViewStops===!1)return{...X,stops:[]};let j=p.get(d),Z=j?n.sections.find(te=>te.id===j):void 0;return{...X,stops:Qo(X,{aspect:U,section:Z&&Z.seatCount>0?{center:Z.center,radius:Z.radius}:null,venue:{center:n.bounds.center,radius:n.bounds.radius}})}},ne=ln({container:t,model:n,opts:o,orbit:b,cinematic:T,analytics:a,loop:I,labelOverlay:H,stageAzimuth:K,overviewFraming:q,gpu:()=>c,isDisposed:()=>M,panorama:()=>P,setPanorama:d=>{P=d},setPanoramaSphereVisible:d=>{E=d},panoramaLoadAbort:()=>R,setPanoramaLoadAbort:d=>{R=d},setFrozen:d=>{u=d},restorePanoramaLayer:V,reducedMotion:ie,resolvedSeatViewPose:be,showSectionSeatLabels:B,setNearFieldDetailEnabled:O,setSeatViewLocked:He,setNavigationMode:Ee,showArriveChip:lt,removeArriveChip:ct,inSeatView:()=>Re!==null,setSeatStepping:d=>{_t=d},seatViewArrival:(d,h)=>o.arriveAtSeatEye?gn(d,h):null,enterSeatView:d=>k?.enter(d)});D=!0;let ut=ne.overviewChip,bn=ne.layoutOverviewChip,yn=ne.applyFloorFocus,xn=ne.focusOverview,Lt=ne.cancelFlight,zt=ne.flyToSeat,Ot=ne.focusSectionCamera;fn.appendChild(ut),it={container:t,model:n,opts:o,analytics:a,orbit:b,loop:I,seatsById:i,ensureSeatView:Fe,resolvedSeatViewPose:be,gpu:()=>c,gl:w.gl,isContextLost:()=>m,isDisposed:()=>M,flightGen:()=>ne.flightGen(),setPanorama:d=>{P=d},getLoadAbort:()=>R,setLoadAbort:d=>{R=d},setPanoramaSphereVisible:d=>{E=d,d&&k?.exit()},setFrozen:d=>{u=d},raisePanoramaLayer:C,restorePanoramaLayer:V,getOverviewChip:()=>ut,labelOverlay:H,reducedMotion:ie,removeArriveChip:ct,showArriveChip:lt};let ue=sn({glctx:w,orbit:b,model:n,seats:e.seats,opts:o,cinematic:T,analytics:a,seatIdByIndex:s,sectionIdBySeatId:p,tapSlop:Tr,tapMs:kr,gpu:()=>c,pick:()=>f,seatViewLocked:()=>ye.seatViewLocked(),focusedSectionId:()=>z,selection:()=>S,cancelFlight:Lt,focusSectionCamera:Ot,setSelection:Q,ensureSeatView:Fe});w.canvas.addEventListener("pointerdown",ue.onDown),w.canvas.addEventListener("pointermove",ue.onMove),w.canvas.addEventListener("pointerup",ue.onUp),w.canvas.addEventListener("pointercancel",ue.onUp),I.requestRender();let dt={setAvailability(d){let h=Eo(S,d),F=ft(n.seats,h);F.length&&c&&c.uploadSeatStateRuns(F),I.requestRender()},setSelection:Q,setNavigationMode:Ee,zoomIn(){b.zoomBy(.82),I.requestRender()},zoomOut(){b.zoomBy(1.22),I.requestRender()},flyToSeat:zt,focusOverview:xn,seatViewStop:()=>Re,recentreSeatView:()=>k?.recentre()??!1,resize(){let{width:d,height:h}=w.resize();b.setAspect(d/Math.max(1,h)),pn(),hn(),bn(),I.requestRender()},stats(){return{...I.stats(),drawCalls:c?c.drawCalls:0,seatCount:n.seatCount}},getQualityEvidence(){let d=I.stats(),h=w.canvas.clientWidth||1,F=w.canvas.clientHeight||1,U=n.bounds.center,X=pe(b.camera.projectionViewMatrix,[U[0],n.bounds.box.min[1],U[2]],h,F),j=pe(b.camera.projectionViewMatrix,[U[0],n.bounds.box.max[1],U[2]],h,F),Z=n.bounds.box,te=[Z.min[0],Z.max[0]].flatMap(_=>[Z.min[1],Z.max[1]].flatMap(re=>[Z.min[2],Z.max[2]].map(se=>pe(b.camera.projectionViewMatrix,[_,re,se],h,F)))).filter(_=>Number.isFinite(_.x)&&Number.isFinite(_.y)&&Number.isFinite(_.depth)),he=te.length?(()=>{let _=Math.min(...te.map(fe=>fe.x)),re=Math.max(...te.map(fe=>fe.x)),se=Math.min(...te.map(fe=>fe.y)),We=Math.max(...te.map(fe=>fe.y)),De=Math.max(0,_),Ue=Math.min(h,re),le=Math.max(0,se),Ve=Math.min(F,We),Ye=Math.max(0,Ue-De),pt=Math.max(0,Ve-le);return{box:{x:De,y:le,width:Ye,height:pt},horizontalFillRatio:Ye/h,verticalFillRatio:pt/F,visibleAreaRatio:Ye*pt/(h*F),clippedEdges:[...se<0?["top"]:[],...re>h?["right"]:[],...We>F?["bottom"]:[],..._<0?["left"]:[]]}})():void 0,de=String(w.gl.getParameter(w.gl.VERSION)??"");return{viewport:{width:h,height:F},context:{webgl2:/webgl\s*2/i.test(de),lost:m},frame:{rendered:d.rendered,idle:d.idle},camera:{position:[b.camera.position.x,b.camera.position.y,b.camera.position.z],distance:b.currentDistance,verticalFovDeg:b.fovY},scene:{seatCount:n.seatCount,floorCount:n.floors.length,zoneCount:n.zones.length,sectionCount:n.sections.length,authoredRelief:v,renderedVerticalSpanM:Math.max(0,n.bounds.box.max[1]-n.bounds.box.min[1]),projectedReliefPx:X.visible&&j.visible?Math.abs(X.y-j.y):0},labels:H.qualityEvidence(),framing:he,...Re?{seatView:{fovDeg:b.camera.fov,stop:Re}}:{}}},getQualityReport(){return Ct(dt.getQualityEvidence())},loseContextForTest(){w.simulateContextLossCycle()},floors(){return n.floors},focusFloor(d){if(d!==null&&!n.floors.some(F=>F.index===d))return!1;let h=d??-1;if(O(d!==null),He(!1),yn(h),Ee("orbit"),d===null)T.cancel(),ie()?b.frame(n.bounds,!1,K,o.portraitOverviewCrop===!0,q):b.frameSoft(n.bounds,K,o.portraitOverviewCrop===!0,q);else{let F=n.floors[d];if(F.seatCount>0){T.cancel();let U=F.focalWorld[0]-F.center[0],X=F.focalWorld[2]-F.center[2],j=Math.hypot(U,X)>F.radius*.12?Math.atan2(U,X):K;b.frame({center:F.center,radius:F.radius,box:F.box},!1,j,!1,{polarDeg:58,margin:1.12})}}return I.requestRender(),!0},zones(){return n.zones},focusZone(d){let h=n.zones.find(j=>j.id===d);if(!h||h.seatCount===0)return!1;O(!1),He(!1),T.cancel(),Ee("orbit"),B(null),o.onSectionFocusChange?.(null);let F=h.focalWorld[0]-h.center[0],U=h.focalWorld[2]-h.center[2],X=Math.hypot(F,U)>h.radius*.12?Math.atan2(F,U):void 0;return b.frame({center:h.center,radius:h.radius*1.25},!1,X),I.requestRender(),!0},sections(){return n.sections},focusSection(d){return Ot(d)},rows(d){return d?n.rows.filter(h=>h.sectionId===d):n.rows},seatsInRow(d){return e.seats.filter(h=>h.rowId===d).map(h=>({id:h.id,label:h.displayLabel||h.label}))},focusRow(d){let h=n.rows.find(F=>F.id===d);return!h||h.seatCount===0?!1:(O(!0),He(!1),T.cancel(),Ee("pan"),h.sectionId&&(B(h.sectionId),o.onSectionFocusChange?.(h.sectionId)),b.frame({center:h.center,radius:Math.max(2.5,h.radius*.65)}),I.requestRender(),!0)},setReducedMotionForTest(d){g=d},dispose(){M=!0,ct(),ut.remove(),mn.remove(),Lt(),k?.dispose(),I.stop(),H.dispose(),Y?.disconnect(),P&&(P.dispose(),P=null),V(),J(),w.canvas.removeEventListener("pointerdown",ue.onDown),w.canvas.removeEventListener("pointermove",ue.onMove),w.canvas.removeEventListener("pointerup",ue.onUp),w.canvas.removeEventListener("pointercancel",ue.onUp),b.dispose(),f&&f.dispose(),c&&c.dispose(),c=null,f=null,w.dispose()}};return a.opened(n.seatCount,v,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),dt}export{En as VENUE3D_QUALITY_REPORT_VERSION,Te as buildSceneModel,Ct as inspectVenue3DQualityEvidence,gi as mountVenue3D,Dr as prepareVenue3D,Vr as prepareVenue3DFromChart};