@seatlayer/core 0.97.0 → 0.99.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/{categoryInventory-4XH7dMDH.d.ts → categoryInventory-DdJdJ4Og.d.ts} +1 -1
  2. package/dist/{categoryInventory-C-bfH2av.d.cts → categoryInventory-DuOez0-4.d.cts} +1 -1
  3. package/dist/{chunk-M5VINTGE.js → chunk-23OTKCJU.js} +1 -1
  4. package/dist/{chunk-CUACREZL.js → chunk-CTIGUXXK.js} +1 -1
  5. package/dist/{chunk-P4C24CIZ.js → chunk-D723OZEY.js} +1 -1
  6. package/dist/chunk-FYJJSWEM.js +1 -0
  7. package/dist/chunk-GLGXP5I7.js +1 -0
  8. package/dist/{chunk-FLMKHAUT.js → chunk-HO4MFTVX.js} +1 -1
  9. package/dist/chunk-HYEZPOZU.js +1 -0
  10. package/dist/chunk-K22SISYC.js +1 -0
  11. package/dist/{chunk-YPESNMTC.js → chunk-KFVUBZMK.js} +1 -1
  12. package/dist/{chunk-OLGPAFXW.js → chunk-L34T3APU.js} +1 -1
  13. package/dist/{chunk-IW7QZIMF.js → chunk-N4J4CT6P.js} +1 -1
  14. package/dist/{chunk-2P72QUJR.js → chunk-UIMDB6GZ.js} +1 -1
  15. package/dist/chunk-UISTXRO5.js +1 -0
  16. package/dist/{chunk-ASIIXY5M.js → chunk-VWT44HBR.js} +1 -1
  17. package/dist/core/chart-ops/index.cjs +1 -1
  18. package/dist/core/chart-ops/index.d.cts +6 -4
  19. package/dist/core/chart-ops/index.d.ts +6 -4
  20. package/dist/core/chart-ops/index.js +1 -1
  21. package/dist/core/inventory/index.cjs +1 -1
  22. package/dist/core/inventory/index.d.cts +4 -4
  23. package/dist/core/inventory/index.d.ts +4 -4
  24. package/dist/core/inventory/index.js +1 -1
  25. package/dist/core/layout/index.cjs +1 -1
  26. package/dist/core/layout/index.d.cts +5 -5
  27. package/dist/core/layout/index.d.ts +5 -5
  28. package/dist/core/layout/index.js +1 -1
  29. package/dist/core/quality/index.d.cts +3 -3
  30. package/dist/core/quality/index.d.ts +3 -3
  31. package/dist/core/quality/index.js +1 -1
  32. package/dist/core/render-assets/index.d.cts +2 -2
  33. package/dist/core/render-assets/index.d.ts +2 -2
  34. package/dist/core/seatConfidence.d.cts +1 -1
  35. package/dist/core/seatConfidence.d.ts +1 -1
  36. package/dist/core/sections/index.cjs +1 -1
  37. package/dist/core/sections/index.d.cts +5 -5
  38. package/dist/core/sections/index.d.ts +5 -5
  39. package/dist/core/sections/index.js +1 -1
  40. package/dist/{eventConfigurations-BEyHDxBT.d.ts → eventConfigurations-BISNREZL.d.ts} +1 -1
  41. package/dist/{eventConfigurations-BE0rFmbQ.d.cts → eventConfigurations-DYn5XP3J.d.cts} +1 -1
  42. package/dist/index.cjs +1 -1
  43. package/dist/index.d.cts +13 -13
  44. package/dist/index.d.ts +13 -13
  45. package/dist/index.js +1 -1
  46. package/dist/{labeling-HWSKKrX8.d.ts → labeling-CzuSxAkr.d.ts} +1 -1
  47. package/dist/{labeling-SURRJh5u.d.cts → labeling-owTTG6e0.d.cts} +1 -1
  48. package/dist/{openPanorama-6FMXAJ6O.js → openPanorama-VD6PE3YZ.js} +2 -2
  49. package/dist/{renderedQuality-CZNfpB1H.d.ts → renderedQuality-BMSbVkwu.d.ts} +1 -1
  50. package/dist/{renderedQuality-QWHMvOej.d.cts → renderedQuality-Bl1Kq_XO.d.cts} +1 -1
  51. package/dist/{renderer-DEnthjgs.d.cts → renderer-Ccv8ZDZS.d.cts} +1 -1
  52. package/dist/{renderer-CuXYGgR3.d.ts → renderer-njHDbIqI.d.ts} +1 -1
  53. package/dist/{seatTypeIcons-BAyWebjw.d.cts → seatTypeIcons-QwEebl3k.d.cts} +1 -1
  54. package/dist/{seatTypeIcons-CqLiEH9C.d.ts → seatTypeIcons-dy3XQVWN.d.ts} +1 -1
  55. package/dist/{sections-DOk8zxm5.d.ts → sections-C8VTe6BN.d.ts} +1 -1
  56. package/dist/{sections-BlCiPWJJ.d.cts → sections-DSIfnBJY.d.cts} +1 -1
  57. package/dist/{segmentedRowModel-BbHdWqJy.d.cts → segmentedRowModel-CDvvJJ4-.d.cts} +1 -1
  58. package/dist/{segmentedRowModel-oVUtwW87.d.ts → segmentedRowModel-I8eYUQft.d.ts} +1 -1
  59. package/dist/{tableSizing-ExOrUwtX.d.ts → tableSizing-BLtQ-KV0.d.ts} +20 -13
  60. package/dist/{tableSizing-DaEXRHYs.d.cts → tableSizing-CB8g2Fs0.d.cts} +20 -13
  61. package/dist/{ticketRestrictions-BvG_INSV.d.cts → ticketRestrictions-BvlWLw10.d.cts} +2 -2
  62. package/dist/{ticketRestrictions-BHUMet7N.d.ts → ticketRestrictions-DUjN2bZn.d.ts} +2 -2
  63. package/dist/{types-BbqhOJ5L.d.ts → types-DWx32xXH.d.cts} +10 -1
  64. package/dist/{types-BbqhOJ5L.d.cts → types-DWx32xXH.d.ts} +10 -1
  65. package/dist/view3d/crossfade/panorama.cjs +1 -1
  66. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  67. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  68. package/dist/view3d/crossfade/panorama.js +1 -1
  69. package/dist/view3d/index.cjs +144 -46
  70. package/dist/view3d/index.d.cts +27 -4
  71. package/dist/view3d/index.d.ts +27 -4
  72. package/dist/view3d/index.js +142 -44
  73. package/dist/view3d/scene/scene.worker.cjs +1 -1
  74. package/dist/view3d/scene/scene.worker.js +1 -1
  75. package/package.json +1 -1
  76. package/dist/chunk-NGZXKXOY.js +0 -1
  77. package/dist/chunk-QEPYNCBJ.js +0 -1
  78. package/dist/chunk-SPM2LMKI.js +0 -1
  79. package/dist/chunk-VAI2VDQR.js +0 -1
  80. package/dist/chunk-Z43H6AWN.js +0 -1
@@ -1,12 +1,40 @@
1
- import{A as Mn,B as Cn,C as He,D as Ft,E as An,F as Pn,a as Be,b as Ae,c as nt,d as Pt,e as cn,f as un,g as be,h as dn,i as mn,j as ot,k as Re,l as Ge,m as hn,n as Et,o as hr,p as pn,q as fn,r as vn,s as bn,t as xe,u as gn,v as yn,w as xn,x as Sn,y as wn,z as rt}from"../chunk-NGZXKXOY.js";import"../chunk-2P72QUJR.js";import"../chunk-OLGPAFXW.js";import"../chunk-QJXSZT3H.js";import"../chunk-ASIIXY5M.js";import"../chunk-M5VINTGE.js";import"../chunk-P4C24CIZ.js";import"../chunk-IW7QZIMF.js";import"../chunk-Z43H6AWN.js";import"../chunk-4N5CHKHD.js";import"../chunk-TQN2VWQO.js";import"../chunk-5BMXWOE7.js";import"../chunk-FLMKHAUT.js";import{Va as an}from"../chunk-VAI2VDQR.js";import"../chunk-5ITK5236.js";import{d as sn,l as ln}from"../chunk-JBOTRSMY.js";import"../chunk-CRCGO52K.js";function En(t,e,n){let r=Math.floor(e.length/3),a=n.center[0],o=n.center[2];if(r>0){let l=Math.max(1,Math.floor(r/4e3)),u=0,p=0,h=0;for(let v=0;v<r;v+=l)u+=e[v*3],p+=e[v*3+2],h++;a=u/h,o=p/h}let i=t[0]-a,s=t[2]-o;return Math.hypot(i,s)>n.radius*.12?Math.atan2(i,s):void 0}var Rt=78,Fn=18;function Rn(){let t=[],e=[],n=[],r=[],a=[],o=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];for(let s of[{part:1,min:[-1,.36,-.95],max:[1,.45,1]},{part:2,min:[-1,Ae,-1],max:[1,nt,-.72]}])for(let l of o){let u=t.length/3,p=l.n[1]+(s.part===2?Math.abs(l.n[0])*(1-Pt)/(nt-Ae):0),h=Math.hypot(l.n[0],p,l.n[2]),v=[l.n[0]/h,p/h,l.n[2]/h];for(let[f,c]of l.c.entries()){let b=c.map((E,P)=>s.min[P]+E*(s.max[P]-s.min[P]));s.part===2&&(b[0]*=1-c[1]*(1-Pt)),t.push(...b),e.push(...v),n.push(s.part),r.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][f])}a.push(u,u+1,u+2,u,u+2,u+3)}let i=t.length/3;for(let[s,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])t.push(s,l,0),e.push(0,1,0),n.push(0),r.push(s,l);return a.push(i,i+1,i+2,i,i+2,i+3),a.push(...a.slice(12,18),...a.slice(60,66),...a.slice(72,78)),{position:new Float32Array(t),normal:new Float32Array(e),surface:new Float32Array(n),uv:new Float32Array(r),index:new Uint16Array(a)}}import{Renderer as pr}from"ogl";function fr(){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 at=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 pr({canvas:this.canvas,dpr:fr(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[ot.top[0],ot.top[1],ot.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),e.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(e){this.clearRgb=[e[0],e[1],e[2]],this.gl.clearColor(e[0],e[1],e[2],1)}get clearColor(){return this.clearRgb}resize(){let e=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(e,n),{width:e,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let e=this.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let e=this.gl.getExtension("WEBGL_lose_context");e&&(e.loseContext(),setTimeout(()=>{e.restoreContext&&e.restoreContext()},300))}};import{Camera as vr,Vec3 as Dt}from"ogl";var de=Math.PI/180,Tt=15*de,It=80*de,De=.12,Dn=35,Tn=1.25,In=.006,br=4,Te=.82,We=1/Te,gr=.12,yr=2;function xr(t,e){return{azimuth:t*In,polar:-e*In}}function Sr(t,e,n){let r=Math.max(yr,Math.max(1,e)*gr),a=n*br;return{minDist:t?Math.min(t.minDist,r):r,maxDist:t?Math.max(t.maxDist,a):a}}var wr=1.5;function Mr(t,e,n){let r=Math.max(1,n)*wr;if(!t)return{anchor:[e[0],e[1],e[2]],limit:r};let[a,o,i]=t.anchor,s=e[1]-o,l=Math.max(Math.abs(e[0]-a),Math.abs(e[2]-i),s>=0?s:-s*2);return{anchor:t.anchor,limit:Math.max(t.limit,l+r)}}var it=class{constructor(e,n,r,a){this.fovY=Dn;this.target=new Dt;this.azimuth=-30*de;this.polar=55*de;this.distance=10;this.azT=-30*de;this.polT=55*de;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new Dt;this.panAnchor=new Dt;this.panLimit=0;this.panBox=null;this.primaryDragMode="orbit";this.camera=new vr(e,{fov:Dn,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=a,this.onPointerDown=o=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(o.pointerId)}catch{}if(this.activePointers.set(o.pointerId,{x:o.clientX,y:o.clientY}),this.activePointers.size===1){let i=o.button===2||o.button===1,s=o.button===0&&(o.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=i||s,this.dragging=!this.panning,this.lastX=o.clientX,this.lastY=o.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let i=this.pinchCentroid();this.pinchCx=i.x,this.pinchCy=i.y}}},this.onPointerMove=o=>{if(!this.interactionEnabled||!this.activePointers.has(o.pointerId))return;if(this.activePointers.set(o.pointerId,{x:o.clientX,y:o.clientY}),this.activePointers.size>=2){let u=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-u)*.005)),this.fireGesture()),this.pinchDist=u;let p=this.pinchCentroid();this.panBy(p.x-this.pinchCx,p.y-this.pinchCy),this.pinchCx=p.x,this.pinchCy=p.y;return}let i=o.clientX-this.lastX,s=o.clientY-this.lastY;if(this.panning){this.lastX=o.clientX,this.lastY=o.clientY,(i!==0||s!==0)&&(this.panBy(i,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=o.clientX,this.lastY=o.clientY,(i!==0||s!==0)&&this.fireGesture();let l=xr(i,s);this.azT+=l.azimuth,this.polT=Math.max(Tt,Math.min(It,this.polT+l.polar)),this.requestRender()},this.onPointerUp=o=>{this.activePointers.delete(o.pointerId);try{this.canvas.releasePointerCapture?.(o.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=o=>{o.preventDefault()},this.onWheel=o=>{if(o.preventDefault(),!this.interactionEnabled)return;let i=o.deltaMode===1?16:o.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,o.deltaY*i/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=o=>{if(!this.interactionEnabled)return;let i=7*de;if(o.shiftKey&&(o.key==="ArrowLeft"||o.key==="ArrowRight"||o.key==="ArrowUp"||o.key==="ArrowDown"))this.panBy(o.key==="ArrowLeft"?-32:o.key==="ArrowRight"?32:0,o.key==="ArrowUp"?-32:o.key==="ArrowDown"?32:0);else if(o.key==="ArrowLeft"||o.key==="ArrowRight")this.azT+=o.key==="ArrowLeft"?-i:i;else if(o.key==="ArrowUp"||o.key==="ArrowDown")this.polT=Math.max(Tt,Math.min(It,this.polT+(o.key==="ArrowUp"?-i:i)));else if(o.key==="+"||o.key==="=")this.dollyBy(Te);else if(o.key==="-"||o.key==="_")this.dollyBy(We);else return;o.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let e=[...this.activePointers.values()];if(!e.length)return{x:0,y:0};let n=0,r=0;for(let a of e)n+=a.x,r+=a.y;return{x:n/e.length,y:r/e.length}}panBy(e,n){let r=this.canvas.clientHeight||1,a=2*this.distance*Math.tan(this.fovY*de/2)/r,o=Math.sin(this.azimuth),i=Math.cos(this.azimuth),s=i,l=-o,u=Math.cos(this.polar),p=Math.sin(this.polar),h=-o*u,v=-i*u;this.targetT.x+=(-e*s+n*h)*a,this.targetT.z+=(-e*l+n*v)*a,this.targetT.y+=n*p*a,this.clampPan(),this.requestRender()}widenPanBox(e){this.panBox=Mr(this.panBox,e.center,e.radius),this.panAnchor.set(this.panBox.anchor[0],this.panBox.anchor[1],this.panBox.anchor[2]),this.panLimit=this.panBox.limit}clampPan(){if(this.panLimit<=0)return;let e=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,a=this.panAnchor.z;this.targetT.x=Math.max(n-e,Math.min(n+e,this.targetT.x)),this.targetT.z=Math.max(a-e,Math.min(a+e,this.targetT.z)),this.targetT.y=Math.max(r-e*.5,Math.min(r+e,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let e=[...this.activePointers.values()];return e.length<2?0:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)}dollyBy(e){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*e)),this.requestRender()}zoomBy(e){this.interactionEnabled&&(this.dollyBy(e),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}setPrimaryDragMode(e){this.primaryDragMode=e}setInteractionEnabled(e){this.interactionEnabled=e,!e&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(e,n=!1,r,a=!1,o){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.widenPanBox(e);let i=Math.max(1,e.radius),s=this.fovY*de/2,l=a?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*l);this.azT=r??-30*de,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*de;let p=this.fitDistance(e,s,u,this.azT,this.polT);this.distT=p*Math.max(1.05,Math.min(2,o?.margin??Tn)),this.envelope=Sr(this.envelope,i,p),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*de,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(e){if(!(e>0)||!Number.isFinite(e))return;let n=this.camera.aspect;if(this.interactionEnabled&&n>0){let r=Math.min(n,1)/Math.min(e,1);this.distance*=r,this.distT*=r,this.maxDist=Math.max(this.maxDist,this.distance,this.distT),this.applyPosition()}this.camera.perspective({aspect:e})}frameSoft(e,n,r=!1,a){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.widenPanBox(e),this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let o=this.fovY*de/2,i=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(o)*i);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,a?.polarDeg??55))*de;let l=this.fitDistance(e,o,s,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,a?.margin??Tn))}fitDistance(e,n,r,a,o){let i=Math.max(1,e.radius),s=Math.max(i/Math.tan(n),i/Math.tan(r)),l=e.box;if(!l)return s;let u=Math.sin(o),p=-u*Math.sin(a),h=-Math.cos(o),v=-u*Math.cos(a);if(Math.abs(h)>.999)return s;let f=-v,c=p,b=Math.hypot(f,c);f/=b,c/=b;let E=-c*h,P=c*p-f*v,L=f*h,C=Math.tan(r),F=Math.tan(n),g=1;for(let A=0;A<8;A++){let S=(A&1?l.max[0]:l.min[0])-e.center[0],w=(A&2?l.max[1]:l.min[1])-e.center[1],R=(A&4?l.max[2]:l.min[2])-e.center[2],T=S*p+w*h+R*v,I=Math.abs(S*f+R*c),Y=Math.abs(S*E+w*P+R*L);g=Math.max(g,I/C-T,Y/F-T)}return Math.min(s,Math.max(g,i*.35))}updateClipping(e){let n=this.camera.position.x-e.center[0],r=this.camera.position.y-e.center[1],a=this.camera.position.z-e.center[2],o=Math.hypot(this.camera.position.x-this.target.x,this.camera.position.y-this.target.y,this.camera.position.z-this.target.z),i=this.interactionEnabled&&Math.abs(o-this.distance)<=this.distance*.01,{near:s,far:l}=Pr(Math.hypot(n,r,a),e.radius,i?this.distance:null);this.camera.perspective({near:s,far:l,aspect:this.camera.aspect})}update(){let e=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,a=this.targetT.x-this.target.x,o=this.targetT.y-this.target.y,i=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),l=Math.abs(e)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(a)>s||Math.abs(o)>s||Math.abs(i)>s;return this.azimuth+=e*De,this.polar+=n*De,this.distance+=r*De,this.target.x+=a*De,this.target.y+=o*De,this.target.z+=i*De,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,r=this.camera.position.z-this.target.z,a=Math.hypot(e,n,r)||1,o=Math.max(Tt,Math.min(It,Math.acos(Math.max(-1,Math.min(1,n/a)))));this.distance=this.distT=a,this.polar=this.polT=o,this.azimuth=this.azT=Math.atan2(e,r)}setTarget(e){this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target)}resumeAfterFlight(e){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),e&&this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let e=Math.sin(this.polar),n=this.target.x+this.distance*e*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),a=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(n,r,a),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}},Cr=.1,Ar=.25;function Pr(t,e,n){let r=Math.max(1,e)*1.18,a=n==null?Ar:Math.max(.05,n*Cr),o=Math.max(a,t-r),i=Math.max(o+10,t+r);return{near:o,far:i}}var st=class{constructor(e){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=e=>{let n=this.lastTime?(e-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=e,n>0){let a=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+a*.1:a}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=e}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};var Ie=2.5,Er=1.15,Ue=12,_e=22,_n=6,Vn=9.5,Ln=.9,kn=2.2,_t=30,Vt=4,lt=8192;var pi=_e+Vt;function On(t,e){let n=e*1.4,r=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:Ie};let a=Math.min(1,(t-n)/Math.max(.001,r-n));return{scale:1-a*.4,fade:a*.55,minPixels:Ie+a*(Er-Ie)}}function zn(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}function Nn(t,e,n,r,a){if(!(t>0)||!(e>0)||!(n>0)||!(r>0)||!(a>0))return!1;let o=Math.tan(r/2*Math.PI/180);if(!(o>0))return!1;let i=e/(n*o)*(a/2);return Math.PI*i*i/t>=64}var Bn=88,Gn=20,Hn={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},Fr=640,Rr=.8,Dr=11,Tr="3px 7px",Ir="2px 5px",Wn="rgba(10,14,22,.62)",_r="#f4f7fb",Un=5,Yn=2,Vr=6,Ye=new Set(["row","seat"]),Xn={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Ve={row:{x:66,y:20},seat:{x:52,y:22}},kt=sn,Lt=t=>ln(t);function Ot(t,e){let n=Lt(t),r=Lt(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function zt(t,e){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(t.replace(/\s/g,""));if(!n)return e;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(a=>Number(n[a])/255*r+e[a-1]*(1-r))}function Lr(t,e=[.04,.06,.1],n=!0){let r=Lt(e)<.42,a=r?"#f4f7fb":"#0b1220",o=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",i=n?zt(o,e):e,s=kt(t),l=n?7:4.5,u=s&&Ot(s,i)>=l?t:a;return r?{ink:u,backing:o,border:"rgba(210,222,245,.24)"}:{ink:u,backing:o,border:"rgba(11,18,32,.22)"}}function kr(t,e=[.04,.06,.1]){let n=zt(Wn,e),r=kt(t);return{ink:r&&Ot(r,n)>=4.5?t:_r,backing:Wn}}var Or='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',ct=class{constructor(e,n={}){this.nodes=new Map;this.labels=[];this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",r.fontFamily=n.fontFamily||Or,e.appendChild(this.root)}setVisible(e){this.root.style.visibility=e?"":"hidden"}setLabels(e){this.labels=e;let n=new Set(e.map(r=>r.id));for(let[r,a]of this.nodes)n.has(r)||(a.remove(),this.nodes.delete(r))}setForcedDense(e){this.forcedDense=e}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,n=>`seat:${n}`))}sizeFor(e){let n=Hn[e].size;return!this.narrowStage||Ye.has(e)?n:Math.max(Dr,n*Rr)}qualityEvidence(){let e=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let a=this.nodes.get(r.id),o=a?.getBoundingClientRect(),i=!!(n&&a&&a.style.display!=="none"&&o&&o.width>0&&o.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:i,renderedFontPx:a&&Number.parseFloat(a.style.fontSize)||0,contrast:a?Number(a.dataset.qualityContrast??0):0,...i&&o?{screenBox:{x:o.x-e.x,y:o.y-e.y,width:o.width,height:o.height}}:{}}})}update(e,n,r,a,o,i){if(!this.labels.length)return;this.narrowStage=n>0&&n<Fr;let s=vn(a,o,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let l=[];for(let g of this.labels){if(!s.has(g.kind)&&!(g.kind==="seat"&&this.selectedSeatLabelIds.has(g.id)))continue;let A=xe(e,g.anchor,n,r);if(!A.visible)continue;let S=Ye.has(g.kind),w=this.sizeFor(g.kind),R=xn(g.text,w,!S)+(S?Un*2:0);if(g.kind==="seat"&&g.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(g.id)&&Mn(e,g.anchor,g.seatWidthM,n)<Math.max(22,R))continue;let T=bn(A,R/2,w/2+(S?Yn:4),n,r),I=i?Math.hypot(g.anchor[0]-i[0],g.anchor[1]-i[1],g.anchor[2]-i[2]):1;l.push({label:g,screen:T,focus:wn(T,I,n,r),halfWidth:R/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let u=fn(l.filter(g=>g.label.kind==="floor"),n),p=[...l.filter(g=>!Ye.has(g.label.kind)&&g.label.kind!=="floor"),...u],h=Sn(n),v=rt(l.filter(g=>g.label.kind==="seat"&&this.selectedSeatLabelIds.has(g.label.id)),Ve.seat.x,Ve.seat.y,h.seat),f=gn(p,Bn,Gn).filter(g=>!v.some(A=>yn(g,A,Bn,Gn))),c=rt(l.filter(g=>g.label.kind==="row"),Ve.row.x,Ve.row.y,h.row,[...f,...v]),b=rt(l.filter(g=>g.label.kind==="seat"&&!this.selectedSeatLabelIds.has(g.label.id)),Ve.seat.x,Ve.seat.y,h.seat-v.length,[...f,...v,...c]),E=[...f,...c,...v,...b],P=new Set(E.map(g=>g.label.id));for(let{label:g,screen:A}of E){let w=this.nodeFor(g).style;w.display="",w.transform=`translate(-50%, -50%) translate(${A.x.toFixed(1)}px, ${A.y.toFixed(1)}px)`}let C=E.filter(({label:g})=>!Ye.has(g.kind)).sort((g,A)=>Xn[A.label.kind]-Xn[g.label.kind]||g.screen.depth-A.screen.depth||g.focus-A.focus).flatMap(({label:g})=>{let A=this.nodes.get(g.id);return A&&A.style.display!=="none"?[{node:A,box:A.getBoundingClientRect()}]:[]}),F=[];for(let{node:g,box:A}of C)F.some(w=>A.left<w.right+3&&A.right+3>w.left&&A.top<w.bottom+3&&A.bottom+3>w.top)?g.style.display="none":F.push(A);for(let[g,A]of this.nodes)P.has(g)||(A.style.display="none")}nodeFor(e){let n=this.nodes.get(e.id);if(!n){n=document.createElement("div");let b=n.style;b.position="absolute",b.left="0",b.top="0",b.whiteSpace="nowrap",b.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",b.display="none",this.root.appendChild(n),this.nodes.set(e.id,n)}let r=this.selectedSeatLabelIds.has(e.id),a=this.nodeAppearance.get(n);if(a&&a.text===e.text&&a.kind===e.kind&&a.color===e.color&&a.selected===r&&a.narrow===this.narrowStage)return n;this.nodeAppearance.set(n,{text:e.text,kind:e.kind,color:e.color,selected:r,narrow:this.narrowStage}),n.textContent=e.text,n.setAttribute("data-label-kind",e.kind),n.toggleAttribute("data-selected-seat",r);let o=Hn[e.kind],i=n.style;i.fontSize=`${this.sizeFor(e.kind)}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let s=Ye.has(e.kind),l=!s,u=Lr(e.color??this.opts.ink,this.opts.backgroundRgb,!0),p=s?kr(e.color??this.opts.ink,this.opts.backgroundRgb):u;i.color=r?"#ecf8ff":p.ink,i.background=r?"rgba(10,28,45,.9)":p.backing,i.border=r?"1px solid rgba(89,199,255,.92)":l?`1px solid ${u.border}`:"",i.borderRadius=r||l?"999px":`${Vr}px`;let h=this.narrowStage?Ir:Tr;i.padding=r||l?h:`${Yn}px ${Un}px`,i.lineHeight=s?"1.1":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":l?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",i.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let v=this.opts.backgroundRgb??[.04,.06,.1],f=kt(r?"#ecf8ff":p.ink)??[1,1,1],c=zt(r?"rgba(10,28,45,.9)":p.backing,v);return n.dataset.qualityContrast=Ot(f,c).toFixed(3),i.textTransform=e.kind==="zone"||e.kind==="floor"?"uppercase":"",n}dispose(){this.root.remove(),this.nodes.clear()}};var zr=1;var Nr=new Set(["floor","zone","section","ga","booth","annotation"]);function Br(t){return t.every(e=>Number.isFinite(e))}function Gr(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 qn(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function Pe(t){return Math.round(t*1e4)/1e4}function Hr(t){if(t)return{box:{x:Pe(t.box.x),y:Pe(t.box.y),width:Pe(t.box.width),height:Pe(t.box.height)},horizontalFillRatio:Pe(t.horizontalFillRatio),verticalFillRatio:Pe(t.verticalFillRatio),visibleAreaRatio:Pe(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function fe(t,e,n){return n.length?{code:t,message:e,count:n.length,samples:n.slice(0,20)}:null}function Nt(t){let e=t.labels.filter(s=>s.visible&&s.screenBox),n=e.filter(s=>Nr.has(s.kind)),r=t.scene.floorCount>1?t.scene.floorCount:t.scene.zoneCount||t.scene.sectionCount,a=[];for(let s=0;s<n.length;s+=1)for(let l=0;l<s;l+=1)Gr(n[s].screenBox,n[l].screenBox)&&a.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[l].id});let o=[...t.camera.position,t.camera.distance,t.camera.verticalFovDeg],i=[fe("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),fe("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),fe("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),fe("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}`}]),fe("camera-invalid","The capture camera must have a finite physical pose",Br(o)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),fe("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}]),fe("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),fe("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),fe("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),fe("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",a)].filter(s=>!!s);return{version:1,state:"venue3d",passed:i.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:t.viewport,context:t.context,frame:t.frame,camera:t.camera,scene:t.scene,composition:{visibleLabels:e.map(({id:s,kind:l,text:u})=>({id:s,kind:l,text:u})).sort((s,l)=>s.kind.localeCompare(l.kind)||s.id.localeCompare(l.id)),framing:Hr(t.framing)},metrics:{minimumHierarchyFontPx:qn(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:qn(n.map(s=>s.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:i}}function jn(t,e,n){t.fill(0);for(let r=0;r<Math.min(n,e.length);r++)t[e[r]]=1}import{Geometry as Xe,Mesh as qe,Program as ma,Texture as ha,Transform as lo}from"ogl";import{Program as Ee}from"ogl";var ut=`
1
+ import{A as Bn,B as Wn,C as Xe,D as kt,E as Un,F as Yn,a as Ue,b as Ce,c as lt,d as Lt,e as Rn,f as Tn,g as be,h as Fn,i as In,j as ct,k as Fe,l as Ye,m as _n,n as Vt,o as Ur,p as Dn,q as Ln,r as Vn,s as kn,t as ge,u as zn,v as On,w as Nn,x as Hn,y as Gn,z as ut}from"../chunk-K22SISYC.js";import"../chunk-UIMDB6GZ.js";import"../chunk-L34T3APU.js";import"../chunk-QJXSZT3H.js";import"../chunk-VWT44HBR.js";import"../chunk-23OTKCJU.js";import"../chunk-D723OZEY.js";import"../chunk-N4J4CT6P.js";import"../chunk-HYEZPOZU.js";import"../chunk-4N5CHKHD.js";import"../chunk-TQN2VWQO.js";import"../chunk-5BMXWOE7.js";import"../chunk-HO4MFTVX.js";import{Va as An}from"../chunk-UISTXRO5.js";import"../chunk-5ITK5236.js";import{d as Cn,l as En}from"../chunk-JBOTRSMY.js";import"../chunk-CRCGO52K.js";function Xn(t,e,n){let r=Math.floor(e.length/3),a=n.center[0],o=n.center[2];if(r>0){let l=Math.max(1,Math.floor(r/4e3)),u=0,d=0,m=0;for(let f=0;f<r;f+=l)u+=e[f*3],d+=e[f*3+2],m++;a=u/m,o=d/m}let i=t[0]-a,s=t[2]-o;return Math.hypot(i,s)>n.radius*.12?Math.atan2(i,s):void 0}import{Mat4 as ls}from"ogl";function qn(t,e,n="#ffffff"){let{iPosition:r,count:a}=e.seats;if(a<2||typeof document>"u")return null;let o=1/0,i=-1/0,s=1/0,l=-1/0;for(let F=0;F<a;F++){let I=r[F*3],h=r[F*3+2];I<o&&(o=I),I>i&&(i=I),h<s&&(s=h),h>l&&(l=h)}for(let F of e.stages)o=Math.min(o,F.cx-F.halfX),i=Math.max(i,F.cx+F.halfX),s=Math.min(s,F.cz-F.halfZ),l=Math.max(l,F.cz+F.halfZ);let u=Math.min(130/Math.max(.001,i-o),86/Math.max(.001,l-s)),d=(148-(i-o)*u)/2,m=(104-(l-s)*u)/2,f=F=>d+(F-o)*u,v=F=>m+(F-s)*u,c=Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),g=document.createElement("canvas");g.width=Math.round(148*c),g.height=Math.round(104*c),g.setAttribute("aria-hidden","true"),g.setAttribute("data-seat-locator","");let x=g.style;x.position="absolute",x.left="12px",x.bottom="12px",x.width="148px",x.height="104px",x.borderRadius="10px",x.background="rgba(10,14,22,.72)",x.border="1px solid rgba(255,255,255,.14)",x.boxShadow="0 4px 14px rgba(0,0,0,.35)",x.pointerEvents="none",x.zIndex="3",x.display="none",t.appendChild(g);let M=document.createElement("canvas");M.width=g.width,M.height=g.height;let D=M.getContext("2d");if(D){D.scale(c,c),D.fillStyle="rgba(214,222,234,.28)";let F=Math.max(1,Math.ceil(a/6e3));for(let I=0;I<a;I+=F)D.fillRect(f(r[I*3])-.6,v(r[I*3+2])-.6,1.2,1.2);D.fillStyle="rgba(236,240,246,.16)",D.strokeStyle="rgba(236,240,246,.55)",D.lineWidth=1;for(let I of e.stages){let h=f(I.cx-I.halfX),y=v(I.cz-I.halfZ),T=I.halfX*2*u,A=I.halfZ*2*u;D.fillRect(h,y,T,A),D.strokeRect(h+.5,y+.5,Math.max(0,T-1),Math.max(0,A-1))}}let S=g.getContext("2d"),E="";return{el:g,update(F,I){if(!F||!S||t.clientWidth>0&&t.clientWidth<560){x.display!=="none"&&(x.display="none"),E="";return}let h=f(F[0]),y=v(F[2]),T=I?Math.atan2(I[2],I[0]):0,A=`${h.toFixed(1)},${y.toFixed(1)},${T.toFixed(2)}`;if(A!==E){if(E=A,x.display="block",S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,g.width,g.height),S.drawImage(M,0,0),S.setTransform(c,0,0,c,0,0),I){let V=S.createRadialGradient(h,y,0,h,y,26);V.addColorStop(0,"rgba(255,255,255,.55)"),V.addColorStop(1,"rgba(255,255,255,0)"),S.fillStyle=V,S.beginPath(),S.moveTo(h,y),S.arc(h,y,26,T-.5,T+.5),S.closePath(),S.fill()}S.fillStyle=n,S.strokeStyle="rgba(10,14,22,.9)",S.lineWidth=1.5,S.beginPath(),S.arc(h,y,3.6,0,Math.PI*2),S.fill(),S.stroke()}},dispose(){g.remove()}}}var zt=78,jn=18;function Kn(){let t=[],e=[],n=[],r=[],a=[],o=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];for(let s of[{part:1,min:[-1,.36,-.95],max:[1,.45,1]},{part:2,min:[-1,Ce,-1],max:[1,lt,-.72]}])for(let l of o){let u=t.length/3,d=l.n[1]+(s.part===2?Math.abs(l.n[0])*(1-Lt)/(lt-Ce):0),m=Math.hypot(l.n[0],d,l.n[2]),f=[l.n[0]/m,d/m,l.n[2]/m];for(let[v,c]of l.c.entries()){let g=c.map((x,M)=>s.min[M]+x*(s.max[M]-s.min[M]));s.part===2&&(g[0]*=1-c[1]*(1-Lt)),t.push(...g),e.push(...f),n.push(s.part),r.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][v])}a.push(u,u+1,u+2,u,u+2,u+3)}let i=t.length/3;for(let[s,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])t.push(s,l,0),e.push(0,1,0),n.push(0),r.push(s,l);return a.push(i,i+1,i+2,i,i+2,i+3),a.push(...a.slice(12,18),...a.slice(60,66),...a.slice(72,78)),{position:new Float32Array(t),normal:new Float32Array(e),surface:new Float32Array(n),uv:new Float32Array(r),index:new Uint16Array(a)}}import{Renderer as Yr}from"ogl";function Xr(){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 dt=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 Yr({canvas:this.canvas,dpr:Xr(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[ct.top[0],ct.top[1],ct.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),e.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(e){this.clearRgb=[e[0],e[1],e[2]],this.gl.clearColor(e[0],e[1],e[2],1)}get clearColor(){return this.clearRgb}resize(){let e=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(e,n),{width:e,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let e=this.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let e=this.gl.getExtension("WEBGL_lose_context");e&&(e.loseContext(),setTimeout(()=>{e.restoreContext&&e.restoreContext()},300))}};import{Camera as qr,Vec3 as Ot}from"ogl";var ce=Math.PI/180,Nt=15*ce,Ht=80*ce,Ie=.12,$n=35,Gt=1.25,Qn=.006,jr=4,_e=.82,qe=1/_e,Kr=.12,$r=2;function Qr(t,e){return{azimuth:t*Qn,polar:-e*Qn}}function Zr(t,e,n){if(!n)return 1;let r=e[0]-t[0],a=e[2]-t[2];return(n[0]-e[0])*r+(n[2]-e[2])*a<0?-1:1}function Zn(t,e,n){let r=Math.max($r,Math.max(1,e)*Kr),a=n*jr;return{minDist:t?Math.min(t.minDist,r):r,maxDist:t?Math.max(t.maxDist,a):a}}var Jr=1.5;function ea(t,e,n){let r=Math.max(1,n)*Jr;if(!t)return{anchor:[e[0],e[1],e[2]],limit:r};let[a,o,i]=t.anchor,s=e[1]-o,l=Math.max(Math.abs(e[0]-a),Math.abs(e[2]-i),s>=0?s:-s*2);return{anchor:t.anchor,limit:Math.max(t.limit,l+r)}}function Jn(t,e,n,r,a,o,i,s){let l=Math.sin(n),u=[l*Math.sin(e),Math.cos(n),l*Math.cos(e)],d=[t[0]+r*u[0],t[1]+r*u[1],t[2]+r*u[2]],m=[-u[0],-u[1],-u[2]],f=[-m[2],0,m[0]],v=Math.hypot(f[0],f[2])||1;f=[f[0]/v,0,f[2]/v];let c=[f[1]*m[2]-f[2]*m[1],f[2]*m[0]-f[0]*m[2],f[0]*m[1]-f[1]*m[0]],g=Math.tan(a*ce/2),x=g*(o>0?o:1),M=[0,1,2].map(E=>m[E]+i*x*f[E]+s*g*c[E]);if(M[1]>=-1e-6)return null;let D=(t[1]-d[1])/M[1],S=Math.hypot(M[0],M[1],M[2]);return!(D>0)||D*S>r*ta?null:[d[0]+M[0]*D,t[1],d[2]+M[2]*D]}var eo=3,ta=4,to=.72;function no(t,e){let n=Math.sin(e),r=-n*Math.sin(t),a=-Math.cos(e),o=-n*Math.cos(t);if(Math.abs(a)>.999)return null;let i=-o,s=r,l=Math.hypot(i,s);return i/=l,s/=l,{fx:r,fy:a,fz:o,rx:i,rz:s,ux:-s*a,uy:s*r-i*o,uz:i*a}}var na=.4;function oa(t,e,n,r,a,o){let i=[t.center[0],t.center[1],t.center[2]],s=o(i),l=t.fitPoints,u=no(r,a);if(!l||l.length<9||!u)return{center:i,distance:s};let{fx:d,fy:m,fz:f,rx:v,rz:c,ux:g,uy:x,uz:M}=u,D=Math.hypot(d,f),S=d/D,E=f/D,F=S*g+E*M,I=na*Math.max(1,t.radius);for(let h=0;h<3;h++){let y=1/0,T=-1/0,A=1/0,V=-1/0;for(let Y=0;Y+2<l.length;Y+=3){let R=l[Y]-i[0],w=l[Y+1]-i[1],ee=l[Y+2]-i[2],k=s+R*d+w*m+ee*f;if(!(k>.001))continue;let P=(R*v+ee*c)/(k*e),H=(R*g+w*x+ee*M)/(k*n);P<y&&(y=P),P>T&&(T=P),H<A&&(A=H),H>V&&(V=H)}if(!Number.isFinite(y))break;let L=(y+T)/2*s*e,_=Math.abs(F)>.1?(A+V)/2*s*n/F:0,N=L*v+_*S,U=L*c+_*E;if(Math.hypot(i[0]+N-t.center[0],i[2]+U-t.center[2])>I){let Y=i[0]-t.center[0],R=i[2]-t.center[2],w=Y+N,ee=R+U,k=I/Math.hypot(w,ee);N=w*k-Y,U=ee*k-R}i=[i[0]+N,i[1],i[2]+U],s=o(i)}return{center:i,distance:s}}var mt=class{constructor(e,n,r,a){this.fovY=$n;this.target=new Ot;this.azimuth=-30*ce;this.polar=55*ce;this.distance=10;this.azT=-30*ce;this.polT=55*ce;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new Ot;this.panAnchor=new Ot;this.panLimit=0;this.panBox=null;this.grabSign=1;this.zoomPointResolver=null;this.primaryDragMode="orbit";this.camera=new qr(e,{fov:$n,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=a,this.onPointerDown=o=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(o.pointerId)}catch{}if(this.activePointers.set(o.pointerId,{x:o.clientX,y:o.clientY}),this.activePointers.size===1){let i=o.button===2||o.button===1,s=o.button===0&&(o.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=i||s,this.dragging=!this.panning,this.dragging&&(this.grabSign=this.grabSignAt(o.clientX,o.clientY)),this.lastX=o.clientX,this.lastY=o.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let i=this.pinchCentroid();this.pinchCx=i.x,this.pinchCy=i.y}}},this.onPointerMove=o=>{if(!this.interactionEnabled||!this.activePointers.has(o.pointerId))return;if(this.activePointers.set(o.pointerId,{x:o.clientX,y:o.clientY}),this.activePointers.size>=2){let u=this.currentPinchDistance(),d=this.pinchCentroid();this.pinchDist>0&&(this.dollyAt(Math.exp((this.pinchDist-u)*.005),d.x,d.y),this.fireGesture()),this.pinchDist=u,this.panBy(d.x-this.pinchCx,d.y-this.pinchCy),this.pinchCx=d.x,this.pinchCy=d.y;return}let i=o.clientX-this.lastX,s=o.clientY-this.lastY;if(this.panning){this.lastX=o.clientX,this.lastY=o.clientY,(i!==0||s!==0)&&(this.panBy(i,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=o.clientX,this.lastY=o.clientY,(i!==0||s!==0)&&this.fireGesture();let l=Qr(i,s);this.azT+=l.azimuth*this.grabSign,this.polT=Math.max(Nt,Math.min(Ht,this.polT+l.polar)),this.requestRender()},this.onPointerUp=o=>{this.activePointers.delete(o.pointerId);try{this.canvas.releasePointerCapture?.(o.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=o=>{o.preventDefault()},this.onWheel=o=>{if(o.preventDefault(),!this.interactionEnabled)return;let i=o.deltaMode===1?16:o.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,o.deltaY*i/100));this.dollyAt(Math.exp(s*.22),o.clientX,o.clientY),this.fireGesture()},this.onKeyDown=o=>{if(!this.interactionEnabled)return;let i=7*ce;if(o.shiftKey&&(o.key==="ArrowLeft"||o.key==="ArrowRight"||o.key==="ArrowUp"||o.key==="ArrowDown"))this.panBy(o.key==="ArrowLeft"?-32:o.key==="ArrowRight"?32:0,o.key==="ArrowUp"?-32:o.key==="ArrowDown"?32:0);else if(o.key==="ArrowLeft"||o.key==="ArrowRight")this.azT+=o.key==="ArrowLeft"?-i:i;else if(o.key==="ArrowUp"||o.key==="ArrowDown")this.polT=Math.max(Nt,Math.min(Ht,this.polT+(o.key==="ArrowUp"?-i:i)));else if(o.key==="+"||o.key==="=")this.dollyBy(_e);else if(o.key==="-"||o.key==="_")this.dollyBy(qe);else return;o.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let e=[...this.activePointers.values()];if(!e.length)return{x:0,y:0};let n=0,r=0;for(let a of e)n+=a.x,r+=a.y;return{x:n/e.length,y:r/e.length}}panBy(e,n){let r=this.canvas.clientHeight||1,a=2*this.distance*Math.tan(this.fovY*ce/2)/r,o=Math.sin(this.azimuth),i=Math.cos(this.azimuth),s=i,l=-o,u=Math.cos(this.polar),d=Math.sin(this.polar),m=-o*u,f=-i*u;this.targetT.x+=(-e*s+n*m)*a,this.targetT.z+=(-e*l+n*f)*a,this.targetT.y+=n*d*a,this.clampPan(),this.requestRender()}widenPanBox(e){this.panBox=ea(this.panBox,e.center,e.radius),this.panAnchor.set(this.panBox.anchor[0],this.panBox.anchor[1],this.panBox.anchor[2]),this.panLimit=this.panBox.limit}clampPan(){if(this.panLimit<=0)return;let e=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,a=this.panAnchor.z;this.targetT.x=Math.max(n-e,Math.min(n+e,this.targetT.x)),this.targetT.z=Math.max(a-e,Math.min(a+e,this.targetT.z)),this.targetT.y=Math.max(r-e*.5,Math.min(r+e,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let e=[...this.activePointers.values()];return e.length<2?0:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)}dollyBy(e){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*e)),this.requestRender()}dollyAt(e,n,r){let a=this.distT,o=this.canvas.getBoundingClientRect?.(),i=this.zoomPointResolver?.(n,r)??null;if(i){this.distT=Math.max(eo,Math.min(this.maxDist,this.distT*e)),this.minDist=Math.min(this.minDist,Math.max(eo,this.distT)),this.requestRender(),this.scaleTargetAbout(i,this.distT/a);return}let s=o&&o.width>0&&o.height>0?Jn([this.targetT.x,this.targetT.y,this.targetT.z],this.azT,this.polT,this.distT,this.fovY,this.camera.aspect||o.width/o.height,(n-o.left)/o.width*2-1,1-(r-o.top)/o.height*2):null;this.dollyBy(e),s&&this.scaleTargetAbout(s,this.distT/a)}scaleTargetAbout(e,n){!Number.isFinite(n)||n===1||(this.targetT.x=e[0]+(this.targetT.x-e[0])*n,this.targetT.y=e[1]+(this.targetT.y-e[1])*n,this.targetT.z=e[2]+(this.targetT.z-e[2])*n,this.clampPan())}grabSignAt(e,n){let r=this.canvas.getBoundingClientRect?.(),a=this.zoomPointResolver?.(e,n)??(r&&r.width>0&&r.height>0?Jn([this.target.x,this.target.y,this.target.z],this.azimuth,this.polar,this.distance,this.fovY,this.camera.aspect||r.width/r.height,(e-r.left)/r.width*2-1,1-(n-r.top)/r.height*2):null),o=this.camera.position;return Zr([o.x,o.y,o.z],[this.target.x,this.target.y,this.target.z],a)}setZoomPointResolver(e){this.zoomPointResolver=e}zoomBy(e){this.interactionEnabled&&(this.dollyBy(e),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}setPrimaryDragMode(e){this.primaryDragMode=e}setInteractionEnabled(e){this.interactionEnabled=e,!e&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(e,n=!1,r,a=!1,o){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.widenPanBox(e);let i=Math.max(1,e.radius),s=this.fovY*ce/2,l=a?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*l);this.azT=r??-30*ce,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*ce;let d=this.framedOn(e,s,u),m=d.distance;this.target.set(d.center[0],d.center[1],d.center[2]),this.targetT.copy(this.target),this.distT=m*Math.max(1.05,Math.min(2,o?.margin??Gt)),this.envelope=Zn(this.envelope,i,m),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*ce,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(e){if(!(e>0)||!Number.isFinite(e))return;let n=this.camera.aspect;if(this.interactionEnabled&&n>0){let r=Math.min(n,1)/Math.min(e,1);this.distance*=r,this.distT*=r,this.maxDist=Math.max(this.maxDist,this.distance,this.distT),this.applyPosition()}this.camera.perspective({aspect:e})}glideTo(e,n){this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.widenPanBox(e),this.targetT.set(e.center[0],e.center[1],e.center[2]);let r=this.fovY*ce/2,a=Math.atan(Math.tan(r)*(this.camera.aspect||1));this.azT=this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*ce;let o=this.framedOn(e,r,a),i=o.distance;this.targetT.set(o.center[0],o.center[1],o.center[2]),this.distT=i*Math.max(1.05,Math.min(2,n?.margin??Gt)),this.envelope=Zn(this.envelope,Math.max(1,e.radius),i),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.requestRender()}frameSoft(e,n,r=!1,a){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.widenPanBox(e),this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let o=this.fovY*ce/2,i=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(o)*i);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,a?.polarDeg??55))*ce;let l=this.framedOn(e,o,s);this.targetT.set(l.center[0],l.center[1],l.center[2]),this.distT=l.distance*Math.max(1.05,Math.min(2,a?.margin??Gt))}framedOn(e,n,r){return oa(e,Math.tan(r),Math.tan(n),this.azT,this.polT,a=>this.fitDistance({...e,center:a},n,r,this.azT,this.polT))}fitDistance(e,n,r,a,o){let i=Math.max(1,e.radius),s=Math.max(i/Math.tan(n),i/Math.tan(r)),l=e.box;if(!l)return s;let u=no(a,o);if(!u)return s;let{fx:d,fy:m,fz:f,rx:v,rz:c,ux:g,uy:x,uz:M}=u,D=Math.tan(r),S=Math.tan(n),E=1;for(let A=0;A<8;A++){let V=(A&1?l.max[0]:l.min[0])-e.center[0],L=(A&2?l.max[1]:l.min[1])-e.center[1],_=(A&4?l.max[2]:l.min[2])-e.center[2],N=V*d+L*m+_*f,U=Math.abs(V*v+_*c),z=Math.abs(V*g+L*x+_*M);E=Math.max(E,U/D-N,z/S-N)}let F=Math.min(s,Math.max(E,i*.35)),I=e.fitPoints;if(!I||I.length<9)return F;let h=0,y=1/(D*to),T=1/(S*to);for(let A=0;A+2<I.length;A+=3){let V=I[A]-e.center[0],L=I[A+1]-e.center[1],_=I[A+2]-e.center[2],N=V*d+L*m+_*f,U=Math.abs(V*v+_*c),z=Math.abs(V*g+L*x+_*M);h=Math.max(h,U*y-N,z*T-N)}return Math.min(F*1.5,Math.max(F*.55,h))}updateClipping(e){let n=this.camera.position.x-e.center[0],r=this.camera.position.y-e.center[1],a=this.camera.position.z-e.center[2],o=Math.hypot(this.camera.position.x-this.target.x,this.camera.position.y-this.target.y,this.camera.position.z-this.target.z),i=this.interactionEnabled&&Math.abs(o-this.distance)<=this.distance*.01,{near:s,far:l}=ia(Math.hypot(n,r,a),e.radius,i?this.distance:null);this.camera.perspective({near:s,far:l,aspect:this.camera.aspect})}update(){let e=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,a=this.targetT.x-this.target.x,o=this.targetT.y-this.target.y,i=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),l=Math.abs(e)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(a)>s||Math.abs(o)>s||Math.abs(i)>s;return this.azimuth+=e*Ie,this.polar+=n*Ie,this.distance+=r*Ie,this.target.x+=a*Ie,this.target.y+=o*Ie,this.target.z+=i*Ie,l&&this.applyPosition(),l}get currentAzimuth(){return this.azimuth}get currentDistance(){return this.distance}syncFromCamera(){let e=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,a=Math.hypot(e,n,r)||1,o=Math.max(Nt,Math.min(Ht,Math.acos(Math.max(-1,Math.min(1,n/a)))));this.distance=this.distT=a,this.polar=this.polT=o,this.azimuth=this.azT=Math.atan2(e,r)}setTarget(e){this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target)}resumeAfterFlight(e){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),e&&this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let e=Math.sin(this.polar),n=this.target.x+this.distance*e*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),a=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(n,r,a),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}},ra=.1,aa=.25;function ia(t,e,n){let r=Math.max(1,e)*1.18,a=n==null?aa:Math.max(.05,n*ra),o=Math.max(a,t-r),i=Math.max(o+10,t+r);return{near:o,far:i}}var ht=class{constructor(e){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=e=>{let n=this.lastTime?(e-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=e,n>0){let a=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+a*.1:a}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=e}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};function oo(t){let e=!1;return n=>{n!==e&&(e=n,n?t.dataset.slReady="1":delete t.dataset.slReady)}}var De=2.5,sa=1.15,je=12,Le=22,ro=6,ao=9.5,io=.9,so=2.2,Bt=30,Wt=4,pt=8192;var Cs=Le+Wt;function lo(t,e){let n=e*1.4,r=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:De};let a=Math.min(1,(t-n)/Math.max(.001,r-n));return{scale:1-a*.4,fade:a*.55,minPixels:De+a*(sa-De)}}function co(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}var la=12;function uo(t,e,n,r,a){if(!(t>0)||!(e>0)||!(n>0)||!(r>0)||!(a>0))return!1;let o=Math.tan(r/2*Math.PI/180);if(!(o>0))return!1;let i=e/(n*o)*(a/2);return Math.PI*i*i/t>=la}import{Geometry as ca,Mesh as ua,Program as da,Transform as ma}from"ogl";var ha=.05,pa=.6,fa=12,va=1.6,ba=1,ga=2.5,ya=650,mo=24;function xa(t){let e=[],n=[],r=[],a=(m,f,v)=>{e.push(...m),n.push(...f),r.push(v)};for(let m=0;m<16;m++){let f=m/16*Math.PI*2,v=(m+1)/16*Math.PI*2,c=S=>[Math.cos(S),0,Math.sin(S)],g=[Math.cos(f)*.012,0,Math.sin(f)*.012],x=[Math.cos(v)*.012,0,Math.sin(v)*.012],M=[Math.cos(f)*.03,1,Math.sin(f)*.03],D=[Math.cos(v)*.03,1,Math.sin(v)*.03];a(g,c(f),0),a(M,c(f),0),a(D,c(v),0),a(g,c(f),0),a(D,c(v),0),a(x,c(v),0)}let l=.16,u=.24,d=.01;for(let m=0;m<48;m++){let f=m/48*Math.PI*2,v=(m+1)/48*Math.PI*2,c=[Math.cos(f)*l,d,Math.sin(f)*l],g=[Math.cos(f)*u,d,Math.sin(f)*u],x=[Math.cos(v)*u,d,Math.sin(v)*u],M=[Math.cos(v)*l,d,Math.sin(v)*l];for(let D of[c,g,x,c,x,M])a(D,[0,1,0],1)}return new ca(t,{position:{size:3,data:new Float32Array(e)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(r)}})}var Sa=`#version 300 es
2
+ precision highp float;
3
+ in vec3 position; in vec3 normal; in float part;
4
+ uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform mat3 normalMatrix;
5
+ uniform vec3 uSeat; uniform float uHeight; uniform float uLift; uniform float uRingScale;
6
+ out vec3 vNormal; out float vPart;
7
+ void main() {
8
+ vNormal = normalize(normalMatrix * normal);
9
+ vPart = part;
10
+ // The stem rises out of the ring as the pin lands (uLift runs 1 \u2192 0).
11
+ float grow = part > 0.5 ? 1.0 : 1.0 - uLift;
12
+ // The ring is the seat's own size, not the stem's: grown with the stem it
13
+ // spread over the neighbouring seats and read as a horseshoe from afar.
14
+ float scale = part > 0.5 ? uRingScale : uHeight;
15
+ vec3 world = uSeat + vec3(position.x, position.y * grow, position.z) * scale;
16
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(world, 1.0);
17
+ }`,wa=`#version 300 es
18
+ precision highp float;
19
+ in vec3 vNormal; in float vPart;
20
+ uniform vec3 uColor; uniform float uRingAlpha;
21
+ out vec4 fragColor;
22
+ void main() {
23
+ if (vPart > 0.5) { fragColor = vec4(uColor, uRingAlpha); return; }
24
+ // View-space light from the upper left: a lit, round stem reads as an
25
+ // object standing in the venue rather than a line drawn on the screen.
26
+ float key = max(dot(normalize(vNormal), normalize(vec3(-0.4, 0.7, 0.6))), 0.0);
27
+ vec3 c = uColor * (0.55 + 0.5 * key) + vec3(0.12) * pow(key, 12.0);
28
+ fragColor = vec4(c, 1.0);
29
+ }`;function Ma(t){if(t>=1)return 1;if(t<.72){let n=t/.72;return 1-(1-n)*(1-n)}let e=(t-.72)/.28;return 1-.08*Math.sin(e*Math.PI)}function Ut(t){return Math.max(pa,Math.min(fa,t*ha))}function ho(t,e){let n=new ma,r=xa(t),a=new Map,o=(i,s)=>{let l=new da(t,{vertex:Sa,fragment:wa,uniforms:{uSeat:{value:i},uHeight:{value:1},uLift:{value:0},uRingScale:{value:1},uColor:{value:e},uRingAlpha:{value:.85}},transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1}),u=new ua(t,{geometry:r,program:l});return u.frustumCulled=!1,u.setParent(n),{mesh:u,program:l,seat:i,start:s}};return{root:n,setSeats(i,s,l){let u=new Set(i.slice(0,mo).map(d=>d.id));for(let[d,m]of a)u.has(d)||(m.mesh.setParent(null),a.delete(d));for(let d of i.slice(0,mo))a.has(d.id)||a.set(d.id,o(d.position,l?s:-1/0))},update(i,s,l,u=!1){let d=!1;for(let m of a.values()){let f=s[0]-m.seat[0],v=s[1]-m.seat[1],c=s[2]-m.seat[2],g=Math.hypot(f,v,c);m.mesh.visible=!l&&g>(u?ba:ga);let x=Ut(g),M=Math.max(0,Math.min(1,(i-m.start)/ya));M<1&&(d=!0),m.program.uniforms.uHeight.value=x,m.program.uniforms.uRingScale.value=Math.min(x,va),m.program.uniforms.uLift.value=u?1:1-Ma(M),m.program.uniforms.uRingAlpha.value=.55+.4*(M<1?Math.sin(M*Math.PI):0)}return d},dispose(){for(let i of a.values())i.mesh.setParent(null);a.clear(),r.remove()}}}var Ke="#ffffff",po="#0b1220",$e=6,Pa=80,fo=14,vo=88,bo=20,go={floor:{size:14,weight:"700",opacity:.98},stage:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},Aa=640,Ca=.8,Ea=11,Ra="3px 7px",Ta="2px 5px",yo="rgba(10,14,22,.62)",Fa="#f4f7fb",xo=5,So=2,Ia=6,Qe=new Set(["row","seat"]),wo={stage:6,floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Ve={row:{x:66,y:20},seat:{x:52,y:22}},Xt=Cn,Yt=t=>En(t);function qt(t,e){let n=Yt(t),r=Yt(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function jt(t,e){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(t.replace(/\s/g,""));if(!n)return e;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(a=>Number(n[a])/255*r+e[a-1]*(1-r))}function _a(t,e=[.04,.06,.1],n=!0){let r=Yt(e)<.42,a=r?"#f4f7fb":"#0b1220",o=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",i=n?jt(o,e):e,s=Xt(t),l=n?7:4.5,u=s&&qt(s,i)>=l?t:a;return r?{ink:u,backing:o,border:"rgba(210,222,245,.24)"}:{ink:u,backing:o,border:"rgba(11,18,32,.22)"}}function Da(t,e=[.04,.06,.1]){let n=jt(yo,e),r=Xt(t);return{ink:r&&qt(r,n)>=4.5?t:Fa,backing:yo}}var La='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',ft=class{constructor(e,n={}){this.nodes=new Map;this.labels=[];this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.seatNumberRow=void 0;this.pinHeads=[];this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",r.fontFamily=n.fontFamily||La,e.appendChild(this.root)}setVisible(e){this.root.style.visibility=e?"":"hidden"}setLabels(e){this.labels=e;let n=new Set(e.map(r=>r.id));for(let[r,a]of this.nodes)n.has(r)||(a.remove(),this.nodes.delete(r))}setForcedDense(e){this.forcedDense=e}setSeatNumberRow(e){return e===this.seatNumberRow?!1:(this.seatNumberRow=e,!0)}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,n=>`seat:${n}`))}sizeFor(e){let n=go[e].size;return!this.narrowStage||Qe.has(e)?n:Math.max(Ea,n*Ca)}qualityEvidence(){let e=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let a=this.nodes.get(r.id),o=a?.getBoundingClientRect(),i=!!(n&&a&&a.style.display!=="none"&&o&&o.width>0&&o.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:i,renderedFontPx:a&&Number.parseFloat(a.style.fontSize)||0,contrast:a?Number(a.dataset.qualityContrast??0):0,...i&&o?{screenBox:{x:o.x-e.x,y:o.y-e.y,width:o.width,height:o.height}}:{}}})}update(e,n,r,a,o,i){if(!this.labels.length)return;this.narrowStage=n>0&&n<Aa;let s=Vn(a,o,{hasZoneLabels:this.labels.some(h=>h.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let l=[];for(let h of this.labels){if(!s.has(h.kind)&&!(h.kind==="seat"&&this.selectedSeatLabelIds.has(h.id)))continue;let y=h.kind==="seat"&&i&&this.selectedSeatLabelIds.has(h.id)?h.pinBase:void 0,T=y&&i?[y[0],y[1]+Ut(Math.hypot(y[0]-i[0],y[1]-i[1],y[2]-i[2])),y[2]]:h.anchor,A=ge(e,T,n,r);if(!A.visible)continue;let V=Qe.has(h.kind),L=this.sizeFor(h.kind),_=Nn(h.text,L,!V)+(V?xo*2:0);if(h.kind==="seat"&&h.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(h.id)&&Bn(e,h.anchor,h.seatWidthM,n)<Math.max(22,_))continue;let N=kn(A,_/2,L/2+(V?So:4),n,r),U=i?Math.hypot(h.anchor[0]-i[0],h.anchor[1]-i[1],h.anchor[2]-i[2]):1;l.push({label:h,screen:N,focus:Gn(N,U,n,r),halfWidth:_/2,...this.selectedSeatLabelIds.has(h.id)?{priority:1}:{}})}let u=Ln(l.filter(h=>h.label.kind==="floor"),n),d=[...l.filter(h=>!Qe.has(h.label.kind)&&h.label.kind!=="floor"),...u],m=Hn(n),f=l.filter(h=>h.label.kind==="seat"&&this.selectedSeatLabelIds.has(h.label.id)),v=ut(f,Ve.seat.x,Ve.seat.y,m.seat);this.placePinHeads(f.filter(h=>h.label.pinBase&&!v.includes(h)).map(h=>h.screen));let c=zn(d,vo,bo).filter(h=>!v.some(y=>On(h,y,vo,bo))),g=ut(l.filter(h=>h.label.kind==="row"),Ve.row.x,Ve.row.y,m.row,[...c,...v]),x=this.seatNumberRow!==void 0,M=ut(l.filter(h=>h.label.kind==="seat"&&!this.selectedSeatLabelIds.has(h.label.id)&&(!x||this.seatNumberRow!==null&&h.label.rowId===this.seatNumberRow)),Ve.seat.x,Ve.seat.y,x?Pa:m.seat-v.length,[...c,...v,...g]),D=[...c,...g,...v,...M],S=new Set(D.map(h=>h.label.id));for(let{label:h,screen:y}of D){let A=this.nodeFor(h).style;A.display="";let V=!!h.pinBase&&this.selectedSeatLabelIds.has(h.id);A.transform=V?`translate(-50%, -100%) translate(${y.x.toFixed(1)}px, ${(y.y-$e).toFixed(1)}px)`:`translate(-50%, -50%) translate(${y.x.toFixed(1)}px, ${y.y.toFixed(1)}px)`}let F=D.filter(({label:h})=>!Qe.has(h.kind)).sort((h,y)=>wo[y.label.kind]-wo[h.label.kind]||h.screen.depth-y.screen.depth||h.focus-y.focus).flatMap(({label:h})=>{let y=this.nodes.get(h.id);return y&&y.style.display!=="none"?[{node:y,box:y.getBoundingClientRect()}]:[]}),I=[];for(let{node:h,box:y}of F)I.some(A=>y.left<A.right+3&&y.right+3>A.left&&y.top<A.bottom+3&&y.bottom+3>A.top)?h.style.display="none":I.push(y);for(let[h,y]of this.nodes)S.has(h)||(y.style.display="none")}nodeFor(e){let n=this.nodes.get(e.id);if(!n){n=document.createElement("div");let g=n.style;g.position="absolute",g.left="0",g.top="0",g.whiteSpace="nowrap",g.display="none",this.root.appendChild(n),this.nodes.set(e.id,n)}let r=this.selectedSeatLabelIds.has(e.id),a=this.nodeAppearance.get(n);if(a&&a.text===e.text&&a.kind===e.kind&&a.color===e.color&&a.selected===r&&a.narrow===this.narrowStage)return n;if(this.nodeAppearance.set(n,{text:e.text,kind:e.kind,color:e.color,selected:r,narrow:this.narrowStage}),n.textContent=e.text,r){let g=document.createElement("span"),x=g.style;x.position="absolute",x.left="50%",x.bottom=`-${$e}px`,x.transform="translateX(-50%)",x.borderLeft=`${$e}px solid transparent`,x.borderRight=`${$e}px solid transparent`,x.borderTop=`${$e}px solid ${Ke}`,n.appendChild(g)}n.setAttribute("data-label-kind",e.kind),n.toggleAttribute("data-selected-seat",r);let o=go[e.kind],i=n.style;i.fontSize=`${this.sizeFor(e.kind)}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let s=Qe.has(e.kind),l=!s,u=_a(e.color??this.opts.ink,this.opts.backgroundRgb,!0),d=s?Da(e.color??this.opts.ink,this.opts.backgroundRgb):u;i.color=r?po:d.ink,i.background=r?Ke:d.backing,i.border=r?`1px solid ${Ke}`:l?`1px solid ${u.border}`:"",i.borderRadius=r||l?"999px":`${Ia}px`;let m=this.narrowStage?Ta:Ra;i.padding=r||l?m:`${So}px ${xo}px`,i.lineHeight=s?"1.1":"",i.boxShadow=r?"0 0 0 3px rgba(255,255,255,.28), 0 0 18px rgba(255,255,255,.55), 0 5px 14px rgba(0,0,0,.45)":l?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",i.textShadow=r||l?"none":"0 1px 1px rgba(0,0,0,0.4)",i.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let f=this.opts.backgroundRgb??[.04,.06,.1],v=Xt(r?po:d.ink)??[1,1,1],c=jt(r?Ke:d.backing,f);return n.dataset.qualityContrast=qt(v,c).toFixed(3),i.textTransform=e.kind==="zone"||e.kind==="floor"?"uppercase":"",n}placePinHeads(e){for(;this.pinHeads.length<e.length;){let n=document.createElement("div");n.setAttribute("data-pin-head",""),n.setAttribute("aria-hidden","true");let r=n.style;r.position="absolute",r.left="0",r.top="0",r.width=`${fo}px`,r.height=`${fo}px`,r.borderRadius="50%",r.background=Ke,r.boxShadow="0 0 0 3px rgba(255,255,255,.28), 0 0 14px rgba(255,255,255,.55), 0 3px 8px rgba(0,0,0,.45)",r.pointerEvents="none",this.root.appendChild(n),this.pinHeads.push(n)}this.pinHeads.forEach((n,r)=>{let a=e[r];n.style.display=a?"":"none",a&&(n.style.transform=`translate(-50%, -100%) translate(${a.x.toFixed(1)}px, ${a.y.toFixed(1)}px)`)})}dispose(){this.pinHeads=[],this.root.remove(),this.nodes.clear()}};var Va=1;var ka=new Set(["floor","stage","zone","section","ga","booth","annotation"]);function za(t){return t.every(e=>Number.isFinite(e))}function Oa(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 Ee(t){return Math.round(t*1e4)/1e4}function Na(t){if(t)return{box:{x:Ee(t.box.x),y:Ee(t.box.y),width:Ee(t.box.width),height:Ee(t.box.height)},horizontalFillRatio:Ee(t.horizontalFillRatio),verticalFillRatio:Ee(t.verticalFillRatio),visibleAreaRatio:Ee(t.visibleAreaRatio),clippedEdges:[...t.clippedEdges]}}function ye(t,e,n){return n.length?{code:t,message:e,count:n.length,samples:n.slice(0,20)}:null}function Kt(t){let e=t.labels.filter(s=>s.visible&&s.screenBox),n=e.filter(s=>ka.has(s.kind)),r=t.scene.floorCount>1?t.scene.floorCount:t.scene.zoneCount||t.scene.sectionCount,a=[];for(let s=0;s<n.length;s+=1)for(let l=0;l<s;l+=1)Oa(n[s].screenBox,n[l].screenBox)&&a.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[l].id});let o=[...t.camera.position,t.camera.distance,t.camera.verticalFovDeg],i=[ye("webgl2-unavailable","The venue scene must render through WebGL2",t.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),ye("context-lost","The WebGL context must be live at capture",t.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),ye("frame-not-stable","The captured 3D frame must be rendered and parked",t.frame.rendered>0&&t.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),ye("viewport-empty","The 3D viewport must have visible dimensions",t.viewport.width>1&&t.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${t.viewport.width}\xD7${t.viewport.height}`}]),ye("camera-invalid","The capture camera must have a finite physical pose",za(o)&&t.camera.distance>0&&t.camera.verticalFovDeg>0&&t.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),ye("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!t.scene.authoredRelief||t.scene.renderedVerticalSpanM>.05&&t.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:t.scene.projectedReliefPx,minimum:2}]),ye("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),ye("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),ye("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),ye("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",a)].filter(s=>!!s);return{version:1,state:"venue3d",passed:i.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:t.viewport,context:t.context,frame:t.frame,camera:t.camera,scene:t.scene,composition:{visibleLabels:e.map(({id:s,kind:l,text:u})=>({id:s,kind:l,text:u})).sort((s,l)=>s.kind.localeCompare(l.kind)||s.id.localeCompare(l.id)),framing:Na(t.framing)},metrics:{minimumHierarchyFontPx:Mo(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Mo(n.map(s=>s.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:i}}function Po(t,e,n){t.fill(0);for(let r=0;r<Math.min(n,e.length);r++)t[e[r]]=1}import{Geometry as Ze,Mesh as Je,Program as ci,Texture as ui,Transform as No}from"ogl";import{Program as Re}from"ogl";var vt=`
2
30
  float chairWeight(float depth) {
3
31
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
4
- }`,Kn=`
32
+ }`,Ao=`
5
33
  float occupantWeight(float depth) {
6
- float nearWeight = smoothstep(${Ln.toFixed(1)}, ${kn.toFixed(1)}, depth);
7
- float farWeight = 1.0 - smoothstep(${_n.toFixed(1)}, ${Vn.toFixed(1)}, depth);
34
+ float nearWeight = smoothstep(${io.toFixed(1)}, ${so.toFixed(1)}, depth);
35
+ float farWeight = 1.0 - smoothstep(${ro.toFixed(1)}, ${ao.toFixed(1)}, depth);
8
36
  return nearWeight * farWeight;
9
- }`,Bt=`
37
+ }`,$t=`
10
38
  float glyphEq(float glyph, float expected) {
11
39
  return 1.0 - step(0.25, abs(glyph - expected));
12
40
  }
@@ -55,7 +83,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
55
83
  p.y += 0.16;
56
84
  }
57
85
  return p;
58
- }`,Wr=`#version 300 es
86
+ }`,Ha=`#version 300 es
59
87
  precision highp float;
60
88
  in vec3 position;
61
89
  in vec3 normal;
@@ -93,7 +121,13 @@ void main() {
93
121
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
94
122
  vColor = color;
95
123
  gl_Position = projectionMatrix * mv;
96
- }`,Ur=`#version 300 es
124
+ }`,Co=`
125
+ bool roomWallHidden(float material, vec3 normalWorld, vec3 posWorld, vec3 eye, vec2 roomCentre) {
126
+ if (abs(material - 6.0) > 0.5) return false;
127
+ vec3 n = normalize(normalWorld);
128
+ if (abs(n.y) > 0.5) return true;
129
+ return dot(n.xz, eye.xz - posWorld.xz) * dot(n.xz, roomCentre - posWorld.xz) <= 0.0;
130
+ }`,Ga=`#version 300 es
97
131
  precision highp float;
98
132
  in vec3 vColor;
99
133
  in vec3 vNormalWorld;
@@ -110,7 +144,10 @@ uniform float uSectionFilter;
110
144
  uniform float uFocusFloor;
111
145
  uniform sampler2D tVenueShadow;
112
146
  uniform mat4 uShadowMatrix;
147
+ uniform vec3 cameraPosition;
148
+ uniform vec2 uRoomCentre;
113
149
  out vec4 fragColor;
150
+ ${Co}
114
151
  // Stable world-space variation; no textures or per-frame random grain.
115
152
  float turfHash(vec2 p) {
116
153
  vec3 q = fract(vec3(p.xyx) * 0.1031);
@@ -149,6 +186,7 @@ float architecturalLight(vec3 normal) {
149
186
  }
150
187
  void main() {
151
188
  if (vDim > 0.5) discard;
189
+ if (roomWallHidden(vMaterial, vNormalWorld, vPosWorld, cameraPosition, uRoomCentre)) discard;
152
190
  // Row treads (material 3) and risers (material 2) are chart truth: the
153
191
  // stepped deck IS the stand, at every distance. What must not survive at
154
192
  // whole-venue scale is the risers' darker shade \u2014 hundreds of sub-pixel dark
@@ -199,7 +237,10 @@ void main() {
199
237
  // of crushing to a single flat value.
200
238
  vec3 fillDir = normalize(vec3(-uKeyDir.x, 0.25, -uKeyDir.z));
201
239
  float fill = max(dot(N, fillDir), 0.0);
202
- vec3 base = vColorRung * (0.40 + 0.28 * hemi) * mix(0.76, 1.0, visibility) + vColorRung * key * 0.46 + vColorRung * fill * 0.12;
240
+ // More sun, less flat ambient: at 0.40-0.68 ambient against a 0.46 key every
241
+ // face read at nearly one value and venues looked flat beside a lit reference
242
+ // (3D Digital Venue comparison, 2026-09-24). Lit and turned faces now part.
243
+ vec3 base = vColorRung * (0.34 + 0.26 * hemi) * mix(0.72, 1.0, visibility) + vColorRung * key * 0.60 + vColorRung * fill * 0.10;
203
244
  float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
204
245
  // Material 1 is a powered display and keeps its authored emission treatment.
205
246
  // Every architectural material uses the venue roughness token; 0.78 maps to
@@ -233,8 +274,8 @@ void main() {
233
274
  + vec3(0.20, 0.10, 0.34) * focalHalo;
234
275
  base = mix(base, display, poweredDisplay * verticalFace * 0.92);
235
276
  fragColor = vec4(base, 1.0);
236
- }`,Qn=`
237
- ${Bt}
277
+ }`,Eo=`
278
+ ${$t}
238
279
  vec4 seatSurface(vec3 source, float radius) {
239
280
  vec4 origin = modelViewMatrix * vec4(iOffset, 1.0);
240
281
  if (iPhysicalSeat < 0.5) {
@@ -248,12 +289,12 @@ vec4 seatSurface(vec3 source, float radius) {
248
289
  if (surface < 0.5) return origin;
249
290
  vec3 p = glyphChairPosition(source, surface, iGlyph);
250
291
  p.xz *= iChairWidth;
251
- if (surface > 1.5) p.z -= max(p.y - ${Ae.toFixed(2)}, 0.0) * ${Be.toFixed(2)} * glyphBackRake(iGlyph);
292
+ if (surface > 1.5) p.z -= max(p.y - ${Ce.toFixed(2)}, 0.0) * ${Ue.toFixed(2)} * glyphBackRake(iGlyph);
252
293
  float c = cos(iYaw), s = sin(iYaw);
253
294
  vec3 rotated = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
254
295
  return modelViewMatrix * vec4(iOffset + rotated, 1.0);
255
296
  }
256
- `,Yr=`#version 300 es
297
+ `,Ba=`#version 300 es
257
298
  precision highp float;
258
299
  in float surface;
259
300
  in float iYaw;
@@ -292,8 +333,8 @@ out float vSectionFade;
292
333
  out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
293
334
  out float vPhysicalSeat;
294
335
  out float vPixelRadius;
295
- ${ut}
296
- ${Qn}
336
+ ${vt}
337
+ ${Eo}
297
338
  void main() {
298
339
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
299
340
  float depth = max(-mv.z, 0.001);
@@ -314,7 +355,7 @@ void main() {
314
355
  mv = seatSurface(position, r);
315
356
  // Match the shell's non-uniform width/depth scale before its back rake.
316
357
  vec3 n = vec3(normal.x / iChairWidth, normal.y, normal.z / iChairWidth);
317
- if (surface > 1.5) n.y += n.z * ${Be.toFixed(2)} * glyphBackRake(iGlyph);
358
+ if (surface > 1.5) n.y += n.z * ${Ue.toFixed(2)} * glyphBackRake(iGlyph);
318
359
  n = normalize(n);
319
360
  vSeatNormal = vec3(n.x * cos(iYaw) + n.z * sin(iYaw), n.y, -n.x * sin(iYaw) + n.z * cos(iYaw));
320
361
  vSeatHeight = position.y;
@@ -326,13 +367,13 @@ void main() {
326
367
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
327
368
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
328
369
  gl_Position = projectionMatrix * mv;
329
- }`,$n=`
370
+ }`,Ro=`
330
371
  float seatSilhouette(vec2 uv, float physical) {
331
372
  // Solid furniture owns its silhouette in geometry. Only empty bays need
332
373
  // a fragment mask; cutting physical faces would open holes in the volume.
333
374
  return mix(max(abs(uv.x), abs(uv.y)), 0.0, physical);
334
375
  }
335
- `,Xr=`#version 300 es
376
+ `,Wa=`#version 300 es
336
377
  precision highp float;
337
378
  in vec3 vSeatNormal;
338
379
  in float vSeatHeight;
@@ -352,7 +393,7 @@ uniform float uSeatDetail; // 0 for venue/area overview; 1 in section/row/sea
352
393
  uniform vec3 uFadeColor;
353
394
  uniform float uRoughness;
354
395
  out vec4 fragColor;
355
- ${$n}
396
+ ${Ro}
356
397
  void main() {
357
398
  if (vDim > 0.5) discard;
358
399
  // Same screen-door dissolve as the structure rung (uStructureDetail): the
@@ -391,7 +432,10 @@ void main() {
391
432
  // seat rather than a sample in a dense screen-space pattern. This is based on
392
433
  // actual projected pixels, so it remains correct for unusually large or small
393
434
  // venues where a radius-normalised camera distance is misleading.
394
- float detailedAlpha = alpha * smoothstep(2.4, 3.2, vPixelRadius) * uSeatDetail;
435
+ // Seats show from ~2 px across. At the old 2.4-3.2 px radius a stadium's
436
+ // whole-venue view hid every seat behind its tier tint and read as a flat
437
+ // 2D map (owner, 2026-09-23); below ~1 px they still dissolve, not alias.
438
+ float detailedAlpha = alpha * smoothstep(0.9, 1.5, vPixelRadius) * uSeatDetail;
395
439
  float grainAlpha = smoothstep(1.0, 0.55, d) * overviewGrain * 0.42;
396
440
  c = mix(vec3(0.27, 0.31, 0.32), c, uSeatDetail);
397
441
  alpha = max(detailedAlpha, grainAlpha);
@@ -414,7 +458,7 @@ void main() {
414
458
  c = mix(c, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
415
459
  }
416
460
  fragColor = vec4(c, alpha);
417
- }`,qr=`#version 300 es
461
+ }`,Ua=`#version 300 es
418
462
  precision highp float;
419
463
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
420
464
  in vec3 normal;
@@ -449,9 +493,10 @@ out float vDim;
449
493
  out float vSectionFade;
450
494
  out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
451
495
  out vec3 vOccupantTint;
452
- ${ut}
453
- ${Kn}
454
- ${Bt}
496
+ out float vTaken; // 1 = sold or held: not for sale
497
+ ${vt}
498
+ ${Ao}
499
+ ${$t}
455
500
  void main() {
456
501
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
457
502
  float viewDepth = -anchor.z;
@@ -473,6 +518,7 @@ void main() {
473
518
  // rasteriser discards, exactly as the chair itself collapses at w=0.
474
519
  float occupant = step(9.5, part);
475
520
  float taken = step(0.0, iSeed);
521
+ vTaken = taken;
476
522
  vOccupant = occupant;
477
523
  p = glyphChairPosition(p, part, iGlyph);
478
524
  if (iPhysicalSeat < 0.5) {
@@ -536,7 +582,7 @@ void main() {
536
582
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
537
583
  vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
538
584
  gl_Position = projectionMatrix * mv;
539
- }`,jr=`#version 300 es
585
+ }`,Ya=`#version 300 es
540
586
  precision highp float;
541
587
  in vec3 vColor;
542
588
  in vec3 vNormalWorld;
@@ -549,6 +595,7 @@ in float vDim;
549
595
  in float vSectionFade;
550
596
  in float vOccupant;
551
597
  in vec3 vOccupantTint;
598
+ in float vTaken;
552
599
  uniform vec3 uKeyDir;
553
600
  uniform vec3 uFadeColor;
554
601
  uniform float uRoughness;
@@ -589,12 +636,23 @@ void main() {
589
636
  // Occupants rise above the 0.92 m chair back, so their ramp uses their own
590
637
  // height or every head would clamp to full brightness and float.
591
638
  float ao = mix(0.58, 1.0, clamp(vHeight / (vOccupant > 0.5 ? 1.30 : 0.92), 0.0, 1.0));
592
- vec3 base = tint * partShade * ao * (0.60 + 0.30 * hemi) + tint * key * 0.28 + tint * fill * 0.16;
639
+ // Chairs follow the structure's balance (see SOLID_FRAG): more sun, less
640
+ // ambient, so seat pads, backs and arms separate instead of reading as one
641
+ // coloured mass.
642
+ vec3 base = tint * partShade * ao * (0.52 + 0.26 * hemi) + tint * key * 0.40 + tint * fill * 0.14;
593
643
  float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
594
644
  // A restrained furniture rim keeps the low-poly edges from looking outlined.
595
645
  // Occupant silhouettes retain their existing stronger separation.
596
646
  float sheen = clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0);
597
647
  base += vec3(0.26, 0.31, 0.38) * fres * mix(0.24, 0.55, vOccupant) * mix(sheen, 1.0, vOccupant);
648
+ // Not for sale: the chair and the person in it go one muted grey, a step
649
+ // toward the venue. Their own clothing and the chair's category tint made a
650
+ // taken seat look like any other at a glance (owner report, 2026-09-23);
651
+ // now only the seats a buyer can take wear full colour.
652
+ if (vTaken > 0.5) {
653
+ float takenLum = dot(base, vec3(0.299, 0.587, 0.114));
654
+ base = mix(vec3(takenLum), uFadeColor, 0.35) * 0.92;
655
+ }
598
656
  // Outside the entered section: quieter, still visible and pickable. Not the
599
657
  // strong grey of a filtered seat, which means nothing to buy there.
600
658
  if (vSectionFade > 0.5) {
@@ -602,25 +660,45 @@ void main() {
602
660
  base = mix(base, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
603
661
  }
604
662
  fragColor = vec4(base, 1.0);
605
- }`,Kr=`#version 300 es
663
+ }`,Xa=`#version 300 es
606
664
  precision highp float;
607
665
  in vec2 position;
608
666
  out vec2 vUv;
609
667
  void main() {
610
668
  vUv = position * 0.5 + 0.5;
611
669
  gl_Position = vec4(position, 0.999, 1.0);
612
- }`,Qr=`#version 300 es
670
+ }`,qa=`#version 300 es
613
671
  precision highp float;
614
672
  in vec2 vUv;
615
673
  uniform vec3 uTop;
616
674
  uniform vec3 uBottom;
675
+ uniform float uSky; // 1 for an open-air venue, see SceneModel.outdoor
676
+ uniform vec3 uZenith;
677
+ uniform vec3 uHorizon;
678
+ uniform mat4 uInvViewProj;
617
679
  out vec4 fragColor;
618
680
  void main() {
619
681
  vec3 col = mix(uBottom, uTop, vUv.y);
620
682
  vec2 c = vUv - 0.5;
621
683
  float vig = 1.0 - dot(c, c) * 0.16; // soft vignette
622
- fragColor = vec4(col * vig, 1.0);
623
- }`,$r=`#version 300 es
684
+ col *= vig;
685
+ // Above the horizon an open-air venue has a sky, not the chart's flat
686
+ // backdrop: from a seat, the stands used to meet a black void. Below the
687
+ // horizon (every overview) nothing changes.
688
+ if (uSky > 0.5) {
689
+ vec2 ndc = vUv * 2.0 - 1.0;
690
+ vec4 near = uInvViewProj * vec4(ndc, -1.0, 1.0);
691
+ vec4 far = uInvViewProj * vec4(ndc, 1.0, 1.0);
692
+ vec3 dir = normalize(far.xyz / far.w - near.xyz / near.w);
693
+ float up = dir.y;
694
+ vec3 sky = mix(uHorizon, uZenith, pow(clamp(up, 0.0, 1.0), 0.45));
695
+ // Reaching a little below the horizon too: from a low seat the far stands
696
+ // top out right at it, and a sliver of backdrop showed as a dark band.
697
+ // Every overview looks further down than this (at least ~24 degrees).
698
+ col = mix(col, sky, smoothstep(-0.22, 0.03, up));
699
+ }
700
+ fragColor = vec4(col, 1.0);
701
+ }`,ja=`#version 300 es
624
702
  precision highp float;
625
703
  in float surface;
626
704
  in float iYaw;
@@ -648,8 +726,8 @@ out float vPhysicalSeat;
648
726
  out float vDotWeight;
649
727
  out float vHidden;
650
728
  flat out vec3 vPick;
651
- ${ut}
652
- ${Qn}
729
+ ${vt}
730
+ ${Eo}
653
731
  void main() {
654
732
  int id = gl_InstanceID + 1; // 0 reserved for no-hit
655
733
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -663,7 +741,7 @@ void main() {
663
741
  vPhysicalSeat = iPhysicalSeat;
664
742
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
665
743
  gl_Position = projectionMatrix * mv;
666
- }`,Zr=`#version 300 es
744
+ }`,Ka=`#version 300 es
667
745
  precision highp float;
668
746
  in vec2 vUv;
669
747
  in float vPhysicalSeat;
@@ -671,7 +749,7 @@ in float vDotWeight;
671
749
  in float vHidden;
672
750
  flat in vec3 vPick;
673
751
  out vec4 fragColor;
674
- ${$n}
752
+ ${Ro}
675
753
  void main() {
676
754
  if (vHidden > 0.5) discard;
677
755
  if (vDotWeight <= 0.99) discard;
@@ -679,7 +757,7 @@ void main() {
679
757
  float d = seatSilhouette(vUv, vPhysicalSeat);
680
758
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
681
759
  fragColor = vec4(vPick, 1.0);
682
- }`,Jr=`#version 300 es
760
+ }`,$a=`#version 300 es
683
761
  precision highp float;
684
762
  in vec3 position;
685
763
  in float part;
@@ -701,9 +779,9 @@ uniform float uFocusFloor;
701
779
  flat out vec3 vPick;
702
780
  out float vChairWeight;
703
781
  out float vHidden;
704
- ${ut}
705
- ${Kn}
706
- ${Bt}
782
+ ${vt}
783
+ ${Ao}
784
+ ${$t}
707
785
  void main() {
708
786
  int id = int(iPickIndex + 0.5); // already global index + 1
709
787
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -737,7 +815,7 @@ void main() {
737
815
  float c = cos(iYaw), s = sin(iYaw);
738
816
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
739
817
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
740
- }`,ea=`#version 300 es
818
+ }`,Qa=`#version 300 es
741
819
  precision highp float;
742
820
  flat in vec3 vPick;
743
821
  in float vHidden;
@@ -747,34 +825,54 @@ void main() {
747
825
  if (vHidden > 0.5) discard;
748
826
  if (vChairWeight < 0.01) discard;
749
827
  fragColor = vec4(vPick, 1.0);
750
- }`,ta=`#version 300 es
828
+ }`,Za=`#version 300 es
751
829
  precision highp float;
752
830
  in vec3 position;
831
+ in vec3 normal;
753
832
  in float floorIndex;
833
+ in float materialIndex;
834
+ uniform mat4 modelMatrix;
754
835
  uniform mat4 modelViewMatrix;
755
836
  uniform mat4 projectionMatrix;
756
837
  uniform float uFocusFloor;
757
838
  out float vHidden;
839
+ out float vMaterial;
840
+ out vec3 vNormalWorld;
841
+ out vec3 vPosWorld;
758
842
  void main() {
759
843
  vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
844
+ vMaterial = materialIndex;
845
+ vNormalWorld = mat3(modelMatrix) * normal;
846
+ vPosWorld = (modelMatrix * vec4(position, 1.0)).xyz;
760
847
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
761
- }`,na=`#version 300 es
848
+ }`,Ja=`#version 300 es
762
849
  precision highp float;
763
850
  in float vHidden;
851
+ in float vMaterial;
852
+ in vec3 vNormalWorld;
853
+ in vec3 vPosWorld;
854
+ uniform vec3 cameraPosition;
855
+ uniform vec2 uRoomCentre;
764
856
  out vec4 fragColor;
857
+ ${Co}
765
858
  void main() {
766
859
  if (vHidden > 0.5) discard;
860
+ if (roomWallHidden(vMaterial, vNormalWorld, vPosWorld, cameraPosition, uRoomCentre)) discard;
767
861
  fragColor = vec4(0.0, 0.0, 0.0, 1.0);
768
- }`;function Zn(t){return new Ee(t,{vertex:$r,fragment:Zr,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Ge},uSeatScale:{value:1},uMinPixels:{value:Ie},uPixelToWorld:{value:.002},uChairFull:{value:Ue},uChairNone:{value:_e},uFocusFloor:{value:-1}}})}function Jn(t){return new Ee(t,{vertex:Jr,fragment:ea,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:Ue},uChairNone:{value:_e},uBackRake:{value:Be},uBackBase:{value:Ae},uFocusFloor:{value:-1}}})}function eo(t){return new Ee(t,{vertex:ta,fragment:na,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function to(t,e=.78,n=[.63,.66,.65]){return new Ee(t,{vertex:Wr,fragment:Ur,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:e}}})}function no(t){return new Ee(t,{vertex:Yr,fragment:Xr,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uSeatRadius:{value:Ge},uSeatScale:{value:1},uMinPixels:{value:Ie},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:Ue},uChairNone:{value:_e}}})}function oo(t,e=.78){return new Ee(t,{vertex:qr,fragment:jr,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:Ue},uChairNone:{value:_e},uBackRake:{value:Be},uBackBase:{value:Ae},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:e}}})}function ro(t,e,n){return new Ee(t,{vertex:Kr,fragment:Qr,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(n)}}})}import{Camera as oa,Mat4 as ra,Mesh as aa,Program as ia,RenderTarget as sa,Transform as la}from"ogl";function ao(t,e,n){let a=Math.max(3,n.radius*1.04),[o,i,s]=n.center,l=new oa(t,{left:-a,right:a,bottom:-a,top:a,near:.1,far:a*6});l.position.set(o-a*1.44,i+a*2.34,s+a*1.2),l.lookAt([o,i,s]);let u=new sa(t,{width:1024,height:1024,depthTexture:!0,minFilter:t.NEAREST,magFilter:t.NEAREST}),p=new ia(t,{cullFace:!1,vertex:`#version 300 es
862
+ }`;function To(t){return new Re(t,{vertex:ja,fragment:Ka,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Ye},uSeatScale:{value:1},uMinPixels:{value:De},uPixelToWorld:{value:.002},uChairFull:{value:je},uChairNone:{value:Le},uFocusFloor:{value:-1}}})}function Fo(t){return new Re(t,{vertex:$a,fragment:Qa,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:je},uChairNone:{value:Le},uBackRake:{value:Ue},uBackBase:{value:Ce},uFocusFloor:{value:-1}}})}function Io(t){return new Re(t,{vertex:Za,fragment:Ja,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1},uRoomCentre:{value:new Float32Array([0,0])}}})}function _o(t,e=.78,n=[.63,.66,.65]){return new Re(t,{vertex:Ha,fragment:Ga,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:e},uRoomCentre:{value:new Float32Array([0,0])}}})}function Do(t){return new Re(t,{vertex:Ba,fragment:Wa,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uSeatRadius:{value:Ye},uSeatScale:{value:1},uMinPixels:{value:De},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:je},uChairNone:{value:Le}}})}function Lo(t,e=.78){return new Re(t,{vertex:Ua,fragment:Ya,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:je},uChairNone:{value:Le},uBackRake:{value:Ue},uBackBase:{value:Ce},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:e}}})}function Vo(t,e,n,r){return new Re(t,{vertex:Xa,fragment:qa,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(n)},uSky:{value:r?1:0},uZenith:{value:new Float32Array(r?.zenith??[0,0,0])},uHorizon:{value:new Float32Array(r?.horizon??[0,0,0])},uInvViewProj:{value:new Float32Array(16)}}})}import{Camera as ei,Mat4 as ti,Mesh as ni,Program as oi,RenderTarget as ri,Transform as ai}from"ogl";function ko(t,e,n){let a=Math.max(3,n.radius*1.04),[o,i,s]=n.center,l=new ei(t,{left:-a,right:a,bottom:-a,top:a,near:.1,far:a*6});l.position.set(o-a*1.44,i+a*2.34,s+a*1.2),l.lookAt([o,i,s]);let u=new ri(t,{width:1024,height:1024,depthTexture:!0,minFilter:t.NEAREST,magFilter:t.NEAREST}),d=new oi(t,{cullFace:!1,vertex:`#version 300 es
769
863
  in vec3 position;
864
+ in float materialIndex;
770
865
  uniform mat4 modelViewMatrix;
771
866
  uniform mat4 projectionMatrix;
772
- void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`,fragment:`#version 300 es
867
+ out float vMaterial;
868
+ void main() { vMaterial = materialIndex; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`,fragment:`#version 300 es
773
869
  precision highp float;
870
+ in float vMaterial;
774
871
  out vec4 fragColor;
775
872
  void main() {
873
+ if (abs(vMaterial - 6.0) < 0.5) discard;
776
874
  fragColor = vec4(1.0);
777
- }`}),h=new la,v=new aa(t,{geometry:e,program:p});v.frustumCulled=!1,v.setParent(h);let f=t.getParameter(t.COLOR_CLEAR_VALUE),c=t.isEnabled(t.DITHER);try{t.disable(t.DITHER),t.clearColor(1,1,1,1),t.renderer.render({scene:h,camera:l,target:u})}finally{c&&t.enable(t.DITHER),t.clearColor(f[0],f[1],f[2],f[3]),p.remove()}let b=new ra().multiply(l.projectionMatrix,l.viewMatrix);return{texture:u.depthTexture,matrix:b,dispose(){for(let E of u.textures)t.deleteTexture(E.texture);t.deleteTexture(u.depthTexture.texture),t.deleteFramebuffer(u.buffer),u.depthBuffer&&t.deleteRenderbuffer(u.depthBuffer)}}}var ca=.65,ua=new Set(["dimmed","sold"]),da=new Set(["dimmed","sold","held"]);function io(t,e,n){let r=new Set,a=!1,o=be.indexOf("dimmed"),i=!1;for(let l=0;l<n.length;l+=1)if(n[l]===o){i=!0;break}let s=i?da:ua;for(let l of t){let u=e.get(l.sectionId);if(!u||!u.length){r.add(l.sectionId);continue}let p=!1;for(let h of u){let v=be[n[h]]??"available";if(!s.has(v)){p=!0;break}}p?r.add(l.sectionId):a=!0}return{lit:r,anyUnlit:a}}function so(t,e,n,r,a,o){let i=[];for(let s of t){let l=a===null||a.has(s.sectionId);if(r.get(s.sectionId)===l)continue;r.set(s.sectionId,l);let u=(s.start+s.count)*3;for(let p=s.start*3;p<u;p++)e[p]=l?n[p]:n[p]+(o[p%3]-n[p])*ca;i.push(s)}return i}function co(t,e,n,r,a,o){for(let i=n;i<n+r;i++){let l=o&&e[i]===0?null:a[e[i]]??a[0];t[i*3]=l?l[0]:o[i*3],t[i*3+1]=l?l[1]:o[i*3+1],t[i*3+2]=l?l[2]:o[i*3+2]}}var pa=new Float32Array([-1,-1,3,-1,-1,3]);function uo(t,e){let n=new lo,r=new lo,a=new Xe(t,{position:{size:2,data:pa}}),o=ro(t,e.theme.background.top,e.theme.background.bottom),i=new qe(t,{geometry:a,program:o});i.frustumCulled=!1,i.setParent(r);let s=new Xe(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=ao(t,s,e.renderBounds),u=to(t,e.theme.materials.roughness,e.theme.structure.tierTop);u.uniforms.tVenueShadow={value:l.texture},u.uniforms.uShadowMatrix={value:l.matrix};let p=new qe(t,{geometry:s,program:u});p.frustumCulled=!1,p.setParent(n);let h=no(t),v=new Float32Array(e.seats.count*3),f=be.map(k=>e.theme.seatStates[k]),c=e.seats.iCategory.slice();for(let k=0;k<e.seats.count;k++){if(e.seats.iPhysicalSeat[k]<.5)continue;let X=e.theme.materials.seat??mn([c[k*3],c[k*3+1],c[k*3+2]]);c.set(X,k*3)}co(v,e.seats.iState,0,e.seats.count,f,c);let b=Rn(),E=new Uint8Array(e.seats.count),P=new Xe(t,{position:{size:3,data:b.position},normal:{size:3,data:b.normal},uv:{size:2,data:b.uv},index:{size:1,data:b.index},surface:{size:1,data:b.surface},iYaw:{size:1,data:e.seats.iYaw,instanced:1},iChairWidth:{size:1,data:e.seats.iChairWidth,instanced:1},iGlyph:{size:1,data:e.seats.iGlyph,instanced:1},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:v,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,instanced:1},iHasChair:{size:1,data:E,type:t.UNSIGNED_BYTE,usage:t.DYNAMIC_DRAW,instanced:1},iPhysicalSeat:{size:1,data:e.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:e.seats.iRing,instanced:1},iFloor:{size:1,data:e.seats.iFloor,instanced:1},iSection:{size:1,data:e.seats.iSection,instanced:1}}),L=new qe(t,{geometry:P,program:h});L.frustumCulled=!1,e.seats.count>0&&L.setParent(n);let C=P.attributes.iColor,F=e.solids.color.slice(),g=e.theme.structure.ground,A=new Map(e.sectionSolidRanges.map(k=>[k.sectionId,!0])),S=un(),w=oo(t,e.theme.materials.roughness),R=lt,T=new Float32Array(R*3),I=new Float32Array(R*3),Y=new Float32Array(R),B=new Float32Array(R),U=new Float32Array(R),V=new Float32Array(R*3),H=new Float32Array(R),D=new Float32Array(R),x=new Float32Array(R),y=new Float32Array(R),G=new Float32Array(R),N=new Xe(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:T,instanced:1},iColor:{size:3,data:I,instanced:1},iRadius:{size:1,data:Y,instanced:1},iYaw:{size:1,data:B,instanced:1},iGlyph:{size:1,data:U,instanced:1},iRing:{size:3,data:V,instanced:1},iFloor:{size:1,data:H,instanced:1},iSection:{size:1,data:D,instanced:1},iPhysicalSeat:{size:1,data:x,instanced:1},iSeed:{size:1,data:G,instanced:1},iPickIndex:{size:1,data:y,instanced:1}}),q=new qe(t,{geometry:N,program:w});q.frustumCulled=!1;let Z=0,ee=!1,he=!1,Q=null,ie=null,te=null,se=new Int32Array(0),ve=()=>{let k=e.seats;for(let X=0;X<Z;X++){let j=se[X];G[X]=hn(k.iState[j],j),I[X*3]=v[j*3],I[X*3+1]=v[j*3+1],I[X*3+2]=v[j*3+2]}N.attributes.iColor.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0},re={main:n,background:r,seatProgram:h,solidProgram:u,chairProgram:w,seatGeometry:P,chairGeometry:N,solidGeometry:s,drawCalls:3,setNearSeats(k,X){let j=Math.min(X,R,k.length);if(jn(E,k,j),P.attributes.iHasChair.needsUpdate=!0,se=k,Z=j,j===0){q.parent&&q.setParent(null),N.instancedCount=0,re.drawCalls=3+(ee?1:0);return}let J=e.seats;for(let O=0;O<j;O++){let ne=k[O];T[O*3]=J.iPosition[ne*3],T[O*3+1]=J.iPosition[ne*3+1],T[O*3+2]=J.iPosition[ne*3+2],Y[O]=J.iChairWidth[ne],B[O]=J.iYaw[ne],U[O]=J.iGlyph[ne],V[O*3]=J.iRing[ne*3],V[O*3+1]=J.iRing[ne*3+1],V[O*3+2]=J.iRing[ne*3+2],H[O]=J.iFloor[ne],D[O]=J.iSection[ne],x[O]=J.iPhysicalSeat[ne],y[O]=ne+1}ve(),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.iSection.needsUpdate=!0,N.attributes.iPhysicalSeat.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0,N.attributes.iPickIndex.needsUpdate=!0,N.instancedCount=j,q.parent||q.setParent(n),re.drawCalls=4+(ee?1:0)},nearSeatCount(){return Z},setSectionShellLit(k){u.uniforms.uSectionFilter.value=k===null?0:1;let X=so(e.sectionSolidRanges,e.solids.color,F,A,k,g);if(!X.length)return;let j=s.attributes.color,J=j.buffer;if(!J){j.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,J);for(let O of X){let ne=e.solids.color.subarray(O.start*3,(O.start+O.count)*3);t.bufferSubData(t.ARRAY_BUFFER,O.start*3*Float32Array.BYTES_PER_ELEMENT,ne)}},uploadSeatStateRuns(k){if(!k.length)return;Z&&ve();for(let j of k)co(v,e.seats.iState,j.start,j.length,f,c);let X=C.buffer;if(!X){C.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,X);for(let j of k){let J=v.subarray(j.start*3,(j.start+j.length)*3);t.bufferSubData(t.ARRAY_BUFFER,j.start*3*Float32Array.BYTES_PER_ELEMENT,J)}},dispose(){he=!0,l.dispose(),a.remove(),o.remove(),s.remove(),u.remove(),P.remove(),h.remove(),N.remove(),w.remove(),Q?.remove(),ie?.remove(),te?.texture&&t.deleteTexture(te.texture)}},le=e.productionElements.find(k=>k.contentImageUrl&&k.contentPlane);if(le?.contentImageUrl&&le.contentPlane?.length===4&&typeof Image<"u"){let k=new Image;k.crossOrigin="anonymous",k.onload=()=>{if(he)return;let X=le.contentPlane;Q=new Xe(t,{position:{size:3,data:new Float32Array(X.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(le.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),te=new ha(t,{image:k,generateMipmaps:!0,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,flipY:!1}),ie=new ma(t,{vertex:`#version 300 es
875
+ }`}),m=new ai,f=new ni(t,{geometry:e,program:d});f.frustumCulled=!1,f.setParent(m);let v=t.getParameter(t.COLOR_CLEAR_VALUE),c=t.isEnabled(t.DITHER);try{t.disable(t.DITHER),t.clearColor(1,1,1,1),t.renderer.render({scene:m,camera:l,target:u})}finally{c&&t.enable(t.DITHER),t.clearColor(v[0],v[1],v[2],v[3]),d.remove()}let g=new ti().multiply(l.projectionMatrix,l.viewMatrix);return{texture:u.depthTexture,matrix:g,dispose(){for(let x of u.textures)t.deleteTexture(x.texture);t.deleteTexture(u.depthTexture.texture),t.deleteFramebuffer(u.buffer),u.depthBuffer&&t.deleteRenderbuffer(u.depthBuffer)}}}var ii=.65,si=new Set(["dimmed","sold"]),li=new Set(["dimmed","sold","held"]);function zo(t,e,n){let r=new Set,a=!1,o=be.indexOf("dimmed"),i=!1;for(let l=0;l<n.length;l+=1)if(n[l]===o){i=!0;break}let s=i?li:si;for(let l of t){let u=e.get(l.sectionId);if(!u||!u.length){r.add(l.sectionId);continue}let d=!1;for(let m of u){let f=be[n[m]]??"available";if(!s.has(f)){d=!0;break}}d?r.add(l.sectionId):a=!0}return{lit:r,anyUnlit:a}}function Oo(t,e,n,r,a,o){let i=[];for(let s of t){let l=a===null||a.has(s.sectionId);if(r.get(s.sectionId)===l)continue;r.set(s.sectionId,l);let u=(s.start+s.count)*3;for(let d=s.start*3;d<u;d++)e[d]=l?n[d]:n[d]+(o[d%3]-n[d])*ii;i.push(s)}return i}var Ho=be.indexOf("selected");function di(t,e){return[0,1,2].map(n=>t[n]*.15+.75+e[n]*.1)}function Go(t,e,n,r,a,o){for(let i=n;i<n+r;i++){let s=o&&e[i]===0,l=o&&e[i]===Ho?di([o[i*3],o[i*3+1],o[i*3+2]],a[Ho]??a[0]):s?null:a[e[i]]??a[0];t[i*3]=l?l[0]:o[i*3],t[i*3+1]=l?l[1]:o[i*3+1],t[i*3+2]=l?l[2]:o[i*3+2]}}var mi=new Float32Array([-1,-1,3,-1,-1,3]);function Bo(t,e){let n=new No,r=new No,a=new Ze(t,{position:{size:2,data:mi}}),o=Vo(t,e.theme.background.top,e.theme.background.bottom,e.outdoor?e.theme.sky:null),i=new Je(t,{geometry:a,program:o});i.frustumCulled=!1,i.setParent(r);let s=new Ze(t,{position:{size:3,data:e.solids.position},normal:{size:3,data:e.solids.normal},color:{size:3,data:e.solids.color},floorIndex:{size:1,data:e.solids.floor},materialIndex:{size:1,data:e.solids.material}}),l=ko(t,s,e.renderBounds),u=_o(t,e.theme.materials.roughness,e.theme.structure.tierTop);u.uniforms.tVenueShadow={value:l.texture},u.uniforms.uShadowMatrix={value:l.matrix},e.room&&u.uniforms.uRoomCentre.value.set(e.room.centre);let d=new Je(t,{geometry:s,program:u});d.frustumCulled=!1,d.setParent(n);let m=Do(t),f=new Float32Array(e.seats.count*3),v=be.map(B=>e.theme.seatStates[B]),c=e.seats.iCategory.slice();for(let B=0;B<e.seats.count;B++){if(e.seats.iPhysicalSeat[B]<.5)continue;let Z=e.theme.materials.seat??In([c[B*3],c[B*3+1],c[B*3+2]]);c.set(Z,B*3)}Go(f,e.seats.iState,0,e.seats.count,v,c);let g=Kn(),x=new Uint8Array(e.seats.count),M=new Ze(t,{position:{size:3,data:g.position},normal:{size:3,data:g.normal},uv:{size:2,data:g.uv},index:{size:1,data:g.index},surface:{size:1,data:g.surface},iYaw:{size:1,data:e.seats.iYaw,instanced:1},iChairWidth:{size:1,data:e.seats.iChairWidth,instanced:1},iGlyph:{size:1,data:e.seats.iGlyph,instanced:1},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:f,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,instanced:1},iHasChair:{size:1,data:x,type:t.UNSIGNED_BYTE,usage:t.DYNAMIC_DRAW,instanced:1},iPhysicalSeat:{size:1,data:e.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:e.seats.iRing,instanced:1},iFloor:{size:1,data:e.seats.iFloor,instanced:1},iSection:{size:1,data:e.seats.iSection,instanced:1}}),D=new Je(t,{geometry:M,program:m});D.frustumCulled=!1,e.seats.count>0&&D.setParent(n);let S=M.attributes.iColor,E=e.solids.color.slice(),F=e.theme.structure.ground,I=new Map(e.sectionSolidRanges.map(B=>[B.sectionId,!0])),h=Tn(),y=Lo(t,e.theme.materials.roughness),T=pt,A=new Float32Array(T*3),V=new Float32Array(T*3),L=new Float32Array(T),_=new Float32Array(T),N=new Float32Array(T),U=new Float32Array(T*3),z=new Float32Array(T),Y=new Float32Array(T),R=new Float32Array(T),w=new Float32Array(T),ee=new Float32Array(T),k=new Ze(t,{position:{size:3,data:h.position},normal:{size:3,data:h.normal},part:{size:1,data:h.part},index:{data:h.index},iOffset:{size:3,data:A,instanced:1},iColor:{size:3,data:V,instanced:1},iRadius:{size:1,data:L,instanced:1},iYaw:{size:1,data:_,instanced:1},iGlyph:{size:1,data:N,instanced:1},iRing:{size:3,data:U,instanced:1},iFloor:{size:1,data:z,instanced:1},iSection:{size:1,data:Y,instanced:1},iPhysicalSeat:{size:1,data:R,instanced:1},iSeed:{size:1,data:ee,instanced:1},iPickIndex:{size:1,data:w,instanced:1}}),P=new Je(t,{geometry:k,program:y});P.frustumCulled=!1;let H=0,te=!1,j=!1,se=null,le=null,K=null,de=new Int32Array(0),me=()=>{let B=e.seats;for(let Z=0;Z<H;Z++){let X=de[Z];ee[Z]=_n(B.iState[X],X),V[Z*3]=f[X*3],V[Z*3+1]=f[X*3+1],V[Z*3+2]=f[X*3+2]}k.attributes.iColor.needsUpdate=!0,k.attributes.iSeed.needsUpdate=!0},ne={main:n,background:r,backgroundProgram:o,seatProgram:m,solidProgram:u,chairProgram:y,seatGeometry:M,chairGeometry:k,solidGeometry:s,drawCalls:3,setNearSeats(B,Z){let X=Math.min(Z,T,B.length);if(Po(x,B,X),M.attributes.iHasChair.needsUpdate=!0,de=B,H=X,X===0){P.parent&&P.setParent(null),k.instancedCount=0,ne.drawCalls=3+(te?1:0);return}let q=e.seats;for(let $=0;$<X;$++){let oe=B[$];A[$*3]=q.iPosition[oe*3],A[$*3+1]=q.iPosition[oe*3+1],A[$*3+2]=q.iPosition[oe*3+2],L[$]=q.iChairWidth[oe],_[$]=q.iYaw[oe],N[$]=q.iGlyph[oe],U[$*3]=q.iRing[oe*3],U[$*3+1]=q.iRing[oe*3+1],U[$*3+2]=q.iRing[oe*3+2],z[$]=q.iFloor[oe],Y[$]=q.iSection[oe],R[$]=q.iPhysicalSeat[oe],w[$]=oe+1}me(),k.attributes.iOffset.needsUpdate=!0,k.attributes.iRadius.needsUpdate=!0,k.attributes.iYaw.needsUpdate=!0,k.attributes.iGlyph.needsUpdate=!0,k.attributes.iRing.needsUpdate=!0,k.attributes.iFloor.needsUpdate=!0,k.attributes.iSection.needsUpdate=!0,k.attributes.iPhysicalSeat.needsUpdate=!0,k.attributes.iSeed.needsUpdate=!0,k.attributes.iPickIndex.needsUpdate=!0,k.instancedCount=X,P.parent||P.setParent(n),ne.drawCalls=4+(te?1:0)},nearSeatCount(){return H},setSectionShellLit(B){u.uniforms.uSectionFilter.value=B===null?0:1;let Z=Oo(e.sectionSolidRanges,e.solids.color,E,I,B,F);if(!Z.length)return;let X=s.attributes.color,q=X.buffer;if(!q){X.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,q);for(let $ of Z){let oe=e.solids.color.subarray($.start*3,($.start+$.count)*3);t.bufferSubData(t.ARRAY_BUFFER,$.start*3*Float32Array.BYTES_PER_ELEMENT,oe)}},uploadSeatStateRuns(B){if(!B.length)return;H&&me();for(let X of B)Go(f,e.seats.iState,X.start,X.length,v,c);let Z=S.buffer;if(!Z){S.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,Z);for(let X of B){let q=f.subarray(X.start*3,(X.start+X.length)*3);t.bufferSubData(t.ARRAY_BUFFER,X.start*3*Float32Array.BYTES_PER_ELEMENT,q)}},dispose(){j=!0,l.dispose(),a.remove(),o.remove(),s.remove(),u.remove(),M.remove(),m.remove(),k.remove(),y.remove(),se?.remove(),le?.remove(),K?.texture&&t.deleteTexture(K.texture)}},ve=e.productionElements.find(B=>B.contentImageUrl&&B.contentPlane);if(ve?.contentImageUrl&&ve.contentPlane?.length===4&&typeof Image<"u"){let B=new Image;B.crossOrigin="anonymous",B.onload=()=>{if(j)return;let Z=ve.contentPlane;se=new Ze(t,{position:{size:3,data:new Float32Array(Z.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(ve.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),K=new ui(t,{image:B,generateMipmaps:!0,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,flipY:!1}),le=new ci(t,{vertex:`#version 300 es
778
876
  precision highp float;
779
877
  in vec3 position; in vec2 uv; in float floorIndex;
780
878
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
@@ -782,4 +880,4 @@ void main() {
782
880
  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
783
881
  precision highp float;
784
882
  in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
785
- void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:te},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let j=new qe(t,{geometry:Q,program:ie});j.frustumCulled=!1,j.setParent(n),re.screenProgram=ie,ee=!0,re.drawCalls=3+(Z?1:0)+1},k.src=le.contentImageUrl}return re}import{Mesh as Gt,RenderTarget as va,Transform as Ht}from"ogl";function fa(t,e,n){let r=t+(e<<8)+(n<<16);return r===0?-1:r-1}function mo(t,e,n,r,a,o){let i=-1,s=1/0;for(let l=0;l<n;l++)for(let u=0;u<e;u++){let p=(l*e+u)*4,h=fa(t[p],t[p+1],t[p+2]);if(h<0||h>=o)continue;let v=u-r,f=l-a,c=v*v+f*f;c<s&&(s=c,i=h)}return i}function ho(t,e,n,r,a,o){let i=t-n.left,s=e-n.top,l=Math.round(i*r),u=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(a-1,l)),y:Math.max(0,Math.min(o-1,u))}}var ba=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],dt=class{constructor(e,n,r,a,o){this.seatScene=new Ht;this.chairScene=new Ht;this.solidScene=new Ht;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=o,this.seatProg=Zn(this.gl),this.chairProg=Jn(this.gl),this.depthProg=eo(this.gl);let i=new Gt(this.gl,{geometry:n,program:this.seatProg});i.frustumCulled=!1,i.setParent(this.seatScene);let s=new Gt(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let l=new Gt(this.gl,{geometry:a,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 ba)this.seatProg.uniforms[r].value=e.uniforms[r].value;let n=e.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let e=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==e||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new va(this.gl,{width:e,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let e=this.gl;this.target.buffer&&e.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&e.deleteTexture(n.texture);this.target.depthBuffer&&e.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(e,n,r,a){let o=this.gl,i=this.ensureTarget(),s=o.drawingBufferWidth,l=o.drawingBufferHeight,u=Math.max(0,n-a),p=Math.max(0,r-a),h=Math.max(1,Math.min(s,n+a+1)-u),v=Math.max(1,Math.min(l,r+a+1)-p);o.enable(o.SCISSOR_TEST),o.scissor(u,p,h,v);let[f,c,b]=this.restoreClear;o.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:e,target:i,clear:!0}),this.renderer.render({scene:this.seatScene,camera:e,target:i,clear:!1}),this.renderer.render({scene:this.chairScene,camera:e,target:i,clear:!1}),o.clearColor(f,c,b,1),o.disable(o.SCISSOR_TEST);let E=new Uint8Array(h*v*4);return this.renderer.bindFramebuffer(i),o.readPixels(u,p,h,v,o.RGBA,o.UNSIGNED_BYTE,E),this.renderer.bindFramebuffer(),mo(E,h,v,n-u,r-p,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function po(t,e){let n=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,dn(r.state)):n.push(r);return n}function fo(t,e,n){let r=new Set;for(let i of e)(t.has(i)||n(i)!==void 0)&&r.add(i);let a=new Map(t),o=[];for(let[i,s]of t)r.has(i)||(o.push({seatId:i,state:be[s]??"available"}),a.delete(i));for(let i of r){if(a.has(i))continue;let s=n(i);s!==void 0&&(a.set(i,s),o.push({seatId:i,state:"selected"}))}return{updates:o,next:a}}import{Quat as je,Vec3 as xa}from"ogl";function ga(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function vo(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function ya(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function bo(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 Wt(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function Ut(t,e){return Math.max(0,Math.min(1,t+e))}function go(t,e){let n=t.length;if(n===0)return[0,0,0];if(n===1)return[...t[0]];let r=Math.max(0,Math.min(1,e)),a=n-1,o=Math.floor(r*a);o>=a&&(o=a-1);let i=r*a-o,s=t[Math.max(0,o-1)],l=t[o],u=t[o+1],p=t[Math.min(n-1,o+2)],h=i*i,v=h*i,f=[0,0,0];for(let c=0;c<3;c++)f[c]=.5*(2*l[c]+(-s[c]+u[c])*i+(2*s[c]-5*l[c]+4*u[c]-p[c])*h+(-s[c]+3*l[c]-3*u[c]+p[c])*v);return f}function Yt(t,e,n,r,a){let o=bo(ga(e,n));o[0]===0&&o[1]===0&&o[2]===0&&(o=[0,0,1]);let i=vo(vo(e,ya(o,2.5)),[0,1.5,0]),s=[e[0]-r[0],0,e[2]-r[2]],l=bo(s);l[0]===0&&l[2]===0&&(l=[o[0],0,o[2]]);let u=Math.max(1,a),p=[r[0]+l[0]*u*1.3,r[1]+u*.75,r[2]+l[2]*u*1.3];return{waypoints:[t,p,i],finalPos:i}}function Xt(t,e,n=35,r=28){let a=Wt(e),o=go(t,a),i=Wt(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:o,fov:n+(r-n)*i,eased:a}}function wo(t,e,n){let r=t.position.clone(),a=new je().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new xa(n[0],n[1],n[2]));let o=new je().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(a),o}var mt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new je;this.endQuat=new je;this.outQuat=new je;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,n,r,a=2500,o=28){return this.settle(),this.waypoints=e,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=a,this.endFov=o,this.startTime=performance.now(),this.active=!0,new Promise(i=>{this.resolveFn=i})}update(e){if(!this.active)return!1;let n=Math.min(1,(e-this.startTime)/this.duration),{pos:r,fov:a,eased:o}=Xt(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Ut(o,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=a,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let e=this.resolveFn;this.resolveFn=null,e&&e()}};var Mo=cn,Sa=.12,wa=.25,Ma=1.5;function Co(t,e,n=0,r,a){let o=[e.x*Re,n+Ma,e.y*Re],i=a?[a[0],a[1],a[2]]:o,s=t[1],l=Number.isFinite(s)?s+Mo:Number.isFinite(r)?n+r:n+Mo,u=o[0]-t[0],p=o[2]-t[2],h=Math.hypot(u,p),v=h>.001?Math.min(Sa,h*wa):0,f=h>.001?u/h:0,c=h>.001?p/h:0;return{eye:[t[0]+f*v,l,t[2]+c*v],focal:i}}var Fe=Math.PI/180,Ca=45,Ao=80,ht=70,Aa=1,Pa=.99;function Ea(t,e){if(!(t<Aa))return Ao;if(!(Number.isFinite(e)&&e>0))return ht;let n=2*Math.atan(e/(2*pt*Pa)/Math.max(.05,t))/Fe;return Math.max(ht,Math.min(Ao,n))}var Fa=.25,pt=1,Ra=.25,Da=12*Fe,Ta=.2,Ia=1.5,Po=.8,Eo=6,To=1.9,_a=2/3,Va=.12,La=.9,ka=1.2,Oa=2,Io=.05,za=6;function _o(t,e,n=0){if(!t.length)return{min:[e[0]-6,n,e[2]-6],max:[e[0]+6,Math.max(n+Po,e[1]),e[2]+6]};let r=1/0,a=-1/0,o=1/0,i=-1/0,s=n;for(let c of t)r=Math.min(r,c.cx-c.halfX),a=Math.max(a,c.cx+c.halfX),o=Math.min(o,c.cz-c.halfZ),i=Math.max(i,c.cz+c.halfZ),s=Math.max(s,c.y);let l=a-r,u=i-o,p=Math.max(l,Math.min(u,Eo))/2,h=Math.max(u,Math.min(l,Eo))/2,v=(r+a)/2,f=(o+i)/2;return{min:[v-p,n,f-h],max:[v+p,Math.max(n+Po,s),f+h]}}function Na(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+To,t.max[2]]}}function qt(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+Ia,e+Ta,e+To*_a),(t.min[2]+t.max[2])/2]}function Vo(t,e){let n=t[0]-e[0],r=t[2]-e[2],a=Math.hypot(n,r);return a<.001?{x:0,z:1}:{x:n/a,z:r/a}}function Fo(t,e,n){let r=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],i=Math.hypot(r,a,o)||1;r/=i,a/=i,o/=i;let s=-o,l=r,u=Math.hypot(s,l);if(u<1e-6)return 1/0;s/=u,l/=u;let p=1/0,h=-1/0;for(let v=0;v<8;v++){let f=(v&1?n.max[0]:n.min[0])-t[0],c=(v&2?n.max[1]:n.min[1])-t[1],b=(v&4?n.max[2]:n.min[2])-t[2],E=Math.max(Io,f*r+c*a+b*o),P=(f*s+b*l)/E;P<p&&(p=P),P>h&&(h=P)}return h-p}function Ro(t,e,n){let r=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],i=Math.hypot(r,a,o)||1;r/=i,a/=i,o/=i;let s=-o,l=r,u=Math.hypot(s,l);if(u<1e-6)return 1/0;s/=u,l/=u;let p=-l*a,h=l*r-s*o,v=s*a,f=1/0,c=-1/0;for(let b=0;b<8;b++){let E=(b&1?n.max[0]:n.min[0])-t[0],P=(b&2?n.max[1]:n.min[1])-t[1],L=(b&4?n.max[2]:n.min[2])-t[2],C=Math.max(Io,E*r+P*a+L*o),F=(E*p+P*h+L*v)/C;F<f&&(f=F),F>c&&(c=F)}return c-f}function ft(t,e){return Math.tan(t*Fe/2)*Math.max(.05,e)}function Do(t,e,n){let r=Ea(n,t),a=l=>Math.max(Ca,Math.min(r,l)),o=l=>2*Math.atan(l)/Fe,i=Number.isFinite(t)&&t>0?a(o(t/(2*Fa)/Math.max(.05,n))):r;if(!(Number.isFinite(e)&&e>0))return i;let s=Math.min(i,a(o(e/(2*Va))));return t/(2*ft(s,n))>pt?i:s}function Lo(t,e,n,r={}){let a=qt(e),o=[t[0],t[1],t[2]],i=0,s=0,l=c=>{if(!(c>0))return;let b=Vo(o,a);o[0]+=b.x*c,o[2]+=b.z*c,s+=c},u=r.preserveEye?0:e.max[1]+Ra-o[1];u>0&&(o[1]+=u,i=u,l(u/Math.tan(Da)));let p=Na(e),h=Fo(o,a,e),v=Do(h,Ro(o,a,p),n),f=h/(2*ft(v,n));for(let c=0;!r.preserveEye&&c<za&&f>pt;c++){let b=Math.max(1,Math.hypot(o[0]-a[0],o[2]-a[2])),E=Number.isFinite(f)?f/pt:2;l(Math.min(60,b*(Math.min(4,E)-1)+.5)),h=Fo(o,a,e),v=Do(h,Ro(o,a,p),n),f=h/(2*ft(v,n))}return{eye:o,focal:a,fov:v,raisedM:i,pulledBackM:s,stageFrameWidth:f}}function Ba(t,e,n){let r=Math.tan(e*Fe/2),a=ft(e,n);return Math.max(1,t/Math.max(.05,Math.min(r,a)))}function ko(t,e){let{aspect:n,venue:r}=e,a=t.focal,o=Vo(t.eye,a),i=v=>(v[0]-a[0])*o.x+(v[2]-a[2])*o.z,s=[{name:"seat",eye:t.eye,focal:a,fov:t.fov}],l=Oa*(e.rowDepthM??La);s.push({name:"row",eye:[t.eye[0]+o.x*l,t.eye[1]+ka,t.eye[2]+o.z*l],focal:a,fov:t.fov});let u=(v,f,c,b)=>{let E=Ba(c,t.fov,n)*1.08,P=E*Math.sin(b*Fe),L=Number.isFinite(e.seatingTopY)?e.seatingTopY+2:-1/0,C=Math.max(P,L-f[1]),F=E*Math.cos(b*Fe);return{name:v,eye:[f[0]+o.x*F,f[1]+C,f[2]+o.z*F],focal:f,fov:t.fov}};e.section&&e.section.radius>0&&s.push(u("section",e.section.center,e.section.radius,35)),s.push(u("venue",r.center,Math.max(1,r.radius),40));let p=[],h=-1/0;for(let v of s){let f=i(v.eye);p.length&&f<=h+.5||(p.push(v),h=f)}return p}import{Vec3 as Ga}from"ogl";var Qe=Math.PI/180,Oo=320,zo=70*Qe,Ha=32*Qe,Wa=24*Qe,No=.0026,Ua=.22,Ya=.006,Xa=180,qa=4,me=(t,e,n)=>Math.max(e,Math.min(n,t)),Bo=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function Go(t){let{canvas:e,camera:n}=t,r=[],a=!1,o=0,i=0,s=0,l=0,u=0,p=0,h=!1,v=[0,0],f=0,c=!1,b=null,E=null,P=new Map,L=!1,C=0,F=0,g=0,A=0,S=()=>a&&r.length?r[me(Math.round(o),0,r.length-1)].name:null,w=()=>{let y=S();y!==b&&(b=y,t.onStopChange?.(y))},R=()=>{if(!a||!r.length)return;let y=r[me(Math.floor(o),0,r.length-1)],G=r[me(Math.ceil(o),0,r.length-1)],N=me(o-Math.floor(o),0,1),q=(X,j)=>X+(j-X)*N,Z=[q(y.eye[0],G.eye[0]),q(y.eye[1],G.eye[1]),q(y.eye[2],G.eye[2])],ee=[q(y.focal[0],G.focal[0]),q(y.focal[1],G.focal[1]),q(y.focal[2],G.focal[2])],he=ee[0]-Z[0],Q=ee[1]-Z[1],ie=ee[2]-Z[2],te=Math.hypot(he,Q,ie)||1,se=Math.atan2(he,ie),ve=Math.asin(me(Q/te,-1,1)),re=se+i,le=me(ve+s,-80*Qe,80*Qe),k=Math.cos(le)*te;he=Math.sin(re)*k,Q=Math.sin(le)*te,ie=Math.cos(re)*k,n.position.set(Z[0],Z[1],Z[2]),n.fov=q(y.fov,G.fov),n.updateProjectionMatrix(),n.lookAt(new Ga(Z[0]+he,Z[1]+Q,Z[2]+ie)),t.onApplied?.()},T=()=>{if(!a||!r.length)return;let y=me(Math.round(o),0,r.length-1);if(t.reducedMotion()){h=!1,o=y,R(),w(),t.requestRender();return}if(Math.abs(y-o)<.001){h=!1,w();return}l=o,u=y,p=performance.now(),h=!0,t.requestRender()},I=y=>{!a||r.length<2||(h=!1,o=me(o+y,0,r.length-1),R(),w(),t.requestRender())},Y=(y,G)=>{a&&(h=!1,c=!1,i=me(i-y*No,-zo,zo),s=me(s-G*No,-Wa,Ha),R(),t.requestRender())},B=y=>{a&&(P.set(y.pointerId,{x:y.clientX,y:y.clientY}),P.size===1?(L=!0,A=0,C=y.clientX,F=y.clientY):P.size===2&&(L=!1,g=U()))},U=()=>{let y=[...P.values()];return y.length<2?0:Math.hypot(y[0].x-y[1].x,y[0].y-y[1].y)},V=y=>{if(!a||!P.has(y.pointerId))return;if(P.set(y.pointerId,{x:y.clientX,y:y.clientY}),P.size>=2){let q=U();g>0&&I((g-q)*Ya),g=q;return}if(!L)return;let G=y.clientX-C,N=y.clientY-F;C=y.clientX,F=y.clientY,A+=Math.abs(G)+Math.abs(N),!(A<=qa)&&Y(G,N)},H=y=>{P.delete(y.pointerId)&&(P.size<2&&(g=0),P.size===0&&(L=!1,T()))},D=y=>{if(!a)return;y.preventDefault();let G=y.deltaMode===1?16:y.deltaMode===2?100:1,N=me(y.deltaY*G/100,-2,2);I(N*Ua),E&&clearTimeout(E),E=setTimeout(()=>{E=null,T()},Xa)},x=()=>{a&&(a=!1,h=!1,c=!1,r=[],P.clear(),L=!1,E&&(clearTimeout(E),E=null),b!==null&&(b=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",B),e.addEventListener("pointermove",V),e.addEventListener("pointerup",H),e.addEventListener("pointercancel",H),e.addEventListener("wheel",D,{passive:!1}),{get active(){return a},enter(y){if(y.length<2){x();return}r=y,a=!0,o=0,i=0,s=0,h=!1,c=!1,b=null,R(),w(),t.requestRender()},exit:x,recentre(){return a?Math.abs(i)<1e-4&&Math.abs(s)<1e-4?!0:t.reducedMotion()?(c=!1,i=0,s=0,R(),t.requestRender(),!0):(v=[i,s],f=performance.now(),c=!0,t.requestRender(),!0):!1},update(y){if(!a)return!1;let G=!1;if(c){let N=me((y-f)/Oo,0,1),q=1-Bo(N);i=v[0]*q,s=v[1]*q,N>=1?(c=!1,i=0,s=0):G=!0}if(h){let N=me((y-p)/Oo,0,1);o=l+(u-l)*Bo(N),N>=1?(h=!1,o=u,w()):G=!0}return R(),G},currentStop:S,dispose(){x(),e.removeEventListener("pointerdown",B),e.removeEventListener("pointermove",V),e.removeEventListener("pointerup",H),e.removeEventListener("pointercancel",H),e.removeEventListener("wheel",D)}}}function Ho(t){return t.flying?"cinematic":t.panoramaMounted?"panorama":t.seatViewActive?"seatView":"orbit"}var jt=null;function Wo(){return jt??=import("../openPanorama-6FMXAJ6O.js").catch(t=>{throw jt=null,t}),jt}var Uo=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),vt=class{constructor(e){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=e}emit(e,n){if(this.cb)try{this.cb(e,n)}catch{}}opened(e,n,r,a){this.emit("3d_opened",{seats:e,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...a===void 0?{}:{prepSource:a}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(e,n){this.emit("3d_seat_picked",{seatId:e,sectionId:n})}cinematicPlayed(e){this.emit("3d_cinematic_played",{durationMs:e,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=Uo(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(Uo()-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 Yo(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function Xo(t){let{container:e,model:n,opts:r,expandedSeatById:a,seatIdsByRow:o,isNarrow:i}=t,s=null,l=()=>{if(!s)return;let h=i();Object.assign(s.style,h?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{s?.remove(),s=null};return{show:(h,v,f=!1)=>{if(u(),t.isDisposed())return null;let c=document.createElement("div");c.setAttribute("role","group"),Object.assign(c.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let b=r.chrome?.caption!==!1,E=r.chrome?.seatStepper!==!1;if(!b&&!E)return null;let P=a.get(h),L=P?.sectionId?n.sections.find(T=>T.id===P.sectionId):void 0,C=P?.label??h;c.setAttribute("aria-label",`Explore views near ${L?.label?`${L.label}, `:""}seat ${C}`);let F=document.createElement("span");F.textContent=r.seatViewCaption?.(h)??["Live 3D seat view",L?.label,C].filter(Boolean).join(" \xB7 "),Object.assign(F.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),b&&c.appendChild(F);let g=document.createElement("div");Object.assign(g.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),c.appendChild(g);let A=P?.rowId?o.get(P.rowId):void 0,S=A?.indexOf(h)??-1,w=S>=0?[A?.[S-1],A?.[S+1]]:[void 0,void 0],R=(T,I,Y,B=!1)=>{let U=document.createElement("button");U.type="button",U.textContent=T,U.setAttribute("aria-label",I),Object.assign(U.style,{minHeight:"44px",padding:B?"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"}),B||(U.style.minWidth="44px"),B&&(U.dataset.panoramaTrigger=""),U.addEventListener("click",Y),g.appendChild(U)};if(E&&w[0]){let T=a.get(w[0])?.label??w[0];R("\u2039",`View previous seat ${T}`,()=>{t.flyToSeat(w[0])})}if(E&&r.getSeatView){let T=r.seatViewActionLabel?.(h)??"Open 360\xB0 panorama";R(f?`\u21BB Retry ${T}`:`\u25C9 ${T}`,`${f?"Retry":T} from seat ${C}`,()=>{if(t.isDisposed()||v!==t.flightGen()){u();return}u(),t.openPanorama(h,400,v)},!0)}if(E&&w[1]){let T=a.get(w[1])?.label??w[1];R("\u203A",`View next seat ${T}`,()=>{t.flyToSeat(w[1])})}return!g.childElementCount&&!b?null:(e.appendChild(c),s=c,l(),c)},remove:u,layout:l}}var ja={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function qo(t){let{container:e,orbit:n,isNarrow:r}=t,a={...ja,...t.labels??{}},o=(C,F)=>{C.setAttribute("aria-label",F),C.title=F},i=document.createElement("div"),s=!1;i.className="sl-3d-navigation-controls",Object.assign(i.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let l=document.createElement("div");l.setAttribute("role","group"),l.setAttribute("aria-label","3D drag mode"),Object.assign(l.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("div");u.setAttribute("role","group"),u.setAttribute("aria-label","3D view controls"),Object.assign(u.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let p=document.createElement("button");p.type="button",p.textContent="\u21BB",o(p,a.rotate);let h=document.createElement("button");h.type="button",h.textContent="\u2725",o(h,a.move);let v=document.createElement("button");v.type="button",v.textContent="\u2212",o(v,a.zoomOut);let f=document.createElement("button");f.type="button",f.textContent="+",o(f,a.zoomIn);for(let C of[p,h,v,f])C.className="sl-3d-icon-control",Object.assign(C.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});l.append(p,h),u.append(f,v);let c=C=>{n.setPrimaryDragMode(C);let F=C==="orbit";p.setAttribute("aria-pressed",String(F)),h.setAttribute("aria-pressed",String(!F)),p.style.background=F?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",h.style.background=F?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",i.title=F?`${a.rotate} \xB7 ${a.move} with Shift`:`${a.move} \xB7 ${a.rotate} with Shift`};p.addEventListener("click",()=>c("orbit")),h.addEventListener("click",()=>c("pan"));let b=()=>{let{atMin:C,atMax:F}=n.dollyLimitState();f.disabled!==C&&(f.disabled=C),v.disabled!==F&&(v.disabled=F)};v.addEventListener("click",()=>{n.zoomBy(We),b()}),f.addEventListener("click",()=>{n.zoomBy(Te),b()}),i.append(l,u),c("orbit"),e.appendChild(i);let E=t.enabled!==!1,P=()=>{let C=r();i.style.display=s||!E?"none":"flex",i.style.right=C?"12px":"14px",i.style.bottom=C?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",l.style.display=C?"none":"flex",f.style.display=C?"none":"",v.style.display=C?"none":""};return P(),{element:i,utilityControls:u,setNavigationMode:c,syncZoomLimits:b,setSeatViewLocked:C=>{s=C,n.setInteractionEnabled(!C),P()},seatViewLocked:()=>s,layout:P}}var Ka=12;function Qa(t,e){if(!t)return!1;let n=t.x-e[0],r=t.y-e[1],a=t.z-e[2];return Math.hypot(n,r,a)>Ka}function jo(t){let{glctx:e,orbit:n,model:r,seats:a,opts:o,cinematic:i,analytics:s,seatIdByIndex:l,sectionIdBySeatId:u,tapSlop:p,tapMs:h,cancelFlight:v,focusSectionCamera:f,setSelection:c,ensureSeatView:b}=t,E=0,P=0,L=0,C=-1,F=!1,g=!1,A=I=>{t.seatViewLocked()||C===-1&&(C=I.pointerId,E=I.clientX,P=I.clientY,L=performance.now(),F=!1,g=i.active,i.active&&(s.cinematicCancelled(),v(),o.onViewTargetChange?.(null)))},S=I=>{I.pointerId===C&&Math.hypot(I.clientX-E,I.clientY-P)>p&&(F=!0)},w=(I,Y,B,U,V)=>{let H=e.canvas.getBoundingClientRect(),D=e.canvas.clientWidth||H.width||1,x=e.canvas.clientHeight||H.height||1,y=I-H.left,G=Y-H.top,N=U*U,q=-1,Z=N,ee=1/0;for(let he of a){if(B&&he.sectionId!==B)continue;let Q=r.seats.idToIndex.get(he.id);if(Q===void 0)continue;if(V){let le=Math.round(r.seats.iState[Q]??0);if(le!==0&&le!==3)continue}let ie=Q*3,te=xe(n.camera.projectionViewMatrix,[r.seats.iPosition[ie],r.seats.iPosition[ie+1]+.55,r.seats.iPosition[ie+2]],D,x);if(!te.visible)continue;let se=te.x-y,ve=te.y-G,re=se*se+ve*ve;(re<Z||Math.abs(re-Z)<1&&te.depth<ee)&&(q=Q,Z=re,ee=te.depth)}return q},R=(I,Y)=>{let B=t.gpu(),U=t.pick();if(!B||!U)return-1;U.syncFromSeatProgram(B.seatProgram);let V=e.canvas.getBoundingClientRect(),H=e.renderer.dpr,{x:D,y:x}=ho(I,Y,V,H,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),y=Math.max(2,Math.round(8*H));return U.pick(n.camera,D,x,y)};return{onDown:A,onMove:S,onUp:I=>{if(I.pointerId!==C)return;let Y=!F&&performance.now()-L<h;if(C=-1,g){g=!1;return}let B=t.gpu(),U=t.pick();if(!Y||!B||!U)return;let V=R(I.clientX,I.clientY);if(t.focusedSectionId()&&V>=0){let x=l[V],y=x?u.get(x):void 0;if(y&&y!==t.focusedSectionId()&&f(y))return}if(t.focusedSectionId()&&V<0&&(V=w(I.clientX,I.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&V<0){let x=w(I.clientX,I.clientY,null,72,!1),y=x>=0?l[x]:void 0,G=y?u.get(y):void 0;if(G&&G!==t.focusedSectionId()&&f(G))return}if(!t.focusedSectionId()){V<0&&(V=w(I.clientX,I.clientY,null,42,!1));let x=V>=0?l[V]:void 0,y=x?u.get(x):void 0;if(y&&f(y))return}if(V<0||V>=l.length){t.selection().size&&(c([]),o.onViewTargetChange?.(null));return}let H=l[V],D=be[Math.round(r.seats.iState[V]??0)]??"available";if(D!=="available"&&D!=="selected"){o.onSeatInspect?.(H,D);return}if(t.selection().has(H)&&t.selection().size===1){c([]),o.onViewTargetChange?.(null),o.onSeatPick?.(H);return}if(c([H]),b(H),s.seatPicked(H,u.get(H)),o.onSeatPick?.(H),t.focusedSectionId()){let x=V*3,y=[r.seats.iPosition[x],r.seats.iPosition[x+1],r.seats.iPosition[x+2]];Qa(n.camera?.position,y)&&t.focusSeatCamera(H)}}}}var bt=class{constructor(e,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=e,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let e=this.iPosition,n=1/0,r=1/0,a=-1/0,o=-1/0;for(let f=0;f<this.count;f++){let c=e[f*3],b=e[f*3+2];c<n&&(n=c),c>a&&(a=c),b<r&&(r=b),b>o&&(o=b)}let i=Math.max(a-n,.001),s=Math.max(o-r,.001);this.cell=Math.max(Math.sqrt(i*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(i/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let l=this.cols*this.rows,u=new Int32Array(l+1),p=f=>{let c=Math.min(this.cols-1,Math.max(0,Math.floor((e[f*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[f*3+2]-r)/this.cell)))*this.cols+c};for(let f=0;f<this.count;f++)u[p(f)+1]++;for(let f=0;f<l;f++)u[f+1]+=u[f];let h=new Int32Array(this.count),v=u.slice(0,l);for(let f=0;f<this.count;f++)h[v[p(f)]++]=f;this.cellStart=u,this.cellItems=h}gather(e,n,r,a,o){this.ensureGrid();let i=this.cellStart,s=this.cellItems;if(!i||!s)return 0;let l=a.length,u=r*r,p=Math.floor((e-this.minX)/this.cell),h=Math.floor((n-this.minZ)/this.cell),v=Math.ceil(r/this.cell)+1,f=this.iPosition,c=0;for(let b=0;b<=v&&c<l;b++){let E=h-b,P=h+b,L=p-b,C=p+b;for(let F=E;F<=P&&c<l;F++){if(F<0||F>=this.rows)continue;let g=F===E||F===P;for(let A=L;A<=C&&c<l;A++){if(!g&&A!==L&&A!==C){A=C-1;continue}if(A<0||A>=this.cols)continue;let S=F*this.cols+A;for(let w=i[S],R=i[S+1];w<R&&c<l;w++){let T=s[w],I=f[T*3]-e,Y=f[T*3+2]-n,B=o===void 0?0:f[T*3+1]-o;I*I+B*B+Y*Y<=u&&(a[c++]=T)}}}}return c}};var gt=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(lt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new bt(e.model.seats.iPosition,e.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(e){let n=this.ctx.gpu();e||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!e&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(e){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!e){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let a=this.ctx.orbit().camera.position;if(Math.hypot(a.x-this.lastGatherX,a.y-this.lastGatherY,a.z-this.lastGatherZ)<Vt)return;if(this.lastGatherX=a.x,this.lastGatherY=a.y,this.lastGatherZ=a.z,Math.hypot(a.x-n.bounds.center[0],a.y-n.bounds.center[1],a.z-n.bounds.center[2])-n.bounds.radius>_t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(a.x,a.z,_t,this.nearBuf,a.y);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(e,n,r){let a=1-Math.exp(-e*9),o=1-Math.exp(-e*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?a:o),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?a:o),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};function Ko(t){let e=Math.max(5,t.radius),n=t.focalWorld[0]-t.center[0],r=t.focalWorld[2]-t.center[2],a=Math.hypot(n,r);if(a<e*.12)return{center:t.center,radius:e,polarDeg:48};let o=Math.min(a*.25,e*1.2);return{center:[t.center[0]+n/a*o,t.center[1],t.center[2]+r/a*o],radius:e+o*.4,azimuth:Math.atan2(-n,-r),polarDeg:50}}import{Quat as $a,Vec3 as Za}from"ogl";function Qo(){let t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round");let n=document.createElementNS(t,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),e.appendChild(n),e}function Jo(t){let{container:e,model:n,opts:r,orbit:a,cinematic:o,analytics:i,loop:s,labelOverlay:l,stageAzimuth:u,overviewFraming:p}=t,h=0,v=-1,f=(S,w,R=28)=>{a.camera.position.set(S[0],S[1],S[2]),a.camera.lookAt(new Za(w[0],w[1],w[2])),a.camera.fov=R,a.camera.updateProjectionMatrix()},c=document.createElement("button");c.className="sl-3d-overview-control sl-3d-icon-control",c.type="button",c.replaceChildren(Qo());let b=r.navLabels?.fitView??"Show whole venue";c.setAttribute("aria-label",b),c.title=b,Object.assign(c.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let E=()=>{c.firstElementChild||c.replaceChildren(Qo())};E();let P=S=>{v=S;let w=t.gpu();w&&(w.seatProgram.uniforms.uFocusFloor.value=S,w.solidProgram.uniforms.uFocusFloor.value=S,w.chairProgram.uniforms.uFocusFloor.value=S),t.showSectionSeatLabels(null)},L=()=>{if(t.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),i.panoramaClosed()),t.setPanoramaSphereVisible(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.restorePanoramaLayer(),c.style.display="",l.setVisible(!0),t.setFrozen(!1);let S=v>=0?n.floors[v]:null;if(t.setNearFieldDetailEnabled(!!S),t.setSeatViewLocked(!1),C(),t.removeArriveChip(),t.setNavigationMode("orbit"),S){let w=S.focalWorld[0]-S.center[0],R=S.focalWorld[2]-S.center[2],T=Math.hypot(w,R)>S.radius*.12?Math.atan2(w,R):u,I={center:S.center,radius:S.radius,box:S.box},Y={polarDeg:58,margin:1.12};t.reducedMotion()?a.frame(I,!1,T,!1,Y):a.frameSoft(I,T,!1,Y)}else t.reducedMotion()?a.frame(n.bounds,!1,u,r.portraitOverviewCrop===!0,p):a.frameSoft(n.bounds,u,r.portraitOverviewCrop===!0,p);t.showSectionSeatLabels(null),s.requestRender()},C=()=>{h++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),o.active&&(o.cancel(),a.resumeAfterFlight(n.focalWorld))},F=S=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let w=n.seats.idToIndex.get(S);if(w===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(S),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),c.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1);let R=t.inSeatView()&&r.arriveAtSeatEye===!0;t.setSeatStepping(R),t.setSeatViewLocked(!1);let T=++h;R?t.showArriveChip(S,T):t.removeArriveChip();let{eye:I,focal:Y}=t.resolvedSeatViewPose(S,w),B=r.arriveAtSeatEye?t.seatViewArrival(S,w):null,U=B?B.focal:Y,V=[a.camera.position.x,a.camera.position.y,a.camera.position.z],H=Yt(V,B?.eye??I,U,n.bounds.center,n.bounds.radius),D=B?B.eye:r.arriveAtSeatEye?I:H.finalPos,x=B?B.fov:r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?ht:65:28,y=[H.waypoints[0],H.waypoints[1],D];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),f(D,U,x),s.requestRender(),i.cinematicSkipped(),t.isDisposed()||a.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),B&&t.enterSeatView(B.stops),t.showArriveChip(S,T),Promise.resolve();let G=new $a().copy(a.camera.quaternion),N=wo(a.camera,D,U);s.requestRender();let q=R?700:2500;return o.start(y,G,N,q,x).then(()=>{t.isDisposed()||T!==h||(t.setSeatStepping(!1),i.cinematicPlayed(q),a.resumeAfterFlight(U),t.setSeatViewLocked(r.arriveAtSeatEye===!0),B&&t.enterSeatView(B.stops),s.requestRender(),t.showArriveChip(S,T))})},g=S=>{let w=n.sections.find(T=>T.id===S);if(!w||w.seatCount===0)return!1;t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),o.cancel(),t.removeArriveChip(),n.floors.length>1&&v!==w.floorIndex&&P(w.floorIndex),t.setNavigationMode("pan"),t.panorama()||l.setVisible(!0),t.showSectionSeatLabels(S);let R=Ko(w);return a.frame({center:R.center,radius:R.radius},!1,R.azimuth,!1,{polarDeg:R.polarDeg,margin:1.12}),r.onSectionFocusChange?.(S),s.requestRender(),!0},A=S=>{if(t.isDisposed()||!t.gpu())return!1;let w=n.seats.idToIndex.get(S);if(w===void 0)return!1;let R=w*3,T=[n.seats.iPosition[R],n.seats.iPosition[R+1]+.55,n.seats.iPosition[R+2]];return t.reducedMotion()?a.frame({center:T,radius:$o},!1,void 0,!1,Zo):a.frameSoft({center:T,radius:$o},void 0,!1,Zo),s.requestRender(),!0};return c.addEventListener("click",L),{overviewChip:c,layoutOverviewChip:E,flightGen:()=>h,focusedFloor:()=>v,applyFloorFocus:P,placeCameraFinal:f,cancelFlight:C,focusOverview:L,flyToSeat:F,focusSectionCamera:g,focusSeatCamera:A}}var $o=4.5,Zo={polarDeg:48,margin:1.25};function er(t){let e=performance.now(),{input:n,estimate:r}=Pn(t);return{model:He(n),buildMs:performance.now()-e,source:"main",...r?{estimate:r}:{}}}function Ja(t){let e=an(t.doc);return{...er({...t,seats:e}),seats:e}}function tr(t,e,n){if(typeof Worker>"u")return Promise.resolve(e());let r;try{r=new Worker(new URL("./scene/scene.worker.js",import.meta.url),{type:"module"})}catch{return Promise.resolve(e())}return new Promise(a=>{let o=!1,i=u=>{o||(o=!0,clearTimeout(l),r.terminate(),a(u))},s=()=>i(e()),l=window.setTimeout(s,15e3);r.onerror=s,r.onmessage=u=>{let p=n(u.data);p?i(p):s()},r.postMessage(t)})}function ei(t){return tr(t,()=>er(t),({model:e,buildMs:n,estimate:r})=>({model:e,buildMs:n,source:"worker",...r?{estimate:r}:{}}))}function ti(t){return tr(t,()=>Ja(t),({model:e,buildMs:n,seats:r,estimate:a})=>r?{model:e,buildMs:n,seats:r,source:"worker",...a?{estimate:a}:{}}:null)}var ni=Math.PI/180,oi=6,ri=500;function fl(t,e,n={}){let r=performance.now(),a=e.prepared?e.prepared.estimate:e.estimate===!1?null:Ft(e.doc,e.seats);a&&(e={...e,doc:a.doc,seats:An(e.seats,a)});let o=e.prepared?.model??He(e),i=new vt(n.onAnalytics),s=new Array(o.seats.count);for(let[d,m]of o.seats.idToIndex)s[m]=d;let l=new Map(e.seats.map(d=>[d.id,d])),u=new Map;for(let d of e.seats){if(!d.rowId)continue;let m=u.get(d.rowId);m?m.push(d.id):u.set(d.rowId,[d.id])}let p=new Map;e.seats.forEach((d,m)=>{p.set(d.id,o.seatSectionIds?.[m]??d.sectionId)});let h=new Map;for(let[d,m]of o.seats.idToIndex){let M=p.get(d);if(!M)continue;let z=h.get(M);z?z.push(m):h.set(M,[m])}let v=()=>{if(!c||!o.sectionSolidRanges.length)return;let{lit:d,anyUnlit:m}=io(o.sectionSolidRanges,h,o.seats.iState);c.setSectionShellLit(m?d:null)},f=e.doc.floors?.some(m=>(m.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(m=>m.objects)??e.doc.objects).some(m=>m.type==="section"&&((m.height??0)>0||(m.rake??0)>0)),c=null,b=null,E=!1,P=!1,L=!1,C=new Map,F=null,g=null,A=null,S=new Map,w=null,R=()=>{A===null&&(A=t.style.zIndex,t.style.zIndex="20")},T=()=>{A!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=A),A=null)},I=!1,Y=()=>I?ce.focusedFloor():-1,B=()=>{c=uo(D.gl,o),v(),le(),b=new dt(D.renderer,c.seatGeometry,c.chairGeometry,c.solidGeometry,o.seats.count),D.setClearColor(o.theme.background.top),b.setRestoreClear(o.theme.background.top),c.seatProgram.uniforms.uSeatRadius.value=Ge*o.theme.seatScale,c.seatProgram.uniforms.uFocusFloor.value=Y(),c.solidProgram.uniforms.uFocusFloor.value=Y(),c.chairProgram.uniforms.uFocusFloor.value=Y(),c.screenProgram&&(c.screenProgram.uniforms.uFocusFloor.value=Y()),V.forceRegather()},U=!1,V=new gt({model:o,orbit:()=>x,gpu:()=>c}),H=d=>V.setDetailEnabled(d),D=new at(t,{onContextLost:()=>{L||i.contextLost(),E=!0,O.stop(),c=null,b=null},onContextRestored:()=>{B(),E=!1,L||i.contextRestored(),O.requestRender()}}),x=new it(D.gl,D.canvas,()=>O.requestRender(),()=>i.orbitEngaged());x.setAspect(D.aspect);let y=(e.doc.floors?.flatMap(d=>d.objects)??e.doc.objects).some(d=>d.type==="section"&&d.physical3dProvenance?.surfaceKind?.status==="inferred"),G=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(y&&o.stages.length===0))return En(o.focalWorld,o.seats.iPosition,o.bounds)})(),N=(e.doc.floors?.flatMap(d=>d.objects)??e.doc.objects).some(d=>d.type==="shape"&&d.stageKind?.startsWith("pitch-")),q=o.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:N?36:48,margin:1.05},Z=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;x.frame(o.bounds,!Z&&n.skipInitialOverviewAnimation!==!0,G,n.portraitOverviewCrop===!0,q);let ee=new mt(x.camera),he=Yo(t),Q=new ct(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),ie=o.labels,te=()=>pn(ie,o.floors.length,Y());Q.setLabels(te());let se=null,ve=()=>[...C.keys()].flatMap(d=>{let m=o.seats.idToIndex.get(d),M=m===void 0?void 0:e.seats[m];if(m===void 0||M?.id!==d)return[];let z=m*3;return[{id:`seat:${d}`,kind:"seat",seatWidthM:o.seats.iChairWidth[m]*2,text:M.displayLabel||M.label,anchor:[o.seats.iPosition[z],o.seats.iPosition[z+1]+1.05,o.seats.iPosition[z+2]]}]}),re=-1,le=()=>{c&&(re=se?o.sections.findIndex(d=>d.id===se):-1,c.seatProgram.uniforms.uFocusSection.value=re,c.chairProgram.uniforms.uFocusSection.value=re)},k=d=>{if(se=d,le(),Q.setForcedDense(!!d),!d){let _=ve(),ue=new Set(_.map(oe=>oe.id));Q.setLabels([...te().filter(oe=>!ue.has(oe.id)),..._]);return}let m=e.seats.filter(_=>p.get(_.id)===d),M=new Set(m.map(_=>_.id)),z=new Set(m.map(_=>_.rowId)),W=new Set(C.keys()),K=new Set(m.filter(_=>W.has(_.id)).map(_=>_.id)),$=te().filter(_=>_.kind!=="row"&&_.kind!=="seat"||(_.kind==="row"?z.has(_.id.slice(4)):M.has(_.id.slice(5))&&(K.size===0||K.has(_.id.slice(5)))));if(o.seatCount<=6e3&&K.size===0){Q.setLabels($);return}let ae=K.size?m.filter(_=>K.has(_.id)):m,we=new Set(ae.map(_=>`seat:${_.id}`)),Me=ae.flatMap(_=>{let ue=o.seats.idToIndex.get(_.id);if(ue===void 0)return[];let oe=ue*3;return[{id:`seat:${_.id}`,kind:"seat",seatWidthM:o.seats.iChairWidth[ue]*2,text:W.has(_.id)?_.displayLabel||_.label:Cn(_.displayLabel||_.label),anchor:[o.seats.iPosition[oe],o.seats.iPosition[oe+1]+(W.has(_.id)?1.05:.55),o.seats.iPosition[oe+2]]}]});Q.setLabels([...$.filter(_=>!we.has(_.id)),...Me])};B();let X=null,j=null,J=d=>{if(E||!c||P)return!1;let m=Ho({flying:ee.active,panoramaMounted:F!==null,seatViewActive:X?.active===!0}),M=m==="orbit"?re:-1;c.seatProgram.uniforms.uFocusSection.value=M,c.chairProgram.uniforms.uFocusSection.value=M;let z=m==="cinematic"?ee.update(performance.now()):m==="seatView"?X.update(performance.now()):m==="orbit"?x.update():!1;j?.syncZoomLimits();let W=Y()>=0?o.floors[Y()]:null,K=W?.radius??o.bounds.radius,$=On(x.currentDistance,K),ae=U?{center:[x.camera.position.x,x.camera.position.y,x.camera.position.z],radius:520}:o.clipBounds??o.renderBounds;x.updateClipping(ae);let we=W?.center??o.renderBounds.center,Me=W?.radius??o.renderBounds.radius,_=(pe,Ce)=>Math.hypot(x.camera.position.x-pe[0],x.camera.position.y-pe[1],x.camera.position.z-pe[2])<=Ce*(V.detailVisible?1.8:1.55),ue=_(we,Me);if(!ue&&se){let pe=o.sections.find(Ce=>Ce.id===se);pe&&(ue=_(pe.center,Math.max(12,pe.radius*2)))}V.detailVisible=ue;let oe=c.seatProgram.uniforms;oe.uSeatScale.value=$.scale,oe.uSeatFade.value=$.fade;let Je=!!W&&zn(W.seatCount,D.canvas.clientWidth||1,D.canvas.clientHeight||1),et=Nn(o.seats.count,K,x.currentDistance,x.camera.fov,D.canvas.clientHeight||1),ze=V.detailVisible||Je||et?1:0,Ne=V.detailVisible||Y()>=0||o.floors.length>1?1:0;V.ease(d,ze,Ne),oe.uSeatDetail.value=V.seatDetailMix;let tt=ze===0&&V.seatDetailMix<.01;return c.seatGeometry.setDrawRange(tt?Rt:0,tt?Fn:Rt),c.solidProgram.uniforms.uStructureDetail.value=V.structureDetailMix,oe.uMinPixels.value=$.minPixels,oe.uPixelToWorld.value=2*Math.tan(x.camera.fov*ni/2)/Math.max(1,D.pixelHeight),V.update(V.detailVisible),D.renderer.render({scene:c.background,clear:!0}),D.renderer.render({scene:c.main,camera:x.camera,clear:!1}),Q.update(x.camera.projectionViewMatrix,D.canvas.clientWidth||1,D.canvas.clientHeight||1,x.currentDistance,K,[x.camera.position.x,x.camera.position.y,x.camera.position.z]),z||V.seatDetailMix!==ze||V.structureDetailMix!==Ne},O=new st(J),ne=typeof ResizeObserver<"u"?new ResizeObserver(()=>At.resize()):null;ne?.observe(t);let Kt=d=>{let m=W=>{let K=o.seats.idToIndex.get(W);return K===void 0?void 0:o.seats.iState[K]},{updates:M,next:z}=fo(C,d,m);if(C=z,Q.setSelectedSeatIds(C.keys()),k(se),M.length){let W=Et(o.seats,M);c&&c.uploadSeatStateRuns(W),v(),O.requestRender()}},$e=()=>w!==null?w:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,nr=8,Qt=d=>{if(!n.getSeatView)return null;let m=S.get(d);if(!m)for(m=Promise.resolve(n.getSeatView(d)),S.set(d,m),m.catch(()=>{S.get(d)===m&&S.delete(d)});S.size>nr;){let M=S.keys().next().value;if(M===void 0)break;S.delete(M)}return m},$t=_o(o.stages,o.focalWorld,o.bounds.groundY??0),or=qt($t),yt=(d,m)=>{let M=l.get(d),z=Math.max(0,Math.round(o.seats.iFloor[m]??0)),W=e.doc.floors?.[z],K=o.floors[z],$=W?.focalPoint??e.doc.focalPoint,ae=K?{x:K.focalWorld[0]/Re,y:K.focalWorld[2]/Re}:$,we=M?.focalPoint?{x:M.focalPoint.x+ae.x-$.x,y:M.focalPoint.y+ae.y-$.y}:ae,Me=[o.seats.iPosition[m*3],o.seats.iPosition[m*3+1],o.seats.iPosition[m*3+2]];return Co(Me,we,W?.baseHeightM??0,M?.eyeHeightM,or)},Zt=()=>(t.clientWidth||D.canvas.clientWidth)<=520,xt=null,Jt=null,rr=async(d,m,M)=>{if(!n.getSeatView||L||M!==ce.flightGen())return;let z;try{z=await Wo()}catch{if(i.panoramaFailed(d,"mount"),!L&&M===ce.flightGen()){let W=wt(d,M,!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(L||M!==ce.flightGen()||!xt))return Jt??=z.createOpenPanorama(xt),Jt(d,m,M)},St=Xo({container:t,model:o,opts:n,expandedSeatById:l,seatIdsByRow:u,isNarrow:Zt,isDisposed:()=>L,flightGen:()=>ce.flightGen(),flyToSeat:d=>on(d),openPanorama:(d,m,M)=>rr(d,m,M)}),wt=St.show,Mt=St.remove,ar=St.layout,Se=qo({container:t,orbit:x,isNarrow:Zt,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});j=Se;let ir=Se.element,ke=Se.setNavigationMode,sr=Se.layout,lr=Se.utilityControls,Oe=null,en=!1,Ze=d=>{Se.setSeatViewLocked(d),d||X?.exit()};X=Go({canvas:D.canvas,camera:x.camera,requestRender:()=>O.requestRender(),reducedMotion:$e,onStopChange:d=>{let m=d??(en?"seat":null);Oe=m;try{n.onSeatViewStopChange?.(m)}catch{}},onApplied:()=>{L||x.syncFromCamera()}});let tn=o.sections.reduce((d,m)=>m.seatCount>0&&m.box?Math.max(d,m.box.max[1]):d,-1/0),cr=(d,m)=>{let{eye:M}=yt(d,m),z=(t.clientWidth||D.canvas.clientWidth||1)/Math.max(1,t.clientHeight||D.canvas.clientHeight||1),W=Lo(M,$t,z,{preserveEye:!0});if(n.seatViewStops===!1)return{...W,stops:[]};let K=p.get(d),$=K?o.sections.find(ae=>ae.id===K):void 0;return{...W,stops:ko(W,{aspect:z,seatingTopY:Number.isFinite(tn)?tn:o.bounds.box.max[1],section:$&&$.seatCount>0?{center:$.center,radius:$.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},ce=Jo({container:t,model:o,opts:n,orbit:x,cinematic:ee,analytics:i,loop:O,labelOverlay:Q,stageAzimuth:G,overviewFraming:q,gpu:()=>c,isDisposed:()=>L,panorama:()=>F,setPanorama:d=>{F=d},setPanoramaSphereVisible:d=>{U=d},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:d=>{g=d},setFrozen:d=>{P=d},restorePanoramaLayer:T,reducedMotion:$e,resolvedSeatViewPose:yt,showSectionSeatLabels:k,setNearFieldDetailEnabled:H,setSeatViewLocked:Ze,setNavigationMode:ke,showArriveChip:wt,removeArriveChip:Mt,inSeatView:()=>Oe!==null,setSeatStepping:d=>{en=d},seatViewArrival:(d,m)=>n.arriveAtSeatEye?cr(d,m):null,enterSeatView:d=>X?.enter(d)});I=!0;let Ct=ce.overviewChip,ur=ce.layoutOverviewChip,dr=ce.applyFloorFocus,mr=ce.focusOverview,nn=ce.cancelFlight,on=ce.flyToSeat,rn=ce.focusSectionCamera;lr.appendChild(Ct),xt={container:t,model:o,opts:n,analytics:i,orbit:x,loop:O,seatsById:l,ensureSeatView:Qt,resolvedSeatViewPose:yt,gpu:()=>c,gl:D.gl,isContextLost:()=>E,isDisposed:()=>L,flightGen:()=>ce.flightGen(),setPanorama:d=>{F=d},getLoadAbort:()=>g,setLoadAbort:d=>{g=d},setPanoramaSphereVisible:d=>{U=d,d&&X?.exit()},setFrozen:d=>{P=d},raisePanoramaLayer:R,restorePanoramaLayer:T,getOverviewChip:()=>Ct,labelOverlay:Q,reducedMotion:$e,removeArriveChip:Mt,showArriveChip:wt};let ge=jo({glctx:D,orbit:x,model:o,seats:e.seats,opts:n,cinematic:ee,analytics:i,seatIdByIndex:s,sectionIdBySeatId:p,tapSlop:oi,tapMs:ri,gpu:()=>c,pick:()=>b,seatViewLocked:()=>Se.seatViewLocked(),focusedSectionId:()=>se,selection:()=>C,cancelFlight:nn,focusSectionCamera:rn,focusSeatCamera:ce.focusSeatCamera,setSelection:Kt,ensureSeatView:Qt});D.canvas.addEventListener("pointerdown",ge.onDown),D.canvas.addEventListener("pointermove",ge.onMove),D.canvas.addEventListener("pointerup",ge.onUp),D.canvas.addEventListener("pointercancel",ge.onUp),O.requestRender();let At={setAvailability(d){let m=po(C,d),M=Et(o.seats,m);M.length&&c&&c.uploadSeatStateRuns(M),v(),O.requestRender()},setSelection:Kt,setNavigationMode:ke,zoomIn(){x.zoomBy(Te),O.requestRender()},zoomOut(){x.zoomBy(We),O.requestRender()},flyToSeat:on,focusOverview:mr,seatViewStop:()=>Oe,recentreSeatView:()=>X?.recentre()??!1,resize(){let{width:d,height:m}=D.resize();x.setAspect(d/Math.max(1,m)),ar(),sr(),ur(),O.requestRender()},stats(){return{...O.stats(),drawCalls:c?c.drawCalls:0,fallbackTriangles:c?c.seatGeometry.drawRange.count/3*o.seats.count:0,seatCount:o.seatCount}},captureImage(d=1280){if(E||!c||typeof document>"u")return null;J(0);let m=D.canvas,M=Math.min(1,d/Math.max(m.width,m.height,1)),z=document.createElement("canvas");z.width=Math.max(1,Math.round(m.width*M)),z.height=Math.max(1,Math.round(m.height*M));let W=z.getContext("2d");return W?(W.drawImage(m,0,0,z.width,z.height),z.toDataURL("image/jpeg",.82)):null},getQualityEvidence(){let d=O.stats(),m=D.canvas.clientWidth||1,M=D.canvas.clientHeight||1,z=o.bounds.center,W=xe(x.camera.projectionViewMatrix,[z[0],o.bounds.box.min[1],z[2]],m,M),K=xe(x.camera.projectionViewMatrix,[z[0],o.bounds.box.max[1],z[2]],m,M),$=o.bounds.box,ae=[$.min[0],$.max[0]].flatMap(_=>[$.min[1],$.max[1]].flatMap(ue=>[$.min[2],$.max[2]].map(oe=>xe(x.camera.projectionViewMatrix,[_,ue,oe],m,M)))).filter(_=>Number.isFinite(_.x)&&Number.isFinite(_.y)&&Number.isFinite(_.depth)),we=ae.length?(()=>{let _=Math.min(...ae.map(ye=>ye.x)),ue=Math.max(...ae.map(ye=>ye.x)),oe=Math.min(...ae.map(ye=>ye.y)),Je=Math.max(...ae.map(ye=>ye.y)),et=Math.max(0,_),ze=Math.min(m,ue),Ne=Math.max(0,oe),tt=Math.min(M,Je),pe=Math.max(0,ze-et),Ce=Math.max(0,tt-Ne);return{box:{x:et,y:Ne,width:pe,height:Ce},horizontalFillRatio:pe/m,verticalFillRatio:Ce/M,visibleAreaRatio:pe*Ce/(m*M),clippedEdges:[...oe<0?["top"]:[],...ue>m?["right"]:[],...Je>M?["bottom"]:[],..._<0?["left"]:[]]}})():void 0,Me=String(D.gl.getParameter(D.gl.VERSION)??"");return{viewport:{width:m,height:M},context:{webgl2:/webgl\s*2/i.test(Me),lost:E},frame:{rendered:d.rendered,idle:d.idle},camera:{position:[x.camera.position.x,x.camera.position.y,x.camera.position.z],distance:x.currentDistance,verticalFovDeg:x.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:f,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:W.visible&&K.visible?Math.abs(W.y-K.y):0},labels:Q.qualityEvidence(),framing:we,...Oe?{seatView:{fovDeg:x.camera.fov,stop:Oe}}:{}}},getQualityReport(){return Nt(At.getQualityEvidence())},loseContextForTest(){D.simulateContextLossCycle()},floors(){return o.floors},focusFloor(d){if(d!==null&&!o.floors.some(M=>M.index===d))return!1;let m=d??-1;if(H(d!==null),Ze(!1),dr(m),ke("orbit"),d===null)ee.cancel(),$e()?x.frame(o.bounds,!1,G,n.portraitOverviewCrop===!0,q):x.frameSoft(o.bounds,G,n.portraitOverviewCrop===!0,q);else{let M=o.floors[d];if(M.seatCount>0){ee.cancel();let z=M.focalWorld[0]-M.center[0],W=M.focalWorld[2]-M.center[2],K=Math.hypot(z,W)>M.radius*.12?Math.atan2(z,W):G;x.frame({center:M.center,radius:M.radius,box:M.box},!1,K,!1,{polarDeg:58,margin:1.12})}}return O.requestRender(),!0},zones(){return o.zones},focusZone(d){let m=o.zones.find(K=>K.id===d);if(!m||m.seatCount===0)return!1;H(!1),Ze(!1),ee.cancel(),ke("orbit"),k(null),n.onSectionFocusChange?.(null);let M=m.focalWorld[0]-m.center[0],z=m.focalWorld[2]-m.center[2],W=Math.hypot(M,z)>m.radius*.12?Math.atan2(M,z):void 0;return x.frame({center:m.center,radius:m.radius*1.25},!1,W),O.requestRender(),!0},sections(){return o.sections},focusSection(d){return rn(d)},rows(d){return d?o.rows.filter(m=>m.sectionId===d):o.rows},seatsInRow(d){return e.seats.filter(m=>m.rowId===d).map(m=>({id:m.id,label:m.displayLabel||m.label}))},focusRow(d){let m=o.rows.find(M=>M.id===d);return!m||m.seatCount===0?!1:(H(!0),Ze(!1),ee.cancel(),ke("pan"),m.sectionId&&(k(m.sectionId),n.onSectionFocusChange?.(m.sectionId)),x.frame({center:m.center,radius:Math.max(2.5,m.radius*.65)}),O.requestRender(),!0)},setReducedMotionForTest(d){w=d},dispose(){L=!0,Mt(),Ct.remove(),ir.remove(),nn(),X?.dispose(),O.stop(),Q.dispose(),ne?.disconnect(),F&&(F.dispose(),F=null),T(),he(),D.canvas.removeEventListener("pointerdown",ge.onDown),D.canvas.removeEventListener("pointermove",ge.onMove),D.canvas.removeEventListener("pointerup",ge.onUp),D.canvas.removeEventListener("pointercancel",ge.onUp),x.dispose(),b&&b.dispose(),c&&c.dispose(),c=null,b=null,D.dispose()}};return i.opened(o.seatCount,f,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),At}export{zr as VENUE3D_QUALITY_REPORT_VERSION,hr as autoVenue3d,He as buildSceneModel,Ft as estimateVenue3D,Nt as inspectVenue3DQualityEvidence,fl as mountVenue3D,ei as prepareVenue3D,ti as prepareVenue3DFromChart};
883
+ void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:K},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let X=new Je(t,{geometry:se,program:le});X.frustumCulled=!1,X.setParent(n),ne.screenProgram=le,te=!0,ne.drawCalls=3+(H?1:0)+1},B.src=ve.contentImageUrl}return ne}import{Mesh as Qt,RenderTarget as pi,Transform as Zt}from"ogl";function hi(t,e,n){let r=t+(e<<8)+(n<<16);return r===0?-1:r-1}function Wo(t,e,n,r,a,o){let i=-1,s=1/0;for(let l=0;l<n;l++)for(let u=0;u<e;u++){let d=(l*e+u)*4,m=hi(t[d],t[d+1],t[d+2]);if(m<0||m>=o)continue;let f=u-r,v=l-a,c=f*f+v*v;c<s&&(s=c,i=m)}return i}function Uo(t,e,n,r,a,o){let i=t-n.left,s=e-n.top,l=Math.round(i*r),u=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(a-1,l)),y:Math.max(0,Math.min(o-1,u))}}var fi=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],bt=class{constructor(e,n,r,a,o){this.seatScene=new Zt;this.chairScene=new Zt;this.solidScene=new Zt;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=o,this.seatProg=To(this.gl),this.chairProg=Fo(this.gl),this.depthProg=Io(this.gl);let i=new Qt(this.gl,{geometry:n,program:this.seatProg});i.frustumCulled=!1,i.setParent(this.seatScene);let s=new Qt(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let l=new Qt(this.gl,{geometry:a,program:this.depthProg});l.frustumCulled=!1,l.setParent(this.solidScene)}setRoomCentre(e){this.depthProg.uniforms.uRoomCentre.value.set(e??[0,0])}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let r of fi)this.seatProg.uniforms[r].value=e.uniforms[r].value;let n=e.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let e=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==e||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new pi(this.gl,{width:e,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let e=this.gl;this.target.buffer&&e.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&e.deleteTexture(n.texture);this.target.depthBuffer&&e.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(e,n,r,a){let o=this.gl,i=this.ensureTarget(),s=o.drawingBufferWidth,l=o.drawingBufferHeight,u=Math.max(0,n-a),d=Math.max(0,r-a),m=Math.max(1,Math.min(s,n+a+1)-u),f=Math.max(1,Math.min(l,r+a+1)-d);o.enable(o.SCISSOR_TEST),o.scissor(u,d,m,f);let[v,c,g]=this.restoreClear;o.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:e,target:i,clear:!0}),this.renderer.render({scene:this.seatScene,camera:e,target:i,clear:!1}),this.renderer.render({scene:this.chairScene,camera:e,target:i,clear:!1}),o.clearColor(v,c,g,1),o.disable(o.SCISSOR_TEST);let x=new Uint8Array(m*f*4);return this.renderer.bindFramebuffer(i),o.readPixels(u,d,m,f,o.RGBA,o.UNSIGNED_BYTE,x),this.renderer.bindFramebuffer(),Wo(x,m,f,n-u,r-d,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Yo(t,e){let n=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,Fn(r.state)):n.push(r);return n}function Xo(t,e,n){let r=new Set;for(let i of e)(t.has(i)||n(i)!==void 0)&&r.add(i);let a=new Map(t),o=[];for(let[i,s]of t)r.has(i)||(o.push({seatId:i,state:be[s]??"available"}),a.delete(i));for(let i of r){if(a.has(i))continue;let s=n(i);s!==void 0&&(a.set(i,s),o.push({seatId:i,state:"selected"}))}return{updates:o,next:a}}import{Quat as et,Vec3 as gi}from"ogl";function vi(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function qo(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function bi(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function jo(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 Jt(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function en(t,e){return Math.max(0,Math.min(1,t+e))}function Ko(t,e){let n=t.length;if(n===0)return[0,0,0];if(n===1)return[...t[0]];let r=Math.max(0,Math.min(1,e)),a=n-1,o=Math.floor(r*a);o>=a&&(o=a-1);let i=r*a-o,s=t[Math.max(0,o-1)],l=t[o],u=t[o+1],d=t[Math.min(n-1,o+2)],m=i*i,f=m*i,v=[0,0,0];for(let c=0;c<3;c++)v[c]=.5*(2*l[c]+(-s[c]+u[c])*i+(2*s[c]-5*l[c]+4*u[c]-d[c])*m+(-s[c]+3*l[c]-3*u[c]+d[c])*f);return v}function tn(t,e,n,r,a){let o=jo(vi(e,n));o[0]===0&&o[1]===0&&o[2]===0&&(o=[0,0,1]);let i=qo(qo(e,bi(o,2.5)),[0,1.5,0]),s=[e[0]-r[0],0,e[2]-r[2]],l=jo(s);l[0]===0&&l[2]===0&&(l=[o[0],0,o[2]]);let u=Math.max(1,a),d=[r[0]+l[0]*u*1.3,r[1]+u*.75,r[2]+l[2]*u*1.3];return{waypoints:[t,d,i],finalPos:i}}function nn(t,e,n=35,r=28){let a=Jt(e),o=Ko(t,a),i=Jt(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:o,fov:n+(r-n)*i,eased:a}}function Jo(t,e,n){let r=t.position.clone(),a=new et().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new gi(n[0],n[1],n[2]));let o=new et().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(a),o}var gt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new et;this.endQuat=new et;this.outQuat=new et;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,n,r,a=2500,o=28){return this.settle(),this.waypoints=e,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=a,this.endFov=o,this.startTime=performance.now(),this.active=!0,new Promise(i=>{this.resolveFn=i})}update(e){if(!this.active)return!1;let n=Math.min(1,(e-this.startTime)/this.duration),{pos:r,fov:a,eased:o}=nn(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,en(o,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=a,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let e=this.resolveFn;this.resolveFn=null,e&&e()}};var er=Rn,yi=.12,xi=.25,Si=1.5;function tr(t,e,n=0,r,a){let o=[e.x*Fe,n+Si,e.y*Fe],i=a?[a[0],a[1],a[2]]:o,s=t[1],l=Number.isFinite(s)?s+er:Number.isFinite(r)?n+r:n+er,u=o[0]-t[0],d=o[2]-t[2],m=Math.hypot(u,d),f=m>.001?Math.min(yi,m*xi):0,v=m>.001?u/m:0,c=m>.001?d/m:0;return{eye:[t[0]+v*f,l,t[2]+c*f],focal:i}}var Se=Math.PI/180,wi=45,on=80,yt=70,Mi=1,Pi=.99;function Ai(t,e){if(!(t<Mi))return on;if(!(Number.isFinite(e)&&e>0))return yt;let n=2*Math.atan(e/(2*xt*Pi)/Math.max(.05,t))/Se;return Math.max(yt,Math.min(on,n))}var Ci=.25,xt=1,Ei=.25,Ri=12*Se,Ti=.2,Fi=1.5,nr=.8,or=6,cr=1.9,Ii=2/3,_i=.12,Di=.9,Li=1.2,Vi=2,ur=.05,ki=6;function dr(t,e,n=0){if(!t.length)return{min:[e[0]-6,n,e[2]-6],max:[e[0]+6,Math.max(n+nr,e[1]),e[2]+6]};let r=1/0,a=-1/0,o=1/0,i=-1/0,s=n;for(let c of t)r=Math.min(r,c.cx-c.halfX),a=Math.max(a,c.cx+c.halfX),o=Math.min(o,c.cz-c.halfZ),i=Math.max(i,c.cz+c.halfZ),s=Math.max(s,c.y);let l=a-r,u=i-o,d=Math.max(l,Math.min(u,or))/2,m=Math.max(u,Math.min(l,or))/2,f=(r+a)/2,v=(o+i)/2;return{min:[f-d,n,v-m],max:[f+d,Math.max(n+nr,s),v+m]}}function zi(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+cr,t.max[2]]}}function rn(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+Fi,e+Ti,e+cr*Ii),(t.min[2]+t.max[2])/2]}function mr(t,e){let n=t[0]-e[0],r=t[2]-e[2],a=Math.hypot(n,r);return a<.001?{x:0,z:1}:{x:n/a,z:r/a}}function rr(t,e,n){let r=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],i=Math.hypot(r,a,o)||1;r/=i,a/=i,o/=i;let s=-o,l=r,u=Math.hypot(s,l);if(u<1e-6)return 1/0;s/=u,l/=u;let d=1/0,m=-1/0;for(let f=0;f<8;f++){let v=(f&1?n.max[0]:n.min[0])-t[0],c=(f&2?n.max[1]:n.min[1])-t[1],g=(f&4?n.max[2]:n.min[2])-t[2],x=Math.max(ur,v*r+c*a+g*o),M=(v*s+g*l)/x;M<d&&(d=M),M>m&&(m=M)}return m-d}function ar(t,e,n){let r=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],i=Math.hypot(r,a,o)||1;r/=i,a/=i,o/=i;let s=-o,l=r,u=Math.hypot(s,l);if(u<1e-6)return 1/0;s/=u,l/=u;let d=-l*a,m=l*r-s*o,f=s*a,v=1/0,c=-1/0;for(let g=0;g<8;g++){let x=(g&1?n.max[0]:n.min[0])-t[0],M=(g&2?n.max[1]:n.min[1])-t[1],D=(g&4?n.max[2]:n.min[2])-t[2],S=Math.max(ur,x*r+M*a+D*o),E=(x*d+M*m+D*f)/S;E<v&&(v=E),E>c&&(c=E)}return c-v}function St(t,e){return Math.tan(t*Se/2)*Math.max(.05,e)}function ir(t,e,n){let r=Ai(n,t),a=l=>Math.max(wi,Math.min(r,l)),o=l=>2*Math.atan(l)/Se,i=Number.isFinite(t)&&t>0?a(o(t/(2*Ci)/Math.max(.05,n))):r;if(!(Number.isFinite(e)&&e>0))return i;let s=Math.min(i,a(o(e/(2*_i))));return t/(2*St(s,n))>xt?i:s}function hr(t,e,n,r={}){let a=rn(e),o=[t[0],t[1],t[2]],i=0,s=0,l=c=>{if(!(c>0))return;let g=mr(o,a);o[0]+=g.x*c,o[2]+=g.z*c,s+=c},u=r.preserveEye?0:e.max[1]+Ei-o[1];u>0&&(o[1]+=u,i=u,l(u/Math.tan(Ri)));let d=zi(e),m=rr(o,a,e),f=ir(m,ar(o,a,d),n),v=m/(2*St(f,n));for(let c=0;!r.preserveEye&&c<ki&&v>xt;c++){let g=Math.max(1,Math.hypot(o[0]-a[0],o[2]-a[2])),x=Number.isFinite(v)?v/xt:2;l(Math.min(60,g*(Math.min(4,x)-1)+.5)),m=rr(o,a,e),f=ir(m,ar(o,a,d),n),v=m/(2*St(f,n))}return{eye:o,focal:a,fov:f,raisedM:i,pulledBackM:s,stageFrameWidth:v}}function Oi(t,e,n){let r=Math.tan(e*Se/2),a=St(e,n);return Math.max(1,t/Math.max(.05,Math.min(r,a)))}var Ni=.7,sr=.5,Hi=.8;function lr(t,e,n){let r=[e[0]-t[0],e[1]-t[1],e[2]-t[2]],a=[n[0]-t[0],n[1]-t[1],n[2]-t[2]],o=r[0]*a[0]+r[1]*a[1]+r[2]*a[2],i=Math.hypot(r[0],r[1],r[2])*Math.hypot(a[0],a[1],a[2])||1;return Math.acos(Math.max(-1,Math.min(1,o/i)))/Se}function Gi(t,e,n){let r=u=>{let d=Math.hypot(u[0],u[1],u[2])||1;return[u[0]/d,u[1]/d,u[2]/d]},a=[e[0]-t[0],e[1]-t[1],e[2]-t[2]],o=Math.hypot(a[0],a[1],a[2]),i=r(a),s=r([n[0]-t[0],n[1]-t[1],n[2]-t[2]]),l=r([0,1,2].map(u=>i[u]*(1-sr)+s[u]*sr));return[t[0]+l[0]*o,t[1]+l[1]*o,t[2]+l[2]*o]}function pr(t,e){let{aspect:n,venue:r}=e,a=t.focal,o=mr(t.eye,a),i=g=>(g[0]-a[0])*o.x+(g[2]-a[2])*o.z,s=[{name:"seat",eye:t.eye,focal:a,fov:t.fov}],l=Vi*(e.rowDepthM??Di),u=[t.eye[0]+o.x*l,t.eye[1]+Li,t.eye[2]+o.z*l],d=[t.eye[0],t.eye[1]-Ni,t.eye[2]],m=Gi(u,a,d);s.push({name:"row",eye:u,focal:m,fov:Math.min(on,Math.max(t.fov,2*Math.max(lr(u,m,d),lr(u,m,a))/Hi))});let f=(g,x,M,D)=>{let S=Oi(M,t.fov,n)*1.08,E=S*Math.sin(D*Se),F=Number.isFinite(e.seatingTopY)?e.seatingTopY+2:-1/0,I=Math.max(E,F-x[1]),h=S*Math.cos(D*Se);return{name:g,eye:[x[0]+o.x*h,x[1]+I,x[2]+o.z*h],focal:x,fov:t.fov}};e.section&&e.section.radius>0&&s.push(f("section",e.section.center,e.section.radius,35)),s.push(f("venue",r.center,Math.max(1,r.radius),40));let v=[],c=-1/0;for(let g of s){let x=i(g.eye);v.length&&x<=c+.5||(v.push(g),c=x)}return v}import{Vec3 as Bi}from"ogl";var nt=Math.PI/180,an=320,fr=70*nt,Wi=32*nt,Ui=24*nt,vr=.0026,Yi=.22,Xi=.006,qi=180,ji=900,Ki=1100,$i=4,fe=(t,e,n)=>Math.max(e,Math.min(n,t)),br=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function gr(t){let{canvas:e,camera:n}=t,r=[],a=!1,o=0,i=0,s=0,l=0,u=0,d=0,m=an,f=null,v=()=>{f&&(clearTimeout(f),f=null)},c=!1,g=[0,0],x=0,M=!1,D=null,S=null,E=new Map,F=!1,I=0,h=0,y=0,T=0,A=()=>a&&r.length?r[fe(Math.round(o),0,r.length-1)].name:null,V=()=>{let P=A();P!==D&&(D=P,t.onStopChange?.(P))},L=()=>{if(!a||!r.length)return;let P=r[fe(Math.floor(o),0,r.length-1)],H=r[fe(Math.ceil(o),0,r.length-1)],te=fe(o-Math.floor(o),0,1),j=($,oe)=>$+(oe-$)*te,se=[j(P.eye[0],H.eye[0]),j(P.eye[1],H.eye[1]),j(P.eye[2],H.eye[2])],le=[j(P.focal[0],H.focal[0]),j(P.focal[1],H.focal[1]),j(P.focal[2],H.focal[2])],K=le[0]-se[0],de=le[1]-se[1],me=le[2]-se[2],ne=Math.hypot(K,de,me)||1,ve=Math.atan2(K,me),B=Math.asin(fe(de/ne,-1,1)),Z=ve+i,X=fe(B+s,-80*nt,80*nt),q=Math.cos(X)*ne;K=Math.sin(Z)*q,de=Math.sin(X)*ne,me=Math.cos(Z)*q,n.position.set(se[0],se[1],se[2]),n.fov=j(P.fov,H.fov),n.updateProjectionMatrix(),n.lookAt(new Bi(se[0]+K,se[1]+de,se[2]+me)),t.onApplied?.()},_=()=>{if(!a||!r.length)return;let P=fe(Math.round(o),0,r.length-1);if(t.reducedMotion()){c=!1,o=P,L(),V(),t.requestRender();return}if(Math.abs(P-o)<.001){c=!1,V();return}l=o,u=P,d=performance.now(),m=an,c=!0,t.requestRender()},N=P=>{!a||r.length<2||(v(),c=!1,o=fe(o+P,0,r.length-1),L(),V(),t.requestRender())},U=(P,H)=>{a&&(v(),c=!1,M=!1,i=fe(i-P*vr,-fr,fr),s=fe(s-H*vr,-Ui,Wi),L(),t.requestRender())},z=P=>{a&&(E.set(P.pointerId,{x:P.clientX,y:P.clientY}),E.size===1?(F=!0,T=0,I=P.clientX,h=P.clientY):E.size===2&&(F=!1,y=Y()))},Y=()=>{let P=[...E.values()];return P.length<2?0:Math.hypot(P[0].x-P[1].x,P[0].y-P[1].y)},R=P=>{if(!a||!E.has(P.pointerId))return;if(E.set(P.pointerId,{x:P.clientX,y:P.clientY}),E.size>=2){let j=Y();y>0&&N((y-j)*Xi),y=j;return}if(!F)return;let H=P.clientX-I,te=P.clientY-h;I=P.clientX,h=P.clientY,T+=Math.abs(H)+Math.abs(te),!(T<=$i)&&U(H,te)},w=P=>{E.delete(P.pointerId)&&(E.size<2&&(y=0),E.size===0&&(F=!1,_()))},ee=P=>{if(!a)return;P.preventDefault();let H=P.deltaMode===1?16:P.deltaMode===2?100:1,te=fe(P.deltaY*H/100,-2,2);N(te*Yi),S&&clearTimeout(S),S=setTimeout(()=>{S=null,_()},qi)},k=()=>{v(),a&&(a=!1,c=!1,M=!1,r=[],E.clear(),F=!1,S&&(clearTimeout(S),S=null),D!==null&&(D=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",z),e.addEventListener("pointermove",R),e.addEventListener("pointerup",w),e.addEventListener("pointercancel",w),e.addEventListener("wheel",ee,{passive:!1}),{get active(){return a},enter(P,H=0){if(P.length<2){k();return}v(),r=P,a=!0,o=t.reducedMotion()?0:fe(H,0,P.length-1),o>0&&(f=setTimeout(()=>{f=null,a&&(l=o,u=0,d=performance.now(),m=Ki,c=!0,t.requestRender())},ji)),i=0,s=0,c=!1,M=!1,D=null,L(),V(),t.requestRender()},exit:k,recentre(){return a?Math.abs(i)<1e-4&&Math.abs(s)<1e-4?!0:t.reducedMotion()?(M=!1,i=0,s=0,L(),t.requestRender(),!0):(g=[i,s],x=performance.now(),M=!0,t.requestRender(),!0):!1},update(P){if(!a)return!1;let H=!1;if(M){let te=fe((P-x)/an,0,1),j=1-br(te);i=g[0]*j,s=g[1]*j,te>=1?(M=!1,i=0,s=0):H=!0}if(c){let te=fe((P-d)/m,0,1);o=l+(u-l)*br(te),te>=1?(c=!1,o=u,V()):H=!0}return L(),H},currentStop:A,dispose(){k(),e.removeEventListener("pointerdown",z),e.removeEventListener("pointermove",R),e.removeEventListener("pointerup",w),e.removeEventListener("pointercancel",w),e.removeEventListener("wheel",ee)}}}function yr(t){return t.flying?"cinematic":t.panoramaMounted?"panorama":t.seatViewActive?"seatView":"orbit"}var sn=null;function xr(){return sn??=import("../openPanorama-VD6PE3YZ.js").catch(t=>{throw sn=null,t}),sn}var Sr=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),wt=class{constructor(e){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=e}emit(e,n){if(this.cb)try{this.cb(e,n)}catch{}}opened(e,n,r,a){this.emit("3d_opened",{seats:e,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...a===void 0?{}:{prepSource:a}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(e,n){this.emit("3d_seat_picked",{seatId:e,sectionId:n})}cinematicPlayed(e){this.emit("3d_cinematic_played",{durationMs:e,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=Sr(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(Sr()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:e})}panoramaFailed(e,n){this.emit("3d_panorama_failed",{seatId:e,phase:n})}panoramaFallback(e){this.emit("3d_panorama_fallback",{seatId:e})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function wr(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function Mr(t){let{container:e,model:n,opts:r,expandedSeatById:a,seatIdsByRow:o,isNarrow:i}=t,s=null,l=()=>{if(!s)return;let m=i();Object.assign(s.style,m?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{s?.remove(),s=null};return{show:(m,f,v=!1)=>{if(u(),t.isDisposed())return null;let c=document.createElement("div");c.setAttribute("role","group"),Object.assign(c.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let g=r.chrome?.caption!==!1,x=r.chrome?.seatStepper!==!1;if(!g&&!x)return null;let M=a.get(m),D=M?.sectionId?n.sections.find(A=>A.id===M.sectionId):void 0,S=M?.label??m;c.setAttribute("aria-label",`Explore views near ${D?.label?`${D.label}, `:""}seat ${S}`);let E=document.createElement("span");E.textContent=r.seatViewCaption?.(m)??["Live 3D seat view",D?.label,S].filter(Boolean).join(" \xB7 "),Object.assign(E.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),g&&c.appendChild(E);let F=document.createElement("div");Object.assign(F.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),c.appendChild(F);let I=M?.rowId?o.get(M.rowId):void 0,h=I?.indexOf(m)??-1,y=h>=0?[I?.[h-1],I?.[h+1]]:[void 0,void 0],T=(A,V,L,_=!1)=>{let N=document.createElement("button");N.type="button",N.textContent=A,N.setAttribute("aria-label",V),Object.assign(N.style,{minHeight:"44px",padding:_?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),_||(N.style.minWidth="44px"),_&&(N.dataset.panoramaTrigger=""),N.addEventListener("click",L),F.appendChild(N)};if(x&&y[0]){let A=a.get(y[0])?.label??y[0];T("\u2039",`View previous seat ${A}`,()=>{t.flyToSeat(y[0])})}if(x&&r.getSeatView){let A=r.seatViewActionLabel?.(m)??"Open 360\xB0 panorama";T(v?`\u21BB Retry ${A}`:`\u25C9 ${A}`,`${v?"Retry":A} from seat ${S}`,()=>{if(t.isDisposed()||f!==t.flightGen()){u();return}u(),t.openPanorama(m,400,f)},!0)}if(x&&y[1]){let A=a.get(y[1])?.label??y[1];T("\u203A",`View next seat ${A}`,()=>{t.flyToSeat(y[1])})}return!F.childElementCount&&!g?null:(e.appendChild(c),s=c,l(),c)},remove:u,layout:l}}var Qi={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function Pr(t){let{container:e,orbit:n,isNarrow:r}=t,a={...Qi,...t.labels??{}},o=(S,E)=>{S.setAttribute("aria-label",E),S.title=E},i=document.createElement("div"),s=!1;i.className="sl-3d-navigation-controls",Object.assign(i.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let l=document.createElement("div");l.setAttribute("role","group"),l.setAttribute("aria-label","3D drag mode"),Object.assign(l.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("div");u.setAttribute("role","group"),u.setAttribute("aria-label","3D view controls"),Object.assign(u.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let d=document.createElement("button");d.type="button",d.textContent="\u21BB",o(d,a.rotate);let m=document.createElement("button");m.type="button",m.textContent="\u2725",o(m,a.move);let f=document.createElement("button");f.type="button",f.textContent="\u2212",o(f,a.zoomOut);let v=document.createElement("button");v.type="button",v.textContent="+",o(v,a.zoomIn);for(let S of[d,m,f,v])S.className="sl-3d-icon-control",Object.assign(S.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});l.append(d,m),u.append(v,f);let c=S=>{n.setPrimaryDragMode(S);let E=S==="orbit";d.setAttribute("aria-pressed",String(E)),m.setAttribute("aria-pressed",String(!E)),d.style.background=E?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",m.style.background=E?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",i.title=E?`${a.rotate} \xB7 ${a.move} with Shift`:`${a.move} \xB7 ${a.rotate} with Shift`};d.addEventListener("click",()=>c("orbit")),m.addEventListener("click",()=>c("pan"));let g=()=>{let{atMin:S,atMax:E}=n.dollyLimitState();v.disabled!==S&&(v.disabled=S),f.disabled!==E&&(f.disabled=E)};f.addEventListener("click",()=>{n.zoomBy(qe),g()}),v.addEventListener("click",()=>{n.zoomBy(_e),g()}),i.append(l,u),c("orbit"),e.appendChild(i);let x=t.enabled!==!1,M=()=>{let S=r();i.style.display=s||!x?"none":"flex",i.style.right=S?"12px":"14px",i.style.bottom=S?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",l.style.display=S?"none":"flex",v.style.display=S?"none":"",f.style.display=S?"none":""};return M(),{element:i,utilityControls:u,setNavigationMode:c,syncZoomLimits:g,setSeatViewLocked:S=>{s=S,n.setInteractionEnabled(!S),M()},seatViewLocked:()=>s,layout:M}}var Zi=12;function Ji(t,e){if(!t)return!1;let n=t.x-e[0],r=t.y-e[1],a=t.z-e[2];return Math.hypot(n,r,a)>Zi}var es=.5,ts=12;function ns(t,e,n){return!(t>0)||!(n>0)?0:es*n/(2*t*Math.tan(e*Math.PI/360))}function Ar(t){let{glctx:e,orbit:n,model:r,seats:a,opts:o,cinematic:i,analytics:s,seatIdByIndex:l,sectionIdBySeatId:u,tapSlop:d,tapMs:m,cancelFlight:f,focusSectionCamera:v,setSelection:c,ensureSeatView:g}=t,x=0,M=0,D=0,S=-1,E=!1,F=!1,I=L=>{t.seatViewLocked()||S===-1&&(S=L.pointerId,x=L.clientX,M=L.clientY,D=performance.now(),E=!1,F=i.active,i.active&&(s.cinematicCancelled(),f(),o.onViewTargetChange?.(null)))},h=L=>{L.pointerId===S&&Math.hypot(L.clientX-x,L.clientY-M)>d&&(E=!0)},y=(L,_,N,U,z)=>{let Y=e.canvas.getBoundingClientRect(),R=e.canvas.clientWidth||Y.width||1,w=e.canvas.clientHeight||Y.height||1,ee=L-Y.left,k=_-Y.top,P=U*U,H=-1,te=P,j=1/0;for(let se of a){if(N&&se.sectionId!==N)continue;let le=r.seats.idToIndex.get(se.id);if(le===void 0)continue;if(z){let B=Math.round(r.seats.iState[le]??0);if(B!==0&&B!==3)continue}let K=le*3,de=ge(n.camera.projectionViewMatrix,[r.seats.iPosition[K],r.seats.iPosition[K+1]+.55,r.seats.iPosition[K+2]],R,w);if(!de.visible)continue;let me=de.x-ee,ne=de.y-k,ve=me*me+ne*ne;(ve<te||Math.abs(ve-te)<1&&de.depth<j)&&(H=le,te=ve,j=de.depth)}return H},T=(L,_)=>{let N=t.gpu(),U=t.pick();if(!N||!U)return-1;U.syncFromSeatProgram(N.seatProgram);let z=e.canvas.getBoundingClientRect(),Y=e.renderer.dpr,{x:R,y:w}=Uo(L,_,z,Y,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),ee=Math.max(2,Math.round(8*Y));return U.pick(n.camera,R,w,ee)},A=L=>{let _=n.camera?.position;if(!_)return!1;let N=L*3,U=Math.hypot(_.x-r.seats.iPosition[N],_.y-r.seats.iPosition[N+1],_.z-r.seats.iPosition[N+2]),z=e.canvas.clientHeight||e.canvas.getBoundingClientRect().height;return ns(U,n.fovY,z)>=ts};return{onDown:I,onMove:h,onUp:L=>{if(L.pointerId!==S)return;let _=!E&&performance.now()-D<m;if(S=-1,F){F=!1;return}let N=t.gpu(),U=t.pick();if(!_||!N||!U)return;let z=T(L.clientX,L.clientY),Y=z>=0&&A(z),R=!1;if(t.focusedSectionId()&&z>=0){let k=l[z],P=k?u.get(k):void 0;if(P&&P!==t.focusedSectionId()&&v(P,{keepCamera:Y})){if(!Y)return;R=!0}}if(t.focusedSectionId()&&z<0&&(z=y(L.clientX,L.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&z<0){let k=y(L.clientX,L.clientY,null,72,!1),P=k>=0?l[k]:void 0,H=P?u.get(P):void 0;if(H&&H!==t.focusedSectionId()&&v(H))return}if(!t.focusedSectionId()){z<0&&(z=y(L.clientX,L.clientY,null,42,!1));let k=z>=0?l[z]:void 0,P=k?u.get(k):void 0;if(P&&v(P,{keepCamera:Y})){if(!Y)return;R=!0}}if(z<0||z>=l.length){t.selection().size&&(c([]),o.onViewTargetChange?.(null));return}let w=l[z],ee=be[Math.round(r.seats.iState[z]??0)]??"available";if(ee!=="available"&&ee!=="selected"){o.onSeatInspect?.(w,ee);return}if(t.selection().has(w)&&t.selection().size===1){c([]),o.onViewTargetChange?.(null),o.onSeatPick?.(w);return}if(c([w]),g(w),s.seatPicked(w,u.get(w)),o.onSeatPick?.(w),t.focusedSectionId()&&!R){let k=z*3,P=[r.seats.iPosition[k],r.seats.iPosition[k+1],r.seats.iPosition[k+2]];Ji(n.camera?.position,P)&&t.focusSeatCamera(w)}}}}var Mt=class{constructor(e,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=e,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let e=this.iPosition,n=1/0,r=1/0,a=-1/0,o=-1/0;for(let v=0;v<this.count;v++){let c=e[v*3],g=e[v*3+2];c<n&&(n=c),c>a&&(a=c),g<r&&(r=g),g>o&&(o=g)}let i=Math.max(a-n,.001),s=Math.max(o-r,.001);this.cell=Math.max(Math.sqrt(i*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(i/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let l=this.cols*this.rows,u=new Int32Array(l+1),d=v=>{let c=Math.min(this.cols-1,Math.max(0,Math.floor((e[v*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[v*3+2]-r)/this.cell)))*this.cols+c};for(let v=0;v<this.count;v++)u[d(v)+1]++;for(let v=0;v<l;v++)u[v+1]+=u[v];let m=new Int32Array(this.count),f=u.slice(0,l);for(let v=0;v<this.count;v++)m[f[d(v)]++]=v;this.cellStart=u,this.cellItems=m}gather(e,n,r,a,o){this.ensureGrid();let i=this.cellStart,s=this.cellItems;if(!i||!s)return 0;let l=a.length,u=r*r,d=Math.floor((e-this.minX)/this.cell),m=Math.floor((n-this.minZ)/this.cell),f=Math.ceil(r/this.cell)+1,v=this.iPosition,c=0;for(let g=0;g<=f&&c<l;g++){let x=m-g,M=m+g,D=d-g,S=d+g;for(let E=x;E<=M&&c<l;E++){if(E<0||E>=this.rows)continue;let F=E===x||E===M;for(let I=D;I<=S&&c<l;I++){if(!F&&I!==D&&I!==S){I=S-1;continue}if(I<0||I>=this.cols)continue;let h=E*this.cols+I;for(let y=i[h],T=i[h+1];y<T&&c<l;y++){let A=s[y],V=v[A*3]-e,L=v[A*3+2]-n,_=o===void 0?0:v[A*3+1]-o;V*V+_*_+L*L<=u&&(a[c++]=A)}}}}return c}};var Pt=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(pt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new Mt(e.model.seats.iPosition,e.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(e){let n=this.ctx.gpu();e||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!e&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(e){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!e){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let a=this.ctx.orbit().camera.position;if(Math.hypot(a.x-this.lastGatherX,a.y-this.lastGatherY,a.z-this.lastGatherZ)<Wt)return;if(this.lastGatherX=a.x,this.lastGatherY=a.y,this.lastGatherZ=a.z,Math.hypot(a.x-n.bounds.center[0],a.y-n.bounds.center[1],a.z-n.bounds.center[2])-n.bounds.radius>Bt){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(a.x,a.z,Bt,this.nearBuf,a.y);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(e,n,r){let a=1-Math.exp(-e*9),o=1-Math.exp(-e*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?a:o),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?a:o),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};function Cr(t){let e=Math.max(5,t.radius),n=t.focalWorld[0]-t.center[0],r=t.focalWorld[2]-t.center[2],a=Math.hypot(n,r);if(a<e*.12)return{center:t.center,radius:e,polarDeg:48};let o=Math.min(a*.25,e*.2);return{center:[t.center[0]+n/a*o,t.center[1],t.center[2]+r/a*o],radius:e+o,polarDeg:50}}import{Quat as os,Vec3 as rs}from"ogl";function Er(){let t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("width","18"),e.setAttribute("height","18"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-linejoin","round");let n=document.createElementNS(t,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),e.appendChild(n),e}function Fr(t){let{container:e,model:n,opts:r,orbit:a,cinematic:o,analytics:i,loop:s,labelOverlay:l,stageAzimuth:u,overviewFraming:d}=t,m=0,f=-1,v=(h,y,T=28)=>{a.camera.position.set(h[0],h[1],h[2]),a.camera.lookAt(new rs(y[0],y[1],y[2])),a.camera.fov=T,a.camera.updateProjectionMatrix()},c=document.createElement("button");c.className="sl-3d-overview-control sl-3d-icon-control",c.type="button",c.replaceChildren(Er());let g=r.navLabels?.fitView??"Show whole venue";c.setAttribute("aria-label",g),c.title=g,Object.assign(c.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let x=()=>{c.firstElementChild||c.replaceChildren(Er())};x();let M=h=>{f=h;let y=t.gpu();y&&(y.seatProgram.uniforms.uFocusFloor.value=h,y.solidProgram.uniforms.uFocusFloor.value=h,y.chairProgram.uniforms.uFocusFloor.value=h),t.showSectionSeatLabels(null)},D=()=>{if(t.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),i.panoramaClosed()),t.setPanoramaSphereVisible(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.restorePanoramaLayer(),c.style.display="",l.setVisible(!0),t.setFrozen(!1);let h=f>=0?n.floors[f]:null;if(t.setNearFieldDetailEnabled(!!h),t.setSeatViewLocked(!1),S(),t.removeArriveChip(),t.setNavigationMode("orbit"),h){let y=h.focalWorld[0]-h.center[0],T=h.focalWorld[2]-h.center[2],A=Math.hypot(y,T)>h.radius*.12?Math.atan2(y,T):u,V={center:h.center,radius:h.radius,box:h.box},L={polarDeg:58,margin:1.12};t.reducedMotion()?a.frame(V,!1,A,!1,L):a.frameSoft(V,A,!1,L)}else t.reducedMotion()?a.frame(n.bounds,!1,u,r.portraitOverviewCrop===!0,d):a.frameSoft(n.bounds,u,r.portraitOverviewCrop===!0,d);t.showSectionSeatLabels(null),s.requestRender()},S=()=>{m++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),o.active&&(o.cancel(),a.resumeAfterFlight(n.focalWorld))},E=h=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let y=n.seats.idToIndex.get(h);if(y===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(h),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),c.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1);let T=t.inSeatView()&&r.arriveAtSeatEye===!0;t.setSeatStepping(T),t.setSeatViewLocked(!1);let A=++m;T?t.showArriveChip(h,A):t.removeArriveChip();let{eye:V,focal:L}=t.resolvedSeatViewPose(h,y),_=r.arriveAtSeatEye?t.seatViewArrival(h,y):null,N=_&&_.stops.length>1&&_.stops[1].name==="row"?_.stops[1]:null,U=_?_.focal:L,z=[a.camera.position.x,a.camera.position.y,a.camera.position.z],Y=tn(z,_?.eye??V,U,n.bounds.center,n.bounds.radius),R=N?N.eye:_?_.eye:r.arriveAtSeatEye?V:Y.finalPos,w=_?_.fov:r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?yt:65:28,ee=[Y.waypoints[0],Y.waypoints[1],R];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),v(R,U,w),s.requestRender(),i.cinematicSkipped(),t.isDisposed()||a.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),_&&t.enterSeatView(_.stops),t.showArriveChip(h,A),Promise.resolve();let k=new os().copy(a.camera.quaternion),P=Jo(a.camera,R,U);s.requestRender();let H=T?700:2500;return o.start(ee,k,P,H,w).then(()=>{t.isDisposed()||A!==m||(t.setSeatStepping(!1),i.cinematicPlayed(H),a.resumeAfterFlight(U),t.setSeatViewLocked(r.arriveAtSeatEye===!0),_&&t.enterSeatView(_.stops,N?1:0),s.requestRender(),t.showArriveChip(h,A))})},F=(h,y)=>{let T=n.sections.find(A=>A.id===h);if(!T||T.seatCount===0)return!1;if(t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),o.cancel(),t.removeArriveChip(),n.floors.length>1&&f!==T.floorIndex&&M(T.floorIndex),t.setNavigationMode("pan"),t.panorama()||l.setVisible(!0),t.showSectionSeatLabels(h),!y?.keepCamera){let A=Cr(T),V={polarDeg:A.polarDeg,margin:1.12};t.reducedMotion()?a.frame({center:A.center,radius:A.radius},!1,a.currentAzimuth,!1,V):a.glideTo({center:A.center,radius:A.radius},V)}return r.onSectionFocusChange?.(h),s.requestRender(),!0},I=h=>{if(t.isDisposed()||!t.gpu())return!1;let y=n.seats.idToIndex.get(h);if(y===void 0)return!1;let T=y*3,A=[n.seats.iPosition[T],n.seats.iPosition[T+1]+.55,n.seats.iPosition[T+2]];return t.reducedMotion()?a.frame({center:A,radius:Rr},!1,void 0,!1,Tr):a.frameSoft({center:A,radius:Rr},void 0,!1,Tr),s.requestRender(),!0};return c.addEventListener("click",D),{overviewChip:c,layoutOverviewChip:x,flightGen:()=>m,focusedFloor:()=>f,applyFloorFocus:M,placeCameraFinal:v,cancelFlight:S,focusOverview:D,flyToSeat:E,focusSectionCamera:F,focusSeatCamera:I}}var Rr=4.5,Tr={polarDeg:48,margin:1.25};function ln(t,e,n,r,a,o,i,s,l=.5){let u=-1,d=s*s,m=1/0;for(let f=0;f<e;f++){let v=f*3,c=ge(n,[t[v],t[v+1]+l,t[v+2]],r,a);if(!c.visible)continue;let g=c.x-o,x=c.y-i,M=g*g+x*x;(M<d-4||M<d+4&&c.depth<m)&&(u=f,d=Math.min(d,M),m=c.depth)}return u}function Ir(t){let e=performance.now(),{input:n,estimate:r}=Yn(t);return{model:Xe(n),buildMs:performance.now()-e,source:"main",...r?{estimate:r}:{}}}function as(t){let e=An(t.doc);return{...Ir({...t,seats:e}),seats:e}}function _r(t,e,n){if(typeof Worker>"u")return Promise.resolve(e());let r;try{r=new Worker(new URL("./scene/scene.worker.js",import.meta.url),{type:"module"})}catch{return Promise.resolve(e())}return new Promise(a=>{let o=!1,i=u=>{o||(o=!0,clearTimeout(l),r.terminate(),a(u))},s=()=>i(e()),l=window.setTimeout(s,15e3);r.onerror=s,r.onmessage=u=>{let d=n(u.data);d?i(d):s()},r.postMessage(t)})}function is(t){return _r(t,()=>Ir(t),({model:e,buildMs:n,estimate:r})=>({model:e,buildMs:n,source:"worker",...r?{estimate:r}:{}}))}function ss(t){return _r(t,()=>as(t),({model:e,buildMs:n,seats:r,estimate:a})=>r?{model:e,buildMs:n,seats:r,source:"worker",...a?{estimate:a}:{}}:null)}var cs=40,us=48,ds=Math.PI/180,ms=6,hs=500;function zc(t,e,n={}){let r=performance.now(),a=e.prepared?e.prepared.estimate:e.estimate===!1?null:kt(e.doc,e.seats);a&&(e={...e,doc:a.doc,seats:Un(e.seats,a)});let o=e.prepared?.model??Xe(e),i=new wt(n.onAnalytics),s=new Array(o.seats.count);for(let[p,b]of o.seats.idToIndex)s[b]=p;let l=new Map(e.seats.map(p=>[p.id,p])),u=new Map;for(let p of e.seats){if(!p.rowId)continue;let b=u.get(p.rowId);b?b.push(p.id):u.set(p.rowId,[p.id])}let d=new Map;e.seats.forEach((p,b)=>{d.set(p.id,o.seatSectionIds?.[b]??p.sectionId)});let m=new Map;for(let[p,b]of o.seats.idToIndex){let C=d.get(p);if(!C)continue;let O=m.get(C);O?O.push(b):m.set(C,[b])}let f=()=>{if(!c||!o.sectionSolidRanges.length)return;let{lit:p,anyUnlit:b}=zo(o.sectionSolidRanges,m,o.seats.iState);c.setSectionShellLit(b?p:null)},v=e.doc.floors?.some(b=>(b.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(b=>b.objects)??e.doc.objects).some(b=>b.type==="section"&&((b.height??0)>0||(b.rake??0)>0)),c=null,g=null,x=null,M=!1,D=!1,S=!1,E=new Map,F=null,I=null,h=null,y=new Map,T=null,A=()=>{h===null&&(h=t.style.zIndex,t.style.zIndex="20")},V=()=>{h!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=h),h=null)},L=!1,_=()=>L?he.focusedFloor():-1,N=()=>{c=Bo(R.gl,o),g?.dispose(),g=ho(R.gl,[1,1,1]),pn(!1),f(),Z(),x=new bt(R.renderer,c.seatGeometry,c.chairGeometry,c.solidGeometry,o.seats.count),R.setClearColor(o.theme.background.top),x.setRestoreClear(o.theme.background.top),x.setRoomCentre(o.room?.centre),c.seatProgram.uniforms.uSeatRadius.value=Ye*o.theme.seatScale,c.seatProgram.uniforms.uFocusFloor.value=_(),c.solidProgram.uniforms.uFocusFloor.value=_(),c.chairProgram.uniforms.uFocusFloor.value=_(),c.screenProgram&&(c.screenProgram.uniforms.uFocusFloor.value=_()),z.forceRegather()},U=!1,z=new Pt({model:o,orbit:()=>w,gpu:()=>c}),Y=p=>z.setDetailEnabled(p),R=new dt(t,{onContextLost:()=>{S||i.contextLost(),M=!0,re.stop(),c=null,x=null},onContextRestored:()=>{N(),M=!1,S||i.contextRestored(),re.requestRender()}}),w=new mt(R.gl,R.canvas,()=>re.requestRender(),()=>i.orbitEngaged());w.setAspect(R.aspect);let ee=(e.doc.floors?.flatMap(p=>p.objects)??e.doc.objects).some(p=>p.type==="section"&&p.physical3dProvenance?.surfaceKind?.status==="inferred"),k=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(ee&&o.stages.length===0))return Xn(o.focalWorld,o.seats.iPosition,o.bounds)})(),P=(e.doc.floors?.flatMap(p=>p.objects)??e.doc.objects).some(p=>p.type==="shape"&&p.stageKind?.startsWith("pitch-")),H=o.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:P?36:48,margin:1.05},te=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;w.frame(o.bounds,!te&&n.skipInitialOverviewAnimation!==!0,k,n.portraitOverviewCrop===!0,H);let j=new gt(w.camera),se=wr(t),le=qn(t,o),K=new ft(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),de=o.labels,me=()=>Dn(de,o.floors.length,_());K.setLabels(me());let ne=null,ve=()=>[...E.keys()].flatMap(p=>{let b=o.seats.idToIndex.get(p),C=b===void 0?void 0:e.seats[b];if(b===void 0||C?.id!==p)return[];let O=b*3;return[{id:`seat:${p}`,kind:"seat",seatWidthM:o.seats.iChairWidth[b]*2,text:C.displayLabel||C.label,anchor:[o.seats.iPosition[O],o.seats.iPosition[O+1]+1.05,o.seats.iPosition[O+2]],pinBase:At(O)}]}),B=-1,Z=()=>{c&&(B=ne?o.sections.findIndex(p=>p.id===ne):-1,c.seatProgram.uniforms.uFocusSection.value=B,c.chairProgram.uniforms.uFocusSection.value=B)},X=p=>{if(ne=p,Z(),K.setForcedDense(!!p),!p){let G=ve(),pe=new Set(G.map(ae=>ae.id));K.setLabels([...me().filter(ae=>!pe.has(ae.id)),...G]);return}let b=e.seats.filter(G=>d.get(G.id)===p),C=new Set(b.map(G=>G.id)),O=new Set(b.map(G=>G.rowId)),W=new Set(E.keys()),J=new Set(b.filter(G=>W.has(G.id)).map(G=>G.id)),Q=me().filter(G=>G.kind!=="row"&&G.kind!=="seat"||(G.kind==="row"?O.has(G.id.slice(4)):C.has(G.id.slice(5))));if(o.seatCount<=6e3&&J.size===0){K.setLabels(Q);return}let ue=b,Pe=new Set(ue.map(G=>`seat:${G.id}`)),Ae=ue.flatMap(G=>{let pe=o.seats.idToIndex.get(G.id);if(pe===void 0)return[];let ae=pe*3;return[{id:`seat:${G.id}`,kind:"seat",seatWidthM:o.seats.iChairWidth[pe]*2,rowId:G.rowId,text:W.has(G.id)?G.displayLabel||G.label:Wn(G.displayLabel||G.label),anchor:[o.seats.iPosition[ae],o.seats.iPosition[ae+1]+(W.has(G.id)?1.05:.55),o.seats.iPosition[ae+2]],...W.has(G.id)?{pinBase:At(ae)}:{}}]});K.setLabels([...Q.filter(G=>!Pe.has(G.id)),...Ae])};N();let q=null,$=null,oe=new ls,cn=p=>{if(M||!c||D)return!1;let b=yr({flying:j.active,panoramaMounted:F!==null,seatViewActive:q?.active===!0}),C=b==="orbit"?B:-1;c.seatProgram.uniforms.uFocusSection.value=C,c.chairProgram.uniforms.uFocusSection.value=C;let O=b==="cinematic"?j.update(performance.now()):b==="seatView"?q.update(performance.now()):b==="orbit"?w.update():!1;$?.syncZoomLimits();let W=_()>=0?o.floors[_()]:null,J=W?.radius??o.bounds.radius,Q=lo(w.currentDistance,J),ue=U?{center:[w.camera.position.x,w.camera.position.y,w.camera.position.z],radius:520}:o.clipBounds??o.renderBounds;w.updateClipping(ue);let Pe=W?.center??o.renderBounds.center,Ae=W?.radius??o.renderBounds.radius,G=(ie,Dt)=>Math.hypot(w.camera.position.x-ie[0],w.camera.position.y-ie[1],w.camera.position.z-ie[2])<=Dt*(z.detailVisible?1.8:1.55),pe=G(Pe,Ae);if(!pe&&ne){let ie=o.sections.find(Dt=>Dt.id===ne);ie&&(pe=G(ie.center,Math.max(12,ie.radius*2)))}z.detailVisible=pe;let ae=c.seatProgram.uniforms;ae.uSeatScale.value=Q.scale,ae.uSeatFade.value=Q.fade;let at=!!W&&co(W.seatCount,R.canvas.clientWidth||1,R.canvas.clientHeight||1),it=uo(o.seats.count,J,w.currentDistance,w.camera.fov,R.canvas.clientHeight||1),Ge=z.detailVisible||at||it?1:0,Be=z.detailVisible||_()>=0||o.floors.length>1?1:0;z.ease(p,Ge,Be),ae.uSeatDetail.value=z.seatDetailMix;let st=Ge===0&&z.seatDetailMix<.01;c.seatGeometry.setDrawRange(st?zt:0,st?jn:zt),c.solidProgram.uniforms.uStructureDetail.value=z.structureDetailMix,ae.uMinPixels.value=Q.minPixels,ae.uPixelToWorld.value=2*Math.tan(w.camera.fov*ds/2)/Math.max(1,R.pixelHeight),z.update(z.detailVisible),o.outdoor&&(oe.copy(w.camera.projectionViewMatrix).inverse(),c.backgroundProgram.uniforms.uInvViewProj.value.set(oe)),R.renderer.render({scene:c.background,clear:!0}),R.renderer.render({scene:c.main,camera:w.camera,clear:!1});let We=g?g.update(performance.now(),[w.camera.position.x,w.camera.position.y,w.camera.position.z],F!==null,b==="seatView"):!1;if(g&&R.renderer.render({scene:g.root,camera:w.camera,clear:!1}),le){let ie=w.camera.worldMatrix;le.update(b==="seatView"?[w.camera.position.x,w.camera.position.y,w.camera.position.z]:null,[-ie[8],-ie[9],-ie[10]])}K.update(w.camera.projectionViewMatrix,R.canvas.clientWidth||1,R.canvas.clientHeight||1,w.currentDistance,J,[w.camera.position.x,w.camera.position.y,w.camera.position.z]);let Te=O||We||z.seatDetailMix!==Ge||z.structureDetailMix!==Be;return un(!Te),Te},un=oo(t),re=new ht(cn),dn=typeof ResizeObserver<"u"?new ResizeObserver(()=>_t.resize()):null;dn?.observe(t),w.setZoomPointResolver((p,b)=>{let C=R.canvas.getBoundingClientRect(),O=R.canvas.clientWidth||C.width,W=R.canvas.clientHeight||C.height;if(!(O>0)||!(W>0))return null;w.camera.updateMatrixWorld();let J=ln(o.seats.iPosition,o.seats.count,w.camera.projectionViewMatrix,O,W,p-C.left,b-C.top,cs);if(J<0)return null;let Q=J*3;return[o.seats.iPosition[Q],o.seats.iPosition[Q+1]+.5,o.seats.iPosition[Q+2]]});function At(p){return[o.seats.iPosition[p],o.seats.iPosition[p+1]+.5,o.seats.iPosition[p+2]]}K.setSeatNumberRow(null);let ze=null,we=0,mn=()=>{we=0;let p=null;if(ze&&!q?.active&&!j.active){let b=R.canvas.getBoundingClientRect(),C=R.canvas.clientWidth||b.width,O=R.canvas.clientHeight||b.height;if(C>0&&O>0){let W=ln(o.seats.iPosition,o.seats.count,w.camera.projectionViewMatrix,C,O,ze.x-b.left,ze.y-b.top,us);p=W>=0?e.seats[W]?.rowId??null:null}}K.setSeatNumberRow(p)&&re.requestRender()},ot=p=>{ze={x:p.clientX,y:p.clientY},we||(we=requestAnimationFrame(mn))},hn=p=>{p.pointerType==="mouse"&&(ze=null,we||(we=requestAnimationFrame(mn)))};R.canvas.addEventListener("pointermove",ot),R.canvas.addEventListener("pointerdown",ot),R.canvas.addEventListener("pointerleave",hn);function pn(p){if(!g)return;let b=[];for(let C of E.keys()){let O=o.seats.idToIndex.get(C);if(O===void 0)continue;let W=O*3;b.push({id:C,position:At(W)})}g.setSeats(b,performance.now(),p)}let fn=p=>{let b=W=>{let J=o.seats.idToIndex.get(W);return J===void 0?void 0:o.seats.iState[J]},{updates:C,next:O}=Xo(E,p,b);if(E=O,K.setSelectedSeatIds(E.keys()),pn(!Oe()),re.requestRender(),X(ne),C.length){let W=Vt(o.seats,C);c&&c.uploadSeatStateRuns(W),f(),re.requestRender()}},Oe=()=>T!==null?T:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Dr=8,vn=p=>{if(!n.getSeatView)return null;let b=y.get(p);if(!b)for(b=Promise.resolve(n.getSeatView(p)),y.set(p,b),b.catch(()=>{y.get(p)===b&&y.delete(p)});y.size>Dr;){let C=y.keys().next().value;if(C===void 0)break;y.delete(C)}return b},bn=dr(o.stages,o.focalWorld,o.bounds.groundY??0),Lr=rn(bn),Ct=(p,b)=>{let C=l.get(p),O=Math.max(0,Math.round(o.seats.iFloor[b]??0)),W=e.doc.floors?.[O],J=o.floors[O],Q=W?.focalPoint??e.doc.focalPoint,ue=J?{x:J.focalWorld[0]/Fe,y:J.focalWorld[2]/Fe}:Q,Pe=C?.focalPoint?{x:C.focalPoint.x+ue.x-Q.x,y:C.focalPoint.y+ue.y-Q.y}:ue,Ae=[o.seats.iPosition[b*3],o.seats.iPosition[b*3+1],o.seats.iPosition[b*3+2]];return tr(Ae,Pe,W?.baseHeightM??0,C?.eyeHeightM,Lr)},gn=()=>(t.clientWidth||R.canvas.clientWidth)<=520,Et=null,yn=null,Vr=async(p,b,C)=>{if(!n.getSeatView||S||C!==he.flightGen())return;let O;try{O=await xr()}catch{if(i.panoramaFailed(p,"mount"),!S&&C===he.flightGen()){let W=Tt(p,C,!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(S||C!==he.flightGen()||!Et))return yn??=O.createOpenPanorama(Et),yn(p,b,C)},Rt=Mr({container:t,model:o,opts:n,expandedSeatById:l,seatIdsByRow:u,isNarrow:gn,isDisposed:()=>S,flightGen:()=>he.flightGen(),flyToSeat:p=>Mn(p),openPanorama:(p,b,C)=>Vr(p,b,C)}),Tt=Rt.show,Ft=Rt.remove,kr=Rt.layout,Me=Pr({container:t,orbit:w,isNarrow:gn,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});$=Me;let zr=Me.element,Ne=Me.setNavigationMode,Or=Me.layout,Nr=Me.utilityControls,He=null,xn=!1,rt=p=>{Me.setSeatViewLocked(p),p||q?.exit()};q=gr({canvas:R.canvas,camera:w.camera,requestRender:()=>re.requestRender(),reducedMotion:Oe,onStopChange:p=>{let b=p??(xn?"seat":null);He=b;try{n.onSeatViewStopChange?.(b)}catch{}},onApplied:()=>{S||w.syncFromCamera()}});let Sn=o.sections.reduce((p,b)=>b.seatCount>0&&b.box?Math.max(p,b.box.max[1]):p,-1/0),Hr=(p,b)=>{let{eye:C}=Ct(p,b),O=(t.clientWidth||R.canvas.clientWidth||1)/Math.max(1,t.clientHeight||R.canvas.clientHeight||1),W=hr(C,bn,O,{preserveEye:!0});if(n.seatViewStops===!1)return{...W,stops:[]};let J=d.get(p),Q=J?o.sections.find(ue=>ue.id===J):void 0;return{...W,stops:pr(W,{aspect:O,seatingTopY:Number.isFinite(Sn)?Sn:o.bounds.box.max[1],section:Q&&Q.seatCount>0?{center:Q.center,radius:Q.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},he=Fr({container:t,model:o,opts:n,orbit:w,cinematic:j,analytics:i,loop:re,labelOverlay:K,stageAzimuth:k,overviewFraming:H,gpu:()=>c,isDisposed:()=>S,panorama:()=>F,setPanorama:p=>{F=p},setPanoramaSphereVisible:p=>{U=p},panoramaLoadAbort:()=>I,setPanoramaLoadAbort:p=>{I=p},setFrozen:p=>{D=p},restorePanoramaLayer:V,reducedMotion:Oe,resolvedSeatViewPose:Ct,showSectionSeatLabels:X,setNearFieldDetailEnabled:Y,setSeatViewLocked:rt,setNavigationMode:Ne,showArriveChip:Tt,removeArriveChip:Ft,inSeatView:()=>He!==null,setSeatStepping:p=>{xn=p},seatViewArrival:(p,b)=>n.arriveAtSeatEye?Hr(p,b):null,enterSeatView:(p,b)=>q?.enter(p,b)});L=!0;let It=he.overviewChip,Gr=he.layoutOverviewChip,Br=he.applyFloorFocus,Wr=he.focusOverview,wn=he.cancelFlight,Mn=he.flyToSeat,Pn=he.focusSectionCamera;Nr.appendChild(It),Et={container:t,model:o,opts:n,analytics:i,orbit:w,loop:re,seatsById:l,ensureSeatView:vn,resolvedSeatViewPose:Ct,gpu:()=>c,gl:R.gl,isContextLost:()=>M,isDisposed:()=>S,flightGen:()=>he.flightGen(),setPanorama:p=>{F=p},getLoadAbort:()=>I,setLoadAbort:p=>{I=p},setPanoramaSphereVisible:p=>{U=p,p&&q?.exit()},setFrozen:p=>{D=p},raisePanoramaLayer:A,restorePanoramaLayer:V,getOverviewChip:()=>It,labelOverlay:K,reducedMotion:Oe,removeArriveChip:Ft,showArriveChip:Tt};let xe=Ar({glctx:R,orbit:w,model:o,seats:e.seats,opts:n,cinematic:j,analytics:i,seatIdByIndex:s,sectionIdBySeatId:d,tapSlop:ms,tapMs:hs,gpu:()=>c,pick:()=>x,seatViewLocked:()=>Me.seatViewLocked(),focusedSectionId:()=>ne,selection:()=>E,cancelFlight:wn,focusSectionCamera:Pn,focusSeatCamera:he.focusSeatCamera,setSelection:fn,ensureSeatView:vn});R.canvas.addEventListener("pointerdown",xe.onDown),R.canvas.addEventListener("pointermove",xe.onMove),R.canvas.addEventListener("pointerup",xe.onUp),R.canvas.addEventListener("pointercancel",xe.onUp),re.requestRender();let _t={setAvailability(p){let b=Yo(E,p),C=Vt(o.seats,b);C.length&&c&&c.uploadSeatStateRuns(C),f(),re.requestRender()},setSelection:fn,setNavigationMode:Ne,zoomIn(){w.zoomBy(_e),re.requestRender()},zoomOut(){w.zoomBy(qe),re.requestRender()},flyToSeat:Mn,focusOverview:Wr,seatViewStop:()=>He,recentreSeatView:()=>q?.recentre()??!1,resize(){let{width:p,height:b}=R.resize();w.setAspect(p/Math.max(1,b)),kr(),Or(),Gr(),re.requestRender()},stats(){return{...re.stats(),drawCalls:c?c.drawCalls:0,fallbackTriangles:c?c.seatGeometry.drawRange.count/3*o.seats.count:0,seatCount:o.seatCount}},captureImage(p=1280){if(M||!c||typeof document>"u")return null;cn(0);let b=R.canvas,C=Math.min(1,p/Math.max(b.width,b.height,1)),O=document.createElement("canvas");O.width=Math.max(1,Math.round(b.width*C)),O.height=Math.max(1,Math.round(b.height*C));let W=O.getContext("2d");return W?(W.drawImage(b,0,0,O.width,O.height),O.toDataURL("image/jpeg",.82)):null},getQualityEvidence(){let p=re.stats(),b=R.canvas.clientWidth||1,C=R.canvas.clientHeight||1,O=o.bounds.center,W=ge(w.camera.projectionViewMatrix,[O[0],o.bounds.box.min[1],O[2]],b,C),J=ge(w.camera.projectionViewMatrix,[O[0],o.bounds.box.max[1],O[2]],b,C),Q=o.bounds.box,ue=[Q.min[0],Q.max[0]].flatMap(G=>[Q.min[1],Q.max[1]].flatMap(pe=>[Q.min[2],Q.max[2]].map(ae=>ge(w.camera.projectionViewMatrix,[G,pe,ae],b,C)))).filter(G=>Number.isFinite(G.x)&&Number.isFinite(G.y)&&Number.isFinite(G.depth)),Pe=ue.length?(()=>{let G=Math.min(...ue.map(ie=>ie.x)),pe=Math.max(...ue.map(ie=>ie.x)),ae=Math.min(...ue.map(ie=>ie.y)),at=Math.max(...ue.map(ie=>ie.y)),it=Math.max(0,G),Ge=Math.min(b,pe),Be=Math.max(0,ae),st=Math.min(C,at),We=Math.max(0,Ge-it),Te=Math.max(0,st-Be);return{box:{x:it,y:Be,width:We,height:Te},horizontalFillRatio:We/b,verticalFillRatio:Te/C,visibleAreaRatio:We*Te/(b*C),clippedEdges:[...ae<0?["top"]:[],...pe>b?["right"]:[],...at>C?["bottom"]:[],...G<0?["left"]:[]]}})():void 0,Ae=String(R.gl.getParameter(R.gl.VERSION)??"");return{viewport:{width:b,height:C},context:{webgl2:/webgl\s*2/i.test(Ae),lost:M},frame:{rendered:p.rendered,idle:p.idle},camera:{position:[w.camera.position.x,w.camera.position.y,w.camera.position.z],distance:w.currentDistance,verticalFovDeg:w.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:v,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:W.visible&&J.visible?Math.abs(W.y-J.y):0},labels:K.qualityEvidence(),framing:Pe,...He?{seatView:{fovDeg:w.camera.fov,stop:He}}:{}}},getQualityReport(){return Kt(_t.getQualityEvidence())},loseContextForTest(){R.simulateContextLossCycle()},floors(){return o.floors},focusFloor(p){if(p!==null&&!o.floors.some(C=>C.index===p))return!1;let b=p??-1;if(Y(p!==null),rt(!1),Br(b),Ne("orbit"),p===null)j.cancel(),Oe()?w.frame(o.bounds,!1,k,n.portraitOverviewCrop===!0,H):w.frameSoft(o.bounds,k,n.portraitOverviewCrop===!0,H);else{let C=o.floors[p];if(C.seatCount>0){j.cancel();let O=C.focalWorld[0]-C.center[0],W=C.focalWorld[2]-C.center[2],J=Math.hypot(O,W)>C.radius*.12?Math.atan2(O,W):k;w.frame({center:C.center,radius:C.radius,box:C.box},!1,J,!1,{polarDeg:58,margin:1.12})}}return re.requestRender(),!0},zones(){return o.zones},focusZone(p){let b=o.zones.find(J=>J.id===p);if(!b||b.seatCount===0)return!1;Y(!1),rt(!1),j.cancel(),Ne("orbit"),X(null),n.onSectionFocusChange?.(null);let C=b.focalWorld[0]-b.center[0],O=b.focalWorld[2]-b.center[2],W=Math.hypot(C,O)>b.radius*.12?Math.atan2(C,O):void 0;return w.frame({center:b.center,radius:b.radius*1.25},!1,W),re.requestRender(),!0},sections(){return o.sections},focusSection(p){return Pn(p)},rows(p){return p?o.rows.filter(b=>b.sectionId===p):o.rows},seatsInRow(p){return e.seats.filter(b=>b.rowId===p).map(b=>({id:b.id,label:b.displayLabel||b.label}))},focusRow(p){let b=o.rows.find(C=>C.id===p);return!b||b.seatCount===0?!1:(Y(!0),rt(!1),j.cancel(),Ne("pan"),b.sectionId&&(X(b.sectionId),n.onSectionFocusChange?.(b.sectionId)),w.frame({center:b.center,radius:Math.max(2.5,b.radius*.65)}),re.requestRender(),!0)},setReducedMotionForTest(p){T=p},dispose(){S=!0,le?.dispose(),un(!1),Ft(),It.remove(),zr.remove(),wn(),q?.dispose(),re.stop(),K.dispose(),dn?.disconnect(),F&&(F.dispose(),F=null),V(),se(),R.canvas.removeEventListener("pointerdown",xe.onDown),R.canvas.removeEventListener("pointermove",xe.onMove),R.canvas.removeEventListener("pointerup",xe.onUp),R.canvas.removeEventListener("pointercancel",xe.onUp),R.canvas.removeEventListener("pointermove",ot),R.canvas.removeEventListener("pointerdown",ot),R.canvas.removeEventListener("pointerleave",hn),we&&cancelAnimationFrame(we),w.dispose(),x&&x.dispose(),c&&c.dispose(),c=null,g?.dispose(),g=null,x=null,R.dispose()}};return i.opened(o.seatCount,v,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),_t}export{Va as VENUE3D_QUALITY_REPORT_VERSION,Ur as autoVenue3d,Xe as buildSceneModel,kt as estimateVenue3D,Kt as inspectVenue3DQualityEvidence,zc as mountVenue3D,is as prepareVenue3D,ss as prepareVenue3DFromChart};