@seatlayer/core 0.53.0 → 0.54.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 (75) hide show
  1. package/README.md +2 -2
  2. package/dist/categoryInventory-B4xo7hE2.d.ts +109 -0
  3. package/dist/categoryInventory-lRtu3VjD.d.cts +109 -0
  4. package/dist/chunk-3QLFGEQY.js +1 -0
  5. package/dist/chunk-55NOSZK5.js +1 -0
  6. package/dist/chunk-6LIPQU4G.js +1 -0
  7. package/dist/chunk-6VTTBC5F.js +1 -0
  8. package/dist/chunk-7PT7OQUO.js +1 -0
  9. package/dist/chunk-AQKYUJBX.js +1 -0
  10. package/dist/chunk-CXF32VPG.js +1 -0
  11. package/dist/chunk-DDE7IOFT.js +1 -0
  12. package/dist/chunk-EQM4FFN5.js +1 -0
  13. package/dist/chunk-EYROIZGQ.js +1 -0
  14. package/dist/chunk-QUKWJQLR.js +1 -0
  15. package/dist/chunk-VDZ24QVV.js +1 -0
  16. package/dist/core/chart-ops/index.cjs +1 -0
  17. package/dist/core/chart-ops/index.d.cts +1235 -0
  18. package/dist/core/chart-ops/index.d.ts +1235 -0
  19. package/dist/core/chart-ops/index.js +1 -0
  20. package/dist/core/color.cjs +1 -0
  21. package/dist/core/color.d.cts +192 -0
  22. package/dist/core/color.d.ts +192 -0
  23. package/dist/core/color.js +1 -0
  24. package/dist/core/inventory/index.cjs +1 -0
  25. package/dist/core/inventory/index.d.cts +209 -0
  26. package/dist/core/inventory/index.d.ts +209 -0
  27. package/dist/core/inventory/index.js +1 -0
  28. package/dist/core/layout/index.cjs +1 -0
  29. package/dist/core/layout/index.d.cts +376 -0
  30. package/dist/core/layout/index.d.ts +376 -0
  31. package/dist/core/layout/index.js +1 -0
  32. package/dist/core/quality/index.cjs +1 -0
  33. package/dist/core/quality/index.d.cts +132 -0
  34. package/dist/core/quality/index.d.ts +132 -0
  35. package/dist/core/quality/index.js +1 -0
  36. package/dist/core/render-assets/index.cjs +1 -0
  37. package/dist/core/render-assets/index.d.cts +99 -0
  38. package/dist/core/render-assets/index.d.ts +99 -0
  39. package/dist/core/render-assets/index.js +1 -0
  40. package/dist/core/seatConfidence.cjs +1 -1
  41. package/dist/core/seatConfidence.d.cts +1 -1
  42. package/dist/core/seatConfidence.d.ts +1 -1
  43. package/dist/core/seatConfidence.js +1 -1
  44. package/dist/core/sections/index.cjs +1 -0
  45. package/dist/core/sections/index.d.cts +346 -0
  46. package/dist/core/sections/index.d.ts +346 -0
  47. package/dist/core/sections/index.js +1 -0
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.d.cts +39 -533
  50. package/dist/index.d.ts +39 -533
  51. package/dist/index.js +1 -1
  52. package/dist/labeling-CsPt1mC_.d.cts +90 -0
  53. package/dist/labeling-w8bl86cb.d.ts +90 -0
  54. package/dist/layout-B5UYbwnv.d.ts +181 -0
  55. package/dist/layout-YFmuxw_M.d.cts +181 -0
  56. package/dist/renderedQuality-CugJarFp.d.cts +113 -0
  57. package/dist/renderedQuality-DbZM034G.d.ts +113 -0
  58. package/dist/renderer-DhUHFtsI.d.cts +531 -0
  59. package/dist/renderer-IBi9YKWR.d.ts +531 -0
  60. package/dist/sections-B7cDF0Nq.d.cts +123 -0
  61. package/dist/sections-mLOZrGrI.d.ts +123 -0
  62. package/dist/segmentedRowModel-BPTnJ7Tz.d.ts +75 -0
  63. package/dist/segmentedRowModel-CGoH684F.d.cts +75 -0
  64. package/dist/ticketRestrictions-BwAebpSK.d.cts +72 -0
  65. package/dist/ticketRestrictions-ChHJwvTq.d.ts +72 -0
  66. package/dist/{types-tLOunI-B.d.cts → types-COfJorq_.d.cts} +233 -757
  67. package/dist/{types-tLOunI-B.d.ts → types-COfJorq_.d.ts} +233 -757
  68. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  69. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  70. package/dist/view3d/index.cjs +25 -25
  71. package/dist/view3d/index.d.cts +2 -1
  72. package/dist/view3d/index.d.ts +2 -1
  73. package/dist/view3d/index.js +27 -27
  74. package/package.json +94 -5
  75. package/dist/chunk-54A7LIL5.js +0 -1
@@ -1,12 +1,12 @@
1
- "use strict";var si=Object.create;var Pt=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var li=Object.getOwnPropertyNames;var ui=Object.getPrototypeOf,di=Object.prototype.hasOwnProperty;var mi=(t,e)=>{for(var n in e)Pt(t,n,{get:e[n],enumerable:!0})},zn=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of li(e))!di.call(t,o)&&o!==n&&Pt(t,o,{get:()=>e[o],enumerable:!(r=ci(e,o))||r.enumerable});return t};var Ze=(t,e,n)=>(n=t!=null?si(ui(t)):{},zn(e||!t||!t.__esModule?Pt(n,"default",{value:t,enumerable:!0}):n,t)),fi=t=>zn(Pt({},"__esModule",{value:!0}),t);var Ks={};mi(Ks,{buildSceneModel:()=>it,mountVenue3D:()=>Ws,prepareVenue3D:()=>oi});module.exports=fi(Ks);var jn=require("ogl");var pi=/^#?([\da-f]{3}|[\da-f]{6})$/i;function hi(t){let e=pi.exec((t??"").trim());if(!e)return null;let n=e[1].length===3?e[1].split("").map(o=>o+o).join(""):e[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function ne(t){let e=hi(t);return e?[e[0]/255,e[1]/255,e[2]/255]:null}function on(t){let e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function bi(t){return .2126*on(t[0])+.7152*on(t[1])+.0722*on(t[2])}function Gn(t){return bi([t[0]*255,t[1]*255,t[2]*255])}function yi(t){return .2126*t[0]+.7152*t[1]+.0722*t[2]}function fe(t,e,n){return[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n,t[2]+(e[2]-t[2])*n]}function ut(t,e){let n=yi(t);return fe(t,[n,n,n],e)}var Me=["available","held","sold","selected","dimmed"];function dt(t){let e=Me.indexOf(t);return e<0?0:e}var Hn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Un(t){let e=.2126*t[0]+.7152*t[1]+.0722*t[2],n=.42,r=.62;return[(e+(t[0]-e)*n)*r,(e+(t[1]-e)*n)*r,(e+(t[2]-e)*n)*r]}var rn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Xe={top:[.05,.06,.08],bottom:[.1,.12,.15]};function be(t,e){return[Math.min(1,t[0]*e),Math.min(1,t[1]*e),Math.min(1,t[2]*e)]}function gi(){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 Ct=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 jn.Renderer({canvas:this.canvas,dpr:gi(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Xe.top[0],Xe.top[1],Xe.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))}};var Je=require("ogl"),de=Math.PI/180,an=15*de,sn=80*de,Qe=.12,Yn=35,Xn=1.25,At=class{constructor(e,n,r,o){this.fovY=Yn;this.target=new Je.Vec3;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.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 Je.Vec3;this.panAnchor=new Je.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new Je.Camera(e,{fov:Yn,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let u=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-u)*.005)),this.fireGesture()),this.pinchDist=u;let l=this.pinchCentroid();this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(an,Math.min(sn,this.polT-s*.006)),this.requestRender())},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*de;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(an,Math.min(sn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);else return;i.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 o of e)n+=o.x,r+=o.y;return{x:n/e.length,y:r/e.length}}panBy(e,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*de/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,u=-i,l=Math.cos(this.polar),d=Math.sin(this.polar),m=-i*l,p=-a*l;this.targetT.x+=(-e*s+n*m)*o,this.targetT.z+=(-e*u+n*p)*o,this.targetT.y+=n*d*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let e=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-e,Math.min(n+e,this.targetT.x)),this.targetT.z=Math.max(o-e,Math.min(o+e,this.targetT.z)),this.targetT.y=Math.max(r-e*.5,Math.min(r+e,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let e=[...this.activePointers.values()];return e.length<2?0:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)}dollyBy(e){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*e)),this.requestRender()}zoomBy(e){this.interactionEnabled&&(this.dollyBy(e),this.fireGesture())}setPrimaryDragMode(e){this.primaryDragMode=e}setInteractionEnabled(e){this.interactionEnabled=e,!e&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(e,n=!1,r,o=!1,i){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,e.radius)*1.5;let a=Math.max(1,e.radius),s=this.fovY*de/2,u=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*u);this.azT=r??-30*de,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*de;let d=this.fitDistance(e,s,l,this.azT,this.polT);this.distT=d*Math.max(1.05,Math.min(2,i?.margin??Xn)),this.minDist=Math.max(2,a*.12),this.maxDist=d*4,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){this.camera.perspective({aspect:e})}frameSoft(e,n,r=!1,o){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,e.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*de/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*de;let u=this.fitDistance(e,i,s,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,o?.margin??Xn))}fitDistance(e,n,r,o,i){let a=Math.max(1,e.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),u=e.box;if(!u)return s;let l=Math.sin(i),d=-l*Math.sin(o),m=-Math.cos(i),p=-l*Math.cos(o);if(Math.abs(m)>.999)return s;let c=-p,f=d,h=Math.hypot(c,f);c/=h,f/=h;let b=-f*m,g=f*d-c*p,y=c*m,x=Math.tan(r),w=Math.tan(n),R=1;for(let M=0;M<8;M++){let k=(M&1?u.max[0]:u.min[0])-e.center[0],O=(M&2?u.max[1]:u.min[1])-e.center[1],L=(M&4?u.max[2]:u.min[2])-e.center[2],U=k*d+O*m+L*p,z=Math.abs(k*c+L*f),_=Math.abs(k*b+O*g+L*y);R=Math.max(R,z/x-U,_/w-U)}return Math.min(s,Math.max(R,a*.35))}updateClipping(e){let n=this.camera.position.x-e.center[0],r=this.camera.position.y-e.center[1],o=this.camera.position.z-e.center[2],i=Math.hypot(n,r,o),a=Math.max(1,e.radius)*1.18,s=Math.max(.05,i-a),u=Math.max(s+10,i+a);this.camera.perspective({near:s,far:u,aspect:this.camera.aspect})}update(){let e=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),u=Math.abs(e)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=e*Qe,this.polar+=n*Qe,this.distance+=r*Qe,this.target.x+=o*Qe,this.target.y+=i*Qe,this.target.z+=a*Qe,u&&this.applyPosition(),u}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,o=Math.hypot(e,n,r)||1,i=Math.max(an,Math.min(sn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(e,r)}setTarget(e){this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target)}resumeAfterFlight(e){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),e&&this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let e=Math.sin(this.polar),n=this.target.x+this.distance*e*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Rt=class{constructor(e){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=e=>{let n=this.lastTime?(e-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=e,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=e}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};var et=2.5,xi=1.15,mt=6,tt=10,Wn=6,Kn=9.5,qn=.9,$n=2.2,cn=30,ln=4,It=8192;var rc=tt+ln;function Zn(t,e){let n=e*1.4,r=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:et};let o=Math.min(1,(t-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:et+o*(xi-et)}}function Qn(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}function Jn(t,e,n,r,o){if(!(t>0)||!(e>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=e/(n*i)*(o/2);return Math.PI*a*a/t>=64}var vi=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],ac=new Map(vi.map(t=>[t.key,t]));var Si={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","plus-size":"#ec4899","lift-armrest":"#22c55e"};function eo(t){let e=t?.[0];return e&&Si[e]||"#3b82f6"}var Mi=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],sc=new Map(Mi.map(t=>[t.key,t]));var wi=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],cc=new Set(wi);var Ce=.02291666666666667,Ve=1/Ce,Pi=58,Ci=Pi*Ce;var Ai=3,to=0,un=120,Ri=0,Ii=45,Ti=7,Tt=1.2;function dn(t,e,n,r){return Number.isFinite(t)?Math.max(e,Math.min(n,t)):r}function Ei(t){return!Number.isFinite(t)||!Number.isInteger(t)||t<0?0:t<=Ti?t:Ai}function no(t,e={}){let n=dn(e.floorBaseHeightM,to,un,0),r=Math.min(un,n+Ei(t.elevation)*Ci),o=t.height===void 0?r:dn(t.height,to,un,r),i=dn(t.rake,Ri,Ii,0);return{height:o,rake:i}}var ro=Ze(require("earcut"),1),io=Ze(require("polygon-clipping"),1);var dc=Math.PI/180;function mn(t){let e=0,n=0;for(let o of t)e+=o.x,n+=o.y;let r=t.length||1;return{x:e/r,y:n/r}}function ft(t){return t.length?mn(t):null}function We(t){let e=0;for(let n=0,r=t.length;n<r;n+=1){let o=t[n],i=t[(n+1)%r];e+=o.x*i.y-i.x*o.y}return e/2}function pt(t,e,n){let r=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let a=t[o],s=t[i];a.y>n!=s.y>n&&e<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var D=Ce,ki=.002;function Fi(t,e,n){let r=Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2]),o=Math.hypot(n[0]-e[0],n[1]-e[1],n[2]-e[2]),i=Math.hypot(t[0]-n[0],t[1]-n[1],t[2]-n[2]),a=Math.max(r,o,i);if(a<1e-9)return!0;let s=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-i)))/a<ki}var Ke=class{constructor(e=16384){this.len=0;this.buf=new Float32Array(e)}push3(e,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=e,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(e){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=e}grow(e){let n=this.buf.length*2;for(;n<e;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Ft=class{constructor(){this.pos=new Ke;this.nor=new Ke;this.col=new Ke;this.flr=new Ke;this.mat=new Ke;this.currentFloor=0;this.currentMaterial=0}setFloor(e){this.currentFloor=e}setMaterial(e){this.currentMaterial=e}tri(e,n,r,o,i,a=i,s=i){Fi(e,n,r)||(this.pos.push3(e[0],e[1],e[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(e,n,r,o,i,a,s,u=s,l=s){[...e,...n,...r].every(Number.isFinite)&&(this.pos.push3(e[0],e[1],e[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(u[0],u[1],u[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function Di(t,e,n){let r=e[0]-t[0],o=e[1]-t[1],i=e[2]-t[2],a=n[0]-t[0],s=n[1]-t[1],u=n[2]-t[2],l=o*u-i*s,d=i*a-r*u,m=r*s-o*a,p=Math.hypot(l,d,m)||1;return l/=p,d/=p,m/=p,[l,d,m]}function Li(t,e){let n=[...t],r=[];for(let a of t)r.push(a.x,a.y);let o=[];if(e){for(let a of e)if(!(a.length<3)){o.push(n.length);for(let s of a)n.push(s),r.push(s.x,s.y)}}let i=(0,ro.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function fn(t){return We(t)<0?[...t].reverse():t}var Oi=3;function _i(t,e,n,r){let o=r(t),i=r(e),a=r(n),s=(c,f,h,b)=>Math.abs(r({x:(c.x+f.x)/2,y:(c.y+f.y)/2})-(h+b)/2),u=(t.x+e.x+n.x)/3,l=(t.y+e.y+n.y)/3,d=(o+i+a)/3,m=Math.max(s(t,e,o,i),s(e,n,i,a),s(n,t,a,o),Math.abs(r({x:u,y:l})-d)),p=(c,f,h)=>{let b=Math.abs(r({x:(c+u)/2,y:(f+l)/2})-(h+d)/2);b>m&&(m=b)};return p((t.x+e.x)/2,(t.y+e.y)/2,(o+i)/2),p((e.x+n.x)/2,(e.y+n.y)/2,(i+a)/2),p((n.x+t.x)/2,(n.y+t.y)/2,(a+o)/2),m}function ht(t,e,n,r,o){if(o<=0)return _i(t,e,n,r);let i={x:(t.x+e.x)/2,y:(t.y+e.y)/2},a={x:(e.x+n.x)/2,y:(e.y+n.y)/2},s={x:(n.x+t.x)/2,y:(n.y+t.y)/2};return Math.max(ht(t,i,s,r,o-1),ht(i,e,a,r,o-1),ht(s,a,n,r,o-1),ht(i,a,s,r,o-1))}function bt(t,e,n,r,o,i,a,s){if(a>0){let p={x:(e.x+n.x)/2,y:(e.y+n.y)/2},c={x:(n.x+r.x)/2,y:(n.y+r.y)/2},f={x:(r.x+e.x)/2,y:(r.y+e.y)/2};bt(t,e,p,f,o,i,a-1,s),bt(t,p,n,c,o,i,a-1,s),bt(t,f,c,r,o,i,a-1,s),bt(t,p,c,f,o,i,a-1,s);return}let u=[e.x*D,o(e),e.y*D],l=[n.x*D,o(n),n.y*D],d=[r.x*D,o(r),r.y*D];if(s){t.triN(u,l,d,s(e),s(n),s(r),i);return}let m=Di(u,l,d);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(u,l,d,m,i)}var Bi=8;function oo(t,e,n){if(!Number.isFinite(n))return t;let r=[],o=(i,a,s,u,l)=>{if(l>0){let d={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=e(d);if(Math.abs(m-(s+u)/2)>n){o(i,d,s,m,l-1),o(d,a,m,u,l-1);return}}r.push(i)};for(let i=0;i<t.length;i++){let a=t[i],s=t[(i+1)%t.length];o(a,s,e(a),e(s),Bi)}return r}function Et(t,e){if(t.length<3)return t;let n=[];for(let o of t){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<e||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<e;)n.pop();if(n.length<3)return t;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],u=s.x-i.x,l=s.y-i.y,d=Math.hypot(u,l);d>e&&Math.abs((a.x-i.x)*l-(a.y-i.y)*u)/d<e||r.push(a)}return r.length>=3?r:n}var kt=.001*Ve*.1;function se(t,e,n,r,o,i,a,s,u=1/0,l){if(!e||e.length<3||(u===void 0&&(u=1/0),Math.abs(We(e))<1e-4))return;let d=Et(oo(Et(fn(e),kt),r,u),kt),m=n?.map(M=>Et(oo(Et(fn(M),kt),r,u),kt)).filter(M=>M.length>=3&&Math.abs(We(M))>=1e-4),{pts:p,tris:c}=Li(d,m),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],h=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],g=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],y=0;if(Number.isFinite(u))for(;y<Oi;y++){let M=0;for(let k=0;k<c.length;k+=3){let O=ht(p[c[k]],p[c[k+1]],p[c[k+2]],r,y);O>M&&(M=O)}if(M<=u)break}for(let M=0;M<c.length;M+=3){let k=p[c[M]],O=p[c[M+1]],L=p[c[M+2]];bt(t,k,O,L,r,f,y,l);let U=[k.x*D,o,k.y*D],z=[O.x*D,o,O.y*D],_=[L.x*D,o,L.y*D];t.tri(U,_,z,[0,-1,0],h)}let x=M=>{if(y<=0)return M;let k=1<<y,O=[];for(let L=0;L<M.length;L++){let U=M[L],z=M[(L+1)%M.length];for(let _=0;_<k;_++){let v=_/k;O.push({x:U.x+(z.x-U.x)*v,y:U.y+(z.y-U.y)*v})}}return O},w=mn(d),R=[{ring:x(d),flip:!1}];if(m)for(let M of m)M.length>=3&&R.push({ring:x(M),flip:!0});for(let{ring:M,flip:k}of R)for(let O=0;O<M.length;O++){let L=M[O],U=M[(O+1)%M.length],z=(U.x-L.x)*D,v=(U.y-L.y)*D,S=-z,C=Math.hypot(v,S)||1;v/=C,S/=C;let G=(L.x+U.x)/2-w.x,P=(L.y+U.y)/2-w.y,T=v*G+S*P;k&&(T=-T),T<0&&(v=-v,S=-S);let I=[v,0,S],E=[L.x*D,r(L),L.y*D],A=[U.x*D,r(U),U.y*D],F=[L.x*D,o,L.y*D],N=[U.x*D,o,U.y*D];t.tri(E,A,N,I,b,b,g),t.tri(E,N,F,I,b,g,g)}}function ao(t){let e=0;for(let u of t)e+=u.count;let n=new Float32Array(e*3),r=new Float32Array(e*3),o=new Float32Array(e*3),i=new Float32Array(e),a=new Float32Array(e),s=0;for(let u of t)n.set(u.position,s*3),r.set(u.normal,s*3),o.set(u.color,s*3),i.set(u.floor,s),a.set(u.material,s),s+=u.count;return{position:n,normal:r,color:o,floor:i,material:a,count:e}}function Dt(t,e,n=2.5){if(e<=0||t.length<3)return t;let r=fn(t),o=r.length,i=[];for(let s=0;s<o;s++){let u=r[s],l=r[(s+1)%o],d=l.x-u.x,m=l.y-u.y,p=Math.hypot(d,m)||1;i.push({x:m/p,y:-d/p})}let a=[];for(let s=0;s<o;s++){let u=r[s],l=i[(s-1+o)%o],d=i[s],m=l.x+d.x,p=l.y+d.y,c=Math.hypot(m,p),f=()=>{a.push([u.x+l.x*e,u.y+l.y*e]),a.push([u.x+d.x*e,u.y+d.y*e])};if(c<1e-9){f();continue}m/=c,p/=c;let h=m*l.x+p*l.y,b=1/Math.max(h,1e-6);if(!Number.isFinite(b)||b>n){f();continue}a.push([u.x+m*e*b,u.y+p*e*b])}if(a.length<3)return t;try{let s=io.default.union([[...a,a[0]]]),u=null,l=-1/0;for(let m of s){let p=Math.abs(We(m[0].map(([c,f])=>({x:c,y:f}))));p>l&&(l=p,u=m[0])}if(!u)return t;let d=u.map(([m,p])=>({x:m,y:p}));if(d.length>1){let m=d[0],p=d[d.length-1];Math.abs(m.x-p.x)<1e-9&&Math.abs(m.y-p.y)<1e-9&&d.pop()}return d.length>=3?d:t}catch{return t}}function Lt(t,e,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:t+n*Math.cos(s),y:e+r*Math.sin(s)})}return i}function yt(t,e,n,r){return[{x:t,y:e},{x:t+n,y:e},{x:t+n,y:e+r},{x:t,y:e+r}]}var le={pedestal:0,pad:1,back:2,body:3,head:4},Ni=.44,Vi=.15,zi=.3,Gi=.24;function so(t){return t===void 0||!Number.isFinite(t)||t<=0?Gi:Math.min(zi,Math.max(Vi,t*Ni))}var pn=.21,Hi=.05,hn=.45,Ot=hn+Hi,Ui=[{part:le.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:le.pad,min:[-1,.36,-.95],max:[1,hn,1]},{part:le.back,min:[-1,Ot,-1],max:[1,.92,-.72]}],ji=[{part:le.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:le.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:le.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:le.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:le.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Yi=[{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]]}];function co(){let t=[],e=[],n=[],r=[],o=(C,G,P)=>{let T=n.length,[I,E,A]=C,F=[E[0]-I[0],E[1]-I[1],E[2]-I[2]],N=[A[0]-I[0],A[1]-I[1],A[2]-I[2]],Y=F[1]*N[2]-F[2]*N[1],V=F[2]*N[0]-F[0]*N[2],B=F[0]*N[1]-F[1]*N[0],j=Math.hypot(Y,V,B);j>1e-9?(Y/=j,V/=j,B/=j):[Y,V,B]=G,Y*G[0]+V*G[1]+B*G[2]<0&&(Y=-Y,V=-V,B=-B);for(let K of C)t.push(...K),e.push(Y,V,B),n.push(P);r.push(T,T+1,T+2,T,T+2,T+3)},i=C=>{for(let G of Yi){let P=G.c.map(T=>T.map((I,E)=>I?C.max[E]:C.min[E]));o(P,G.n,C.part)}};for(let C of Ui)i(C);for(let C of ji)i(C);let a=hn,s=1.08,u=.47,l=.69,d=-.55,m=.08,p=-.48,c=.01,f=[-u,a,d],h=[u,a,d],b=[-u,a,m],g=[u,a,m],y=[-l,s,p],x=[l,s,p],w=[-l,s,c],R=[l,s,c];o([h,x,R,g],[1,0,0],le.body),o([b,w,y,f],[-1,0,0],le.body),o([w,R,x,y],[0,1,0],le.body),o([f,h,g,b],[0,-1,0],le.body),o([g,R,w,b],[0,0,1],le.body),o([f,y,x,h],[0,0,-1],le.body);let M=10,k=8,O=[0,1.205,-.23],L=[.42,.115,.38],U=n.length;for(let C=0;C<=k;C++){let G=Math.PI*C/k,P=Math.cos(G),T=Math.sin(G);for(let I=0;I<=M;I++){let E=Math.PI*2*I/M,A=T*Math.cos(E),F=T*Math.sin(E);t.push(O[0]+L[0]*A,O[1]+L[1]*P,O[2]+L[2]*F);let N=A/L[0],Y=P/L[1],V=F/L[2],B=Math.hypot(N,Y,V)||1;N/=B,Y/=B,V/=B,e.push(N,Y,V),n.push(le.head)}}for(let C=0;C<k;C++)for(let G=0;G<M;G++){let P=U+C*(M+1)+G,T=P+M+1;r.push(P,T,P+1,P+1,T,T+1)}let z=new Float32Array(t),_=new Float32Array(e),v=new Float32Array(n),S=new Uint16Array(r);return{position:z,normal:_,part:v,index:S,vertexCount:n.length,indexCount:r.length}}function lo(t,e,n,r){let o=new Float32Array(e),i=l=>t[l*3],a=l=>t[l*3+2],s=0,u=(l,d)=>{let m=d-l;for(let p=l;p<d;p++){let[c,f]=r(p),h=c-i(p),b=f-a(p);if(m>=2){let g=Math.max(l,p-1),y=Math.min(d-1,p+1),x=i(y)-i(g),w=a(y)-a(g),R=Math.hypot(x,w);if(R>1e-6){let M=-w/R,k=x/R;M*h+k*b<0&&(M=-M,k=-k),h=M,b=k}}o[p]=h===0&&b===0?0:Math.atan2(h,b)}};for(let l=1;l<=e;l++)(l===e||n(l)!==n(s))&&(u(s,l),s=l);return o}var ke=.22;function uo(t,e){let n=Me[t];if(n!=="sold"&&n!=="held")return-1;let r=(e+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Xi=.42;function Wi(t){let e=t.length,n=new Float64Array(e);if(e<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let f of t)f.x<r&&(r=f.x),f.y<o&&(o=f.y),f.x>i&&(i=f.x),f.y>a&&(a=f.y);let s=Math.max(i-r,1e-6),u=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*u/e),1e-6),d=Math.max(1,Math.ceil(s/l)+1),m=Math.max(1,Math.ceil(u/l)+1),p=new Map,c=(f,h)=>{let b=Math.min(d-1,Math.max(0,Math.floor((f-r)/l)));return Math.min(m-1,Math.max(0,Math.floor((h-o)/l)))*d+b};for(let f=0;f<e;f++){let h=c(t[f].x,t[f].y),b=p.get(h);b?b.push(f):p.set(h,[f])}for(let f=0;f<e;f++){let h=t[f],b=Math.min(d-1,Math.max(0,Math.floor((h.x-r)/l))),g=Math.min(m-1,Math.max(0,Math.floor((h.y-o)/l))),y=1/0;for(let x=1;x<=4;x++){for(let w=g-x;w<=g+x;w++)if(!(w<0||w>=m))for(let R=b-x;R<=b+x;R++){if(R<0||R>=d||x>1&&Math.abs(w-g)<x&&Math.abs(R-b)<x)continue;let M=p.get(w*d+R);if(M)for(let k of M){if(k===f)continue;let O=Math.hypot(t[k].x-h.x,t[k].y-h.y);O<y&&(y=O)}}if(Number.isFinite(y)&&y<=x*l)break}n[f]=y}return n}function Ki(t){let e=t.eyeHeightM;return Number.isFinite(e)?Math.max(0,e-Tt):0}function mo(t,e,n,r,o){let i=t.length,a=new Float32Array(i*3),s=new Float32Array(i),u=new Float32Array(i*3),l=new Float32Array(i),d=new Float32Array(i),m=new Float32Array(i),p=new Float32Array(i*3),c=new Map,f=Wi(t);for(let h=0;h<i;h++){let b=t[h],y=(n?.seatPitchU(h)??f[h])*D;l[h]=Number.isFinite(y)?Math.max(.06,Math.min(ke,y*Xi)):ke,d[h]=so(Number.isFinite(y)?y:void 0),m[h]=b.wheelchairSpaceType==="no-seat"?0:1,a[h*3]=b.x*D,a[h*3+1]=n?n.seatDeckY(h):Ki(b),a[h*3+2]=b.y*D,s[h]=dt(e?e(b):"available");let x=ne(o?.get(b.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[h*3]=x[0],u[h*3+1]=x[1],u[h*3+2]=x[2],b.accessibility?.length){let w=ne(eo(b.accessibility));w&&(p[h*3]=w[0],p[h*3+1]=w[1],p[h*3+2]=w[2])}c.set(b.id,h)}return{count:i,iPosition:a,iState:s,iCategory:u,iMaxRadius:l,iRing:p,idToIndex:c,iChairWidth:d,iPhysicalSeat:m,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var qi=64;function bn(t,e){let n=[];for(let a of e){let s=t.idToIndex.get(a.seatId);if(s===void 0)continue;let u=dt(a.state);t.iState[s]!==u&&(t.iState[s]=u,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+qi){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var $i=.15,Zi=.9,Qi=1.76,Ji=.7,ea=1.6;function ta(){return{background:{top:[...Xe.top],bottom:[...Xe.bottom]},structure:rn,seatStates:{...Hn},seatScale:1}}function fo(t){let e=ta();if(!t)return e;let n=ne(t.background);if(n){e.background={top:be(n,Zi),bottom:be(n,Qi)};let i={};for(let[a,s]of Object.entries(rn))i[a]=fe(s,n,$i);e.structure=i}let r=ne(t.selectionColor)??ne(t.accent);r&&(e.seatStates={...e.seatStates,selected:r});let o=t.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(e.seatScale=Math.min(ea,Math.max(Ji,o))),e}function po(t,e){let n=[];for(let r of e)n.push(...t.seatStates[r]);return n}function ho(t){let e=t.length;return e<=3?[...t]:[t[Math.floor(e*.25)],t[Math.floor(e*.5)],t[Math.floor(e*.75)]]}function nt(t,e,n){if(!t.length)return 1/0;if(t.length===1)return Math.hypot(e-t[0].x,n-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let i=t[o],a=t[o+1],s=a.x-i.x,u=a.y-i.y,l=s*s+u*u,d=l>1e-12?((e-i.x)*s+(n-i.y)*u)/l:0;d<0?d=0:d>1&&(d=1);let m=Math.hypot(e-(i.x+d*s),n-(i.y+d*u));m<r&&(r=m)}return r}function na(t){let e=0,n=0;for(let i of t)e+=i.x,n+=i.y;let r=t.length||1;e/=r,n/=r;let o=0;for(let i of t){let a=Math.hypot(i.x-e,i.y-n);a>o&&(o=a)}return{cx:e,cy:n,r:o}}function bo(t,e){return Math.hypot(t.cx-e.cx,t.cy-e.cy)-t.r-e.r}function yn(t,e){let n=1/0;for(let r of ho(t)){let o=nt(e,r.x,r.y);o<n&&(n=o)}for(let r of ho(e)){let o=nt(t,r.x,r.y);o<n&&(n=o)}return n}function oa(t,e){if(t.length<3)return{pts:t,seatIndices:e};let n=0,r=0;for(let d of t)n+=d.x,r+=d.y;n/=t.length,r/=t.length;let o=-1,i=t[0];for(let d of t){let m=Math.hypot(d.x-n,d.y-r);m>o&&(o=m,i=d)}let a=i.x-n,s=i.y-r,u=Math.hypot(a,s);u>1e-9?(a/=u,s/=u):(a=1,s=0);let l=t.map((d,m)=>({p:d,i:m,t:(d.x-n)*a+(d.y-r)*s})).sort((d,m)=>d.t-m.t);return{pts:l.map(d=>d.p),seatIndices:l.map(d=>e[d.i])}}function gn(t){let e=t.length;if(e<3)return null;let n=0,r=0;for(let y of t)n+=y.x,r+=y.y;n/=e,r/=e;let o=0,i=0,a=0,s=0,u=0,l=0,d=0;for(let y of t){let x=y.x-n,w=y.y-r;o+=x*x,a+=w*w,i+=x*w,s+=x*x*x,u+=w*w*w,l+=x*w*w,d+=w*x*x}let m=o*a-i*i;if(Math.abs(m)<1e-9)return null;let p=(s+l)/2,c=(u+d)/2,f=(p*a-c*i)/m,h=(c*o-p*i)/m,b=f+n,g=h+r;return!Number.isFinite(b)||!Number.isFinite(g)?null:{cx:b,cy:g}}var ra=.15;function ia(t){if(t.length<2)return null;let e=t.map(y=>{let x=0,w=0;for(let R of y.pts)x+=R.x,w+=R.y;return{x:x/y.pts.length,y:w/y.pts.length}}),n=0,r=0;for(let y of e)n+=y.x,r+=y.y;n/=e.length,r/=e.length;let o=0,i=0,a=0;for(let y of e){let x=y.x-n,w=y.y-r;o+=x*x,i+=x*w,a+=w*w}let s=o+a,u=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-u)),d,m;Math.abs(i)>1e-12?(d=l-a,m=i):o>=a?(d=1,m=0):(d=0,m=1);let p=Math.hypot(d,m);if(!(p>1e-12))return null;d/=p,m/=p;let c=1/0,f=-1/0,h=[];for(let y of t){let x=1/0,w=-1/0;for(let R of y.pts){let M=R.x*d+R.y*m;M<x&&(x=M),M>w&&(w=M),M<c&&(c=M),M>f&&(f=M)}h.push(w-x)}let b=f-c;return b>1e-9?(h.sort((y,x)=>y-x),h[Math.min(h.length-1,Math.floor(h.length*.9))]/b<=aa?{x:d,y:m}:null):null}var aa=.35;function yo(t,e,n,r){let o=new Map;for(let b of n){let g=e[b],y=g.rowId||`__seat-${b}`,x=o.get(y);x||(x={pts:[],idx:[]},o.set(y,x)),x.pts.push({x:g.x,y:g.y}),x.idx.push(b)}if(!o.size)return{sectionId:t,rows:[],blockCount:0};let i=[];for(let[b,g]of o){let y=oa(g.pts,g.idx),x=0;for(let w of y.pts)x+=Math.hypot(w.x-r.x,w.y-r.y);i.push({id:b,pts:y.pts,seatIndices:y.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/y.pts.length})}let a=i.map(b=>na(b.pts)),s=[];for(let b=0;b<i.length;b++){let g=1/0;for(let y=0;y<i.length;y++){if(b===y||bo(a[b],a[y])>=g)continue;let x=yn(i[b].pts,i[y].pts);x<g&&(g=x)}Number.isFinite(g)&&s.push(g)}s.sort((b,g)=>b-g);let u=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(u*1.8,1e-6),d=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let g=b+1;g<i.length;g++)bo(a[b],a[g])>l||yn(i[b].pts,i[g].pts)<=l&&(d[b].push(g),d[g].push(b));let m=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let g=m++,y=[b];for(i[b].blockId=g;y.length;){let x=y.pop();for(let w of d[x])i[w].blockId===-1&&(i[w].blockId=g,y.push(w))}}let p=new Map;for(let b of i){let g=p.get(b.blockId)??[];g.push(b),p.set(b.blockId,g)}let c=[];for(let b of i){if(b.pts.length<4)continue;let g=gn(b.pts);g&&(!Number.isFinite(g.cx)||!Number.isFinite(g.cy)||c.push({x:g.cx,y:g.cy}))}let f=c.length>=2?(()=>{let b=c.map(x=>x.x).sort((x,w)=>x-w),g=c.map(x=>x.y).sort((x,w)=>x-w),y=Math.floor(c.length/2);return{cx:b[y],cy:g[y]}})():null;if(f){let b=M=>Math.hypot(M.x-f.cx,M.y-f.cy),g=1/0,y=-1/0,x=[];for(let M of i){let k=1/0,O=-1/0;for(let L of M.pts){let U=b(L);U<k&&(k=U),U>O&&(O=U)}x.push(O-k),k<g&&(g=k),O>y&&(y=O)}let w=y-g;x.sort((M,k)=>M-k);let R=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(w>1e-9&&R/w<=ra){let M=i.map(_=>{let v=0;for(let S of _.pts)v+=b(S);return{row:_,radius:v/_.pts.length}}),k=1/0;for(let _ of M)_.radius<k&&(k=_.radius);M.sort((_,v)=>_.radius-v.radius);let O=-1,L=-1/0,U=w/Math.max(1,M.length)*.5,z=[];for(let _ of M)_.radius-L>U&&(O++,L=_.radius),_.row.ordinal=O,_.row.blockDepth=_.radius-k,z.push(_.row);return{sectionId:t,rows:z,blockCount:m}}}let h=[];for(let[,b]of p){let g=ia(b);if(g){let y=w=>{let R=0;for(let M of w.pts)R+=M.x*g.x+M.y*g.y;return R/w.pts.length};b.sort((w,R)=>y(w)-y(R));let x=0;for(let w=0;w<b.length;w++)w>0&&(x+=yn(b[w-1].pts,b[w].pts)),b[w].ordinal=w,b[w].blockDepth=x,h.push(b[w])}else{let y=1/0;for(let x of b)x.focalDistance<y&&(y=x.focalDistance);b.sort((x,w)=>x.focalDistance-w.focalDistance);for(let x=0;x<b.length;x++)b[x].ordinal=x,b[x].blockDepth=Math.max(0,b[x].focalDistance-y),h.push(b[x])}}return{sectionId:t,rows:h,blockCount:m}}var Tc=Math.PI/180;function go(t,e){let n=!1;for(let r=0,o=e.length-1;r<e.length;o=r++){let i=e[r].x,a=e[r].y,s=e[o].x,u=e[o].y;a>t.y!=u>t.y&&t.x<(s-i)*(t.y-a)/(u-a)+i&&(n=!n)}return n}function sa(t,e){return e.some((n,r)=>{let o=e[(r+1)%e.length],i=(t.y-n.y)*(o.x-n.x)-(t.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(t.x-n.x)*(o.x-n.x)+(t.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function xo(t,e,n){return go(t,e)&&!(n??[]).some(r=>go(t,r)||sa(t,r))}function ca(t){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(e,n)=>Math.hypot(e-t.x,n-t.y),gradientAt:(e,n)=>{let r=e-t.x,o=n-t.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function la(t,e){if(!t.length)return null;let n=0,r=0,o=0;for(let c of t)n+=c.x,r+=c.y,o+=Math.hypot(c.x-e.x,c.y-e.y);let i=t.length;n/=i,r/=i,o/=i;let a=t[0],s=-1;for(let c of t){let f=Math.hypot(c.x-n,c.y-r);f>s&&(s=f,a=c)}let u=a.x-n,l=a.y-r,d=Math.hypot(u,l);d>1e-9?(u/=d,l/=d):(u=1,l=0);let m=[...t].sort((c,f)=>(c.x-n)*u+(c.y-r)*l-((f.x-n)*u+(f.y-r)*l)),p=0;for(let c of m){let f=Math.hypot(c.x-n,c.y-r);f>p&&(p=f)}return{pts:m,cx:n,cy:r,radius:p,depth:o}}function vo(t,e,n){let r=t.pts;if(r.length===1)return Math.hypot(e-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],u=s.x-a.x,l=s.y-a.y,d=u*u+l*l,m=d>1e-12?((e-a.x)*u+(n-a.y)*l)/d:0;m<0?m=0:m>1&&(m=1);let p=Math.hypot(e-(a.x+m*u),n-(a.y+m*l));p<o&&(o=p)}return o}var _t=8;function ua(t,e,n){let r=new Array(_t).fill(1/0),o=new Array(_t).fill(-1);for(let d=0;d<t.length;d++){let m=t[d],p=Math.hypot(e-m.cx,n-m.cy)-m.radius;for(let c=0;c<_t;c++)if(p<r[c]){for(let f=_t-1;f>c;f--)r[f]=r[f-1],o[f]=o[f-1];r[c]=p,o[c]=d;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let d of o){if(d<0)continue;let m=vo(t[d],e,n);for(let p=0;p<3;p++)if(m<i[p]){for(let c=2;c>p;c--)i[c]=i[c-1],a[c]=a[c-1];i[p]=m,a[p]=d;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return t[a[0]].depth;let s=i[0]*2.2,u=0,l=0;for(let d=0;d<3;d++){let m=a[d];if(m<0||i[d]>s)continue;let p=1/(i[d]*i[d]);u+=p*t[m].depth,l+=p}return l>0?u/l:t[a[0]].depth}function da(t){let e=(r,o)=>ua(t,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<t.length;s++){let u=t[s];if(Math.hypot(r-u.cx,o-u.cy)-u.radius>=i)continue;let l=vo(u,r,o);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:t.length,rows:t,nearestRow:n,depthAt:e,gradientAt:(r,o)=>{let i=(e(r+.5,o)-e(r-.5,o))/1,a=(e(r,o+.5)-e(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function So(t,e){let n=[];for(let r of t){let o=la(r.points,e);o&&n.push(o)}return n.length<2?ca(e):(n.sort((r,o)=>r.depth-o.depth),da(n))}var Sn=Ze(require("polygon-clipping"),1);var Co=Ze(require("earcut"),1);var ma=.58,Mo=.01,ye=ke*1.5*Ve,fa=.5,pa=.6;function ha(t,e){let n=t.length,r=[];for(let a=0;a<n;a++){let s=t[Math.max(0,a-1)],u=t[Math.min(n-1,a+1)],l=u.x-s.x,d=u.y-s.y,m=Math.hypot(l,d);if(m<1e-9){r.push([0,0]);continue}l/=m,d/=m,r.push([-d,l])}let o=0;for(let a=0;a<n;a++)o+=(t[a].x-e.x)*r[a][0]+(t[a].y-e.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function ba(t,e){if(t.length<2||e<=0)return[...t];let n=[...t],r=(a,s)=>{let u=s.x-a.x,l=s.y-a.y,d=Math.hypot(u,l)||1;return{x:u/d,y:l/d}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*e,y:n[0].y+o.y*e}),n.push({x:n[n.length-1].x+i.x*e,y:n[n.length-1].y+i.y*e}),n}var wo=Math.PI/12;function ya(t){if(t.length<3)return[...t];let e=[...t].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(e),...r([...e].reverse())];return o.length>=3?o:[...t]}function Ao(t,e){if(!t.length||!(e>0))return[];let n=ya(t),r=(s,u,l,d)=>{let m=l-u;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let p=Math.max(1,Math.ceil(m/wo)),c=e/Math.cos(m/p/2);for(let f=0;f<=p;f++){let h=u+m*f/p;d.push({x:s.x+Math.cos(h)*c,y:s.y+Math.sin(h)*c})}};if(n.length<3){let s=0,u=0;for(let c of n)s+=c.x,u+=c.y;s/=n.length||1,u/=n.length||1;let l=0;for(let c of n)l=Math.max(l,Math.hypot(c.x-s,c.y-u));let d=[],m=Math.max(3,Math.ceil(Math.PI*2/wo)),p=(l+e)/Math.cos(Math.PI/m);for(let c=0;c<m;c++){let f=c/m*Math.PI*2;d.push({x:s+Math.cos(f)*p,y:u+Math.sin(f)*p})}return d}let o=n.length,i=[];for(let s=0;s<o;s++){let u=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-u.x),l.y-u.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return ko(a)}function ga(t,e,n){if(t.length===1)return Math.hypot(e-t[0].x,n-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let i=t[o],a=t[o+1],s=a.x-i.x,u=a.y-i.y,l=s*s+u*u,d=l>1e-12?((e-i.x)*s+(n-i.y)*u)/l:0;d<0?d=0:d>1&&(d=1);let m=Math.hypot(e-(i.x+d*s),n-(i.y+d*u));m<r&&(r=m)}return r}function Bt(t){let e=t.map(o=>{let i=0,a=0;for(let l of o.pts)i+=l.x,a+=l.y;let s=o.pts.length||1;i/=s,a/=s;let u=0;for(let l of o.pts){let d=Math.hypot(l.x-i,l.y-a);d>u&&(u=d)}return{cx:i,cy:a,rad:u}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<t.length;o++){let i=n(t[o].pts),a=[],s=1/0,u=null;for(let d of i){let m=1/0;for(let p=0;p<t.length;p++){if(p===o||Math.abs(t[p].y-t[o].y)<.001)continue;let c=e[p],f=Math.hypot(d.x-c.cx,d.y-c.cy)-c.rad;if(f>=m&&f>=s)continue;let h=ga(t[p].pts,d.x,d.y);h<m&&(m=h),t[p].depth<t[o].depth&&h<s&&(s=h,u=t[p].y)}Number.isFinite(m)&&m>0&&a.push(m)}a.sort((d,m)=>d-m);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:u})}return r}function Ro(t,e,n,r){let o=t[e],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let d=o.pts[0],m=d.x-r.x,p=d.y-r.y,c=Math.hypot(m,p)||1;m/=c,p/=c;let f=Math.max(n[e].pitch,.001)*.5;return[{x:d.x+p*f,y:d.y-m*f},{x:d.x-p*f,y:d.y+m*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let d=1;d<i.length;d++){let m=Math.hypot(i[d].x-i[d-1].x,i[d].y-i[d-1].y);m>1e-6&&(a+=m,s++)}let u=s>0?a/s:0,l=ba(i,Math.max(u*pa,ye));return{pts:l,nrm:ha(l,r),front:Math.max(n[e].pitch*ma,ye),back:Math.max(n[e].pitch*fa,ye)}}var ot=1.5,Io=.3;function xn(t,e){if(t.length<3)return t;let n=t[0],r=t[t.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,u=-1;for(let m=1;m<t.length-1;m++){let p=t[m],c=a>1e-12?Math.abs((p.x-n.x)*i-(p.y-n.y)*o)/a:Math.hypot(p.x-n.x,p.y-n.y);c>s&&(s=c,u=m)}if(s<=e||u<0)return[n,r];let l=xn(t.slice(0,u+1),e),d=xn(t.slice(u),e);return[...l.slice(0,-1),...d]}function To(t,e){if(t.length<4)return t;let n=xn([...t,t[0]],e);return n.pop(),n.length>=3?n:t}function Eo(t,e,n){if(t.length<2)return[];let r=n??Bt(t),o=new Map;for(let a=0;a<t.length;a++){let s=o.get(t[a].blockId);s?s.push(a):o.set(t[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let y of a){let x=t[y].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:t[y].y}):s.push(y)}if(!s.length)continue;s.sort((y,x)=>t[y].depth-t[x].depth);let l=s.map(y=>Ro(t,y,r,e)).filter(y=>y!==null);if(!l.length)continue;let d=(y,x)=>({x:y.pts[x].x-y.nrm[x][0]*(y.front+ot),y:y.pts[x].y-y.nrm[x][1]*(y.front+ot)}),m=(y,x)=>({x:y.pts[x].x+y.nrm[x][0]*(y.back+ot),y:y.pts[x].y+y.nrm[x][1]*(y.back+ot)}),p=l[0],c=l[l.length-1],f=[];for(let y=0;y<p.pts.length;y++)f.push(d(p,y));for(let y of l)f.push(m(y,y.pts.length-1));for(let y=c.pts.length-1;y>=0;y--)f.push(m(c,y));for(let y=l.length-1;y>=0;y--)f.push(d(l[y],0));let h=ko(f),b=1/0;for(let y of s)t[y].y<b&&(b=t[y].y);if(!Number.isFinite(b))continue;if(h.length>=3&&Math.abs(We(h))>1e-6&&l.every(y=>{let x=y.pts[Math.floor(y.pts.length/2)];return pt(h,x.x,x.y)})){i.push({outline:To(h,Io),holes:[],topY:b});continue}for(let y of xa(l))i.push({outline:y,holes:[],topY:b})}return i}function xa(t){let e=[];for(let n of t){let r=[],o=[],i=n.front+ot,a=n.back+ot;for(let u=0;u<n.pts.length;u++){let l=n.pts[u],d=n.nrm[u];r.push([l.x-d[0]*i,l.y-d[1]*i]),o.push([l.x+d[0]*a,l.y+d[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),e.push([s]))}if(!e.length)return[];try{let n=Sn.default.union(e[0],...e.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([u,l])=>({x:u,y:l})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(To(i,Io))}return r}catch{return[]}}function ko(t){let e=[];for(let n of t){let r=e[e.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||e.push(n)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<1e-9;)e.pop();return e}var vn=class{constructor(e){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=e;for(let n of e)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(e){for(let n of e)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of e)if(!pt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Po(t,e,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],d=r[0];for(let m=1;m+1<r.length;m++){let p=r[m],c=r[m+1];t.tri([d.x*D,o,d.y*D],[p.x*D,o,p.y*D],[c.x*D,o,c.y*D],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=Sn.default.intersection([a],e)}catch{return}let u=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let d=l[0],m=[],p=[];for(let f=0;f<d.length-1;f++)m.push(d[f][0],d[f][1]),p.push([d[f][0],d[f][1]]);if(p.length<3)continue;let c=(0,Co.default)(m,void 0,2);for(let f=0;f<c.length;f+=3){let h=p[c[f]],b=p[c[f+1]],g=p[c[f+2]];t.tri([h[0]*D,o,h[1]*D],[b[0]*D,o,b[1]*D],[g[0]*D,o,g[1]*D],u,i)}}}function Fo(t,e,n,r,o,i,a){if(e.length<2)return;let s=a??Bt(e),u=[0,1,0],l=i&&i.length>=3?[[...i.map(c=>[c.x,c.y]),[i[0].x,i[0].y]]]:null,d=i&&i.length>=3?new vn([[...i]]):null,m=c=>{t.setMaterial(2),c(),t.setMaterial(0)},p=c=>{t.setMaterial(3),c(),t.setMaterial(0)};for(let c=0;c<e.length;c++){let f=e[c];if(f.patch&&f.patch.length>=3){let R=[...f.patch],M=s[c].belowY??r;if(p(()=>{if(l&&d)Po(t,l,d,R,f.y,o.tread);else{let k=R[0];for(let O=1;O+1<R.length;O++){let L=R[O],U=R[O+1];t.tri([k.x*D,f.y,k.y*D],[L.x*D,f.y,L.y*D],[U.x*D,f.y,U.y*D],u,o.tread)}}}),f.y>M+Mo){let k=0,O=0;for(let L of R)k+=L.x,O+=L.y;k/=R.length,O/=R.length,m(()=>{for(let L=0;L<R.length;L++){let U=R[L],z=R[(L+1)%R.length],_=z.x-U.x,v=z.y-U.y,S=Math.hypot(_,v);if(S<1e-6)continue;let C=v/S,G=-_/S;(U.x-k)*C+(U.y-O)*G<0&&(C=-C,G=-G);let P=[C,0,G],T=[U.x*D,f.y,U.y*D],I=[z.x*D,f.y,z.y*D],E=[U.x*D,M,U.y*D],A=[z.x*D,M,z.y*D];t.tri(T,I,A,P,o.riser),t.tri(T,A,E,P,o.riser)}})}continue}let h=Ro(e,c,s,n);if(!h)continue;let{pts:b,nrm:g,front:y,back:x}=h,w=s[c].belowY??r;for(let R=0;R+1<b.length;R++){let M=b[R],k=b[R+1],O=g[R],L=g[R+1];if(Math.hypot(k.x-M.x,k.y-M.y)<1e-6||O[0]===0&&O[1]===0||L[0]===0&&L[1]===0)continue;let U=[(M.x-O[0]*y)*D,f.y,(M.y-O[1]*y)*D],z=[(k.x-L[0]*y)*D,f.y,(k.y-L[1]*y)*D],_=[(M.x+O[0]*x)*D,f.y,(M.y+O[1]*x)*D],v=[(k.x+L[0]*x)*D,f.y,(k.y+L[1]*x)*D];if(p(()=>{l&&d?Po(t,l,d,[{x:M.x-O[0]*y,y:M.y-O[1]*y},{x:k.x-L[0]*y,y:k.y-L[1]*y},{x:k.x+L[0]*x,y:k.y+L[1]*x},{x:M.x+O[0]*x,y:M.y+O[1]*x}],f.y,o.tread):(t.tri(U,z,v,u,o.tread),t.tri(U,v,_,u,o.tread))}),f.y>w+Mo){let S=[U[0],w,U[2]],C=[z[0],w,z[2]],G=[-O[0],0,-O[1]];m(()=>{t.tri(U,z,C,G,o.riser),t.tri(U,C,S,G,o.riser)})}}}}function Do(t){let e=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of t)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<e&&(e=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:e,minY:n,maxX:r,maxY:o}:null}function Nt(t,e){return t.minX<=e.maxX&&e.minX<=t.maxX&&t.minY<=e.maxY&&e.minY<=t.maxY}var Mn=Ze(require("polygon-clipping"),1);function va(t,e){let n=t.eventConfigurationIds;return!n?.length||!!e&&n.includes(e)}function Lo(t,e){return t.filter(n=>n.type!=="shape"||va(n,e))}function Oo(t,e){let n=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:Lo(r.objects,e),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Lo(t.objects,e),focal:n,baseHeightM:0,index:0}]}var Sa={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function rt(t){return Do(t)??Sa}function _o(t,e){let n=Dt(t.outline,ye),r=rt(n),o=e.filter(a=>a!==t&&a.outline&&a.outline.length>=3&&Nt(r,rt(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(u=>[u.x,u.y]);return s.push(s[0]),s};try{let a=Mn.default.difference([i(n)],...o.map(u=>[i(u.outline)])),s=[];for(let u of a){if(!u.length)continue;let l=u[0].map(([d,m])=>({x:d,y:m}));if(l.length>1){let d=l[0],m=l[l.length-1];Math.abs(d.x-m.x)<1e-9&&Math.abs(d.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function Bo(t,e){if(!e.length)return t;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=e.map(i=>[n(i)]),o=[];for(let i of t){let a;try{a=Mn.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let u=s[0].map(([l,d])=>({x:l,y:d}));if(u.length>1){let l=u[0],d=u[u.length-1];Math.abs(l.x-d.x)<1e-9&&Math.abs(l.y-d.y)<1e-9&&u.pop()}u.length>=3&&o.push({outline:u,holes:[],topY:i.topY})}}return o.length?o:t}var Ma=.05,No=.05,wa=.15,wn=25;function Vo(t,e,n){let r=new Map,o=new Array(e.length).fill(null),i=new Float64Array(e.length),a=new Array(e.length).fill(void 0),s=new Array(e.length).fill(void 0),u=new Map,l=[],d=new Set;for(let m=0;m<t.length;m+=1){let p=t[m];for(let c of p.objects){if(c.type==="table"&&d.add(c.id),c.type!=="section"||!c.outline||c.outline.length<3)continue;let f=Dt(c.outline,ye);u.set(c.id,{section:c,unit:p,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:c.id,floorIndex:m,box:rt(f),section:c,unit:p,outline:f})}}for(let m=0;m<e.length;m++){let p=e[m];for(let c of l){if(n&&c.floorIndex!==n[m]||p.x<c.box.minX||p.x>c.box.maxX||p.y<c.box.minY||p.y>c.box.maxY||!xo({x:p.x,y:p.y},c.outline,c.section.holes))continue;o[m]=c.id;let f=u.get(c.id);f.hasSeats=!0;let h=p.focalPoint??c.unit.focal,b=Math.hypot(p.x-h.x,p.y-h.y);b<f.frontU&&(f.frontU=b),f.seatIndices.push(m);let g=p.rowId||`__seat-${m}`,y=f.rows.get(g);y?y.push({x:p.x,y:p.y}):f.rows.set(g,[{x:p.x,y:p.y}]);break}}for(let[m,p]of u){let c=no(p.section,{floorBaseHeightM:p.unit.baseHeightM}),f=p.unit.baseHeightM,h=c.rake>0?Math.tan(c.rake*Math.PI/180):0,b=c.rake<=.01&&c.height<=f+.001,g=p.section.surfaceKind,y=g==="flat"?!0:g==="rakedRows"&&c.rake>.01?!1:b,x=p.hasSeats?yo(m,e,p.seatIndices,p.unit.focal):{sectionId:m,rows:[],blockCount:0},R=x.rows.length<2?So([...p.rows.values()].map(P=>({points:P})),p.unit.focal):null,M=1/0;if(R){if(p.hasSeats)for(let P of p.rows.values())for(let T of P){let I=R.depthAt(T.x,T.y);I<M&&(M=I)}if(!p.hasSeats||!Number.isFinite(M)){M=1/0;for(let P of p.section.outline){let T=R.depthAt(P.x,P.y);T<M&&(M=T)}}}let k=f+Ma,O=Math.max(k,c.height),L=P=>{let T=Math.max(0,P-M)*Ce,I=Math.min(T*h,wn);return Math.max(k,c.height+I)},U=P=>{let T=Math.max(0,P)*Ce,I=Math.min(T*h,wn);return Math.max(k,c.height+I)},z=y?[]:x.rows.map(P=>({pts:P.pts,y:U(P.blockDepth),depth:P.blockDepth,blockId:P.blockId,...d.has(P.id)?{patch:Ao(P.pts,ye)}:{}})),_=z.length?z[0].y:O,v=z.map(P=>{let T=P.patch&&P.patch.length>=3?P.patch:P.pts,I=0,E=0;for(let N of T)I+=N.x,E+=N.y;let A=T.length||1;I/=A,E/=A;let F=0;for(let N of T){let Y=Math.hypot(N.x-I,N.y-E);Y>F&&(F=Y)}return{cx:I,cy:E,rad:F}}),S=y?()=>O:z.length>=2?(P,T)=>{let I=1/0,E=_;for(let A=0;A<z.length;A++){let F=v[A];if(Math.hypot(P-F.cx,T-F.cy)-F.rad>=I)continue;let N=z[A].patch,Y=N&&N.length>=3?pt(N,P,T)?0:nt(N,P,T):nt(z[A].pts,P,T);Y<I&&(I=Y,E=z[A].y)}return E}:(P,T)=>R?L(R.depthAt(P,T)):O,C=[0,1,0],G=z.length>=2||y?()=>C:(P,T)=>{if(!R)return C;let I=R.depthAt(P,T);if(I<=M)return C;let E=(I-M)*Ce;if(E*h>=wn||c.height+E*h<=k)return C;let[A,F]=R.gradientAt(P,T);if(A===0&&F===0)return C;let N=1/Math.hypot(h,1);return[-A*h*N,N,-F*h*N]};if(!y)for(let P of x.rows){let T=U(P.blockDepth);for(let I of P.seatIndices)a[I]=T}for(let P of x.rows){let T=[];for(let N=1;N<P.pts.length;N++){let Y=Math.hypot(P.pts[N].x-P.pts[N-1].x,P.pts[N].y-P.pts[N-1].y);Y>1e-6&&T.push(Y)}T.sort((N,Y)=>N-Y);let I=T.length?T[Math.floor(T.length/2)]:1/0,E=1/0,A=P.pts[Math.floor(P.pts.length/2)];if(A)for(let N of x.rows){if(N===P||N.blockId!==P.blockId)continue;let Y=nt(N.pts,A.x,A.y);Y>1e-6&&Y<E&&(E=Y)}let F=Math.min(I,Math.max(E,I*.5));if(Number.isFinite(F)&&F>0)for(let N of P.seatIndices)s[N]=F}r.set(m,{sectionId:m,deckAt:S,normalAt:G,flat:y,bottomY:f,rowLevels:z,landingY:_})}for(let m=0;m<e.length;m++){let p=o[m],c=e[m];if(p){let h=a[m];i[m]=(h??r.get(p).deckAt(c.x,c.y))+wa;continue}let f=c.eyeHeightM;i[m]=Number.isFinite(f)?Math.max(0,f-Tt):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var ae={top:1,wallBottom:.5,bottomCap:.4};function Fe(t,e){if(!t)return e;let n=be(ut(t,.4),.62);return fe(e,n,.72)}function zo(t,e){let n=new Map;for(let i of t.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of e){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,u=0,l=0,d=0;for(let[m,p]of a){let c=ne(n.get(m));c&&(s+=c[0]*p,u+=c[1]*p,l+=c[2]*p,d+=p)}d>0&&o.set(i,[s/d,u/d,l/d])}return o}function Go(t,e){return ne(t.color)??e.get(t.logicalSectionId??t.id)??null}var Ho=Ze(require("polygon-clipping"),1);function Pa(t,e){return t===void 0||e===void 0?!0:Math.abs(t-e)<.001}var Vt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(e,n){let r=e.map(u=>[u.x,u.y]);if(r.length<3)return[];r.push(r[0]);let o=rt(e),i=this.rings.filter((u,l)=>Nt(o,this.boxes[l])&&Pa(n,this.levels[l])),a=[[r]];if(i.length)try{a=Ho.default.difference([r],...i).map(l=>l.map(d=>d.map(([m,p])=>[m,p])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let u of a){if(!u.length)continue;let l=u[0].map(([d,m])=>({x:d,y:m}));if(l.length>1){let d=l[0],m=l[l.length-1];Math.abs(d.x-m.x)<1e-9&&Math.abs(d.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Ca(t,e){if(!e)return t;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let m of t)n=Math.min(n,m.x),r=Math.max(r,m.x),o=Math.min(o,m.y),i=Math.max(i,m.y);let a=(n+r)/2,s=(o+i)/2,u=e*Math.PI/180,l=Math.cos(u),d=Math.sin(u);return t.map(m=>{let p=m.x-a,c=m.y-s;return{x:a+p*l-c*d,y:s+p*d+c*l}})}function gt(t){let e=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(e=t.points),t.kind==="rect"&&t.width&&t.height&&(e=yt(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let n=(t.x??0)+t.width/2,r=(t.y??0)+t.height/2;e=Lt(n,r,t.width/2,t.height/2)}return e?Ca(e,t.rotation):null}function xt(t){let e=t.role??"",r={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}}[e]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var Aa=.08;function Uo(t,e){let n=gt(t),r=xt(t),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,u=-1/0;for(let d of n)i=Math.min(i,d.x),a=Math.min(a,d.y),s=Math.max(s,d.x),u=Math.max(u,d.y);let l=o;for(let d of e)s>d.minX&&i<d.maxX&&u>d.minY&&a<d.maxY&&l<=d.topOffsetM+1e-6&&(l=d.topOffsetM+Aa);return e.push({minX:i,minY:a,maxX:s,maxY:u,topOffsetM:l}),l}function ze(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}}function jo(t){if(t.length!==4)return t;let e=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),n=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return e>=n?t:[t[1],t[2],t[3],t[0]]}function vt(t,e,n){return[ze(t[0],t[1],e),ze(t[0],t[1],n),ze(t[3],t[2],n),ze(t[3],t[2],e)]}function Yo(t,e,n){return[ze(t[0],t[3],e),ze(t[1],t[2],e),ze(t[1],t[2],n),ze(t[0],t[3],n)]}function De(t,e,n,r,o,i){se(t,e,void 0,()=>n,r,o,i,ae)}var Pn=2.4,Ra=.75,Ia=.15;function St(t){if(t.points&&t.points.length>=3)return t.points;let{center:e,width:n,height:r,rotation:o}=t;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),u=n/2,l=r/2;return[[-u,-l],[u,-l],[u,l],[-u,l]].map(([d,m])=>({x:e.x+d*a-m*s,y:e.y+d*s+m*a}))}function Xo(t,e,n,r,o){let i=St(e);i&&se(t,i,void 0,()=>n+Pn,n,Fe(r,o.boothTop),o.boothWall,ae)}function Cn(t){if(t.shape==="round"){let d=t.radius;return d?Lt(t.center.x,t.center.y,d,d,24):null}let{width:e,height:n,rotation:r,center:o}=t;if(!e||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),u=e/2,l=n/2;return[[-u,-l],[u,-l],[u,l],[-u,l]].map(([d,m])=>({x:o.x+d*a-m*s,y:o.y+d*s+m*a}))}function Wo(t,e,n,r,o){let i=Cn(e);i&&se(t,i,void 0,()=>n+Ra,n,Fe(r,o.tableTop),o.tableWall,ae)}function Ko(t,e,n,r,o,i,a){let s=gt(e);if(!s)return;let u=e.role==="stage",l=xt(e),d=n+r;if(u&&a){let h=1/0,b=-1/0,g=1/0,y=-1/0;for(let x of s)x.x<h&&(h=x.x),x.x>b&&(b=x.x),x.y<g&&(g=x.y),x.y>y&&(y=x.y);a.push({cx:(h+b)/2*D,cz:(g+y)/2*D,y:d,halfX:Math.max((b-h)/2*D,.5),halfZ:Math.max((y-g)/2*D,.5)})}let m=ne(e.fill),p=u&&m?fe(o.stageTop,be(ut(m,.18),.9),.9):Fe(m,u?o.stageTop:o.decorTop),c=e.role==="screen"?m:null,f=u?m?fe(o.stageWall,be(m,.58),.82):o.stageWall:e.role==="screen"?c?fe(be(c,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Fe(ne(e.fill),o.decorWall);if(l.kind==="portal"&&s.length===4){let h=jo(s);De(t,vt(h,0,.16),d,n,p,f),De(t,vt(h,.84,1),d,n,p,f),De(t,h,d,Math.max(n,d-.35),p,f);return}if(l.kind==="suite"&&s.length===4){let h=s.map((y,x)=>{let w=s[(x+1)%4],R=(y.x+w.x)/2,M=(y.y+w.y)/2;return Math.hypot(R-i.x,M-i.y)}),b=h.indexOf(Math.min(...h)),g=[0,1,2,3].map(y=>s[(b+y)%4]);De(t,vt(g,0,.08),d,n,p,f),De(t,vt(g,.92,1),d,n,p,f),De(t,Yo(g,.88,1),d,n,p,f),De(t,g,d,Math.max(n,d-.18),p,f);return}De(t,s,d,n,p,f)}function An(t){let{x:e,y:n,width:r,height:o}=t;if(!r||!o)return null;let i=e+r/2,a=n+o/2,s=(t.rotation??0)*Math.PI/180,u=Math.cos(s),l=Math.sin(s),d=r/2,m=o/2;return[[-d,-m],[d,-m],[d,m],[-d,m]].map(([p,c])=>({x:i+p*u-c*l,y:a+p*l+c*u}))}function Ta(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let e=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{e=atob(e)}catch{return null}else try{e=decodeURIComponent(e)}catch{}let n=e.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return ne(r);let i=e.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let u=ne(s[1].trim());u&&a.push(u)}return a.length?a.reduce((s,u,l)=>fe(s,u,1/(l+1)),a[0]):null}function qo(t,e,n,r){if(e.layer==="foreground")return;let o=An(e);if(!o)return;let i=n+Ia,a=Fe(Ta(e.href),r.decorTop),s=Math.max(0,Math.min(1,e.opacity??1));s<1&&(a=fe(r.ground,a,s)),se(t,o,void 0,()=>i,n,a,fe(a,r.decorWall,.5),ae)}function $o(t,e,n,r,o){if(!e.points||e.points.length<3)return;let i=Fe(r,o.gaTop);se(t,e.points,e.holes,()=>n+.15,n,i,o.gaWall,ae)}var Ea=Math.PI/180,te=96,ka=6,Fa=60,Da=150,Zo=.2,La=.35;function Rn(t,e){let n=Math.atan2(e.x-t.x,e.y-t.y)/Ea;return n<0?n+360:n}function zt(t){if(!t.length)return NaN;let e=[...t].sort((n,r)=>n-r);return e[Math.floor(e.length/2)]}function Gt(t,e,n=2){let r=t.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let u=-n;u<=n;u++){let l=i+u;if(e)l=(l%r+r)%r;else if(l<0||l>=r)continue;a+=t[l],s++}o[i]=a/s}return o}function Qo(t,e){let n=t.filter(p=>p.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let p of n)for(let c of p.rows){for(let f of c.pts)o+=f.x,i+=f.y,a++;if(c.pts.length>=4){let f=gn(c.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&r.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:o/a,y:i/a},u=s;if(r.length>=8){let p=zt(r.map(g=>g.x)),c=zt(r.map(g=>g.y)),f=0;for(let g of n)for(let y of g.rows)for(let x of y.pts){let w=Math.hypot(x.x-s.x,x.y-s.y);w>f&&(f=w)}let h=0,b=f*.2;for(let g of n)for(let y of g.rows)for(let x of y.pts)Math.hypot(x.x-p,x.y-c)<b&&h++;Math.hypot(p-s.x,c-s.y)<=f&&h/a<.01&&(u={x:p,y:c})}let l=[];for(let p of n){let c={sectionId:p.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of p.rows)for(let h of f.pts){let b=Math.hypot(h.x-u.x,h.y-u.y),g=Math.min(te-1,Math.floor(Rn(u,h)/(360/te)));c.samples.push({r:b,bin:g,levelM:f.levelM}),b<c.rMin&&(c.rMin=b),b>c.rMax&&(c.rMax=b)}c.samples.length&&l.push(c)}if(!l.length)return null;l.sort((p,c)=>p.rMin+p.rMax-(c.rMin+c.rMax));let d=[];for(let p of l){let c=!1;for(let f of d){let h=Math.min(p.rMax,f.rMax)-Math.max(p.rMin,f.rMin),b=Math.min(p.rMax-p.rMin,f.rMax-f.rMin);if(b>1e-9&&h>=La*b){f.members.push(p),f.rMin=Math.min(f.rMin,p.rMin),f.rMax=Math.max(f.rMax,p.rMax),c=!0;break}}c||d.push({members:[p],rMin:p.rMin,rMax:p.rMax})}let m=[];for(let p of d){let c=new Array(te).fill(null);for(let v of p.members)for(let S of v.samples){let C=c[S.bin];C||(C={samples:[]},c[S.bin]=C),C.samples.push({r:S.r,levelM:S.levelM})}let f=c.map(v=>!!v);if(!f.filter(Boolean).length)continue;let b=[],g=[];for(let v of c){if(!v)continue;let S=1/0,C=-1/0;for(let G of v.samples)G.r<S&&(S=G.r),G.r>C&&(C=G.r);b.push(S),g.push(C)}let y=zt(b),x=zt(g);if(!(y>=Zo*x)||!(x>0))continue;let w=[...b].sort((v,S)=>v-S);if(!(w[Math.floor(w.length*.1)]>=Zo*x))continue;let M=c.map(v=>{if(!v)return null;let S=[...v.samples].sort((F,N)=>F.r-N.r),C=S[0].r,G=S[S.length-1].r,P=S[0].levelM,T=-1/0;for(let F of S)F.levelM>T&&(T=F.levelM);let I=[];for(let F of S){let N={r:F.r,l:F.levelM};for(;I.length&&Math.abs(I[I.length-1].r-N.r)<1e-9;){if(I[I.length-1].l<=N.l){N.skip=!0;break}I.pop()}if(!N.skip){for(;I.length>=2;){let Y=I[I.length-2],V=I[I.length-1];if((V.r-Y.r)*(N.l-Y.l)-(V.l-Y.l)*(N.r-Y.r)<=0)I.pop();else break}I.push(N)}}let E=I.map(F=>F.r),A=I.map(F=>F.l);return{inner:C,outer:G,front:P,top:T,profile:{rs:E,ls:A}}}),k=f.slice();for(let v=0;v<te;v++){if(k[v])continue;let S=-1,C=-1,G=0;for(let B=1;B<=te;B++){let j=(v-B+te*2)%te;if(k[j]){S=j;break}}for(let B=1;B<=te;B++){let j=(v+B)%te;if(k[j]){C=j,G=B;break}}if(S<0||C<0)continue;let P=0;for(let B=1;B<=te;B++){let j=(v-B+te*2)%te;if(f[j]){P=B;break}}if(P-1+G>ka)continue;let I=M[S],E=M[C],A=P/(P+G),F=I.inner+(E.inner-I.inner)*A,N=I.outer+(E.outer-I.outer)*A,Y=I.front+(E.front-I.front)*A,V=I.top+(E.top-I.top)*A;M[v]={inner:F,outer:N,front:Y,top:V,profile:{rs:[F,N],ls:[Y,V]}}}for(let v=0;v<te;v++)M[v]&&(k[v]=!0);let O=360/te,L=[],U=k.filter(Boolean).length,z=[];if(U===te)z.push({start:0,len:te});else{let v=0;for(;k[v];)v=(v+1)%te;let S=-1;for(let C=0;C<=te;C++){let G=(v+C)%te,P=C<te&&k[G];if(P&&S<0)S=G;else if(!P&&S>=0){let T=(G-S+te)%te||te;z.push({start:S,len:T}),S=-1}}}for(let v of z){if(v.len*O<Fa&&v.len<te)continue;let S=v.len===te,C=new Float64Array(v.len),G=new Float64Array(v.len),P=new Float64Array(v.len),T=new Float64Array(v.len),I=[];for(let B=0;B<v.len;B++){let j=M[(v.start+B)%te];C[B]=j.inner,G[B]=j.outer,P[B]=j.front,T[B]=j.top,I.push(j.profile??{rs:[j.inner,j.outer],ls:[j.front,j.top]})}let E=Gt(C,S),A=Gt(G,S),F=Gt(P,S),N=Gt(T,S);for(let B=0;B<v.len;B++)E[B]>C[B]&&(E[B]=C[B]),A[B]<G[B]&&(A[B]=G[B]),E[B]>A[B]-1e-6&&(E[B]=Math.max(0,A[B]-1e-6)),N[B]<F[B]&&(N[B]=F[B]);let Y={startBin:v.start,binCount:v.len,closed:S,innerR:E,outerR:A,frontLevelM:F,topLevelM:N,profiles:I},V=(B,j,K)=>{let J=I[B],Z=J.rs,ee=J.ls;if(j<=Z[0]){ee[0]>K&&(ee[0]=K);return}if(j>=Z[Z.length-1]){ee[ee.length-1]>K&&(ee[ee.length-1]=K);return}for(let Q=0;Q+1<Z.length;Q++)if(j<=Z[Q+1]){ee[Q]>K&&(ee[Q]=K),ee[Q+1]>K&&(ee[Q+1]=K);return}};for(let B=0;B<v.len;B++){let j=c[(v.start+B)%te];if(j)for(let K of j.samples){V(B,K.r,K.levelM);let J=S?(B-1+v.len)%v.len:B-1,Z=S?(B+1)%v.len:B+1;J>=0&&V(J,K.r,K.levelM),Z<v.len&&V(Z,K.r,K.levelM)}}L.push(Y)}L.reduce((v,S)=>v+S.binCount*O,0)<Da||m.push({arcs:L,sectionIds:p.members.map(v=>v.sectionId),innerRMedian:y,outerRMedian:x})}if(!m.length)return null;if(m.sort((p,c)=>p.innerRMedian-c.innerRMedian),e){let p=m[m.length-1].outerRMedian;if(Math.hypot(e.x-u.x,e.y-u.y)>.9*p)return null}return{centre:u,binCount:te,binStepDeg:360/te,rings:m}}function Jo(t,e,n,r){let o=t.binStepDeg,i=n/o-.5-e.startBin;i=(i%t.binCount+t.binCount)%t.binCount,i>e.binCount-1&&(e.closed?i=i-e.binCount<e.binCount-i?0:e.binCount-1:i=i-(e.binCount-1)<t.binCount-i?e.binCount-1:0);let a=Math.floor(i),s=e.closed?(a+1)%e.binCount:Math.min(e.binCount-1,a+1),u=i-a,l=d=>{let m=e.profiles[d],p=m.rs,c=m.ls;if(r<=p[0])return c[0];if(r>=p[p.length-1])return c[c.length-1];for(let f=0;f+1<p.length;f++)if(r<=p[f+1]){let h=p[f+1]-p[f],b=h>1e-9?(r-p[f])/h:0;return c[f]+(c[f+1]-c[f])*b}return c[c.length-1]};return l(a)*(1-u)+l(s)*u}var er=.25,Oa=1.2,_a=.6,Ba=.45,Na=2.3,Va=Math.PI/180;function qe(t,e,n){let r=n*Va;return{x:t.x+e*Math.sin(r),y:t.y+e*Math.cos(r)}}function za(t,e){let n=e.rings[e.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let a=0;for(let s of i)Math.hypot(s.x-e.centre.x,s.y-e.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var Ga=24;function Ha(t,e,n,r,o,i,a,s,u){let l=n.binCount,d=Ga,m=Ce,p=i+.02,c=[];for(let v=0;v<l;v++){let S=(n.startBin+v+.5)*e.binStepDeg,C=new Float64Array(d+1);for(let G=0;G<=d;G++){let P=r[v]+(o[v]-r[v])*G/d;C[G]=Math.max(p,Jo(e,n,S,P)-er)}c.push(C)}for(let v of u){let S=Rn(e.centre,v),C=Math.hypot(v.x-e.centre.x,v.y-e.centre.y),G=S/e.binStepDeg-.5-n.startBin;if(G=(G%e.binCount+e.binCount)%e.binCount,G>l-1&&!n.closed&&!(G<l-.5||G>e.binCount-.5))continue;let P=v.deckY-er,T=Math.min(l-1,Math.max(0,Math.floor(G))),I=[T,n.closed?(T+1)%l:Math.min(l-1,T+1)];for(let E of I){let A=o[E]-r[E];if(!(A>1e-9))continue;let F=(C-r[E])/A*d;if(F<-.75||F>d+.75)continue;let N=Math.min(d,Math.max(0,Math.floor(F))),Y=Math.min(d,N+1);c[E][N]>P&&(c[E][N]=Math.max(p,P)),c[E][Y]>P&&(c[E][Y]=Math.max(p,P))}}let f=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],h=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],b=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],g=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(v,S)=>{let C=(n.startBin+v+.5)*e.binStepDeg,G=r[v]+(o[v]-r[v])*S/d,P=qe(e.centre,G,C);return[P.x*m,c[v][S],P.y*m]};{let v=Math.tan(12*Math.PI/180);for(let S=0;S<6;S++){let C=!1;for(let P=0;P<l;P++)for(let T=d-1;T>=0;T--)c[P][T]>c[P][T+1]&&(c[P][T]=c[P][T+1],C=!0);let G=n.closed?l:l-1;for(let P=0;P<G;P++){let T=(P+1)%l;for(let I=0;I<=d;I++){let E=c[T][I]-c[P][I];if(Math.abs(E)>1)continue;let A=r[P]+(o[P]-r[P])*I/d,F=r[T]+(o[T]-r[T])*I/d,N=qe(e.centre,A,(n.startBin+P+.5)*e.binStepDeg),Y=qe(e.centre,F,(n.startBin+T+.5)*e.binStepDeg),V=v*Math.hypot(Y.x-N.x,Y.y-N.y)*m;E>V?(c[T][I]=c[P][I]+V,C=!0):-E>V&&(c[P][I]=c[T][I]+V,C=!0)}}if(!C)break}}let x=1,w=(v,S)=>{for(let C=0;C<=d;C+=4)if(Math.abs(c[v][C]-c[S][C])>x)return!0;return Math.abs(c[v][d]-c[S][d])>x},R=Math.tan(38*Math.PI/180),M=v=>(o[v]-r[v])/d*m,k=(v,S)=>c[v][S+1]-c[v][S]>R*Math.max(1e-6,M(v)),O=(v,S)=>{let C=n.closed?(v-1+l)%l:Math.max(0,v-1),G=n.closed?(v+1)%l:Math.min(l-1,v+1);Math.abs(c[C][S]-c[v][S])>x&&(C=v),Math.abs(c[G][S]-c[v][S])>x&&(G=v);let P=Math.max(0,S-1),T=Math.min(d,S+1);P<S&&k(v,P)&&(P=S),T>S&&k(v,S)&&(T=S);let I=y(C,S),E=y(G,S),A=y(v,P),F=y(v,T),N=E[0]-I[0],Y=E[1]-I[1],V=E[2]-I[2],B=F[0]-A[0],j=F[1]-A[1],K=F[2]-A[2],J=Y*K-V*j,Z=V*B-N*K,ee=N*j-Y*B,Q=Math.hypot(J,Z,ee);return Q>1e-12?(J/=Q,Z/=Q,ee/=Q,Z<0&&(J=-J,Z=-Z,ee=-ee),[J,Z,ee]):[0,1,0]},L=(v,S)=>{let C=[v[0],i,v[2]],G=[S[0],i,S[2]],P=S[0]-v[0],T=S[2]-v[2],I=Math.hypot(P,T);if(!(I>1e-12))return;let E=[T/I,0,-P/I];t.tri(v,S,G,E,b,b,g),t.tri(v,G,C,E,b,g,g)},U=.05*Ve,z=v=>o[v]-r[v]<U,_=n.closed?l:l-1;for(let v=0;v<_;v++){let S=(v+1)%l;if(z(v)||z(S))continue;if(w(v,S)){let E=(n.startBin+v+1)*e.binStepDeg,A=(j,K)=>{let J=(r[v]+r[S])/2,Z=(o[v]+o[S])/2,ee=J+(Z-J)*K/d,Q=qe(e.centre,ee,E);return[Q.x*m,c[j][K],Q.y*m]};for(let j=0;j<d;j++){let K=y(v,j),J=y(v,j+1),Z=A(v,j),ee=A(v,j+1),Q=O(v,j),he=O(v,j+1);t.triN(K,Z,ee,Q,Q,he,f),t.triN(K,ee,J,Q,he,he,f);let je=y(S,j),Le=y(S,j+1),ge=A(S,j),Ie=A(S,j+1),Oe=O(S,j),me=O(S,j+1);t.triN(ge,je,Le,Oe,Oe,me,f),t.triN(ge,Le,Ie,Oe,me,me,f);let we=A(v,j),ce=A(v,j+1),Te=A(S,j+1),ct=A(S,j),$e=ce[0]-we[0],ie=ce[2]-we[2],Pe=Math.hypot($e,ie);if(Pe>1e-12){let wt=[ie/Pe,0,-$e/Pe];t.tri(we,ce,Te,wt,b),t.tri(we,Te,ct,wt,b)}}let F=y(v,0),N=y(S,0),Y=y(S,d),V=y(v,d),B=j=>[j[0],i,j[2]];t.tri(B(F),B(Y),B(N),[0,-1,0],h),t.tri(B(F),B(V),B(Y),[0,-1,0],h),L(F,N),L(V,Y);continue}for(let E=0;E<d;E++){let A=O(v,E),F=O(S,E),N=O(S,E+1),Y=O(v,E+1);if(k(v,E)||k(S,E)){let J=(ce,Te)=>{let ct=(n.startBin+ce+.5)*e.binStepDeg,$e=r[ce]+(o[ce]-r[ce])*(E+.5)/d,ie=qe(e.centre,$e,ct);return[ie.x*m,Te,ie.y*m]},Z=y(v,E),ee=y(S,E),Q=J(v,c[v][E]),he=J(S,c[S][E]);t.triN(Z,ee,he,A,F,F,f),t.triN(Z,he,Q,A,F,A,f);let je=y(S,E+1),Le=y(v,E+1),ge=J(v,c[v][E+1]),Ie=J(S,c[S][E+1]);t.triN(ge,Ie,je,Y,N,N,f),t.triN(ge,je,Le,Y,N,Y,f);let Oe=he[0]-Q[0],me=he[2]-Q[2],we=Math.hypot(Oe,me);if(we>1e-12){let ce=[-me/we,0,Oe/we];t.tri(Q,he,Ie,ce,b),t.tri(Q,Ie,ge,ce,b)}continue}let V=y(v,E),B=y(S,E),j=y(S,E+1),K=y(v,E+1);t.triN(V,B,j,A,F,N,f),t.triN(V,j,K,A,N,Y,f)}let C=y(v,0),G=y(S,0),P=y(S,d),T=y(v,d),I=E=>[E[0],i,E[2]];t.tri(I(C),I(P),I(G),[0,-1,0],h),t.tri(I(C),I(T),I(P),[0,-1,0],h),L(C,G),L(T,P)}if(!n.closed)for(let v of[0,l-1])for(let S=0;S<d;S++)L(y(v,S),y(v,S+1))}function tr(t,e,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(e.binCount).fill(-1/0);for(let d of e.rings)for(let m of d.arcs){let p=new Float64Array(m.binCount),c=new Float64Array(m.binCount);for(let h=0;h<m.binCount;h++){let b=(m.startBin+h)%e.binCount,g=Math.max(0,m.innerR[h]-ye);p[h]=Math.max(g,a[b]+.001),c[h]=Math.max(p[h]+.001,m.outerR[h]+ye)}let f=0;for(let h=0;h<m.binCount;h++){let b=m.topLevelM[h]-r;b>f&&(f=b)}f>=Oa&&Ha(t,e,m,p,c,r,o,i,n.seatGuards);for(let h=0;h<m.binCount;h++){let b=(m.startBin+h)%e.binCount;c[h]>a[b]&&(a[b]=c[h])}}if(za(n.shapes,e))return;let s=e.rings[e.rings.length-1],u=_a*Ve,l=Ba*Ve;for(let d of s.arcs){let m=[],p=[];for(let h=0;h<d.binCount;h++){let b=(d.startBin+h+.5)*e.binStepDeg,g=d.outerR[h]+ye+u;m.push(qe(e.centre,g,b)),p.push(qe(e.centre,g+l,b))}let c=-1/0;for(let h=0;h<d.binCount;h++)d.topLevelM[h]>c&&(c=d.topLevelM[h]);let f=()=>c+Na;d.closed?se(t,p,[m.slice().reverse()],f,r,o.shellTop,o.shellWall,i):se(t,[...p,...m.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function nr(t,e,n,r,o,i,a,s){if(!e.outline||e.outline.length<3)return;let u=n.baseHeightM,l=Fe(r,s.tierTop);if(!o)return;let d=b=>o.deckAt(b.x,b.y),m=_o(e,a),p=m[0]??e.outline;if(o.rowLevels.length>=2){let b=Bt(o.rowLevels),g=Bo(Eo(o.rowLevels,n.focal,b),m),y=()=>[0,1,0];for(let w of g){let R=Math.max(u,w.topY-.02);for(let M of i.subtract(w.outline,R))se(t,M,w.holes,()=>R,u,l,s.tierWall,ae,void 0,y)}g.length||se(t,p,e.holes,()=>o.landingY,u,l,s.tierWall,ae);let x={tread:[l[0]*ae.top,l[1]*ae.top,l[2]*ae.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let w of m.length?m:[p])Fo(t,o.rowLevels,n.focal,o.landingY,x,w,b);return}let c=o.flat?1/0:No,f=b=>o.normalAt(b.x,b.y),h=o.flat?o.landingY:void 0;for(let b of i.subtract(p,h))se(t,b,e.holes,d,u,l,s.tierWall,ae,c,f)}function Ua(t,e,n){let r=new Set;for(let a of t.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<e.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let u=n.bySection.get(s);if(u&&u.rowLevels.length>=2)continue;let l=e[a],d=o.get(s);d||(d=new Map,o.set(s,d));let m=l.rowId||`__seat-${a}`,p=d.get(m);p||(p={pts:[],levelM:0,n:0},d.set(m,p)),p.pts.push({x:l.x,y:l.y}),p.levelM+=n.seatDeckY(a),p.n++}let i=[];for(let a of t.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(d=>!d.patch).map(d=>({pts:d.pts,levelM:d.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let u=o.get(a.id);u&&i.push({sectionId:a.id,rows:[...u.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function or(t,e,n,r,o){let i=Ua(e,n,r);if(!i.length)return;let a=Qo(i,e.focal);if(!a)return;let s=new Set;for(let l of e.objects)l.type==="section"&&s.add(l.id);let u=[];for(let l=0;l<n.length;l++){let d=r.seatOwner[l];(!d||s.has(d))&&u.push({x:n[l].x,y:n[l].y,deckY:r.seatDeckY(l)})}t.setMaterial(0),tr(t,a,{bottomY:e.baseHeightM,colors:{bandTop:be(o.tierTop,.8),bandWall:o.tierWall,shellTop:be(o.tierWall,1.15),shellWall:o.tierWall},ao:ae,shapes:e.objects.filter(l=>l.type==="shape"),seatGuards:u})}function rr(t,e,n){return n<0?e>1?t.filter(r=>r.kind==="floor"):[...t]:t.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function ir(t,e){let n=[...t].sort((o,i)=>o.screen.y-i.screen.y),r=[];for(let o of n){let i=r.find(a=>a.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));i?i.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(e-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var ja=1.15,Ya=3.25,Xa=4.5,Wa=.85,Ka=.5,qa=.26;function ar(t,e,n){let r=Math.max(1e-6,e),o=t/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=ja&&a.add("zone"),o<=(i?Ya:Xa)&&(a.add("section"),a.add("ga")),o<=Wa&&(a.add("annotation"),a.add("booth")),o<=Ka&&a.add("row"),o<=qa&&a.add("seat"),a}function Ht(t,e,n,r){let o=t,i=e[0],a=e[1],s=e[2],u=o[0]*i+o[4]*a+o[8]*s+o[12],l=o[1]*i+o[5]*a+o[9]*s+o[13],d=o[2]*i+o[6]*a+o[10]*s+o[14],m=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let p=u/m,c=l/m,f=d/m,h=p>=-1.05&&p<=1.05&&c>=-1.05&&c<=1.05&&f<=1;return{x:(p*.5+.5)*n,y:(1-(c*.5+.5))*r,depth:f,visible:h}}function sr(t,e,n=e){let r=[],o=[...t].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r){let u=Math.abs(i.screen.x-s.screen.x),l=Math.abs(i.screen.y-s.screen.y);if(u<e&&l<n){a=!0;break}}a||r.push(i)}return r}var cr={row:8,seat:14};function lr(t,e,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(t.x-n/2,t.y-r/2)/o);return e*(1+1.5*i)}function ur(t,e,n,r){let o=[...t].sort((a,s)=>(s.priority??0)-(a.priority??0)||a.focus-s.focus),i=[];for(let a of o){if(i.length>=r)break;let s=!1;for(let u of i)if(Math.abs(a.screen.x-u.screen.x)<e&&Math.abs(a.screen.y-u.screen.y)<n){s=!0;break}s||i.push(a)}return i}var $a=6,Za=2.2,dr=.1,Qa=.3,Ja=1.8,es=.9,ts=.55,ns=6e3;function mr(t){let{doc:e,units:n,seats:r,surfaces:o,focal:i}=t,a=e.zones??[],s=[];if(a.length){let u=new Map;for(let d of n)for(let m of d.objects)m.type==="section"&&m.zone&&u.set(m.id,m.zone);let l=new Map;for(let d=0;d<r.length;d++){let m=r[d],p=o.seatOwner[d],c=m.zoneId??(p?u.get(p):void 0);if(!c)continue;let f=l.get(c);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(c,f)),f.n++,m.x<f.minX&&(f.minX=m.x),m.y<f.minY&&(f.minY=m.y),m.x>f.maxX&&(f.maxX=m.x),m.y>f.maxY&&(f.maxY=m.y),f.sumY+=o.seatDeckY(d)}for(let d of a){let m=l.get(d.id),p=[];for(let[c,f]of u)f===d.id&&p.push(c);if(!m||m.n===0){s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:p,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(d.focalPoint??i).x*D,1.5,(d.focalPoint??i).y*D]});continue}s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:p,seatCount:m.n,center:[(m.minX+m.maxX)/2*D,m.sumY/m.n,(m.minY+m.maxY)/2*D],radius:.5*Math.hypot((m.maxX-m.minX)*D,(m.maxY-m.minY)*D)||1,focalWorld:[(d.focalPoint??i).x*D,1.5,(d.focalPoint??i).y*D]})}}return s}function fr(t){let{doc:e,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:u}=t,l=[],d=[],m=[];for(let p of s)p.seatCount!==0&&l.push({id:`zone:${p.id}`,kind:"zone",text:p.label,anchor:[p.center[0],p.center[1]+$a,p.center[2]],color:e.zones?.find(c=>c.id===p.id)?.color});{let p=new Map,c=new Map;for(let f=0;f<r.length;f++){let h=o.seatOwner[f];if(!h)continue;let b=p.get(h);b||(b={n:0,x:0,y:0,deck:0},p.set(h,b)),b.n++,b.x+=r[f].x,b.y+=r[f].y,b.deck+=o.seatDeckY(f);let g=c.get(h);g||(g={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},c.set(h,g)),r[f].x<g.minX&&(g.minX=r[f].x),r[f].x>g.maxX&&(g.maxX=r[f].x),r[f].y<g.minY&&(g.minY=r[f].y),r[f].y>g.maxY&&(g.maxY=r[f].y)}for(let f of n)for(let h of f.objects){if(h.type!=="section")continue;let b=p.get(h.id);if(!b||b.n===0)continue;let g=c.get(h.id),y=[b.x/b.n*D,b.deck/b.n,b.y/b.n*D],x=h.displayLabel||h.label||h.id;d.push({id:h.id,floorIndex:f.index,label:x,seatCount:b.n,center:y,radius:Math.max(1,Math.hypot(g.maxX-g.minX,g.maxY-g.minY)*.5*D),focalWorld:[f.focal.x*D,f.baseHeightM+1.5,f.focal.y*D]});let w=e.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&w===x.trim().toLocaleLowerCase()||l.push({id:`section:${h.id}`,kind:"section",text:x,anchor:[y[0],y[1]+Za,y[2]],floorIndex:f.index})}}{for(let f of n)for(let h of f.objects){if(h.type!=="gaArea")continue;let b=ft(h.points);if(!b)continue;let g=h.displayLabel||h.label||h.id;l.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${g} \xB7 ${h.capacity.toLocaleString()}`:g,anchor:[b.x*D,f.baseHeightM+Ja,b.y*D],floorIndex:f.index})}let p=new Map;for(let f=0;f<r.length;f++){let h=r[f],b=Math.hypot(h.x-u.x,h.y-u.y),g=p.get(h.rowId);(!g||b>g.far)&&p.set(h.rowId,{seat:h,index:f,far:b})}for(let[f,h]of p){let b=h.seat.label?h.seat.label.lastIndexOf("-"):-1,g=b>0?h.seat.label.slice(0,b):f;g&&l.push({id:`row:${f}`,kind:"row",text:g,anchor:[h.seat.x*D,o.seatDeckY(h.index)+es,h.seat.y*D],floorIndex:a[h.index]})}let c=new Map;for(let f=0;f<r.length;f++){let h=r[f],b=h.label?h.label.lastIndexOf("-"):-1,g=c.get(h.rowId);g||(g={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:b>0?h.label.slice(0,b):h.rowId,sectionId:h.sectionId},c.set(h.rowId,g));let y=f*3,x=i.iPosition[y],w=i.iPosition[y+1],R=i.iPosition[y+2];g.n++,g.x+=x,g.y+=w,g.z+=R,g.minX=Math.min(g.minX,x),g.maxX=Math.max(g.maxX,x),g.minZ=Math.min(g.minZ,R),g.maxZ=Math.max(g.maxZ,R)}for(let[f,h]of c)m.push({id:f,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=ns)for(let f=0;f<r.length;f++){let h=r[f],b=h.displayLabel||h.label;b&&l.push({id:`seat:${h.id}`,kind:"seat",text:b,anchor:[h.x*D,o.seatDeckY(f)+ts,h.y*D],floorIndex:a[f]})}}for(let p of n)for(let c of p.objects)if(c.type==="shape"&&c.role&&["entrance","exit","screen","suite","obstruction"].includes(c.role)){let f=gt(c),h=f?ft(f):null;if(!h||!c.label)continue;l.push({id:`architecture:${c.id}`,kind:"annotation",text:c.label,anchor:[h.x*D,p.baseHeightM+xt(c).heightM+dr,h.y*D],color:c.fill,floorIndex:p.index})}else if(c.type==="text"){if(!c.text)continue;l.push({id:`text:${c.id}`,kind:"annotation",text:c.text,anchor:[c.position.x*D,p.baseHeightM+dr,c.position.y*D],color:c.color,rotation:c.rotation,floorIndex:p.index})}else if(c.type==="booth"){let f=St(c);if(!f)continue;let h=ft(f);if(!h)continue;l.push({id:`booth:${c.id}`,kind:"booth",text:c.displayLabel||c.label||c.id,anchor:[h.x*D,p.baseHeightM+Pn+Qa,h.y*D],floorIndex:p.index})}return{labels:l,sections:d,rows:m}}function pr(t,e){if(e.length>1)for(let n of e)t.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function hr(t){let{doc:e,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=t,u=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let p=0;p<i.floor.length;p+=1){let c=Math.max(0,Math.min(n.length-1,Math.round(i.floor[p]))),f=p*3,h=l[c];h.minX=Math.min(h.minX,i.position[f]),h.minY=Math.min(h.minY,i.position[f+1]),h.minZ=Math.min(h.minZ,i.position[f+2]),h.maxX=Math.max(h.maxX,i.position[f]),h.maxY=Math.max(h.maxY,i.position[f+1]),h.maxZ=Math.max(h.maxZ,i.position[f+2])}let d=new Map;for(let p=0;p<n.length;p++)for(let c of n[p].objects)c.type==="section"&&d.set(c.id,p);let m=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let p=0;p<r.length;p++){let c=o.seatOwner[p],f=(c!==null?d.get(c):void 0)??a[p];if(f===void 0)continue;let h=m[f],b=r[p];h.n++,b.x<h.minX&&(h.minX=b.x),b.y<h.minY&&(h.minY=b.y),b.x>h.maxX&&(h.maxX=b.x),b.y>h.maxY&&(h.maxY=b.y);let g=o.seatDeckY(p);h.sumX+=b.x*D,h.sumDeck+=g,h.sumZ+=b.y*D,h.minDeck=Math.min(h.minDeck,g),h.maxDeck=Math.max(h.maxDeck,g+1.6),s[p]=f}for(let p=0;p<n.length;p++){let c=m[p],f=e.floors?.[p],h=l[p],b=Math.min(c.n?c.minX*D:n[p].focal.x*D-1,Number.isFinite(h.minX)?h.minX:1/0),g=Math.max(c.n?c.maxX*D:n[p].focal.x*D+1,Number.isFinite(h.maxX)?h.maxX:-1/0),y=Math.min(c.n?c.minY*D:n[p].focal.y*D-1,Number.isFinite(h.minZ)?h.minZ:1/0),x=Math.max(c.n?c.maxY*D:n[p].focal.y*D+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),w=Math.min(c.n?Math.min(n[p].baseHeightM,c.minDeck):n[p].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),R=Math.max(c.n?Math.max(c.maxDeck,w+.5):w+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),M=[c.n?c.sumX/c.n:(b+g)/2,c.n?c.sumDeck/c.n:(w+R)/2,c.n?c.sumZ/c.n:(y+x)/2],k=Math.max(1,.5*Math.hypot(g-b,R-w,x-y));u.push({index:p,id:f?.id??`floor-${p}`,label:f?.name??(n.length>1?`Floor ${p+1}`:"Venue"),seatCount:c.n,center:M,radius:k,box:{min:[b,w,y],max:[g,R,x]},focalWorld:[n[p].focal.x*D,n[p].baseHeightM+1.5,n[p].focal.y*D]})}}return u}function In(t,e){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,u)=>{s<n&&(n=s),u<r&&(r=u),s>o&&(o=s),u>i&&(i=u)};for(let s of e)a(s.x,s.y);for(let s of t)for(let u of s.objects)if(u.type==="section")for(let l of u.outline)a(l.x,l.y);else if(u.type==="shape"&&u.points)for(let l of u.points)a(l.x,l.y);else if(u.type==="gaArea")for(let l of u.points)a(l.x,l.y);else if(u.type==="booth"){let l=St(u);if(l)for(let d of l)a(d.x,d.y)}else if(u.type==="table"){let l=Cn(u);if(l)for(let d of l)a(d.x,d.y)}else if(u.type==="decorImage"){let l=An(u);if(l)for(let d of l)a(d.x,d.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function br(t,e,n,r,o,i){if(e.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=yt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);se(t,s,void 0,()=>0,-.4,i.ground,i.ground,ae)}else{let a=e.reduce((c,f)=>f.baseHeightM<c.baseHeightM?f:c);t.setFloor(a.index);let s=n.filter((c,f)=>r[f]===a.index),u=In([a],s),l=Math.hypot(u.maxX-u.minX,u.maxY-u.minY),d=Math.max(28,Math.min(80,l*.04)),m=yt(u.minX-d,u.minY-d,u.maxX-u.minX+d*2,u.maxY-u.minY+d*2),p=a.baseHeightM-.03;se(t,m,void 0,()=>p,p-.22,i.ground,i.ground,ae)}}function yr(t,e,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,u=1/0,l=-1/0,d=-1/0,m=-1/0,p=(h,b,g)=>{a=Math.min(a,h),l=Math.max(l,h),s=Math.min(s,b),d=Math.max(d,b),u=Math.min(u,g),m=Math.max(m,g)};for(let h=0;h<t.position.length;h+=3)p(t.position[h],t.position[h+1],t.position[h+2]);for(let h=0;h<e.count;h++){let b=h*3,g=e.iPosition[b],y=e.iPosition[b+1],x=e.iPosition[b+2],w=Math.max(.35,e.iMaxRadius[h]??.35);p(g-w,y,x-w),p(g+w,y+1.6,x+w)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,d=i*.16,u=o-i,m=o+i);let c=[(a+l)/2,(s+d)/2,(u+m)/2],f=Math.max(1,.5*Math.hypot(l-a,d-s,m-u));return{center:c,radius:f,minY:s,maxY:d}}function gr(t,e,n,r,o,i){let a=1/0,s=1/0,u=-1/0,l=-1/0;for(let w=0;w<t.count;w++){let R=w*3,M=t.iPosition[R],k=t.iPosition[R+2];M<a&&(a=M),M>u&&(u=M),k<s&&(s=k),k>l&&(l=k)}for(let w of e)a=Math.min(a,w.cx-w.halfX),u=Math.max(u,w.cx+w.halfX),s=Math.min(s,w.cz-w.halfZ),l=Math.max(l,w.cz+w.halfZ);let d=n.minX*D,m=n.maxX*D,p=n.minY*D,c=n.maxY*D,f=d,h=m,b=p,g=c;if(Number.isFinite(a)){let w=Math.max(2,.06*Math.hypot(u-a,l-s));f=Math.max(d,a-w),h=Math.min(m,u+w),b=Math.max(p,s-w),g=Math.min(c,l+w)}let y=Math.min(0,r),x=Math.max(o,i*.05);return{min:[f,y,b],max:[h,x,g]}}function it(t){let{doc:e}=t,n=fo(e.theme),r=n.structure,o=Oo(e,t.eventConfigurationId??e.eventConfigurationId),i=t.seats,a=new Ft,s=new Map;for(let _ of o)for(let v of _.objects)s.set(v.id,_.index),v.type==="section"&&s.set(v.logicalSectionId??v.id,_.index);let u=i.map(_=>s.get(_.sectionId??"")??s.get(_.rowId??"")??0),l=In(o,i);br(a,o,i,u,l,r);let d=zo(e,i),m=new Map;for(let _ of e.categories??[])m.set(_.key,_.color);let p=[],c=Vo(o,i,u),f=new Float32Array(i.length);for(let _=0;_<o.length;_++){let v=o[_];a.setFloor(_);let S=new Vt,C=[],G=v.objects.filter(P=>P.type==="section"&&!!P.outline&&P.outline.length>=3);for(let P of v.objects)P.type==="section"?nr(a,P,v,Go(P,d),c.bySection.get(P.id),S,G,r):P.type==="shape"?(a.setMaterial(P.role==="screen"?1:0),Ko(a,P,v.baseHeightM,Uo(P,C),r,v.focal,p),a.setMaterial(0)):P.type==="gaArea"?$o(a,P,v.baseHeightM,ne(m.get(P.categoryKey)),r):P.type==="booth"?Xo(a,P,v.baseHeightM,ne(m.get(P.categoryKey)),r):P.type==="table"?Wo(a,P,v.baseHeightM,ne(m.get(P.categoryKey)),r):P.type==="decorImage"&&qo(a,P,v.baseHeightM,r);or(a,v,i,c,r)}let h=o.length>1?{x:o.reduce((_,v)=>_+v.focal.x,0)/o.length,y:o.reduce((_,v)=>_+v.focal.y,0)/o.length}:e.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},b=ao([a.build()]),g=mo(i,t.initialState,c,f,m),y=mr({doc:e,units:o,seats:i,surfaces:c,focal:h}),{labels:x,sections:w,rows:R}=fr({doc:e,units:o,seats:i,surfaces:c,seatData:g,hintedSeatFloor:u,zones:y,focal:h}),M=hr({doc:e,units:o,seats:i,surfaces:c,solids:b,hintedSeatFloor:u,seatFloor:f});pr(x,M),g.iYaw=lo(g.iPosition,i.length,_=>i[_].rowId,_=>{let v=o[f[_]]?.focal??h;return[v.x*D,v.y*D]});let k=(l.minX+l.maxX)/2*D,O=(l.minY+l.maxY)/2*D,L=.5*Math.hypot((l.maxX-l.minX)*D,(l.maxY-l.minY)*D)||10,U=yr(b,g,{cx:k,cz:O,radius:L}),z=gr(g,p,l,U.minY,U.maxY,L);return{solids:b,seats:g,bounds:{center:[(z.min[0]+z.max[0])/2,(z.min[1]+z.max[1])/2,(z.min[2]+z.max[2])/2],radius:L,groundY:0,box:z},renderBounds:{center:U.center,radius:U.radius},stateColorLUT:po(n,Me),theme:n,seatCount:i.length,focalWorld:[h.x*D,1.5,h.y*D],zones:y,stages:p,sections:w,rows:R,labels:x,floors:M}}var os=88,rs=20,is={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},xr=new Set(["row","seat"]),vr={row:{x:62,y:16},seat:{x:46,y:18}},as=ne,Tn=t=>Gn(t);function ss(t,e){let n=Tn(t),r=Tn(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function cs(t,e=[.04,.06,.1]){let n=Tn(e)<.42,r=n?"#f4f7fb":"#0b1220",o=as(t),i=o&&ss(o,e)>=4.5?t:r;return n?{ink:i,backing:"rgba(8,12,22,.78)",border:"rgba(210,222,245,.24)"}:{ink:i,backing:"rgba(255,255,255,.84)",border:"rgba(11,18,32,.22)"}}var Ut=class{constructor(e,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",n.fontFamily&&(r.fontFamily=n.fontFamily),e.appendChild(this.root)}setVisible(e){this.root.style.visibility=e?"":"hidden"}setLabels(e){this.labels=e;for(let[n,r]of this.nodes)e.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(e){this.forcedDense=e}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,n=>`seat:${n}`))}update(e,n,r,o,i,a){if(!this.labels.length)return;let s=ar(o,i,{hasZoneLabels:this.labels.some(c=>c.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let u=[];for(let c of this.labels){if(!s.has(c.kind))continue;let f=Ht(e,c.anchor,n,r);if(!f.visible)continue;let h=a?Math.hypot(c.anchor[0]-a[0],c.anchor[1]-a[1],c.anchor[2]-a[2]):1;u.push({label:c,screen:f,focus:lr(f,h,n,r),...this.selectedSeatLabelIds.has(c.id)?{priority:1}:{}})}let l=ir(u.filter(c=>c.label.kind==="floor"),n),d=[...u.filter(c=>!xr.has(c.label.kind)&&c.label.kind!=="floor"),...l],m=[...sr(d,os,rs),...["row","seat"].flatMap(c=>ur(u.filter(f=>f.label.kind===c),vr[c].x,vr[c].y,cr[c]))],p=new Set(m.map(c=>c.label.id));for(let{label:c,screen:f}of m){let b=this.nodeFor(c).style;b.display="",b.transform=`translate(-50%, -50%) translate(${f.x.toFixed(1)}px, ${f.y.toFixed(1)}px)`}for(let[c,f]of this.nodes)p.has(c)||(f.style.display="none")}nodeFor(e){let n=this.nodes.get(e.id);if(!n){n=document.createElement("div");let u=n.style;u.position="absolute",u.left="0",u.top="0",u.whiteSpace="nowrap",u.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",u.display="none",this.root.appendChild(n),this.nodes.set(e.id,n)}n.textContent=e.text,n.setAttribute("data-label-kind",e.kind);let r=this.selectedSeatLabelIds.has(e.id);n.toggleAttribute("data-selected-seat",r);let o=is[e.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=cs(e.color??this.opts.ink,this.opts.backgroundRgb),s=!xr.has(e.kind);return i.color=r?"#ecf8ff":a.ink,i.background=r?"rgba(10,28,45,.9)":s?a.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${a.border}`:"",i.borderRadius=r||s?"999px":"",i.padding=r||s?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em",(e.kind==="zone"||e.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var pe=require("ogl");var Ge=require("ogl");var jt=`
1
+ "use strict";var ci=Object.create;var St=Object.defineProperty;var li=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames;var mi=Object.getPrototypeOf,di=Object.prototype.hasOwnProperty;var fi=(t,e)=>{for(var n in e)St(t,n,{get:e[n],enumerable:!0})},Vn=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ui(e))!di.call(t,o)&&o!==n&&St(t,o,{get:()=>e[o],enumerable:!(r=li(e,o))||r.enumerable});return t};var $e=(t,e,n)=>(n=t!=null?ci(mi(t)):{},Vn(e||!t||!t.__esModule?St(n,"default",{value:t,enumerable:!0}):n,t)),pi=t=>Vn(St({},"__esModule",{value:!0}),t);var qs={};fi(qs,{buildSceneModel:()=>rt,mountVenue3D:()=>Ks,prepareVenue3D:()=>oi});module.exports=pi(qs);var Un=require("ogl");var hi=/^#?([\da-f]{3}|[\da-f]{6})$/i;function bi(t){let e=hi.exec((t??"").trim());if(!e)return null;let n=e[1].length===3?e[1].split("").map(o=>o+o).join(""):e[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function te(t){let e=bi(t);return e?[e[0]/255,e[1]/255,e[2]/255]:null}function tn(t){let e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function yi(t){return .2126*tn(t[0])+.7152*tn(t[1])+.0722*tn(t[2])}function zn(t){return yi([t[0]*255,t[1]*255,t[2]*255])}function gi(t){return .2126*t[0]+.7152*t[1]+.0722*t[2]}function de(t,e,n){return[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n,t[2]+(e[2]-t[2])*n]}function lt(t,e){let n=gi(t);return de(t,[n,n,n],e)}var ye=["available","held","sold","selected","dimmed"];function ut(t){let e=ye.indexOf(t);return e<0?0:e}var Gn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Hn(t){let e=.2126*t[0]+.7152*t[1]+.0722*t[2],n=.42,r=.62;return[(e+(t[0]-e)*n)*r,(e+(t[1]-e)*n)*r,(e+(t[2]-e)*n)*r]}var nn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Ue={top:[.05,.06,.08],bottom:[.1,.12,.15]};function he(t,e){return[Math.min(1,t[0]*e),Math.min(1,t[1]*e),Math.min(1,t[2]*e)]}function xi(){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 wt=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 Un.Renderer({canvas:this.canvas,dpr:xi(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ue.top[0],Ue.top[1],Ue.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))}};var Qe=require("ogl"),ue=Math.PI/180,on=15*ue,rn=80*ue,Ze=.12,jn=35,Yn=1.25,Pt=class{constructor(e,n,r,o){this.fovY=jn;this.target=new Qe.Vec3;this.azimuth=-30*ue;this.polar=55*ue;this.distance=10;this.azT=-30*ue;this.polT=55*ue;this.distT=10;this.minDist=1;this.maxDist=100;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new Qe.Vec3;this.panAnchor=new Qe.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new Qe.Camera(e,{fov:jn,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let u=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-u)*.005)),this.fireGesture()),this.pinchDist=u;let l=this.pinchCentroid();this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(on,Math.min(rn,this.polT-s*.006)),this.requestRender())},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*ue;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(on,Math.min(rn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);else return;i.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 o of e)n+=o.x,r+=o.y;return{x:n/e.length,y:r/e.length}}panBy(e,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*ue/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,u=-i,l=Math.cos(this.polar),m=Math.sin(this.polar),d=-i*l,p=-a*l;this.targetT.x+=(-e*s+n*d)*o,this.targetT.z+=(-e*u+n*p)*o,this.targetT.y+=n*m*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let e=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-e,Math.min(n+e,this.targetT.x)),this.targetT.z=Math.max(o-e,Math.min(o+e,this.targetT.z)),this.targetT.y=Math.max(r-e*.5,Math.min(r+e,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let e=[...this.activePointers.values()];return e.length<2?0:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)}dollyBy(e){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*e)),this.requestRender()}zoomBy(e){this.interactionEnabled&&(this.dollyBy(e),this.fireGesture())}setPrimaryDragMode(e){this.primaryDragMode=e}setInteractionEnabled(e){this.interactionEnabled=e,!e&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(e,n=!1,r,o=!1,i){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,e.radius)*1.5;let a=Math.max(1,e.radius),s=this.fovY*ue/2,u=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*u);this.azT=r??-30*ue,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*ue;let m=this.fitDistance(e,s,l,this.azT,this.polT);this.distT=m*Math.max(1.05,Math.min(2,i?.margin??Yn)),this.minDist=Math.max(2,a*.12),this.maxDist=m*4,n?(this.azimuth=this.azT,this.polar=12*ue,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(e){this.camera.perspective({aspect:e})}frameSoft(e,n,r=!1,o){this.target.set(e.center[0],e.center[1],e.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,e.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*ue/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*ue;let u=this.fitDistance(e,i,s,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,o?.margin??Yn))}fitDistance(e,n,r,o,i){let a=Math.max(1,e.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),u=e.box;if(!u)return s;let l=Math.sin(i),m=-l*Math.sin(o),d=-Math.cos(i),p=-l*Math.cos(o);if(Math.abs(d)>.999)return s;let c=-p,f=m,h=Math.hypot(c,f);c/=h,f/=h;let b=-f*d,g=f*m-c*p,y=c*d,x=Math.tan(r),P=Math.tan(n),R=1;for(let S=0;S<8;S++){let F=(S&1?u.max[0]:u.min[0])-e.center[0],B=(S&2?u.max[1]:u.min[1])-e.center[1],L=(S&4?u.max[2]:u.min[2])-e.center[2],H=F*m+B*d+L*p,O=Math.abs(F*c+L*f),N=Math.abs(F*b+B*g+L*y);R=Math.max(R,O/x-H,N/P-H)}return Math.min(s,Math.max(R,a*.35))}updateClipping(e){let n=this.camera.position.x-e.center[0],r=this.camera.position.y-e.center[1],o=this.camera.position.z-e.center[2],i=Math.hypot(n,r,o),a=Math.max(1,e.radius)*1.18,s=Math.max(.05,i-a),u=Math.max(s+10,i+a);this.camera.perspective({near:s,far:u,aspect:this.camera.aspect})}update(){let e=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),u=Math.abs(e)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=e*Ze,this.polar+=n*Ze,this.distance+=r*Ze,this.target.x+=o*Ze,this.target.y+=i*Ze,this.target.z+=a*Ze,u&&this.applyPosition(),u}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,o=Math.hypot(e,n,r)||1,i=Math.max(on,Math.min(rn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(e,r)}setTarget(e){this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target)}resumeAfterFlight(e){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),e&&this.target.set(e[0],e[1],e[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let e=Math.sin(this.polar),n=this.target.x+this.distance*e*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*e*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Ct=class{constructor(e){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=e=>{let n=this.lastTime?(e-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=e,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=e}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};var Je=2.5,vi=1.15,mt=6,et=10,Xn=6,Wn=9.5,Kn=.9,qn=2.2,an=30,sn=4,At=8192;var ic=et+sn;function $n(t,e){let n=e*1.4,r=e*3.2;if(t<=n)return{scale:1,fade:0,minPixels:Je};let o=Math.min(1,(t-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:Je+o*(vi-Je)}}function Zn(t,e,n){return!(t>0)||!(e>0)||!(n>0)?!1:e*n/t>=64}function Qn(t,e,n,r,o){if(!(t>0)||!(e>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=e/(n*i)*(o/2);return Math.PI*a*a/t>=64}var Mi=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],sc=new Map(Mi.map(t=>[t.key,t]));var Si={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","plus-size":"#ec4899","lift-armrest":"#22c55e"};function Jn(t){let e=t?.[0];return e&&Si[e]||"#3b82f6"}var wi=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],cc=new Map(wi.map(t=>[t.key,t]));var Pi=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],lc=new Set(Pi);var ve=.02291666666666667,Le=1/ve,Ci=58,Ai=Ci*ve;var Ri=3,eo=0,cn=120,Ii=0,Ti=45,Ei=7,Rt=1.2;function ln(t,e,n,r){return Number.isFinite(t)?Math.max(e,Math.min(n,t)):r}function ki(t){return!Number.isFinite(t)||!Number.isInteger(t)||t<0?0:t<=Ei?t:Ri}function to(t,e={}){let n=ln(e.floorBaseHeightM,eo,cn,0),r=Math.min(cn,n+ki(t.elevation)*Ai),o=t.height===void 0?r:ln(t.height,eo,cn,r),i=ln(t.rake,Ii,Ti,0);return{height:o,rake:i}}var oo=$e(require("earcut"),1),ro=$e(require("polygon-clipping"),1);var pc=Math.PI/180;function un(t){let e=0,n=0;for(let o of t)e+=o.x,n+=o.y;let r=t.length||1;return{x:e/r,y:n/r}}function dt(t){return t.length?un(t):null}function je(t){let e=0;for(let n=0,r=t.length;n<r;n+=1){let o=t[n],i=t[(n+1)%r];e+=o.x*i.y-i.x*o.y}return e/2}function ft(t,e,n){let r=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let a=t[o],s=t[i];a.y>n!=s.y>n&&e<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var D=ve,Fi=.002;function Di(t,e,n){let r=Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2]),o=Math.hypot(n[0]-e[0],n[1]-e[1],n[2]-e[2]),i=Math.hypot(t[0]-n[0],t[1]-n[1],t[2]-n[2]),a=Math.max(r,o,i);if(a<1e-9)return!0;let s=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-i)))/a<Fi}var Ye=class{constructor(e=16384){this.len=0;this.buf=new Float32Array(e)}push3(e,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=e,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(e){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=e}grow(e){let n=this.buf.length*2;for(;n<e;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Et=class{constructor(){this.pos=new Ye;this.nor=new Ye;this.col=new Ye;this.flr=new Ye;this.mat=new Ye;this.currentFloor=0;this.currentMaterial=0}setFloor(e){this.currentFloor=e}setMaterial(e){this.currentMaterial=e}tri(e,n,r,o,i,a=i,s=i){Di(e,n,r)||(this.pos.push3(e[0],e[1],e[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(e,n,r,o,i,a,s,u=s,l=s){[...e,...n,...r].every(Number.isFinite)&&(this.pos.push3(e[0],e[1],e[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(u[0],u[1],u[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function Li(t,e,n){let r=e[0]-t[0],o=e[1]-t[1],i=e[2]-t[2],a=n[0]-t[0],s=n[1]-t[1],u=n[2]-t[2],l=o*u-i*s,m=i*a-r*u,d=r*s-o*a,p=Math.hypot(l,m,d)||1;return l/=p,m/=p,d/=p,[l,m,d]}function Oi(t,e){let n=[...t],r=[];for(let a of t)r.push(a.x,a.y);let o=[];if(e){for(let a of e)if(!(a.length<3)){o.push(n.length);for(let s of a)n.push(s),r.push(s.x,s.y)}}let i=(0,oo.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function mn(t){return je(t)<0?[...t].reverse():t}var _i=3;function Bi(t,e,n,r){let o=r(t),i=r(e),a=r(n),s=(c,f,h,b)=>Math.abs(r({x:(c.x+f.x)/2,y:(c.y+f.y)/2})-(h+b)/2),u=(t.x+e.x+n.x)/3,l=(t.y+e.y+n.y)/3,m=(o+i+a)/3,d=Math.max(s(t,e,o,i),s(e,n,i,a),s(n,t,a,o),Math.abs(r({x:u,y:l})-m)),p=(c,f,h)=>{let b=Math.abs(r({x:(c+u)/2,y:(f+l)/2})-(h+m)/2);b>d&&(d=b)};return p((t.x+e.x)/2,(t.y+e.y)/2,(o+i)/2),p((e.x+n.x)/2,(e.y+n.y)/2,(i+a)/2),p((n.x+t.x)/2,(n.y+t.y)/2,(a+o)/2),d}function pt(t,e,n,r,o){if(o<=0)return Bi(t,e,n,r);let i={x:(t.x+e.x)/2,y:(t.y+e.y)/2},a={x:(e.x+n.x)/2,y:(e.y+n.y)/2},s={x:(n.x+t.x)/2,y:(n.y+t.y)/2};return Math.max(pt(t,i,s,r,o-1),pt(i,e,a,r,o-1),pt(s,a,n,r,o-1),pt(i,a,s,r,o-1))}function ht(t,e,n,r,o,i,a,s){if(a>0){let p={x:(e.x+n.x)/2,y:(e.y+n.y)/2},c={x:(n.x+r.x)/2,y:(n.y+r.y)/2},f={x:(r.x+e.x)/2,y:(r.y+e.y)/2};ht(t,e,p,f,o,i,a-1,s),ht(t,p,n,c,o,i,a-1,s),ht(t,f,c,r,o,i,a-1,s),ht(t,p,c,f,o,i,a-1,s);return}let u=[e.x*D,o(e),e.y*D],l=[n.x*D,o(n),n.y*D],m=[r.x*D,o(r),r.y*D];if(s){t.triN(u,l,m,s(e),s(n),s(r),i);return}let d=Li(u,l,m);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),t.tri(u,l,m,d,i)}var Ni=8;function no(t,e,n){if(!Number.isFinite(n))return t;let r=[],o=(i,a,s,u,l)=>{if(l>0){let m={x:(i.x+a.x)/2,y:(i.y+a.y)/2},d=e(m);if(Math.abs(d-(s+u)/2)>n){o(i,m,s,d,l-1),o(m,a,d,u,l-1);return}}r.push(i)};for(let i=0;i<t.length;i++){let a=t[i],s=t[(i+1)%t.length];o(a,s,e(a),e(s),Ni)}return r}function It(t,e){if(t.length<3)return t;let n=[];for(let o of t){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<e||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<e;)n.pop();if(n.length<3)return t;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],u=s.x-i.x,l=s.y-i.y,m=Math.hypot(u,l);m>e&&Math.abs((a.x-i.x)*l-(a.y-i.y)*u)/m<e||r.push(a)}return r.length>=3?r:n}var Tt=.001*Le*.1;function ae(t,e,n,r,o,i,a,s,u=1/0,l){if(!e||e.length<3||(u===void 0&&(u=1/0),Math.abs(je(e))<1e-4))return;let m=It(no(It(mn(e),Tt),r,u),Tt),d=n?.map(S=>It(no(It(mn(S),Tt),r,u),Tt)).filter(S=>S.length>=3&&Math.abs(je(S))>=1e-4),{pts:p,tris:c}=Oi(m,d),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],h=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],g=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],y=0;if(Number.isFinite(u))for(;y<_i;y++){let S=0;for(let F=0;F<c.length;F+=3){let B=pt(p[c[F]],p[c[F+1]],p[c[F+2]],r,y);B>S&&(S=B)}if(S<=u)break}for(let S=0;S<c.length;S+=3){let F=p[c[S]],B=p[c[S+1]],L=p[c[S+2]];ht(t,F,B,L,r,f,y,l);let H=[F.x*D,o,F.y*D],O=[B.x*D,o,B.y*D],N=[L.x*D,o,L.y*D];t.tri(H,N,O,[0,-1,0],h)}let x=S=>{if(y<=0)return S;let F=1<<y,B=[];for(let L=0;L<S.length;L++){let H=S[L],O=S[(L+1)%S.length];for(let N=0;N<F;N++){let v=N/F;B.push({x:H.x+(O.x-H.x)*v,y:H.y+(O.y-H.y)*v})}}return B},P=un(m),R=[{ring:x(m),flip:!1}];if(d)for(let S of d)S.length>=3&&R.push({ring:x(S),flip:!0});for(let{ring:S,flip:F}of R)for(let B=0;B<S.length;B++){let L=S[B],H=S[(B+1)%S.length],O=(H.x-L.x)*D,v=(H.y-L.y)*D,M=-O,C=Math.hypot(v,M)||1;v/=C,M/=C;let G=(L.x+H.x)/2-P.x,w=(L.y+H.y)/2-P.y,E=v*G+M*w;F&&(E=-E),E<0&&(v=-v,M=-M);let I=[v,0,M],T=[L.x*D,r(L),L.y*D],A=[H.x*D,r(H),H.y*D],k=[L.x*D,o,L.y*D],V=[H.x*D,o,H.y*D];t.tri(T,A,V,I,b,b,g),t.tri(T,V,k,I,b,g,g)}}function io(t){let e=0;for(let u of t)e+=u.count;let n=new Float32Array(e*3),r=new Float32Array(e*3),o=new Float32Array(e*3),i=new Float32Array(e),a=new Float32Array(e),s=0;for(let u of t)n.set(u.position,s*3),r.set(u.normal,s*3),o.set(u.color,s*3),i.set(u.floor,s),a.set(u.material,s),s+=u.count;return{position:n,normal:r,color:o,floor:i,material:a,count:e}}function kt(t,e,n=2.5){if(e<=0||t.length<3)return t;let r=mn(t),o=r.length,i=[];for(let s=0;s<o;s++){let u=r[s],l=r[(s+1)%o],m=l.x-u.x,d=l.y-u.y,p=Math.hypot(m,d)||1;i.push({x:d/p,y:-m/p})}let a=[];for(let s=0;s<o;s++){let u=r[s],l=i[(s-1+o)%o],m=i[s],d=l.x+m.x,p=l.y+m.y,c=Math.hypot(d,p),f=()=>{a.push([u.x+l.x*e,u.y+l.y*e]),a.push([u.x+m.x*e,u.y+m.y*e])};if(c<1e-9){f();continue}d/=c,p/=c;let h=d*l.x+p*l.y,b=1/Math.max(h,1e-6);if(!Number.isFinite(b)||b>n){f();continue}a.push([u.x+d*e*b,u.y+p*e*b])}if(a.length<3)return t;try{let s=ro.default.union([[...a,a[0]]]),u=null,l=-1/0;for(let d of s){let p=Math.abs(je(d[0].map(([c,f])=>({x:c,y:f}))));p>l&&(l=p,u=d[0])}if(!u)return t;let m=u.map(([d,p])=>({x:d,y:p}));if(m.length>1){let d=m[0],p=m[m.length-1];Math.abs(d.x-p.x)<1e-9&&Math.abs(d.y-p.y)<1e-9&&m.pop()}return m.length>=3?m:t}catch{return t}}function Ft(t,e,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:t+n*Math.cos(s),y:e+r*Math.sin(s)})}return i}function bt(t,e,n,r){return[{x:t,y:e},{x:t+n,y:e},{x:t+n,y:e+r},{x:t,y:e+r}]}var ce={pedestal:0,pad:1,back:2,body:3,head:4},Vi=.44,zi=.15,Gi=.3,Hi=.24;function ao(t){return t===void 0||!Number.isFinite(t)||t<=0?Hi:Math.min(Gi,Math.max(zi,t*Vi))}var dn=.21,Ui=.05,fn=.45,Dt=fn+Ui,ji=[{part:ce.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ce.pad,min:[-1,.36,-.95],max:[1,fn,1]},{part:ce.back,min:[-1,Dt,-1],max:[1,.92,-.72]}],Yi=[{part:ce.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ce.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ce.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ce.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ce.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Xi=[{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]]}];function so(){let t=[],e=[],n=[],r=[],o=(C,G,w)=>{let E=n.length,[I,T,A]=C,k=[T[0]-I[0],T[1]-I[1],T[2]-I[2]],V=[A[0]-I[0],A[1]-I[1],A[2]-I[2]],Y=k[1]*V[2]-k[2]*V[1],z=k[2]*V[0]-k[0]*V[2],_=k[0]*V[1]-k[1]*V[0],U=Math.hypot(Y,z,_);U>1e-9?(Y/=U,z/=U,_/=U):[Y,z,_]=G,Y*G[0]+z*G[1]+_*G[2]<0&&(Y=-Y,z=-z,_=-_);for(let W of C)t.push(...W),e.push(Y,z,_),n.push(w);r.push(E,E+1,E+2,E,E+2,E+3)},i=C=>{for(let G of Xi){let w=G.c.map(E=>E.map((I,T)=>I?C.max[T]:C.min[T]));o(w,G.n,C.part)}};for(let C of ji)i(C);for(let C of Yi)i(C);let a=fn,s=1.08,u=.47,l=.69,m=-.55,d=.08,p=-.48,c=.01,f=[-u,a,m],h=[u,a,m],b=[-u,a,d],g=[u,a,d],y=[-l,s,p],x=[l,s,p],P=[-l,s,c],R=[l,s,c];o([h,x,R,g],[1,0,0],ce.body),o([b,P,y,f],[-1,0,0],ce.body),o([P,R,x,y],[0,1,0],ce.body),o([f,h,g,b],[0,-1,0],ce.body),o([g,R,P,b],[0,0,1],ce.body),o([f,y,x,h],[0,0,-1],ce.body);let S=10,F=8,B=[0,1.205,-.23],L=[.42,.115,.38],H=n.length;for(let C=0;C<=F;C++){let G=Math.PI*C/F,w=Math.cos(G),E=Math.sin(G);for(let I=0;I<=S;I++){let T=Math.PI*2*I/S,A=E*Math.cos(T),k=E*Math.sin(T);t.push(B[0]+L[0]*A,B[1]+L[1]*w,B[2]+L[2]*k);let V=A/L[0],Y=w/L[1],z=k/L[2],_=Math.hypot(V,Y,z)||1;V/=_,Y/=_,z/=_,e.push(V,Y,z),n.push(ce.head)}}for(let C=0;C<F;C++)for(let G=0;G<S;G++){let w=H+C*(S+1)+G,E=w+S+1;r.push(w,E,w+1,w+1,E,E+1)}let O=new Float32Array(t),N=new Float32Array(e),v=new Float32Array(n),M=new Uint16Array(r);return{position:O,normal:N,part:v,index:M,vertexCount:n.length,indexCount:r.length}}function co(t,e,n,r){let o=new Float32Array(e),i=l=>t[l*3],a=l=>t[l*3+2],s=0,u=(l,m)=>{let d=m-l;for(let p=l;p<m;p++){let[c,f]=r(p),h=c-i(p),b=f-a(p);if(d>=2){let g=Math.max(l,p-1),y=Math.min(m-1,p+1),x=i(y)-i(g),P=a(y)-a(g),R=Math.hypot(x,P);if(R>1e-6){let S=-P/R,F=x/R;S*h+F*b<0&&(S=-S,F=-F),h=S,b=F}}o[p]=h===0&&b===0?0:Math.atan2(h,b)}};for(let l=1;l<=e;l++)(l===e||n(l)!==n(s))&&(u(s,l),s=l);return o}var Pe=.22;function lo(t,e){let n=ye[t];if(n!=="sold"&&n!=="held")return-1;let r=(e+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Wi=.42;function Ki(t){let e=t.length,n=new Float64Array(e);if(e<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let f of t)f.x<r&&(r=f.x),f.y<o&&(o=f.y),f.x>i&&(i=f.x),f.y>a&&(a=f.y);let s=Math.max(i-r,1e-6),u=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*u/e),1e-6),m=Math.max(1,Math.ceil(s/l)+1),d=Math.max(1,Math.ceil(u/l)+1),p=new Map,c=(f,h)=>{let b=Math.min(m-1,Math.max(0,Math.floor((f-r)/l)));return Math.min(d-1,Math.max(0,Math.floor((h-o)/l)))*m+b};for(let f=0;f<e;f++){let h=c(t[f].x,t[f].y),b=p.get(h);b?b.push(f):p.set(h,[f])}for(let f=0;f<e;f++){let h=t[f],b=Math.min(m-1,Math.max(0,Math.floor((h.x-r)/l))),g=Math.min(d-1,Math.max(0,Math.floor((h.y-o)/l))),y=1/0;for(let x=1;x<=4;x++){for(let P=g-x;P<=g+x;P++)if(!(P<0||P>=d))for(let R=b-x;R<=b+x;R++){if(R<0||R>=m||x>1&&Math.abs(P-g)<x&&Math.abs(R-b)<x)continue;let S=p.get(P*m+R);if(S)for(let F of S){if(F===f)continue;let B=Math.hypot(t[F].x-h.x,t[F].y-h.y);B<y&&(y=B)}}if(Number.isFinite(y)&&y<=x*l)break}n[f]=y}return n}function qi(t){let e=t.eyeHeightM;return Number.isFinite(e)?Math.max(0,e-Rt):0}function uo(t,e,n,r,o){let i=t.length,a=new Float32Array(i*3),s=new Float32Array(i),u=new Float32Array(i*3),l=new Float32Array(i),m=new Float32Array(i),d=new Float32Array(i),p=new Float32Array(i*3),c=new Map,f=Ki(t);for(let h=0;h<i;h++){let b=t[h],y=(n?.seatPitchU(h)??f[h])*D;l[h]=Number.isFinite(y)?Math.max(.06,Math.min(Pe,y*Wi)):Pe,m[h]=ao(Number.isFinite(y)?y:void 0),d[h]=b.wheelchairSpaceType==="no-seat"?0:1,a[h*3]=b.x*D,a[h*3+1]=n?n.seatDeckY(h):qi(b),a[h*3+2]=b.y*D,s[h]=ut(e?e(b):"available");let x=te(o?.get(b.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[h*3]=x[0],u[h*3+1]=x[1],u[h*3+2]=x[2],b.accessibility?.length){let P=te(Jn(b.accessibility));P&&(p[h*3]=P[0],p[h*3+1]=P[1],p[h*3+2]=P[2])}c.set(b.id,h)}return{count:i,iPosition:a,iState:s,iCategory:u,iMaxRadius:l,iRing:p,idToIndex:c,iChairWidth:m,iPhysicalSeat:d,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var $i=64;function pn(t,e){let n=[];for(let a of e){let s=t.idToIndex.get(a.seatId);if(s===void 0)continue;let u=ut(a.state);t.iState[s]!==u&&(t.iState[s]=u,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+$i){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var Zi=.15,Qi=.9,Ji=1.76,ea=.7,ta=1.6;function na(){return{background:{top:[...Ue.top],bottom:[...Ue.bottom]},structure:nn,seatStates:{...Gn},seatScale:1}}function mo(t){let e=na();if(!t)return e;let n=te(t.background);if(n){e.background={top:he(n,Qi),bottom:he(n,Ji)};let i={};for(let[a,s]of Object.entries(nn))i[a]=de(s,n,Zi);e.structure=i}let r=te(t.selectionColor)??te(t.accent);r&&(e.seatStates={...e.seatStates,selected:r});let o=t.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(e.seatScale=Math.min(ta,Math.max(ea,o))),e}function fo(t,e){let n=[];for(let r of e)n.push(...t.seatStates[r]);return n}function po(t){let e=t.length;return e<=3?[...t]:[t[Math.floor(e*.25)],t[Math.floor(e*.5)],t[Math.floor(e*.75)]]}function tt(t,e,n){if(!t.length)return 1/0;if(t.length===1)return Math.hypot(e-t[0].x,n-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let i=t[o],a=t[o+1],s=a.x-i.x,u=a.y-i.y,l=s*s+u*u,m=l>1e-12?((e-i.x)*s+(n-i.y)*u)/l:0;m<0?m=0:m>1&&(m=1);let d=Math.hypot(e-(i.x+m*s),n-(i.y+m*u));d<r&&(r=d)}return r}function oa(t){let e=0,n=0;for(let i of t)e+=i.x,n+=i.y;let r=t.length||1;e/=r,n/=r;let o=0;for(let i of t){let a=Math.hypot(i.x-e,i.y-n);a>o&&(o=a)}return{cx:e,cy:n,r:o}}function ho(t,e){return Math.hypot(t.cx-e.cx,t.cy-e.cy)-t.r-e.r}function hn(t,e){let n=1/0;for(let r of po(t)){let o=tt(e,r.x,r.y);o<n&&(n=o)}for(let r of po(e)){let o=tt(t,r.x,r.y);o<n&&(n=o)}return n}function ra(t,e){if(t.length<3)return{pts:t,seatIndices:e};let n=0,r=0;for(let m of t)n+=m.x,r+=m.y;n/=t.length,r/=t.length;let o=-1,i=t[0];for(let m of t){let d=Math.hypot(m.x-n,m.y-r);d>o&&(o=d,i=m)}let a=i.x-n,s=i.y-r,u=Math.hypot(a,s);u>1e-9?(a/=u,s/=u):(a=1,s=0);let l=t.map((m,d)=>({p:m,i:d,t:(m.x-n)*a+(m.y-r)*s})).sort((m,d)=>m.t-d.t);return{pts:l.map(m=>m.p),seatIndices:l.map(m=>e[m.i])}}function bn(t){let e=t.length;if(e<3)return null;let n=0,r=0;for(let y of t)n+=y.x,r+=y.y;n/=e,r/=e;let o=0,i=0,a=0,s=0,u=0,l=0,m=0;for(let y of t){let x=y.x-n,P=y.y-r;o+=x*x,a+=P*P,i+=x*P,s+=x*x*x,u+=P*P*P,l+=x*P*P,m+=P*x*x}let d=o*a-i*i;if(Math.abs(d)<1e-9)return null;let p=(s+l)/2,c=(u+m)/2,f=(p*a-c*i)/d,h=(c*o-p*i)/d,b=f+n,g=h+r;return!Number.isFinite(b)||!Number.isFinite(g)?null:{cx:b,cy:g}}var ia=.15;function aa(t){if(t.length<2)return null;let e=t.map(y=>{let x=0,P=0;for(let R of y.pts)x+=R.x,P+=R.y;return{x:x/y.pts.length,y:P/y.pts.length}}),n=0,r=0;for(let y of e)n+=y.x,r+=y.y;n/=e.length,r/=e.length;let o=0,i=0,a=0;for(let y of e){let x=y.x-n,P=y.y-r;o+=x*x,i+=x*P,a+=P*P}let s=o+a,u=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-u)),m,d;Math.abs(i)>1e-12?(m=l-a,d=i):o>=a?(m=1,d=0):(m=0,d=1);let p=Math.hypot(m,d);if(!(p>1e-12))return null;m/=p,d/=p;let c=1/0,f=-1/0,h=[];for(let y of t){let x=1/0,P=-1/0;for(let R of y.pts){let S=R.x*m+R.y*d;S<x&&(x=S),S>P&&(P=S),S<c&&(c=S),S>f&&(f=S)}h.push(P-x)}let b=f-c;return b>1e-9?(h.sort((y,x)=>y-x),h[Math.min(h.length-1,Math.floor(h.length*.9))]/b<=sa?{x:m,y:d}:null):null}var sa=.35;function bo(t,e,n,r){let o=new Map;for(let b of n){let g=e[b],y=g.rowId||`__seat-${b}`,x=o.get(y);x||(x={pts:[],idx:[]},o.set(y,x)),x.pts.push({x:g.x,y:g.y}),x.idx.push(b)}if(!o.size)return{sectionId:t,rows:[],blockCount:0};let i=[];for(let[b,g]of o){let y=ra(g.pts,g.idx),x=0;for(let P of y.pts)x+=Math.hypot(P.x-r.x,P.y-r.y);i.push({id:b,pts:y.pts,seatIndices:y.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/y.pts.length})}let a=i.map(b=>oa(b.pts)),s=[];for(let b=0;b<i.length;b++){let g=1/0;for(let y=0;y<i.length;y++){if(b===y||ho(a[b],a[y])>=g)continue;let x=hn(i[b].pts,i[y].pts);x<g&&(g=x)}Number.isFinite(g)&&s.push(g)}s.sort((b,g)=>b-g);let u=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(u*1.8,1e-6),m=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let g=b+1;g<i.length;g++)ho(a[b],a[g])>l||hn(i[b].pts,i[g].pts)<=l&&(m[b].push(g),m[g].push(b));let d=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let g=d++,y=[b];for(i[b].blockId=g;y.length;){let x=y.pop();for(let P of m[x])i[P].blockId===-1&&(i[P].blockId=g,y.push(P))}}let p=new Map;for(let b of i){let g=p.get(b.blockId)??[];g.push(b),p.set(b.blockId,g)}let c=[];for(let b of i){if(b.pts.length<4)continue;let g=bn(b.pts);g&&(!Number.isFinite(g.cx)||!Number.isFinite(g.cy)||c.push({x:g.cx,y:g.cy}))}let f=c.length>=2?(()=>{let b=c.map(x=>x.x).sort((x,P)=>x-P),g=c.map(x=>x.y).sort((x,P)=>x-P),y=Math.floor(c.length/2);return{cx:b[y],cy:g[y]}})():null;if(f){let b=S=>Math.hypot(S.x-f.cx,S.y-f.cy),g=1/0,y=-1/0,x=[];for(let S of i){let F=1/0,B=-1/0;for(let L of S.pts){let H=b(L);H<F&&(F=H),H>B&&(B=H)}x.push(B-F),F<g&&(g=F),B>y&&(y=B)}let P=y-g;x.sort((S,F)=>S-F);let R=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(P>1e-9&&R/P<=ia){let S=i.map(N=>{let v=0;for(let M of N.pts)v+=b(M);return{row:N,radius:v/N.pts.length}}),F=1/0;for(let N of S)N.radius<F&&(F=N.radius);S.sort((N,v)=>N.radius-v.radius);let B=-1,L=-1/0,H=P/Math.max(1,S.length)*.5,O=[];for(let N of S)N.radius-L>H&&(B++,L=N.radius),N.row.ordinal=B,N.row.blockDepth=N.radius-F,O.push(N.row);return{sectionId:t,rows:O,blockCount:d}}}let h=[];for(let[,b]of p){let g=aa(b);if(g){let y=P=>{let R=0;for(let S of P.pts)R+=S.x*g.x+S.y*g.y;return R/P.pts.length};b.sort((P,R)=>y(P)-y(R));let x=0;for(let P=0;P<b.length;P++)P>0&&(x+=hn(b[P-1].pts,b[P].pts)),b[P].ordinal=P,b[P].blockDepth=x,h.push(b[P])}else{let y=1/0;for(let x of b)x.focalDistance<y&&(y=x.focalDistance);b.sort((x,P)=>x.focalDistance-P.focalDistance);for(let x=0;x<b.length;x++)b[x].ordinal=x,b[x].blockDepth=Math.max(0,b[x].focalDistance-y),h.push(b[x])}}return{sectionId:t,rows:h,blockCount:d}}var Fc=Math.PI/180;function yo(t,e){let n=!1;for(let r=0,o=e.length-1;r<e.length;o=r++){let i=e[r].x,a=e[r].y,s=e[o].x,u=e[o].y;a>t.y!=u>t.y&&t.x<(s-i)*(t.y-a)/(u-a)+i&&(n=!n)}return n}function ca(t,e){return e.some((n,r)=>{let o=e[(r+1)%e.length],i=(t.y-n.y)*(o.x-n.x)-(t.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(t.x-n.x)*(o.x-n.x)+(t.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function go(t,e,n){return yo(t,e)&&!(n??[]).some(r=>yo(t,r)||ca(t,r))}function la(t){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(e,n)=>Math.hypot(e-t.x,n-t.y),gradientAt:(e,n)=>{let r=e-t.x,o=n-t.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function ua(t,e){if(!t.length)return null;let n=0,r=0,o=0;for(let c of t)n+=c.x,r+=c.y,o+=Math.hypot(c.x-e.x,c.y-e.y);let i=t.length;n/=i,r/=i,o/=i;let a=t[0],s=-1;for(let c of t){let f=Math.hypot(c.x-n,c.y-r);f>s&&(s=f,a=c)}let u=a.x-n,l=a.y-r,m=Math.hypot(u,l);m>1e-9?(u/=m,l/=m):(u=1,l=0);let d=[...t].sort((c,f)=>(c.x-n)*u+(c.y-r)*l-((f.x-n)*u+(f.y-r)*l)),p=0;for(let c of d){let f=Math.hypot(c.x-n,c.y-r);f>p&&(p=f)}return{pts:d,cx:n,cy:r,radius:p,depth:o}}function xo(t,e,n){let r=t.pts;if(r.length===1)return Math.hypot(e-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],u=s.x-a.x,l=s.y-a.y,m=u*u+l*l,d=m>1e-12?((e-a.x)*u+(n-a.y)*l)/m:0;d<0?d=0:d>1&&(d=1);let p=Math.hypot(e-(a.x+d*u),n-(a.y+d*l));p<o&&(o=p)}return o}var Lt=8;function ma(t,e,n){let r=new Array(Lt).fill(1/0),o=new Array(Lt).fill(-1);for(let m=0;m<t.length;m++){let d=t[m],p=Math.hypot(e-d.cx,n-d.cy)-d.radius;for(let c=0;c<Lt;c++)if(p<r[c]){for(let f=Lt-1;f>c;f--)r[f]=r[f-1],o[f]=o[f-1];r[c]=p,o[c]=m;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let m of o){if(m<0)continue;let d=xo(t[m],e,n);for(let p=0;p<3;p++)if(d<i[p]){for(let c=2;c>p;c--)i[c]=i[c-1],a[c]=a[c-1];i[p]=d,a[p]=m;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return t[a[0]].depth;let s=i[0]*2.2,u=0,l=0;for(let m=0;m<3;m++){let d=a[m];if(d<0||i[m]>s)continue;let p=1/(i[m]*i[m]);u+=p*t[d].depth,l+=p}return l>0?u/l:t[a[0]].depth}function da(t){let e=(r,o)=>ma(t,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<t.length;s++){let u=t[s];if(Math.hypot(r-u.cx,o-u.cy)-u.radius>=i)continue;let l=xo(u,r,o);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:t.length,rows:t,nearestRow:n,depthAt:e,gradientAt:(r,o)=>{let i=(e(r+.5,o)-e(r-.5,o))/1,a=(e(r,o+.5)-e(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function vo(t,e){let n=[];for(let r of t){let o=ua(r.points,e);o&&n.push(o)}return n.length<2?la(e):(n.sort((r,o)=>r.depth-o.depth),da(n))}var xn=$e(require("polygon-clipping"),1);var Po=$e(require("earcut"),1);var fa=.58,Mo=.01,be=Pe*1.5*Le,pa=.5,ha=.6;function ba(t,e){let n=t.length,r=[];for(let a=0;a<n;a++){let s=t[Math.max(0,a-1)],u=t[Math.min(n-1,a+1)],l=u.x-s.x,m=u.y-s.y,d=Math.hypot(l,m);if(d<1e-9){r.push([0,0]);continue}l/=d,m/=d,r.push([-m,l])}let o=0;for(let a=0;a<n;a++)o+=(t[a].x-e.x)*r[a][0]+(t[a].y-e.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function ya(t,e){if(t.length<2||e<=0)return[...t];let n=[...t],r=(a,s)=>{let u=s.x-a.x,l=s.y-a.y,m=Math.hypot(u,l)||1;return{x:u/m,y:l/m}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*e,y:n[0].y+o.y*e}),n.push({x:n[n.length-1].x+i.x*e,y:n[n.length-1].y+i.y*e}),n}var So=Math.PI/12;function ga(t){if(t.length<3)return[...t];let e=[...t].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(e),...r([...e].reverse())];return o.length>=3?o:[...t]}function Co(t,e){if(!t.length||!(e>0))return[];let n=ga(t),r=(s,u,l,m)=>{let d=l-u;for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;let p=Math.max(1,Math.ceil(d/So)),c=e/Math.cos(d/p/2);for(let f=0;f<=p;f++){let h=u+d*f/p;m.push({x:s.x+Math.cos(h)*c,y:s.y+Math.sin(h)*c})}};if(n.length<3){let s=0,u=0;for(let c of n)s+=c.x,u+=c.y;s/=n.length||1,u/=n.length||1;let l=0;for(let c of n)l=Math.max(l,Math.hypot(c.x-s,c.y-u));let m=[],d=Math.max(3,Math.ceil(Math.PI*2/So)),p=(l+e)/Math.cos(Math.PI/d);for(let c=0;c<d;c++){let f=c/d*Math.PI*2;m.push({x:s+Math.cos(f)*p,y:u+Math.sin(f)*p})}return m}let o=n.length,i=[];for(let s=0;s<o;s++){let u=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-u.x),l.y-u.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return Eo(a)}function xa(t,e,n){if(t.length===1)return Math.hypot(e-t[0].x,n-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let i=t[o],a=t[o+1],s=a.x-i.x,u=a.y-i.y,l=s*s+u*u,m=l>1e-12?((e-i.x)*s+(n-i.y)*u)/l:0;m<0?m=0:m>1&&(m=1);let d=Math.hypot(e-(i.x+m*s),n-(i.y+m*u));d<r&&(r=d)}return r}function Ot(t){let e=t.map(o=>{let i=0,a=0;for(let l of o.pts)i+=l.x,a+=l.y;let s=o.pts.length||1;i/=s,a/=s;let u=0;for(let l of o.pts){let m=Math.hypot(l.x-i,l.y-a);m>u&&(u=m)}return{cx:i,cy:a,rad:u}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<t.length;o++){let i=n(t[o].pts),a=[],s=1/0,u=null;for(let m of i){let d=1/0;for(let p=0;p<t.length;p++){if(p===o||Math.abs(t[p].y-t[o].y)<.001)continue;let c=e[p],f=Math.hypot(m.x-c.cx,m.y-c.cy)-c.rad;if(f>=d&&f>=s)continue;let h=xa(t[p].pts,m.x,m.y);h<d&&(d=h),t[p].depth<t[o].depth&&h<s&&(s=h,u=t[p].y)}Number.isFinite(d)&&d>0&&a.push(d)}a.sort((m,d)=>m-d);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:u})}return r}function Ao(t,e,n,r){let o=t[e],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let m=o.pts[0],d=m.x-r.x,p=m.y-r.y,c=Math.hypot(d,p)||1;d/=c,p/=c;let f=Math.max(n[e].pitch,.001)*.5;return[{x:m.x+p*f,y:m.y-d*f},{x:m.x-p*f,y:m.y+d*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let m=1;m<i.length;m++){let d=Math.hypot(i[m].x-i[m-1].x,i[m].y-i[m-1].y);d>1e-6&&(a+=d,s++)}let u=s>0?a/s:0,l=ya(i,Math.max(u*ha,be));return{pts:l,nrm:ba(l,r),front:Math.max(n[e].pitch*fa,be),back:Math.max(n[e].pitch*pa,be)}}var nt=1.5,Ro=.3;function yn(t,e){if(t.length<3)return t;let n=t[0],r=t[t.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,u=-1;for(let d=1;d<t.length-1;d++){let p=t[d],c=a>1e-12?Math.abs((p.x-n.x)*i-(p.y-n.y)*o)/a:Math.hypot(p.x-n.x,p.y-n.y);c>s&&(s=c,u=d)}if(s<=e||u<0)return[n,r];let l=yn(t.slice(0,u+1),e),m=yn(t.slice(u),e);return[...l.slice(0,-1),...m]}function Io(t,e){if(t.length<4)return t;let n=yn([...t,t[0]],e);return n.pop(),n.length>=3?n:t}function To(t,e,n){if(t.length<2)return[];let r=n??Ot(t),o=new Map;for(let a=0;a<t.length;a++){let s=o.get(t[a].blockId);s?s.push(a):o.set(t[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let y of a){let x=t[y].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:t[y].y}):s.push(y)}if(!s.length)continue;s.sort((y,x)=>t[y].depth-t[x].depth);let l=s.map(y=>Ao(t,y,r,e)).filter(y=>y!==null);if(!l.length)continue;let m=(y,x)=>({x:y.pts[x].x-y.nrm[x][0]*(y.front+nt),y:y.pts[x].y-y.nrm[x][1]*(y.front+nt)}),d=(y,x)=>({x:y.pts[x].x+y.nrm[x][0]*(y.back+nt),y:y.pts[x].y+y.nrm[x][1]*(y.back+nt)}),p=l[0],c=l[l.length-1],f=[];for(let y=0;y<p.pts.length;y++)f.push(m(p,y));for(let y of l)f.push(d(y,y.pts.length-1));for(let y=c.pts.length-1;y>=0;y--)f.push(d(c,y));for(let y=l.length-1;y>=0;y--)f.push(m(l[y],0));let h=Eo(f),b=1/0;for(let y of s)t[y].y<b&&(b=t[y].y);if(!Number.isFinite(b))continue;if(h.length>=3&&Math.abs(je(h))>1e-6&&l.every(y=>{let x=y.pts[Math.floor(y.pts.length/2)];return ft(h,x.x,x.y)})){i.push({outline:Io(h,Ro),holes:[],topY:b});continue}for(let y of va(l))i.push({outline:y,holes:[],topY:b})}return i}function va(t){let e=[];for(let n of t){let r=[],o=[],i=n.front+nt,a=n.back+nt;for(let u=0;u<n.pts.length;u++){let l=n.pts[u],m=n.nrm[u];r.push([l.x-m[0]*i,l.y-m[1]*i]),o.push([l.x+m[0]*a,l.y+m[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),e.push([s]))}if(!e.length)return[];try{let n=xn.default.union(e[0],...e.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([u,l])=>({x:u,y:l})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(Io(i,Ro))}return r}catch{return[]}}function Eo(t){let e=[];for(let n of t){let r=e[e.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||e.push(n)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<1e-9;)e.pop();return e}var gn=class{constructor(e){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=e;for(let n of e)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(e){for(let n of e)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of e)if(!ft(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function wo(t,e,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],m=r[0];for(let d=1;d+1<r.length;d++){let p=r[d],c=r[d+1];t.tri([m.x*D,o,m.y*D],[p.x*D,o,p.y*D],[c.x*D,o,c.y*D],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=xn.default.intersection([a],e)}catch{return}let u=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let m=l[0],d=[],p=[];for(let f=0;f<m.length-1;f++)d.push(m[f][0],m[f][1]),p.push([m[f][0],m[f][1]]);if(p.length<3)continue;let c=(0,Po.default)(d,void 0,2);for(let f=0;f<c.length;f+=3){let h=p[c[f]],b=p[c[f+1]],g=p[c[f+2]];t.tri([h[0]*D,o,h[1]*D],[b[0]*D,o,b[1]*D],[g[0]*D,o,g[1]*D],u,i)}}}function ko(t,e,n,r,o,i,a){if(e.length<2)return;let s=a??Ot(e),u=[0,1,0],l=i&&i.length>=3?[[...i.map(c=>[c.x,c.y]),[i[0].x,i[0].y]]]:null,m=i&&i.length>=3?new gn([[...i]]):null,d=c=>{t.setMaterial(2),c(),t.setMaterial(0)},p=c=>{t.setMaterial(3),c(),t.setMaterial(0)};for(let c=0;c<e.length;c++){let f=e[c];if(f.patch&&f.patch.length>=3){let R=[...f.patch],S=s[c].belowY??r;if(p(()=>{if(l&&m)wo(t,l,m,R,f.y,o.tread);else{let F=R[0];for(let B=1;B+1<R.length;B++){let L=R[B],H=R[B+1];t.tri([F.x*D,f.y,F.y*D],[L.x*D,f.y,L.y*D],[H.x*D,f.y,H.y*D],u,o.tread)}}}),f.y>S+Mo){let F=0,B=0;for(let L of R)F+=L.x,B+=L.y;F/=R.length,B/=R.length,d(()=>{for(let L=0;L<R.length;L++){let H=R[L],O=R[(L+1)%R.length],N=O.x-H.x,v=O.y-H.y,M=Math.hypot(N,v);if(M<1e-6)continue;let C=v/M,G=-N/M;(H.x-F)*C+(H.y-B)*G<0&&(C=-C,G=-G);let w=[C,0,G],E=[H.x*D,f.y,H.y*D],I=[O.x*D,f.y,O.y*D],T=[H.x*D,S,H.y*D],A=[O.x*D,S,O.y*D];t.tri(E,I,A,w,o.riser),t.tri(E,A,T,w,o.riser)}})}continue}let h=Ao(e,c,s,n);if(!h)continue;let{pts:b,nrm:g,front:y,back:x}=h,P=s[c].belowY??r;for(let R=0;R+1<b.length;R++){let S=b[R],F=b[R+1],B=g[R],L=g[R+1];if(Math.hypot(F.x-S.x,F.y-S.y)<1e-6||B[0]===0&&B[1]===0||L[0]===0&&L[1]===0)continue;let H=[(S.x-B[0]*y)*D,f.y,(S.y-B[1]*y)*D],O=[(F.x-L[0]*y)*D,f.y,(F.y-L[1]*y)*D],N=[(S.x+B[0]*x)*D,f.y,(S.y+B[1]*x)*D],v=[(F.x+L[0]*x)*D,f.y,(F.y+L[1]*x)*D];if(p(()=>{l&&m?wo(t,l,m,[{x:S.x-B[0]*y,y:S.y-B[1]*y},{x:F.x-L[0]*y,y:F.y-L[1]*y},{x:F.x+L[0]*x,y:F.y+L[1]*x},{x:S.x+B[0]*x,y:S.y+B[1]*x}],f.y,o.tread):(t.tri(H,O,v,u,o.tread),t.tri(H,v,N,u,o.tread))}),f.y>P+Mo){let M=[H[0],P,H[2]],C=[O[0],P,O[2]],G=[-B[0],0,-B[1]];d(()=>{t.tri(H,O,C,G,o.riser),t.tri(H,C,M,G,o.riser)})}}}}function Fo(t){let e=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of t)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<e&&(e=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:e,minY:n,maxX:r,maxY:o}:null}function _t(t,e){return t.minX<=e.maxX&&e.minX<=t.maxX&&t.minY<=e.maxY&&e.minY<=t.maxY}var vn=$e(require("polygon-clipping"),1);function Ma(t,e){let n=t.eventConfigurationIds;return!n?.length||!!e&&n.includes(e)}function Do(t,e){return t.filter(n=>n.type!=="shape"||Ma(n,e))}function Lo(t,e){let n=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:Do(r.objects,e),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Do(t.objects,e),focal:n,baseHeightM:0,index:0}]}var Sa={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function ot(t){return Fo(t)??Sa}function Oo(t,e){let n=kt(t.outline,be),r=ot(n),o=e.filter(a=>a!==t&&a.outline&&a.outline.length>=3&&_t(r,ot(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(u=>[u.x,u.y]);return s.push(s[0]),s};try{let a=vn.default.difference([i(n)],...o.map(u=>[i(u.outline)])),s=[];for(let u of a){if(!u.length)continue;let l=u[0].map(([m,d])=>({x:m,y:d}));if(l.length>1){let m=l[0],d=l[l.length-1];Math.abs(m.x-d.x)<1e-9&&Math.abs(m.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function _o(t,e){if(!e.length)return t;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=e.map(i=>[n(i)]),o=[];for(let i of t){let a;try{a=vn.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let u=s[0].map(([l,m])=>({x:l,y:m}));if(u.length>1){let l=u[0],m=u[u.length-1];Math.abs(l.x-m.x)<1e-9&&Math.abs(l.y-m.y)<1e-9&&u.pop()}u.length>=3&&o.push({outline:u,holes:[],topY:i.topY})}}return o.length?o:t}var wa=.05,Bo=.05,Pa=.15,Mn=25;function No(t,e,n){let r=new Map,o=new Array(e.length).fill(null),i=new Float64Array(e.length),a=new Array(e.length).fill(void 0),s=new Array(e.length).fill(void 0),u=new Map,l=[],m=new Set;for(let d=0;d<t.length;d+=1){let p=t[d];for(let c of p.objects){if(c.type==="table"&&m.add(c.id),c.type!=="section"||!c.outline||c.outline.length<3)continue;let f=kt(c.outline,be);u.set(c.id,{section:c,unit:p,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:c.id,floorIndex:d,box:ot(f),section:c,unit:p,outline:f})}}for(let d=0;d<e.length;d++){let p=e[d];for(let c of l){if(n&&c.floorIndex!==n[d]||p.x<c.box.minX||p.x>c.box.maxX||p.y<c.box.minY||p.y>c.box.maxY||!go({x:p.x,y:p.y},c.outline,c.section.holes))continue;o[d]=c.id;let f=u.get(c.id);f.hasSeats=!0;let h=p.focalPoint??c.unit.focal,b=Math.hypot(p.x-h.x,p.y-h.y);b<f.frontU&&(f.frontU=b),f.seatIndices.push(d);let g=p.rowId||`__seat-${d}`,y=f.rows.get(g);y?y.push({x:p.x,y:p.y}):f.rows.set(g,[{x:p.x,y:p.y}]);break}}for(let[d,p]of u){let c=to(p.section,{floorBaseHeightM:p.unit.baseHeightM}),f=p.unit.baseHeightM,h=c.rake>0?Math.tan(c.rake*Math.PI/180):0,b=c.rake<=.01&&c.height<=f+.001,g=p.section.surfaceKind,y=g==="flat"?!0:g==="rakedRows"&&c.rake>.01?!1:b,x=p.hasSeats?bo(d,e,p.seatIndices,p.unit.focal):{sectionId:d,rows:[],blockCount:0},R=x.rows.length<2?vo([...p.rows.values()].map(w=>({points:w})),p.unit.focal):null,S=1/0;if(R){if(p.hasSeats)for(let w of p.rows.values())for(let E of w){let I=R.depthAt(E.x,E.y);I<S&&(S=I)}if(!p.hasSeats||!Number.isFinite(S)){S=1/0;for(let w of p.section.outline){let E=R.depthAt(w.x,w.y);E<S&&(S=E)}}}let F=f+wa,B=Math.max(F,c.height),L=w=>{let E=Math.max(0,w-S)*ve,I=Math.min(E*h,Mn);return Math.max(F,c.height+I)},H=w=>{let E=Math.max(0,w)*ve,I=Math.min(E*h,Mn);return Math.max(F,c.height+I)},O=y?[]:x.rows.map(w=>({pts:w.pts,y:H(w.blockDepth),depth:w.blockDepth,blockId:w.blockId,...m.has(w.id)?{patch:Co(w.pts,be)}:{}})),N=O.length?O[0].y:B,v=O.map(w=>{let E=w.patch&&w.patch.length>=3?w.patch:w.pts,I=0,T=0;for(let V of E)I+=V.x,T+=V.y;let A=E.length||1;I/=A,T/=A;let k=0;for(let V of E){let Y=Math.hypot(V.x-I,V.y-T);Y>k&&(k=Y)}return{cx:I,cy:T,rad:k}}),M=y?()=>B:O.length>=2?(w,E)=>{let I=1/0,T=N;for(let A=0;A<O.length;A++){let k=v[A];if(Math.hypot(w-k.cx,E-k.cy)-k.rad>=I)continue;let V=O[A].patch,Y=V&&V.length>=3?ft(V,w,E)?0:tt(V,w,E):tt(O[A].pts,w,E);Y<I&&(I=Y,T=O[A].y)}return T}:(w,E)=>R?L(R.depthAt(w,E)):B,C=[0,1,0],G=O.length>=2||y?()=>C:(w,E)=>{if(!R)return C;let I=R.depthAt(w,E);if(I<=S)return C;let T=(I-S)*ve;if(T*h>=Mn||c.height+T*h<=F)return C;let[A,k]=R.gradientAt(w,E);if(A===0&&k===0)return C;let V=1/Math.hypot(h,1);return[-A*h*V,V,-k*h*V]};if(!y)for(let w of x.rows){let E=H(w.blockDepth);for(let I of w.seatIndices)a[I]=E}for(let w of x.rows){let E=[];for(let V=1;V<w.pts.length;V++){let Y=Math.hypot(w.pts[V].x-w.pts[V-1].x,w.pts[V].y-w.pts[V-1].y);Y>1e-6&&E.push(Y)}E.sort((V,Y)=>V-Y);let I=E.length?E[Math.floor(E.length/2)]:1/0,T=1/0,A=w.pts[Math.floor(w.pts.length/2)];if(A)for(let V of x.rows){if(V===w||V.blockId!==w.blockId)continue;let Y=tt(V.pts,A.x,A.y);Y>1e-6&&Y<T&&(T=Y)}let k=Math.min(I,Math.max(T,I*.5));if(Number.isFinite(k)&&k>0)for(let V of w.seatIndices)s[V]=k}r.set(d,{sectionId:d,deckAt:M,normalAt:G,flat:y,bottomY:f,rowLevels:O,landingY:N})}for(let d=0;d<e.length;d++){let p=o[d],c=e[d];if(p){let h=a[d];i[d]=(h??r.get(p).deckAt(c.x,c.y))+Pa;continue}let f=c.eyeHeightM;i[d]=Number.isFinite(f)?Math.max(0,f-Rt):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var ie={top:1,wallBottom:.5,bottomCap:.4};function Ce(t,e){if(!t)return e;let n=he(lt(t,.4),.62);return de(e,n,.72)}function Vo(t,e){let n=new Map;for(let i of t.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of e){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,u=0,l=0,m=0;for(let[d,p]of a){let c=te(n.get(d));c&&(s+=c[0]*p,u+=c[1]*p,l+=c[2]*p,m+=p)}m>0&&o.set(i,[s/m,u/m,l/m])}return o}function zo(t,e){return te(t.color)??e.get(t.logicalSectionId??t.id)??null}var Go=$e(require("polygon-clipping"),1);function Ca(t,e){return t===void 0||e===void 0?!0:Math.abs(t-e)<.001}var Bt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(e,n){let r=e.map(u=>[u.x,u.y]);if(r.length<3)return[];r.push(r[0]);let o=ot(e),i=this.rings.filter((u,l)=>_t(o,this.boxes[l])&&Ca(n,this.levels[l])),a=[[r]];if(i.length)try{a=Go.default.difference([r],...i).map(l=>l.map(m=>m.map(([d,p])=>[d,p])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let u of a){if(!u.length)continue;let l=u[0].map(([m,d])=>({x:m,y:d}));if(l.length>1){let m=l[0],d=l[l.length-1];Math.abs(m.x-d.x)<1e-9&&Math.abs(m.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Aa(t,e){if(!e)return t;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let d of t)n=Math.min(n,d.x),r=Math.max(r,d.x),o=Math.min(o,d.y),i=Math.max(i,d.y);let a=(n+r)/2,s=(o+i)/2,u=e*Math.PI/180,l=Math.cos(u),m=Math.sin(u);return t.map(d=>{let p=d.x-a,c=d.y-s;return{x:a+p*l-c*m,y:s+p*m+c*l}})}function yt(t){let e=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(e=t.points),t.kind==="rect"&&t.width&&t.height&&(e=bt(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let n=(t.x??0)+t.width/2,r=(t.y??0)+t.height/2;e=Ft(n,r,t.width/2,t.height/2)}return e?Aa(e,t.rotation):null}function gt(t){let e=t.role??"",r={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}}[e]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var Ra=.08;function Ho(t,e){let n=yt(t),r=gt(t),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,u=-1/0;for(let m of n)i=Math.min(i,m.x),a=Math.min(a,m.y),s=Math.max(s,m.x),u=Math.max(u,m.y);let l=o;for(let m of e)s>m.minX&&i<m.maxX&&u>m.minY&&a<m.maxY&&l<=m.topOffsetM+1e-6&&(l=m.topOffsetM+Ra);return e.push({minX:i,minY:a,maxX:s,maxY:u,topOffsetM:l}),l}function Oe(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}}function Uo(t){if(t.length!==4)return t;let e=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),n=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return e>=n?t:[t[1],t[2],t[3],t[0]]}function xt(t,e,n){return[Oe(t[0],t[1],e),Oe(t[0],t[1],n),Oe(t[3],t[2],n),Oe(t[3],t[2],e)]}function jo(t,e,n){return[Oe(t[0],t[3],e),Oe(t[1],t[2],e),Oe(t[1],t[2],n),Oe(t[0],t[3],n)]}function Ae(t,e,n,r,o,i){ae(t,e,void 0,()=>n,r,o,i,ie)}var Sn=2.4,Ia=.75,Ta=.15;function vt(t){if(t.points&&t.points.length>=3)return t.points;let{center:e,width:n,height:r,rotation:o}=t;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),u=n/2,l=r/2;return[[-u,-l],[u,-l],[u,l],[-u,l]].map(([m,d])=>({x:e.x+m*a-d*s,y:e.y+m*s+d*a}))}function Yo(t,e,n,r,o){let i=vt(e);i&&ae(t,i,void 0,()=>n+Sn,n,Ce(r,o.boothTop),o.boothWall,ie)}function wn(t){if(t.shape==="round"){let m=t.radius;return m?Ft(t.center.x,t.center.y,m,m,24):null}let{width:e,height:n,rotation:r,center:o}=t;if(!e||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),u=e/2,l=n/2;return[[-u,-l],[u,-l],[u,l],[-u,l]].map(([m,d])=>({x:o.x+m*a-d*s,y:o.y+m*s+d*a}))}function Xo(t,e,n,r,o){let i=wn(e);i&&ae(t,i,void 0,()=>n+Ia,n,Ce(r,o.tableTop),o.tableWall,ie)}function Wo(t,e,n,r,o,i,a){let s=yt(e);if(!s)return;let u=e.role==="stage",l=gt(e),m=n+r;if(u&&a){let h=1/0,b=-1/0,g=1/0,y=-1/0;for(let x of s)x.x<h&&(h=x.x),x.x>b&&(b=x.x),x.y<g&&(g=x.y),x.y>y&&(y=x.y);a.push({cx:(h+b)/2*D,cz:(g+y)/2*D,y:m,halfX:Math.max((b-h)/2*D,.5),halfZ:Math.max((y-g)/2*D,.5)})}let d=te(e.fill),p=u&&d?de(o.stageTop,he(lt(d,.18),.9),.9):Ce(d,u?o.stageTop:o.decorTop),c=e.role==="screen"?d:null,f=u?d?de(o.stageWall,he(d,.58),.82):o.stageWall:e.role==="screen"?c?de(he(c,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Ce(te(e.fill),o.decorWall);if(l.kind==="portal"&&s.length===4){let h=Uo(s);Ae(t,xt(h,0,.16),m,n,p,f),Ae(t,xt(h,.84,1),m,n,p,f),Ae(t,h,m,Math.max(n,m-.35),p,f);return}if(l.kind==="suite"&&s.length===4){let h=s.map((y,x)=>{let P=s[(x+1)%4],R=(y.x+P.x)/2,S=(y.y+P.y)/2;return Math.hypot(R-i.x,S-i.y)}),b=h.indexOf(Math.min(...h)),g=[0,1,2,3].map(y=>s[(b+y)%4]);Ae(t,xt(g,0,.08),m,n,p,f),Ae(t,xt(g,.92,1),m,n,p,f),Ae(t,jo(g,.88,1),m,n,p,f),Ae(t,g,m,Math.max(n,m-.18),p,f);return}Ae(t,s,m,n,p,f)}function Pn(t){let{x:e,y:n,width:r,height:o}=t;if(!r||!o)return null;let i=e+r/2,a=n+o/2,s=(t.rotation??0)*Math.PI/180,u=Math.cos(s),l=Math.sin(s),m=r/2,d=o/2;return[[-m,-d],[m,-d],[m,d],[-m,d]].map(([p,c])=>({x:i+p*u-c*l,y:a+p*l+c*u}))}function Ea(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let e=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{e=atob(e)}catch{return null}else try{e=decodeURIComponent(e)}catch{}let n=e.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return te(r);let i=e.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let u=te(s[1].trim());u&&a.push(u)}return a.length?a.reduce((s,u,l)=>de(s,u,1/(l+1)),a[0]):null}function Ko(t,e,n,r){if(e.layer==="foreground")return;let o=Pn(e);if(!o)return;let i=n+Ta,a=Ce(Ea(e.href),r.decorTop),s=Math.max(0,Math.min(1,e.opacity??1));s<1&&(a=de(r.ground,a,s)),ae(t,o,void 0,()=>i,n,a,de(a,r.decorWall,.5),ie)}function qo(t,e,n,r,o){if(!e.points||e.points.length<3)return;let i=Ce(r,o.gaTop);ae(t,e.points,e.holes,()=>n+.15,n,i,o.gaWall,ie)}var ka=Math.PI/180,ee=96,Fa=6,Da=60,La=150,$o=.2,Oa=.35;function Cn(t,e){let n=Math.atan2(e.x-t.x,e.y-t.y)/ka;return n<0?n+360:n}function Nt(t){if(!t.length)return NaN;let e=[...t].sort((n,r)=>n-r);return e[Math.floor(e.length/2)]}function Vt(t,e,n=2){let r=t.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let u=-n;u<=n;u++){let l=i+u;if(e)l=(l%r+r)%r;else if(l<0||l>=r)continue;a+=t[l],s++}o[i]=a/s}return o}function Zo(t,e){let n=t.filter(p=>p.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let p of n)for(let c of p.rows){for(let f of c.pts)o+=f.x,i+=f.y,a++;if(c.pts.length>=4){let f=bn(c.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&r.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:o/a,y:i/a},u=s;if(r.length>=8){let p=Nt(r.map(g=>g.x)),c=Nt(r.map(g=>g.y)),f=0;for(let g of n)for(let y of g.rows)for(let x of y.pts){let P=Math.hypot(x.x-s.x,x.y-s.y);P>f&&(f=P)}let h=0,b=f*.2;for(let g of n)for(let y of g.rows)for(let x of y.pts)Math.hypot(x.x-p,x.y-c)<b&&h++;Math.hypot(p-s.x,c-s.y)<=f&&h/a<.01&&(u={x:p,y:c})}let l=[];for(let p of n){let c={sectionId:p.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of p.rows)for(let h of f.pts){let b=Math.hypot(h.x-u.x,h.y-u.y),g=Math.min(ee-1,Math.floor(Cn(u,h)/(360/ee)));c.samples.push({r:b,bin:g,levelM:f.levelM}),b<c.rMin&&(c.rMin=b),b>c.rMax&&(c.rMax=b)}c.samples.length&&l.push(c)}if(!l.length)return null;l.sort((p,c)=>p.rMin+p.rMax-(c.rMin+c.rMax));let m=[];for(let p of l){let c=!1;for(let f of m){let h=Math.min(p.rMax,f.rMax)-Math.max(p.rMin,f.rMin),b=Math.min(p.rMax-p.rMin,f.rMax-f.rMin);if(b>1e-9&&h>=Oa*b){f.members.push(p),f.rMin=Math.min(f.rMin,p.rMin),f.rMax=Math.max(f.rMax,p.rMax),c=!0;break}}c||m.push({members:[p],rMin:p.rMin,rMax:p.rMax})}let d=[];for(let p of m){let c=new Array(ee).fill(null);for(let v of p.members)for(let M of v.samples){let C=c[M.bin];C||(C={samples:[]},c[M.bin]=C),C.samples.push({r:M.r,levelM:M.levelM})}let f=c.map(v=>!!v);if(!f.filter(Boolean).length)continue;let b=[],g=[];for(let v of c){if(!v)continue;let M=1/0,C=-1/0;for(let G of v.samples)G.r<M&&(M=G.r),G.r>C&&(C=G.r);b.push(M),g.push(C)}let y=Nt(b),x=Nt(g);if(!(y>=$o*x)||!(x>0))continue;let P=[...b].sort((v,M)=>v-M);if(!(P[Math.floor(P.length*.1)]>=$o*x))continue;let S=c.map(v=>{if(!v)return null;let M=[...v.samples].sort((k,V)=>k.r-V.r),C=M[0].r,G=M[M.length-1].r,w=M[0].levelM,E=-1/0;for(let k of M)k.levelM>E&&(E=k.levelM);let I=[];for(let k of M){let V={r:k.r,l:k.levelM};for(;I.length&&Math.abs(I[I.length-1].r-V.r)<1e-9;){if(I[I.length-1].l<=V.l){V.skip=!0;break}I.pop()}if(!V.skip){for(;I.length>=2;){let Y=I[I.length-2],z=I[I.length-1];if((z.r-Y.r)*(V.l-Y.l)-(z.l-Y.l)*(V.r-Y.r)<=0)I.pop();else break}I.push(V)}}let T=I.map(k=>k.r),A=I.map(k=>k.l);return{inner:C,outer:G,front:w,top:E,profile:{rs:T,ls:A}}}),F=f.slice();for(let v=0;v<ee;v++){if(F[v])continue;let M=-1,C=-1,G=0;for(let _=1;_<=ee;_++){let U=(v-_+ee*2)%ee;if(F[U]){M=U;break}}for(let _=1;_<=ee;_++){let U=(v+_)%ee;if(F[U]){C=U,G=_;break}}if(M<0||C<0)continue;let w=0;for(let _=1;_<=ee;_++){let U=(v-_+ee*2)%ee;if(f[U]){w=_;break}}if(w-1+G>Fa)continue;let I=S[M],T=S[C],A=w/(w+G),k=I.inner+(T.inner-I.inner)*A,V=I.outer+(T.outer-I.outer)*A,Y=I.front+(T.front-I.front)*A,z=I.top+(T.top-I.top)*A;S[v]={inner:k,outer:V,front:Y,top:z,profile:{rs:[k,V],ls:[Y,z]}}}for(let v=0;v<ee;v++)S[v]&&(F[v]=!0);let B=360/ee,L=[],H=F.filter(Boolean).length,O=[];if(H===ee)O.push({start:0,len:ee});else{let v=0;for(;F[v];)v=(v+1)%ee;let M=-1;for(let C=0;C<=ee;C++){let G=(v+C)%ee,w=C<ee&&F[G];if(w&&M<0)M=G;else if(!w&&M>=0){let E=(G-M+ee)%ee||ee;O.push({start:M,len:E}),M=-1}}}for(let v of O){if(v.len*B<Da&&v.len<ee)continue;let M=v.len===ee,C=new Float64Array(v.len),G=new Float64Array(v.len),w=new Float64Array(v.len),E=new Float64Array(v.len),I=[];for(let _=0;_<v.len;_++){let U=S[(v.start+_)%ee];C[_]=U.inner,G[_]=U.outer,w[_]=U.front,E[_]=U.top,I.push(U.profile??{rs:[U.inner,U.outer],ls:[U.front,U.top]})}let T=Vt(C,M),A=Vt(G,M),k=Vt(w,M),V=Vt(E,M);for(let _=0;_<v.len;_++)T[_]>C[_]&&(T[_]=C[_]),A[_]<G[_]&&(A[_]=G[_]),T[_]>A[_]-1e-6&&(T[_]=Math.max(0,A[_]-1e-6)),V[_]<k[_]&&(V[_]=k[_]);let Y={startBin:v.start,binCount:v.len,closed:M,innerR:T,outerR:A,frontLevelM:k,topLevelM:V,profiles:I},z=(_,U,W)=>{let Q=I[_],$=Q.rs,J=Q.ls;if(U<=$[0]){J[0]>W&&(J[0]=W);return}if(U>=$[$.length-1]){J[J.length-1]>W&&(J[J.length-1]=W);return}for(let Z=0;Z+1<$.length;Z++)if(U<=$[Z+1]){J[Z]>W&&(J[Z]=W),J[Z+1]>W&&(J[Z+1]=W);return}};for(let _=0;_<v.len;_++){let U=c[(v.start+_)%ee];if(U)for(let W of U.samples){z(_,W.r,W.levelM);let Q=M?(_-1+v.len)%v.len:_-1,$=M?(_+1)%v.len:_+1;Q>=0&&z(Q,W.r,W.levelM),$<v.len&&z($,W.r,W.levelM)}}L.push(Y)}L.reduce((v,M)=>v+M.binCount*B,0)<La||d.push({arcs:L,sectionIds:p.members.map(v=>v.sectionId),innerRMedian:y,outerRMedian:x})}if(!d.length)return null;if(d.sort((p,c)=>p.innerRMedian-c.innerRMedian),e){let p=d[d.length-1].outerRMedian;if(Math.hypot(e.x-u.x,e.y-u.y)>.9*p)return null}return{centre:u,binCount:ee,binStepDeg:360/ee,rings:d}}function Qo(t,e,n,r){let o=t.binStepDeg,i=n/o-.5-e.startBin;i=(i%t.binCount+t.binCount)%t.binCount,i>e.binCount-1&&(e.closed?i=i-e.binCount<e.binCount-i?0:e.binCount-1:i=i-(e.binCount-1)<t.binCount-i?e.binCount-1:0);let a=Math.floor(i),s=e.closed?(a+1)%e.binCount:Math.min(e.binCount-1,a+1),u=i-a,l=m=>{let d=e.profiles[m],p=d.rs,c=d.ls;if(r<=p[0])return c[0];if(r>=p[p.length-1])return c[c.length-1];for(let f=0;f+1<p.length;f++)if(r<=p[f+1]){let h=p[f+1]-p[f],b=h>1e-9?(r-p[f])/h:0;return c[f]+(c[f+1]-c[f])*b}return c[c.length-1]};return l(a)*(1-u)+l(s)*u}var Jo=.25,_a=1.2,Ba=.6,Na=.45,Va=2.3,za=Math.PI/180;function Xe(t,e,n){let r=n*za;return{x:t.x+e*Math.sin(r),y:t.y+e*Math.cos(r)}}function Ga(t,e){let n=e.rings[e.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let a=0;for(let s of i)Math.hypot(s.x-e.centre.x,s.y-e.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var Ha=24;function Ua(t,e,n,r,o,i,a,s,u){let l=n.binCount,m=Ha,d=ve,p=i+.02,c=[];for(let v=0;v<l;v++){let M=(n.startBin+v+.5)*e.binStepDeg,C=new Float64Array(m+1);for(let G=0;G<=m;G++){let w=r[v]+(o[v]-r[v])*G/m;C[G]=Math.max(p,Qo(e,n,M,w)-Jo)}c.push(C)}for(let v of u){let M=Cn(e.centre,v),C=Math.hypot(v.x-e.centre.x,v.y-e.centre.y),G=M/e.binStepDeg-.5-n.startBin;if(G=(G%e.binCount+e.binCount)%e.binCount,G>l-1&&!n.closed&&!(G<l-.5||G>e.binCount-.5))continue;let w=v.deckY-Jo,E=Math.min(l-1,Math.max(0,Math.floor(G))),I=[E,n.closed?(E+1)%l:Math.min(l-1,E+1)];for(let T of I){let A=o[T]-r[T];if(!(A>1e-9))continue;let k=(C-r[T])/A*m;if(k<-.75||k>m+.75)continue;let V=Math.min(m,Math.max(0,Math.floor(k))),Y=Math.min(m,V+1);c[T][V]>w&&(c[T][V]=Math.max(p,w)),c[T][Y]>w&&(c[T][Y]=Math.max(p,w))}}let f=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],h=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],b=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],g=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(v,M)=>{let C=(n.startBin+v+.5)*e.binStepDeg,G=r[v]+(o[v]-r[v])*M/m,w=Xe(e.centre,G,C);return[w.x*d,c[v][M],w.y*d]};{let v=Math.tan(12*Math.PI/180);for(let M=0;M<6;M++){let C=!1;for(let w=0;w<l;w++)for(let E=m-1;E>=0;E--)c[w][E]>c[w][E+1]&&(c[w][E]=c[w][E+1],C=!0);let G=n.closed?l:l-1;for(let w=0;w<G;w++){let E=(w+1)%l;for(let I=0;I<=m;I++){let T=c[E][I]-c[w][I];if(Math.abs(T)>1)continue;let A=r[w]+(o[w]-r[w])*I/m,k=r[E]+(o[E]-r[E])*I/m,V=Xe(e.centre,A,(n.startBin+w+.5)*e.binStepDeg),Y=Xe(e.centre,k,(n.startBin+E+.5)*e.binStepDeg),z=v*Math.hypot(Y.x-V.x,Y.y-V.y)*d;T>z?(c[E][I]=c[w][I]+z,C=!0):-T>z&&(c[w][I]=c[E][I]+z,C=!0)}}if(!C)break}}let x=1,P=(v,M)=>{for(let C=0;C<=m;C+=4)if(Math.abs(c[v][C]-c[M][C])>x)return!0;return Math.abs(c[v][m]-c[M][m])>x},R=Math.tan(38*Math.PI/180),S=v=>(o[v]-r[v])/m*d,F=(v,M)=>c[v][M+1]-c[v][M]>R*Math.max(1e-6,S(v)),B=(v,M)=>{let C=n.closed?(v-1+l)%l:Math.max(0,v-1),G=n.closed?(v+1)%l:Math.min(l-1,v+1);Math.abs(c[C][M]-c[v][M])>x&&(C=v),Math.abs(c[G][M]-c[v][M])>x&&(G=v);let w=Math.max(0,M-1),E=Math.min(m,M+1);w<M&&F(v,w)&&(w=M),E>M&&F(v,M)&&(E=M);let I=y(C,M),T=y(G,M),A=y(v,w),k=y(v,E),V=T[0]-I[0],Y=T[1]-I[1],z=T[2]-I[2],_=k[0]-A[0],U=k[1]-A[1],W=k[2]-A[2],Q=Y*W-z*U,$=z*_-V*W,J=V*U-Y*_,Z=Math.hypot(Q,$,J);return Z>1e-12?(Q/=Z,$/=Z,J/=Z,$<0&&(Q=-Q,$=-$,J=-J),[Q,$,J]):[0,1,0]},L=(v,M)=>{let C=[v[0],i,v[2]],G=[M[0],i,M[2]],w=M[0]-v[0],E=M[2]-v[2],I=Math.hypot(w,E);if(!(I>1e-12))return;let T=[E/I,0,-w/I];t.tri(v,M,G,T,b,b,g),t.tri(v,G,C,T,b,g,g)},H=.05*Le,O=v=>o[v]-r[v]<H,N=n.closed?l:l-1;for(let v=0;v<N;v++){let M=(v+1)%l;if(O(v)||O(M))continue;if(P(v,M)){let T=(n.startBin+v+1)*e.binStepDeg,A=(U,W)=>{let Q=(r[v]+r[M])/2,$=(o[v]+o[M])/2,J=Q+($-Q)*W/m,Z=Xe(e.centre,J,T);return[Z.x*d,c[U][W],Z.y*d]};for(let U=0;U<m;U++){let W=y(v,U),Q=y(v,U+1),$=A(v,U),J=A(v,U+1),Z=B(v,U),pe=B(v,U+1);t.triN(W,$,J,Z,Z,pe,f),t.triN(W,J,Q,Z,pe,pe,f);let Ve=y(M,U),ze=y(M,U+1),ge=A(M,U),Re=A(M,U+1),xe=B(M,U),Ie=B(M,U+1);t.triN(ge,Ve,ze,xe,xe,Ie,f),t.triN(ge,ze,Re,xe,Ie,Ie,f);let se=A(v,U),me=A(v,U+1),we=A(M,U+1),Te=A(M,U),We=me[0]-se[0],Ge=me[2]-se[2],le=Math.hypot(We,Ge);if(le>1e-12){let Ke=[Ge/le,0,-We/le];t.tri(se,me,we,Ke,b),t.tri(se,we,Te,Ke,b)}}let k=y(v,0),V=y(M,0),Y=y(M,m),z=y(v,m),_=U=>[U[0],i,U[2]];t.tri(_(k),_(Y),_(V),[0,-1,0],h),t.tri(_(k),_(z),_(Y),[0,-1,0],h),L(k,V),L(z,Y);continue}for(let T=0;T<m;T++){let A=B(v,T),k=B(M,T),V=B(M,T+1),Y=B(v,T+1);if(F(v,T)||F(M,T)){let Q=(me,we)=>{let Te=(n.startBin+me+.5)*e.binStepDeg,We=r[me]+(o[me]-r[me])*(T+.5)/m,Ge=Xe(e.centre,We,Te);return[Ge.x*d,we,Ge.y*d]},$=y(v,T),J=y(M,T),Z=Q(v,c[v][T]),pe=Q(M,c[M][T]);t.triN($,J,pe,A,k,k,f),t.triN($,pe,Z,A,k,A,f);let Ve=y(M,T+1),ze=y(v,T+1),ge=Q(v,c[v][T+1]),Re=Q(M,c[M][T+1]);t.triN(ge,Re,Ve,Y,V,V,f),t.triN(ge,Ve,ze,Y,V,Y,f);let xe=pe[0]-Z[0],Ie=pe[2]-Z[2],se=Math.hypot(xe,Ie);if(se>1e-12){let me=[-Ie/se,0,xe/se];t.tri(Z,pe,Re,me,b),t.tri(Z,Re,ge,me,b)}continue}let z=y(v,T),_=y(M,T),U=y(M,T+1),W=y(v,T+1);t.triN(z,_,U,A,k,V,f),t.triN(z,U,W,A,V,Y,f)}let C=y(v,0),G=y(M,0),w=y(M,m),E=y(v,m),I=T=>[T[0],i,T[2]];t.tri(I(C),I(w),I(G),[0,-1,0],h),t.tri(I(C),I(E),I(w),[0,-1,0],h),L(C,G),L(E,w)}if(!n.closed)for(let v of[0,l-1])for(let M=0;M<m;M++)L(y(v,M),y(v,M+1))}function er(t,e,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(e.binCount).fill(-1/0);for(let m of e.rings)for(let d of m.arcs){let p=new Float64Array(d.binCount),c=new Float64Array(d.binCount);for(let h=0;h<d.binCount;h++){let b=(d.startBin+h)%e.binCount,g=Math.max(0,d.innerR[h]-be);p[h]=Math.max(g,a[b]+.001),c[h]=Math.max(p[h]+.001,d.outerR[h]+be)}let f=0;for(let h=0;h<d.binCount;h++){let b=d.topLevelM[h]-r;b>f&&(f=b)}f>=_a&&Ua(t,e,d,p,c,r,o,i,n.seatGuards);for(let h=0;h<d.binCount;h++){let b=(d.startBin+h)%e.binCount;c[h]>a[b]&&(a[b]=c[h])}}if(Ga(n.shapes,e))return;let s=e.rings[e.rings.length-1],u=Ba*Le,l=Na*Le;for(let m of s.arcs){let d=[],p=[];for(let h=0;h<m.binCount;h++){let b=(m.startBin+h+.5)*e.binStepDeg,g=m.outerR[h]+be+u;d.push(Xe(e.centre,g,b)),p.push(Xe(e.centre,g+l,b))}let c=-1/0;for(let h=0;h<m.binCount;h++)m.topLevelM[h]>c&&(c=m.topLevelM[h]);let f=()=>c+Va;m.closed?ae(t,p,[d.slice().reverse()],f,r,o.shellTop,o.shellWall,i):ae(t,[...p,...d.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function tr(t,e,n,r,o,i,a,s){if(!e.outline||e.outline.length<3)return;let u=n.baseHeightM,l=Ce(r,s.tierTop);if(!o)return;let m=b=>o.deckAt(b.x,b.y),d=Oo(e,a),p=d[0]??e.outline;if(o.rowLevels.length>=2){let b=Ot(o.rowLevels),g=_o(To(o.rowLevels,n.focal,b),d),y=()=>[0,1,0];for(let P of g){let R=Math.max(u,P.topY-.02);for(let S of i.subtract(P.outline,R))ae(t,S,P.holes,()=>R,u,l,s.tierWall,ie,void 0,y)}g.length||ae(t,p,e.holes,()=>o.landingY,u,l,s.tierWall,ie);let x={tread:[l[0]*ie.top,l[1]*ie.top,l[2]*ie.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let P of d.length?d:[p])ko(t,o.rowLevels,n.focal,o.landingY,x,P,b);return}let c=o.flat?1/0:Bo,f=b=>o.normalAt(b.x,b.y),h=o.flat?o.landingY:void 0;for(let b of i.subtract(p,h))ae(t,b,e.holes,m,u,l,s.tierWall,ie,c,f)}function ja(t,e,n){let r=new Set;for(let a of t.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<e.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let u=n.bySection.get(s);if(u&&u.rowLevels.length>=2)continue;let l=e[a],m=o.get(s);m||(m=new Map,o.set(s,m));let d=l.rowId||`__seat-${a}`,p=m.get(d);p||(p={pts:[],levelM:0,n:0},m.set(d,p)),p.pts.push({x:l.x,y:l.y}),p.levelM+=n.seatDeckY(a),p.n++}let i=[];for(let a of t.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(m=>!m.patch).map(m=>({pts:m.pts,levelM:m.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let u=o.get(a.id);u&&i.push({sectionId:a.id,rows:[...u.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function nr(t,e,n,r,o){let i=ja(e,n,r);if(!i.length)return;let a=Zo(i,e.focal);if(!a)return;let s=new Set;for(let l of e.objects)l.type==="section"&&s.add(l.id);let u=[];for(let l=0;l<n.length;l++){let m=r.seatOwner[l];(!m||s.has(m))&&u.push({x:n[l].x,y:n[l].y,deckY:r.seatDeckY(l)})}t.setMaterial(0),er(t,a,{bottomY:e.baseHeightM,colors:{bandTop:he(o.tierTop,.8),bandWall:o.tierWall,shellTop:he(o.tierWall,1.15),shellWall:o.tierWall},ao:ie,shapes:e.objects.filter(l=>l.type==="shape"),seatGuards:u})}function or(t,e,n){return n<0?e>1?t.filter(r=>r.kind==="floor"):[...t]:t.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function rr(t,e){let n=[...t].sort((o,i)=>o.screen.y-i.screen.y),r=[];for(let o of n){let i=r.find(a=>a.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));i?i.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(e-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var Ya=1.15,Xa=3.25,Wa=4.5,Ka=.85,qa=.5,$a=.26;function ir(t,e,n){let r=Math.max(1e-6,e),o=t/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=Ya&&a.add("zone"),o<=(i?Xa:Wa)&&(a.add("section"),a.add("ga")),o<=Ka&&(a.add("annotation"),a.add("booth")),o<=qa&&a.add("row"),o<=$a&&a.add("seat"),a}function zt(t,e,n,r){let o=t,i=e[0],a=e[1],s=e[2],u=o[0]*i+o[4]*a+o[8]*s+o[12],l=o[1]*i+o[5]*a+o[9]*s+o[13],m=o[2]*i+o[6]*a+o[10]*s+o[14],d=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(d>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let p=u/d,c=l/d,f=m/d,h=p>=-1.05&&p<=1.05&&c>=-1.05&&c<=1.05&&f<=1;return{x:(p*.5+.5)*n,y:(1-(c*.5+.5))*r,depth:f,visible:h}}function ar(t,e,n=e){let r=[],o=[...t].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r){let u=Math.abs(i.screen.x-s.screen.x),l=Math.abs(i.screen.y-s.screen.y);if(u<e&&l<n){a=!0;break}}a||r.push(i)}return r}var sr={row:8,seat:14};function cr(t,e,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(t.x-n/2,t.y-r/2)/o);return e*(1+1.5*i)}function lr(t,e,n,r){let o=[...t].sort((a,s)=>(s.priority??0)-(a.priority??0)||a.focus-s.focus),i=[];for(let a of o){if(i.length>=r)break;let s=!1;for(let u of i)if(Math.abs(a.screen.x-u.screen.x)<e&&Math.abs(a.screen.y-u.screen.y)<n){s=!0;break}s||i.push(a)}return i}var Za=6,Qa=2.2,ur=.1,Ja=.3,es=1.8,ts=.9,ns=.55,os=6e3;function mr(t){let{doc:e,units:n,seats:r,surfaces:o,focal:i}=t,a=e.zones??[],s=[];if(a.length){let u=new Map;for(let m of n)for(let d of m.objects)d.type==="section"&&d.zone&&u.set(d.id,d.zone);let l=new Map;for(let m=0;m<r.length;m++){let d=r[m],p=o.seatOwner[m],c=d.zoneId??(p?u.get(p):void 0);if(!c)continue;let f=l.get(c);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(c,f)),f.n++,d.x<f.minX&&(f.minX=d.x),d.y<f.minY&&(f.minY=d.y),d.x>f.maxX&&(f.maxX=d.x),d.y>f.maxY&&(f.maxY=d.y),f.sumY+=o.seatDeckY(m)}for(let m of a){let d=l.get(m.id),p=[];for(let[c,f]of u)f===m.id&&p.push(c);if(!d||d.n===0){s.push({id:m.id,label:m.label,color:te(m.color),sectionIds:p,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(m.focalPoint??i).x*D,1.5,(m.focalPoint??i).y*D]});continue}s.push({id:m.id,label:m.label,color:te(m.color),sectionIds:p,seatCount:d.n,center:[(d.minX+d.maxX)/2*D,d.sumY/d.n,(d.minY+d.maxY)/2*D],radius:.5*Math.hypot((d.maxX-d.minX)*D,(d.maxY-d.minY)*D)||1,focalWorld:[(m.focalPoint??i).x*D,1.5,(m.focalPoint??i).y*D]})}}return s}function dr(t){let{doc:e,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:u}=t,l=[],m=[],d=[];for(let p of s)p.seatCount!==0&&l.push({id:`zone:${p.id}`,kind:"zone",text:p.label,anchor:[p.center[0],p.center[1]+Za,p.center[2]],color:e.zones?.find(c=>c.id===p.id)?.color});{let p=new Map,c=new Map;for(let f=0;f<r.length;f++){let h=o.seatOwner[f];if(!h)continue;let b=p.get(h);b||(b={n:0,x:0,y:0,deck:0},p.set(h,b)),b.n++,b.x+=r[f].x,b.y+=r[f].y,b.deck+=o.seatDeckY(f);let g=c.get(h);g||(g={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},c.set(h,g)),r[f].x<g.minX&&(g.minX=r[f].x),r[f].x>g.maxX&&(g.maxX=r[f].x),r[f].y<g.minY&&(g.minY=r[f].y),r[f].y>g.maxY&&(g.maxY=r[f].y)}for(let f of n)for(let h of f.objects){if(h.type!=="section")continue;let b=p.get(h.id);if(!b||b.n===0)continue;let g=c.get(h.id),y=[b.x/b.n*D,b.deck/b.n,b.y/b.n*D],x=h.displayLabel||h.label||h.id;m.push({id:h.id,floorIndex:f.index,label:x,seatCount:b.n,center:y,radius:Math.max(1,Math.hypot(g.maxX-g.minX,g.maxY-g.minY)*.5*D),focalWorld:[f.focal.x*D,f.baseHeightM+1.5,f.focal.y*D]});let P=e.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&P===x.trim().toLocaleLowerCase()||l.push({id:`section:${h.id}`,kind:"section",text:x,anchor:[y[0],y[1]+Qa,y[2]],floorIndex:f.index})}}{for(let f of n)for(let h of f.objects){if(h.type!=="gaArea")continue;let b=dt(h.points);if(!b)continue;let g=h.displayLabel||h.label||h.id;l.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${g} \xB7 ${h.capacity.toLocaleString()}`:g,anchor:[b.x*D,f.baseHeightM+es,b.y*D],floorIndex:f.index})}let p=new Map;for(let f=0;f<r.length;f++){let h=r[f],b=Math.hypot(h.x-u.x,h.y-u.y),g=p.get(h.rowId);(!g||b>g.far)&&p.set(h.rowId,{seat:h,index:f,far:b})}for(let[f,h]of p){let b=h.seat.label?h.seat.label.lastIndexOf("-"):-1,g=b>0?h.seat.label.slice(0,b):f;g&&l.push({id:`row:${f}`,kind:"row",text:g,anchor:[h.seat.x*D,o.seatDeckY(h.index)+ts,h.seat.y*D],floorIndex:a[h.index]})}let c=new Map;for(let f=0;f<r.length;f++){let h=r[f],b=h.label?h.label.lastIndexOf("-"):-1,g=c.get(h.rowId);g||(g={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:b>0?h.label.slice(0,b):h.rowId,sectionId:h.sectionId},c.set(h.rowId,g));let y=f*3,x=i.iPosition[y],P=i.iPosition[y+1],R=i.iPosition[y+2];g.n++,g.x+=x,g.y+=P,g.z+=R,g.minX=Math.min(g.minX,x),g.maxX=Math.max(g.maxX,x),g.minZ=Math.min(g.minZ,R),g.maxZ=Math.max(g.maxZ,R)}for(let[f,h]of c)d.push({id:f,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=os)for(let f=0;f<r.length;f++){let h=r[f],b=h.displayLabel||h.label;b&&l.push({id:`seat:${h.id}`,kind:"seat",text:b,anchor:[h.x*D,o.seatDeckY(f)+ns,h.y*D],floorIndex:a[f]})}}for(let p of n)for(let c of p.objects)if(c.type==="shape"&&c.role&&["entrance","exit","screen","suite","obstruction"].includes(c.role)){let f=yt(c),h=f?dt(f):null;if(!h||!c.label)continue;l.push({id:`architecture:${c.id}`,kind:"annotation",text:c.label,anchor:[h.x*D,p.baseHeightM+gt(c).heightM+ur,h.y*D],color:c.fill,floorIndex:p.index})}else if(c.type==="text"){if(!c.text)continue;l.push({id:`text:${c.id}`,kind:"annotation",text:c.text,anchor:[c.position.x*D,p.baseHeightM+ur,c.position.y*D],color:c.color,rotation:c.rotation,floorIndex:p.index})}else if(c.type==="booth"){let f=vt(c);if(!f)continue;let h=dt(f);if(!h)continue;l.push({id:`booth:${c.id}`,kind:"booth",text:c.displayLabel||c.label||c.id,anchor:[h.x*D,p.baseHeightM+Sn+Ja,h.y*D],floorIndex:p.index})}return{labels:l,sections:m,rows:d}}function fr(t,e){if(e.length>1)for(let n of e)t.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function pr(t){let{doc:e,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=t,u=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let p=0;p<i.floor.length;p+=1){let c=Math.max(0,Math.min(n.length-1,Math.round(i.floor[p]))),f=p*3,h=l[c];h.minX=Math.min(h.minX,i.position[f]),h.minY=Math.min(h.minY,i.position[f+1]),h.minZ=Math.min(h.minZ,i.position[f+2]),h.maxX=Math.max(h.maxX,i.position[f]),h.maxY=Math.max(h.maxY,i.position[f+1]),h.maxZ=Math.max(h.maxZ,i.position[f+2])}let m=new Map;for(let p=0;p<n.length;p++)for(let c of n[p].objects)c.type==="section"&&m.set(c.id,p);let d=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let p=0;p<r.length;p++){let c=o.seatOwner[p],f=(c!==null?m.get(c):void 0)??a[p];if(f===void 0)continue;let h=d[f],b=r[p];h.n++,b.x<h.minX&&(h.minX=b.x),b.y<h.minY&&(h.minY=b.y),b.x>h.maxX&&(h.maxX=b.x),b.y>h.maxY&&(h.maxY=b.y);let g=o.seatDeckY(p);h.sumX+=b.x*D,h.sumDeck+=g,h.sumZ+=b.y*D,h.minDeck=Math.min(h.minDeck,g),h.maxDeck=Math.max(h.maxDeck,g+1.6),s[p]=f}for(let p=0;p<n.length;p++){let c=d[p],f=e.floors?.[p],h=l[p],b=Math.min(c.n?c.minX*D:n[p].focal.x*D-1,Number.isFinite(h.minX)?h.minX:1/0),g=Math.max(c.n?c.maxX*D:n[p].focal.x*D+1,Number.isFinite(h.maxX)?h.maxX:-1/0),y=Math.min(c.n?c.minY*D:n[p].focal.y*D-1,Number.isFinite(h.minZ)?h.minZ:1/0),x=Math.max(c.n?c.maxY*D:n[p].focal.y*D+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),P=Math.min(c.n?Math.min(n[p].baseHeightM,c.minDeck):n[p].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),R=Math.max(c.n?Math.max(c.maxDeck,P+.5):P+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[c.n?c.sumX/c.n:(b+g)/2,c.n?c.sumDeck/c.n:(P+R)/2,c.n?c.sumZ/c.n:(y+x)/2],F=Math.max(1,.5*Math.hypot(g-b,R-P,x-y));u.push({index:p,id:f?.id??`floor-${p}`,label:f?.name??(n.length>1?`Floor ${p+1}`:"Venue"),seatCount:c.n,center:S,radius:F,box:{min:[b,P,y],max:[g,R,x]},focalWorld:[n[p].focal.x*D,n[p].baseHeightM+1.5,n[p].focal.y*D]})}}return u}function An(t,e){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,u)=>{s<n&&(n=s),u<r&&(r=u),s>o&&(o=s),u>i&&(i=u)};for(let s of e)a(s.x,s.y);for(let s of t)for(let u of s.objects)if(u.type==="section")for(let l of u.outline)a(l.x,l.y);else if(u.type==="shape"&&u.points)for(let l of u.points)a(l.x,l.y);else if(u.type==="gaArea")for(let l of u.points)a(l.x,l.y);else if(u.type==="booth"){let l=vt(u);if(l)for(let m of l)a(m.x,m.y)}else if(u.type==="table"){let l=wn(u);if(l)for(let m of l)a(m.x,m.y)}else if(u.type==="decorImage"){let l=Pn(u);if(l)for(let m of l)a(m.x,m.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function hr(t,e,n,r,o,i){if(e.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=bt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ae(t,s,void 0,()=>0,-.4,i.ground,i.ground,ie)}else{let a=e.reduce((c,f)=>f.baseHeightM<c.baseHeightM?f:c);t.setFloor(a.index);let s=n.filter((c,f)=>r[f]===a.index),u=An([a],s),l=Math.hypot(u.maxX-u.minX,u.maxY-u.minY),m=Math.max(28,Math.min(80,l*.04)),d=bt(u.minX-m,u.minY-m,u.maxX-u.minX+m*2,u.maxY-u.minY+m*2),p=a.baseHeightM-.03;ae(t,d,void 0,()=>p,p-.22,i.ground,i.ground,ie)}}function br(t,e,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,u=1/0,l=-1/0,m=-1/0,d=-1/0,p=(h,b,g)=>{a=Math.min(a,h),l=Math.max(l,h),s=Math.min(s,b),m=Math.max(m,b),u=Math.min(u,g),d=Math.max(d,g)};for(let h=0;h<t.position.length;h+=3)p(t.position[h],t.position[h+1],t.position[h+2]);for(let h=0;h<e.count;h++){let b=h*3,g=e.iPosition[b],y=e.iPosition[b+1],x=e.iPosition[b+2],P=Math.max(.35,e.iMaxRadius[h]??.35);p(g-P,y,x-P),p(g+P,y+1.6,x+P)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,m=i*.16,u=o-i,d=o+i);let c=[(a+l)/2,(s+m)/2,(u+d)/2],f=Math.max(1,.5*Math.hypot(l-a,m-s,d-u));return{center:c,radius:f,minY:s,maxY:m}}function yr(t,e,n,r,o,i){let a=1/0,s=1/0,u=-1/0,l=-1/0;for(let P=0;P<t.count;P++){let R=P*3,S=t.iPosition[R],F=t.iPosition[R+2];S<a&&(a=S),S>u&&(u=S),F<s&&(s=F),F>l&&(l=F)}for(let P of e)a=Math.min(a,P.cx-P.halfX),u=Math.max(u,P.cx+P.halfX),s=Math.min(s,P.cz-P.halfZ),l=Math.max(l,P.cz+P.halfZ);let m=n.minX*D,d=n.maxX*D,p=n.minY*D,c=n.maxY*D,f=m,h=d,b=p,g=c;if(Number.isFinite(a)){let P=Math.max(2,.06*Math.hypot(u-a,l-s));f=Math.max(m,a-P),h=Math.min(d,u+P),b=Math.max(p,s-P),g=Math.min(c,l+P)}let y=Math.min(0,r),x=Math.max(o,i*.05);return{min:[f,y,b],max:[h,x,g]}}function rt(t){let{doc:e}=t,n=mo(e.theme),r=n.structure,o=Lo(e,t.eventConfigurationId??e.eventConfigurationId),i=t.seats,a=new Et,s=new Map;for(let N of o)for(let v of N.objects)s.set(v.id,N.index),v.type==="section"&&s.set(v.logicalSectionId??v.id,N.index);let u=i.map(N=>s.get(N.sectionId??"")??s.get(N.rowId??"")??0),l=An(o,i);hr(a,o,i,u,l,r);let m=Vo(e,i),d=new Map;for(let N of e.categories??[])d.set(N.key,N.color);let p=[],c=No(o,i,u),f=new Float32Array(i.length);for(let N=0;N<o.length;N++){let v=o[N];a.setFloor(N);let M=new Bt,C=[],G=v.objects.filter(w=>w.type==="section"&&!!w.outline&&w.outline.length>=3);for(let w of v.objects)w.type==="section"?tr(a,w,v,zo(w,m),c.bySection.get(w.id),M,G,r):w.type==="shape"?(a.setMaterial(w.role==="screen"?1:0),Wo(a,w,v.baseHeightM,Ho(w,C),r,v.focal,p),a.setMaterial(0)):w.type==="gaArea"?qo(a,w,v.baseHeightM,te(d.get(w.categoryKey)),r):w.type==="booth"?Yo(a,w,v.baseHeightM,te(d.get(w.categoryKey)),r):w.type==="table"?Xo(a,w,v.baseHeightM,te(d.get(w.categoryKey)),r):w.type==="decorImage"&&Ko(a,w,v.baseHeightM,r);nr(a,v,i,c,r)}let h=o.length>1?{x:o.reduce((N,v)=>N+v.focal.x,0)/o.length,y:o.reduce((N,v)=>N+v.focal.y,0)/o.length}:e.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},b=io([a.build()]),g=uo(i,t.initialState,c,f,d),y=mr({doc:e,units:o,seats:i,surfaces:c,focal:h}),{labels:x,sections:P,rows:R}=dr({doc:e,units:o,seats:i,surfaces:c,seatData:g,hintedSeatFloor:u,zones:y,focal:h}),S=pr({doc:e,units:o,seats:i,surfaces:c,solids:b,hintedSeatFloor:u,seatFloor:f});fr(x,S),g.iYaw=co(g.iPosition,i.length,N=>i[N].rowId,N=>{let v=o[f[N]]?.focal??h;return[v.x*D,v.y*D]});let F=(l.minX+l.maxX)/2*D,B=(l.minY+l.maxY)/2*D,L=.5*Math.hypot((l.maxX-l.minX)*D,(l.maxY-l.minY)*D)||10,H=br(b,g,{cx:F,cz:B,radius:L}),O=yr(g,p,l,H.minY,H.maxY,L);return{solids:b,seats:g,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:L,groundY:0,box:O},renderBounds:{center:H.center,radius:H.radius},stateColorLUT:fo(n,ye),theme:n,seatCount:i.length,focalWorld:[h.x*D,1.5,h.y*D],zones:y,stages:p,sections:P,rows:R,labels:x,floors:S}}var rs=88,is=20,as={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},gr=new Set(["row","seat"]),xr={row:{x:62,y:16},seat:{x:46,y:18}},ss=te,Rn=t=>zn(t);function cs(t,e){let n=Rn(t),r=Rn(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function ls(t,e=[.04,.06,.1]){let n=Rn(e)<.42,r=n?"#f4f7fb":"#0b1220",o=ss(t),i=o&&cs(o,e)>=4.5?t:r;return n?{ink:i,backing:"rgba(8,12,22,.78)",border:"rgba(210,222,245,.24)"}:{ink:i,backing:"rgba(255,255,255,.84)",border:"rgba(11,18,32,.22)"}}var Gt=class{constructor(e,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",n.fontFamily&&(r.fontFamily=n.fontFamily),e.appendChild(this.root)}setVisible(e){this.root.style.visibility=e?"":"hidden"}setLabels(e){this.labels=e;for(let[n,r]of this.nodes)e.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(e){this.forcedDense=e}setSelectedSeatIds(e){this.selectedSeatLabelIds=new Set(Array.from(e,n=>`seat:${n}`))}update(e,n,r,o,i,a){if(!this.labels.length)return;let s=ir(o,i,{hasZoneLabels:this.labels.some(c=>c.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let u=[];for(let c of this.labels){if(!s.has(c.kind))continue;let f=zt(e,c.anchor,n,r);if(!f.visible)continue;let h=a?Math.hypot(c.anchor[0]-a[0],c.anchor[1]-a[1],c.anchor[2]-a[2]):1;u.push({label:c,screen:f,focus:cr(f,h,n,r),...this.selectedSeatLabelIds.has(c.id)?{priority:1}:{}})}let l=rr(u.filter(c=>c.label.kind==="floor"),n),m=[...u.filter(c=>!gr.has(c.label.kind)&&c.label.kind!=="floor"),...l],d=[...ar(m,rs,is),...["row","seat"].flatMap(c=>lr(u.filter(f=>f.label.kind===c),xr[c].x,xr[c].y,sr[c]))],p=new Set(d.map(c=>c.label.id));for(let{label:c,screen:f}of d){let b=this.nodeFor(c).style;b.display="",b.transform=`translate(-50%, -50%) translate(${f.x.toFixed(1)}px, ${f.y.toFixed(1)}px)`}for(let[c,f]of this.nodes)p.has(c)||(f.style.display="none")}nodeFor(e){let n=this.nodes.get(e.id);if(!n){n=document.createElement("div");let u=n.style;u.position="absolute",u.left="0",u.top="0",u.whiteSpace="nowrap",u.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",u.display="none",this.root.appendChild(n),this.nodes.set(e.id,n)}n.textContent=e.text,n.setAttribute("data-label-kind",e.kind);let r=this.selectedSeatLabelIds.has(e.id);n.toggleAttribute("data-selected-seat",r);let o=as[e.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=ls(e.color??this.opts.ink,this.opts.backgroundRgb),s=!gr.has(e.kind);return i.color=r?"#ecf8ff":a.ink,i.background=r?"rgba(10,28,45,.9)":s?a.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${a.border}`:"",i.borderRadius=r||s?"999px":"",i.padding=r||s?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em",(e.kind==="zone"||e.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var fe=require("ogl");var _e=require("ogl");var Ht=`
2
2
  float chairWeight(float depth) {
3
3
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
4
- }`,Sr=`
4
+ }`,vr=`
5
5
  float occupantWeight(float depth) {
6
- float nearWeight = smoothstep(${qn.toFixed(1)}, ${$n.toFixed(1)}, depth);
7
- float farWeight = 1.0 - smoothstep(${Wn.toFixed(1)}, ${Kn.toFixed(1)}, depth);
6
+ float nearWeight = smoothstep(${Kn.toFixed(1)}, ${qn.toFixed(1)}, depth);
7
+ float farWeight = 1.0 - smoothstep(${Xn.toFixed(1)}, ${Wn.toFixed(1)}, depth);
8
8
  return nearWeight * farWeight;
9
- }`,ls=`#version 300 es
9
+ }`,us=`#version 300 es
10
10
  precision highp float;
11
11
  in vec3 position;
12
12
  in vec3 normal;
@@ -42,7 +42,7 @@ void main() {
42
42
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
43
43
  vColor = color;
44
44
  gl_Position = projectionMatrix * mv;
45
- }`,us=`#version 300 es
45
+ }`,ms=`#version 300 es
46
46
  precision highp float;
47
47
  in vec3 vColor;
48
48
  in vec3 vNormalWorld;
@@ -130,7 +130,7 @@ out float vDim;
130
130
  out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
131
131
  out float vPhysicalSeat;
132
132
  out float vPixelRadius;
133
- ${jt}
133
+ ${Ht}
134
134
  void main() {
135
135
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
136
136
  float depth = max(-mv.z, 0.001);
@@ -163,7 +163,7 @@ void main() {
163
163
  vPhysicalSeat = iPhysicalSeat;
164
164
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
165
165
  gl_Position = projectionMatrix * mv;
166
- }`,ms=`#version 300 es
166
+ }`,fs=`#version 300 es
167
167
  precision highp float;
168
168
  in vec2 vUv;
169
169
  in vec3 vColor;
@@ -221,7 +221,7 @@ void main() {
221
221
  alpha *= vDotWeight;
222
222
  if (alpha <= 0.0) discard;
223
223
  fragColor = vec4(c, alpha);
224
- }`,fs=`#version 300 es
224
+ }`,ps=`#version 300 es
225
225
  precision highp float;
226
226
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
227
227
  in vec3 normal;
@@ -251,8 +251,8 @@ out vec3 vRing;
251
251
  out float vDim;
252
252
  out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
253
253
  out vec3 vOccupantTint;
254
- ${jt}
255
- ${Sr}
254
+ ${Ht}
255
+ ${vr}
256
256
  void main() {
257
257
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
258
258
  float viewDepth = -anchor.z;
@@ -335,7 +335,7 @@ void main() {
335
335
  vRing = iRing;
336
336
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
337
337
  gl_Position = projectionMatrix * mv;
338
- }`,ps=`#version 300 es
338
+ }`,hs=`#version 300 es
339
339
  precision highp float;
340
340
  in vec3 vColor;
341
341
  in vec3 vNormalWorld;
@@ -385,14 +385,14 @@ void main() {
385
385
  // which is what stops a block of them merging into one mass up close.
386
386
  base += vec3(0.26, 0.31, 0.38) * fres * 0.55;
387
387
  fragColor = vec4(base, 1.0);
388
- }`,hs=`#version 300 es
388
+ }`,bs=`#version 300 es
389
389
  precision highp float;
390
390
  in vec2 position;
391
391
  out vec2 vUv;
392
392
  void main() {
393
393
  vUv = position * 0.5 + 0.5;
394
394
  gl_Position = vec4(position, 0.999, 1.0);
395
- }`,bs=`#version 300 es
395
+ }`,ys=`#version 300 es
396
396
  precision highp float;
397
397
  in vec2 vUv;
398
398
  uniform vec3 uTop;
@@ -403,7 +403,7 @@ void main() {
403
403
  vec2 c = vUv - 0.5;
404
404
  float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
405
405
  fragColor = vec4(col * vig, 1.0);
406
- }`,ys=`#version 300 es
406
+ }`,gs=`#version 300 es
407
407
  precision highp float;
408
408
  in vec2 position;
409
409
  in vec3 iOffset;
@@ -424,7 +424,7 @@ out float vPhysicalSeat;
424
424
  out float vDotWeight;
425
425
  out float vHidden;
426
426
  flat out vec3 vPick;
427
- ${jt}
427
+ ${Ht}
428
428
  void main() {
429
429
  int id = gl_InstanceID + 1; // 0 reserved for no-hit
430
430
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -440,7 +440,7 @@ void main() {
440
440
  vPhysicalSeat = iPhysicalSeat;
441
441
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
442
442
  gl_Position = projectionMatrix * mv;
443
- }`,gs=`#version 300 es
443
+ }`,xs=`#version 300 es
444
444
  precision highp float;
445
445
  in vec2 vUv;
446
446
  in float vPhysicalSeat;
@@ -454,7 +454,7 @@ void main() {
454
454
  float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
455
455
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
456
456
  fragColor = vec4(vPick, 1.0);
457
- }`,xs=`#version 300 es
457
+ }`,vs=`#version 300 es
458
458
  precision highp float;
459
459
  in vec3 position;
460
460
  in float part;
@@ -474,8 +474,8 @@ uniform float uBackBase;
474
474
  uniform float uFocusFloor;
475
475
  flat out vec3 vPick;
476
476
  out float vHidden;
477
- ${jt}
478
- ${Sr}
477
+ ${Ht}
478
+ ${vr}
479
479
  void main() {
480
480
  int id = int(iPickIndex + 0.5); // already global index + 1
481
481
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -505,7 +505,7 @@ void main() {
505
505
  float c = cos(iYaw), s = sin(iYaw);
506
506
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
507
507
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
508
- }`,vs=`#version 300 es
508
+ }`,Ms=`#version 300 es
509
509
  precision highp float;
510
510
  flat in vec3 vPick;
511
511
  in float vHidden;
@@ -524,14 +524,14 @@ out float vHidden;
524
524
  void main() {
525
525
  vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
526
526
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
527
- }`,Ms=`#version 300 es
527
+ }`,ws=`#version 300 es
528
528
  precision highp float;
529
529
  in float vHidden;
530
530
  out vec4 fragColor;
531
531
  void main() {
532
532
  if (vHidden > 0.5) discard;
533
533
  fragColor = vec4(0.0, 0.0, 0.0, 1.0);
534
- }`;function Mr(t){return new Ge.Program(t,{vertex:ys,fragment:gs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:ke},uSeatScale:{value:1},uMinPixels:{value:et},uPixelToWorld:{value:.002},uChairFull:{value:mt},uChairNone:{value:tt},uFocusFloor:{value:-1}}})}function wr(t){return new Ge.Program(t,{vertex:xs,fragment:vs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:mt},uChairNone:{value:tt},uBackRake:{value:pn},uBackBase:{value:Ot},uFocusFloor:{value:-1}}})}function Pr(t){return new Ge.Program(t,{vertex:Ss,fragment:Ms,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function Cr(t){return new Ge.Program(t,{vertex:ls,fragment:us,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function Ar(t){return new Ge.Program(t,{vertex:ds,fragment:ms,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:ke},uSeatScale:{value:1},uMinPixels:{value:et},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:mt},uChairNone:{value:tt}}})}function Rr(t){return new Ge.Program(t,{vertex:fs,fragment:ps,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:mt},uChairNone:{value:tt},uBackRake:{value:pn},uBackBase:{value:Ot},uFocusFloor:{value:-1}}})}function Ir(t,e,n){return new Ge.Program(t,{vertex:hs,fragment:bs,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(n)}}})}function Tr(t,e,n,r,o,i){for(let a=n;a<n+r;a++){let u=i&&e[a]===0?null:o[e[a]]??o[0];t[a*3]=u?u[0]:i[a*3],t[a*3+1]=u?u[1]:i[a*3+1],t[a*3+2]=u?u[2]:i[a*3+2]}}var ws=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Ps=new Float32Array([-1,-1,3,-1,-1,3]);function Er(t,e){let n=new pe.Transform,r=new pe.Transform,o=new pe.Geometry(t,{position:{size:2,data:Ps}}),i=Ir(t,e.theme.background.top,e.theme.background.bottom),a=new pe.Mesh(t,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new pe.Geometry(t,{position:{size:3,data:e.solids.position},normal:{size:3,data:e.solids.normal},color:{size:3,data:e.solids.color},floorIndex:{size:1,data:e.solids.floor},materialIndex:{size:1,data:e.solids.material}}),u=Cr(t),l=new pe.Mesh(t,{geometry:s,program:u});l.frustumCulled=!1,l.setParent(n);let d=Ar(t),m=new Float32Array(e.seats.count*3),p=Me.map(T=>e.theme.seatStates[T]);Tr(m,e.seats.iState,0,e.seats.count,p,e.seats.iCategory);let c=new pe.Geometry(t,{position:{size:2,data:ws},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:m,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,instanced:1},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}}),f=new pe.Mesh(t,{geometry:c,program:d});f.frustumCulled=!1,e.seats.count>0&&f.setParent(n);let h=c.attributes.iColor,b=co(),g=Rr(t),y=It,x=new Float32Array(y*3),w=new Float32Array(y*3),R=new Float32Array(y),M=new Float32Array(y),k=new Float32Array(y*3),O=new Float32Array(y),L=new Float32Array(y),U=new Float32Array(y),z=new Float32Array(y),_=new pe.Geometry(t,{position:{size:3,data:b.position},normal:{size:3,data:b.normal},part:{size:1,data:b.part},index:{data:b.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:w,instanced:1},iRadius:{size:1,data:R,instanced:1},iYaw:{size:1,data:M,instanced:1},iRing:{size:3,data:k,instanced:1},iFloor:{size:1,data:O,instanced:1},iPhysicalSeat:{size:1,data:L,instanced:1},iSeed:{size:1,data:z,instanced:1},iPickIndex:{size:1,data:U,instanced:1}}),v=new pe.Mesh(t,{geometry:_,program:g});v.frustumCulled=!1;let S=0,C=new Int32Array(0),G=()=>{let T=e.seats;for(let I=0;I<S;I++){let E=C[I];z[I]=uo(T.iState[E],E);let F=T.iCategory&&T.iState[E]===0?null:p[T.iState[E]]??p[0];if(F)w[I*3]=F[0],w[I*3+1]=F[1],w[I*3+2]=F[2];else{let N=Un([T.iCategory[E*3],T.iCategory[E*3+1],T.iCategory[E*3+2]]);w[I*3]=N[0],w[I*3+1]=N[1],w[I*3+2]=N[2]}}_.attributes.iColor.needsUpdate=!0,_.attributes.iSeed.needsUpdate=!0},P={main:n,background:r,seatProgram:d,solidProgram:u,chairProgram:g,seatGeometry:c,chairGeometry:_,solidGeometry:s,drawCalls:3,setNearSeats(T,I){let E=Math.min(I,y);if(C=T,S=E,E===0){v.parent&&v.setParent(null),_.instancedCount=0,P.drawCalls=3;return}let A=e.seats;for(let F=0;F<E;F++){let N=T[F];x[F*3]=A.iPosition[N*3],x[F*3+1]=A.iPosition[N*3+1],x[F*3+2]=A.iPosition[N*3+2],R[F]=A.iChairWidth[N],M[F]=A.iYaw[N],k[F*3]=A.iRing[N*3],k[F*3+1]=A.iRing[N*3+1],k[F*3+2]=A.iRing[N*3+2],O[F]=A.iFloor[N],L[F]=A.iPhysicalSeat[N],U[F]=N+1}G(),_.attributes.iOffset.needsUpdate=!0,_.attributes.iRadius.needsUpdate=!0,_.attributes.iYaw.needsUpdate=!0,_.attributes.iRing.needsUpdate=!0,_.attributes.iFloor.needsUpdate=!0,_.attributes.iPhysicalSeat.needsUpdate=!0,_.attributes.iSeed.needsUpdate=!0,_.attributes.iPickIndex.needsUpdate=!0,_.instancedCount=E,v.parent||v.setParent(n),P.drawCalls=4},nearSeatCount(){return S},uploadSeatStateRuns(T){if(!T.length)return;S&&G();for(let E of T)Tr(m,e.seats.iState,E.start,E.length,p,e.seats.iCategory);let I=h.buffer;if(!I){h.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,I);for(let E of T){let A=m.subarray(E.start*3,(E.start+E.length)*3);t.bufferSubData(t.ARRAY_BUFFER,E.start*3*Float32Array.BYTES_PER_ELEMENT,A)}},dispose(){o.remove(),i.remove(),s.remove(),u.remove(),c.remove(),d.remove(),_.remove(),g.remove()}};return P}var Ae=require("ogl");function Cs(t,e,n){let r=t+(e<<8)+(n<<16);return r===0?-1:r-1}function kr(t,e,n,r,o,i){let a=-1,s=1/0;for(let u=0;u<n;u++)for(let l=0;l<e;l++){let d=(u*e+l)*4,m=Cs(t[d],t[d+1],t[d+2]);if(m<0||m>=i)continue;let p=l-r,c=u-o,f=p*p+c*c;f<s&&(s=f,a=m)}return a}function Fr(t,e,n,r,o,i){let a=t-n.left,s=e-n.top,u=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,u)),y:Math.max(0,Math.min(i-1,l))}}var As=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Yt=class{constructor(e,n,r,o,i){this.seatScene=new Ae.Transform;this.chairScene=new Ae.Transform;this.solidScene=new Ae.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=i,this.seatProg=Mr(this.gl),this.chairProg=wr(this.gl),this.depthProg=Pr(this.gl);let a=new Ae.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Ae.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let u=new Ae.Mesh(this.gl,{geometry:o,program:this.depthProg});u.frustumCulled=!1,u.setParent(this.solidScene)}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let r of As)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 Ae.RenderTarget(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,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,u=i.drawingBufferHeight,l=Math.max(0,n-o),d=Math.max(0,r-o),m=Math.max(1,Math.min(s,n+o+1)-l),p=Math.max(1,Math.min(u,r+o+1)-d);i.enable(i.SCISSOR_TEST),i.scissor(l,d,m,p);let[c,f,h]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:e,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:e,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:e,target:a,clear:!1}),i.clearColor(c,f,h,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(m*p*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,d,m,p,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),kr(b,m,p,n-l,r-d,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Dr(t,e){let n=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,dt(r.state)):n.push(r);return n}function Lr(t,e,n){let r=new Set;for(let a of e)(t.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(t),i=[];for(let[a,s]of t)r.has(a)||(i.push({seatId:a,state:Me[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var He=require("ogl");function Rs(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function Or(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function Is(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function _r(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 En(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function kn(t,e){return Math.max(0,Math.min(1,t+e))}function Br(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)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=t[Math.max(0,i-1)],u=t[i],l=t[i+1],d=t[Math.min(n-1,i+2)],m=a*a,p=m*a,c=[0,0,0];for(let f=0;f<3;f++)c[f]=.5*(2*u[f]+(-s[f]+l[f])*a+(2*s[f]-5*u[f]+4*l[f]-d[f])*m+(-s[f]+3*u[f]-3*l[f]+d[f])*p);return c}function Fn(t,e,n,r,o){let i=_r(Rs(e,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Or(Or(e,Is(i,2.5)),[0,1.5,0]),s=[e[0]-r[0],0,e[2]-r[2]],u=_r(s);u[0]===0&&u[2]===0&&(u=[i[0],0,i[2]]);let l=Math.max(1,o),d=[r[0]+u[0]*l*1.3,r[1]+l*.75,r[2]+u[2]*l*1.3];return{waypoints:[t,d,a],finalPos:a}}function Dn(t,e,n=35,r=28){let o=En(e),i=Br(t,o),a=En(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function zr(t,e,n){let r=t.position.clone(),o=new He.Quat().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new He.Vec3(n[0],n[1],n[2]));let i=new He.Quat().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(o),i}var Xt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new He.Quat;this.endQuat=new He.Quat;this.outQuat=new He.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,n,r,o=2500,i=28){return this.settle(),this.waypoints=e,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(e){if(!this.active)return!1;let n=Math.min(1,(e-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Dn(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,kn(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let e=this.resolveFn;this.resolveFn=null,e&&e()}};var Ts=1.02,Es=1.5;function Gr(t,e,n=0,r){let o=Number.isFinite(r)?n+r:t[1]+Ts;return{eye:[t[0],o,t[2]],focal:[e.x*D,n+Es,e.y*D]}}function ks(t,e){return!Number.isFinite(t)||!Number.isFinite(e)||t<=0||e<=0?0:Math.ceil(t*e*4*(4/3))}function Fs(t){return(t!==void 0&&t<=2?32:t!==void 0&&t>=8?192:96)*1024*1024}function Wt(t){let e=typeof navigator>"u"?void 0:navigator;return{saveData:e?.connection?.saveData===!0,maxTextureSize:t,maxDecodedBytes:Fs(e?.deviceMemory)}}function Kt(t,e={}){let n=t.previewUrl?.trim();if(!n||n===t.url)return{initialUrl:t.url,initialWidth:t.sourceWidth,initialHeight:t.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:t.previewWidth,initialHeight:t.previewHeight};return e.saveData?{...r,reason:"save-data"}:e.maxTextureSize!==void 0&&t.sourceWidth!==void 0&&t.sourceHeight!==void 0&&Math.max(t.sourceWidth,t.sourceHeight)>e.maxTextureSize?{...r,reason:"texture-limit"}:e.maxDecodedBytes!==void 0&&t.sourceWidth!==void 0&&t.sourceHeight!==void 0&&ks(t.sourceWidth,t.sourceHeight)>e.maxDecodedBytes?{...r,reason:"memory-limit"}:{...r,upgradeUrl:t.url,reason:"progressive"}}function Hr(){return new DOMException("Panorama image load aborted","AbortError")}function Mt(t,e){return new Promise((n,r)=>{if(e?.aborted){r(Hr());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,e?.removeEventListener("abort",u)},s=l=>{i||(i=!0,a(),l?r(l):n(o))},u=()=>{o.src="",s(Hr())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),e?.addEventListener("abort",u,{once:!0}),o.src=t})}function qt(t){let e=globalThis;if(e.requestIdleCallback){let r=e.requestIdleCallback(t,{timeout:1200});return()=>e.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(t,32);return()=>globalThis.clearTimeout(n)}function jr(t){let e=t.mediaKind==="demo-render",n=t.generated||t.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":e?t.coverage==="exact-seat"?"AI-generated exact-seat demo":t.coverage==="row-representative"?"AI-generated representative row demo":t.coverage==="section-representative"?"AI-generated representative section demo":"AI-generated illustrative venue demo":t.coverage==="exact-seat"?"Exact seat photo":t.coverage==="row-representative"?"Representative row view":t.coverage==="section-representative"?"Representative section view":t.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=t.capturedAt&&/^\d{4}/.test(t.capturedAt)?t.capturedAt.slice(0,4):"";return[n,r?`${e?"created":"captured"} ${r}`:"",t.sourceLabel??""].filter(Boolean).join(" \xB7 ")}var Zt=70,Ds=35,Ls=90;function Ln(t){return Math.max(Ds,Math.min(Ls,t))}var Re=35;function Os(t,e,n){let r=(.5+t/360)*n;return e/2-r}function _s(t,e=Zt){return t*(180/e)}function Ur(t,e,n){return(t-e)/2+$t(n,e)}function $t(t,e){let n=Re/180*e;return Math.max(-n,Math.min(n,t))}function Yr(t,e,n={}){let r=n.fadeMs??400,o=e.initialBearingDeg??0,i=Kt(e,Wt()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let u=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;u.setAttribute("role","dialog"),u.setAttribute("aria-modal","true"),u.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),u.tabIndex=-1,Object.assign(u.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let d=document.createElement("div");Object.assign(d.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),u.appendChild(d);let m=document.createElement("button");if(m.type="button",m.setAttribute("aria-label","Close"),m.textContent="\u2715",Object.assign(m.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),u.appendChild(m),n.disclosure){let V=document.createElement("div");V.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(V.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),u.appendChild(V)}let p=document.createElement("div");p.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(p.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),u.appendChild(p),t.appendChild(u),m.focus({preventScroll:!0});let c=0,f=0,h=0,b=0,g=Zt,y=()=>{let V=u.clientHeight||1,B=u.clientWidth||1,j=R.naturalWidth||B*2,K=R.naturalHeight||V,J=c>0?(B/2-h)/c:0,Z=f>0?b/f:0;f=_s(V,g),c=f*(j/K),d.style.backgroundSize=`${c}px ${f}px`,x?h=B/2-J*c:(h=Os(o,B,c),b=$t((e.initialPitchDeg??0)/180*f,f),x=!0),b=$t(Z*f,f),d.style.backgroundPosition=`${h}px ${Ur(V,f,b)}px`},x=!1,w=()=>{let V=u.clientHeight||1;b=$t(b,f),d.style.backgroundPosition=`${h}px ${Ur(V,f,b)}px`},R=new Image;R.onload=y,R.src=i.initialUrl;let M=()=>{};i.upgradeUrl&&(M=qt(()=>{(e.resolveUrl?e.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(B=>!B||a.signal.aborted?null:Mt(B,a.signal).then(j=>({full:j,url:B}))).then(B=>{B&&(I||a.signal.aborted||(R=B.full,d.style.backgroundImage=`url("${B.url}")`,y()))}).catch(()=>{})})),requestAnimationFrame(y);let k=!1,O=0,L=0,U=0,z=new Map,_=()=>{let[V,B]=[...z.values()];return V&&B?Math.hypot(V.x-B.x,V.y-B.y):0},v=V=>{let B=Ln(V);B!==g&&(g=B,y())},S=V=>{z.set(V.pointerId,{x:V.clientX,y:V.clientY}),k=z.size===1,O=V.clientX,L=V.clientY,z.size===2&&(U=_()),d.style.cursor="grabbing";try{d.setPointerCapture?.(V.pointerId)}catch{}},C=V=>{if(z.has(V.pointerId)){if(z.set(V.pointerId,{x:V.clientX,y:V.clientY}),z.size>=2){let B=_();U>0&&B>0&&v(g*(U/B)),U=B,k=!1;return}k&&(h+=V.clientX-O,b+=V.clientY-L,O=V.clientX,L=V.clientY,w())}},G=V=>{z.delete(V.pointerId),U=z.size===2?_():0;let B=z.values().next().value;k=z.size===1,B?(O=B.x,L=B.y):d.style.cursor="grab";try{d.releasePointerCapture?.(V.pointerId)}catch{}},P=V=>{V.preventDefault(),v(g+V.deltaY*.04)};d.addEventListener("pointerdown",S),d.addEventListener("pointermove",C),d.addEventListener("pointerup",G),d.addEventListener("pointercancel",G),d.addEventListener("wheel",P,{passive:!1});let T=!1,I=!1,E=0,A=()=>{d.removeEventListener("pointerdown",S),d.removeEventListener("pointermove",C),d.removeEventListener("pointerup",G),d.removeEventListener("pointercancel",G),d.removeEventListener("wheel",P),window.removeEventListener("keydown",Y)},F=()=>{M(),a.abort(),n.signal?.removeEventListener("abort",s),E&&(window.clearTimeout(E),E=0),A(),u.parentNode&&u.parentNode.removeChild(u),l?.isConnected&&l.focus({preventScroll:!0})},N=()=>{if(T)return;T=!0,u.style.opacity="0";let V=()=>{E=0,!I&&(F(),n.onClose?.())};E=window.setTimeout(V,r)},Y=V=>{if(V.key==="Tab"){V.preventDefault(),m.focus({preventScroll:!0});return}if(V.key==="Escape"){V.stopPropagation(),N();return}if(V.key==="ArrowLeft"||V.key==="ArrowRight")h+=V.key==="ArrowLeft"?-32:32;else if(V.key==="ArrowUp"||V.key==="ArrowDown")b+=(V.key==="ArrowUp"?4:-4)*(f/180);else if(V.key==="+"||V.key==="="){v(g-5),V.preventDefault();return}else if(V.key==="-"){v(g+5),V.preventDefault();return}else return;V.preventDefault(),w()};return window.addEventListener("keydown",Y),m.addEventListener("click",N),requestAnimationFrame(()=>{u.style.opacity="1"}),{close:N,dispose(){T=!0,I=!0,F()}}}var Ue=require("ogl"),Bs=64,Ns=32,Vs=500;function zs(t=Bs,e=Ns,n=Vs){let r=t+1,o=e+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let d=0;d<o;d++){let m=d/e,p=m*Math.PI,c=Math.sin(p),f=Math.cos(p);for(let h=0;h<r;h++){let b=h/t,g=(b-.5)*Math.PI*2,y=d*r+h;a[y*3]=n*c*Math.sin(g),a[y*3+1]=n*f,a[y*3+2]=-n*c*Math.cos(g),s[y*2]=b,s[y*2+1]=m}}let u=new Uint16Array(t*e*6),l=0;for(let d=0;d<e;d++)for(let m=0;m<t;m++){let p=d*r+m,c=p+r;u[l++]=p,u[l++]=c,u[l++]=p+1,u[l++]=p+1,u[l++]=c,u[l++]=c+1}return{position:a,uv:s,index:u}}function Xr(t,e){let n=t*Math.PI/180,r=e*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}var Gs=`#version 300 es
534
+ }`;function Mr(t){return new _e.Program(t,{vertex:gs,fragment:xs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Pe},uSeatScale:{value:1},uMinPixels:{value:Je},uPixelToWorld:{value:.002},uChairFull:{value:mt},uChairNone:{value:et},uFocusFloor:{value:-1}}})}function Sr(t){return new _e.Program(t,{vertex:vs,fragment:Ms,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:mt},uChairNone:{value:et},uBackRake:{value:dn},uBackBase:{value:Dt},uFocusFloor:{value:-1}}})}function wr(t){return new _e.Program(t,{vertex:Ss,fragment:ws,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function Pr(t){return new _e.Program(t,{vertex:us,fragment:ms,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function Cr(t){return new _e.Program(t,{vertex:ds,fragment:fs,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Pe},uSeatScale:{value:1},uMinPixels:{value:Je},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:mt},uChairNone:{value:et}}})}function Ar(t){return new _e.Program(t,{vertex:ps,fragment:hs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:mt},uChairNone:{value:et},uBackRake:{value:dn},uBackBase:{value:Dt},uFocusFloor:{value:-1}}})}function Rr(t,e,n){return new _e.Program(t,{vertex:bs,fragment:ys,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(n)}}})}function Ir(t,e,n,r,o,i){for(let a=n;a<n+r;a++){let u=i&&e[a]===0?null:o[e[a]]??o[0];t[a*3]=u?u[0]:i[a*3],t[a*3+1]=u?u[1]:i[a*3+1],t[a*3+2]=u?u[2]:i[a*3+2]}}var Ps=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Cs=new Float32Array([-1,-1,3,-1,-1,3]);function Tr(t,e){let n=new fe.Transform,r=new fe.Transform,o=new fe.Geometry(t,{position:{size:2,data:Cs}}),i=Rr(t,e.theme.background.top,e.theme.background.bottom),a=new fe.Mesh(t,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new fe.Geometry(t,{position:{size:3,data:e.solids.position},normal:{size:3,data:e.solids.normal},color:{size:3,data:e.solids.color},floorIndex:{size:1,data:e.solids.floor},materialIndex:{size:1,data:e.solids.material}}),u=Pr(t),l=new fe.Mesh(t,{geometry:s,program:u});l.frustumCulled=!1,l.setParent(n);let m=Cr(t),d=new Float32Array(e.seats.count*3),p=ye.map(E=>e.theme.seatStates[E]);Ir(d,e.seats.iState,0,e.seats.count,p,e.seats.iCategory);let c=new fe.Geometry(t,{position:{size:2,data:Ps},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:d,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:e.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:e.seats.iRing,instanced:1},iFloor:{size:1,data:e.seats.iFloor,instanced:1}}),f=new fe.Mesh(t,{geometry:c,program:m});f.frustumCulled=!1,e.seats.count>0&&f.setParent(n);let h=c.attributes.iColor,b=so(),g=Ar(t),y=At,x=new Float32Array(y*3),P=new Float32Array(y*3),R=new Float32Array(y),S=new Float32Array(y),F=new Float32Array(y*3),B=new Float32Array(y),L=new Float32Array(y),H=new Float32Array(y),O=new Float32Array(y),N=new fe.Geometry(t,{position:{size:3,data:b.position},normal:{size:3,data:b.normal},part:{size:1,data:b.part},index:{data:b.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:P,instanced:1},iRadius:{size:1,data:R,instanced:1},iYaw:{size:1,data:S,instanced:1},iRing:{size:3,data:F,instanced:1},iFloor:{size:1,data:B,instanced:1},iPhysicalSeat:{size:1,data:L,instanced:1},iSeed:{size:1,data:O,instanced:1},iPickIndex:{size:1,data:H,instanced:1}}),v=new fe.Mesh(t,{geometry:N,program:g});v.frustumCulled=!1;let M=0,C=new Int32Array(0),G=()=>{let E=e.seats;for(let I=0;I<M;I++){let T=C[I];O[I]=lo(E.iState[T],T);let k=E.iCategory&&E.iState[T]===0?null:p[E.iState[T]]??p[0];if(k)P[I*3]=k[0],P[I*3+1]=k[1],P[I*3+2]=k[2];else{let V=Hn([E.iCategory[T*3],E.iCategory[T*3+1],E.iCategory[T*3+2]]);P[I*3]=V[0],P[I*3+1]=V[1],P[I*3+2]=V[2]}}N.attributes.iColor.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0},w={main:n,background:r,seatProgram:m,solidProgram:u,chairProgram:g,seatGeometry:c,chairGeometry:N,solidGeometry:s,drawCalls:3,setNearSeats(E,I){let T=Math.min(I,y);if(C=E,M=T,T===0){v.parent&&v.setParent(null),N.instancedCount=0,w.drawCalls=3;return}let A=e.seats;for(let k=0;k<T;k++){let V=E[k];x[k*3]=A.iPosition[V*3],x[k*3+1]=A.iPosition[V*3+1],x[k*3+2]=A.iPosition[V*3+2],R[k]=A.iChairWidth[V],S[k]=A.iYaw[V],F[k*3]=A.iRing[V*3],F[k*3+1]=A.iRing[V*3+1],F[k*3+2]=A.iRing[V*3+2],B[k]=A.iFloor[V],L[k]=A.iPhysicalSeat[V],H[k]=V+1}G(),N.attributes.iOffset.needsUpdate=!0,N.attributes.iRadius.needsUpdate=!0,N.attributes.iYaw.needsUpdate=!0,N.attributes.iRing.needsUpdate=!0,N.attributes.iFloor.needsUpdate=!0,N.attributes.iPhysicalSeat.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0,N.attributes.iPickIndex.needsUpdate=!0,N.instancedCount=T,v.parent||v.setParent(n),w.drawCalls=4},nearSeatCount(){return M},uploadSeatStateRuns(E){if(!E.length)return;M&&G();for(let T of E)Ir(d,e.seats.iState,T.start,T.length,p,e.seats.iCategory);let I=h.buffer;if(!I){h.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,I);for(let T of E){let A=d.subarray(T.start*3,(T.start+T.length)*3);t.bufferSubData(t.ARRAY_BUFFER,T.start*3*Float32Array.BYTES_PER_ELEMENT,A)}},dispose(){o.remove(),i.remove(),s.remove(),u.remove(),c.remove(),m.remove(),N.remove(),g.remove()}};return w}var Me=require("ogl");function As(t,e,n){let r=t+(e<<8)+(n<<16);return r===0?-1:r-1}function Er(t,e,n,r,o,i){let a=-1,s=1/0;for(let u=0;u<n;u++)for(let l=0;l<e;l++){let m=(u*e+l)*4,d=As(t[m],t[m+1],t[m+2]);if(d<0||d>=i)continue;let p=l-r,c=u-o,f=p*p+c*c;f<s&&(s=f,a=d)}return a}function kr(t,e,n,r,o,i){let a=t-n.left,s=e-n.top,u=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,u)),y:Math.max(0,Math.min(i-1,l))}}var Rs=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Ut=class{constructor(e,n,r,o,i){this.seatScene=new Me.Transform;this.chairScene=new Me.Transform;this.solidScene=new Me.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=i,this.seatProg=Mr(this.gl),this.chairProg=Sr(this.gl),this.depthProg=wr(this.gl);let a=new Me.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Me.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let u=new Me.Mesh(this.gl,{geometry:o,program:this.depthProg});u.frustumCulled=!1,u.setParent(this.solidScene)}setRestoreClear(e){this.restoreClear=[e[0],e[1],e[2]]}syncFromSeatProgram(e){for(let r of Rs)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 Me.RenderTarget(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,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,u=i.drawingBufferHeight,l=Math.max(0,n-o),m=Math.max(0,r-o),d=Math.max(1,Math.min(s,n+o+1)-l),p=Math.max(1,Math.min(u,r+o+1)-m);i.enable(i.SCISSOR_TEST),i.scissor(l,m,d,p);let[c,f,h]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:e,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:e,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:e,target:a,clear:!1}),i.clearColor(c,f,h,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(d*p*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,m,d,p,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),Er(b,d,p,n-l,r-m,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Fr(t,e){let n=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,ut(r.state)):n.push(r);return n}function Dr(t,e,n){let r=new Set;for(let a of e)(t.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(t),i=[];for(let[a,s]of t)r.has(a)||(i.push({seatId:a,state:ye[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var Be=require("ogl");function Is(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function Lr(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function Ts(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Or(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 In(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function Tn(t,e){return Math.max(0,Math.min(1,t+e))}function _r(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)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=t[Math.max(0,i-1)],u=t[i],l=t[i+1],m=t[Math.min(n-1,i+2)],d=a*a,p=d*a,c=[0,0,0];for(let f=0;f<3;f++)c[f]=.5*(2*u[f]+(-s[f]+l[f])*a+(2*s[f]-5*u[f]+4*l[f]-m[f])*d+(-s[f]+3*u[f]-3*l[f]+m[f])*p);return c}function En(t,e,n,r,o){let i=Or(Is(e,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Lr(Lr(e,Ts(i,2.5)),[0,1.5,0]),s=[e[0]-r[0],0,e[2]-r[2]],u=Or(s);u[0]===0&&u[2]===0&&(u=[i[0],0,i[2]]);let l=Math.max(1,o),m=[r[0]+u[0]*l*1.3,r[1]+l*.75,r[2]+u[2]*l*1.3];return{waypoints:[t,m,a],finalPos:a}}function kn(t,e,n=35,r=28){let o=In(e),i=_r(t,o),a=In(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Vr(t,e,n){let r=t.position.clone(),o=new Be.Quat().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new Be.Vec3(n[0],n[1],n[2]));let i=new Be.Quat().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(o),i}var jt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new Be.Quat;this.endQuat=new Be.Quat;this.outQuat=new Be.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=e}start(e,n,r,o=2500,i=28){return this.settle(),this.waypoints=e,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(e){if(!this.active)return!1;let n=Math.min(1,(e-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=kn(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,Tn(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let e=this.resolveFn;this.resolveFn=null,e&&e()}};var Es=1.02,ks=1.5;function zr(t,e,n=0,r){let o=Number.isFinite(r)?n+r:t[1]+Es;return{eye:[t[0],o,t[2]],focal:[e.x*D,n+ks,e.y*D]}}function Fs(t,e){return!Number.isFinite(t)||!Number.isFinite(e)||t<=0||e<=0?0:Math.ceil(t*e*4*(4/3))}function Ds(t){return(t!==void 0&&t<=2?32:t!==void 0&&t>=8?192:96)*1024*1024}function Yt(t){let e=typeof navigator>"u"?void 0:navigator;return{saveData:e?.connection?.saveData===!0,maxTextureSize:t,maxDecodedBytes:Ds(e?.deviceMemory)}}function Xt(t,e={}){let n=t.previewUrl?.trim();if(!n||n===t.url)return{initialUrl:t.url,initialWidth:t.sourceWidth,initialHeight:t.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:t.previewWidth,initialHeight:t.previewHeight};return e.saveData?{...r,reason:"save-data"}:e.maxTextureSize!==void 0&&t.sourceWidth!==void 0&&t.sourceHeight!==void 0&&Math.max(t.sourceWidth,t.sourceHeight)>e.maxTextureSize?{...r,reason:"texture-limit"}:e.maxDecodedBytes!==void 0&&t.sourceWidth!==void 0&&t.sourceHeight!==void 0&&Fs(t.sourceWidth,t.sourceHeight)>e.maxDecodedBytes?{...r,reason:"memory-limit"}:{...r,upgradeUrl:t.url,reason:"progressive"}}function Gr(){return new DOMException("Panorama image load aborted","AbortError")}function Mt(t,e){return new Promise((n,r)=>{if(e?.aborted){r(Gr());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,e?.removeEventListener("abort",u)},s=l=>{i||(i=!0,a(),l?r(l):n(o))},u=()=>{o.src="",s(Gr())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),e?.addEventListener("abort",u,{once:!0}),o.src=t})}function Wt(t){let e=globalThis;if(e.requestIdleCallback){let r=e.requestIdleCallback(t,{timeout:1200});return()=>e.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(t,32);return()=>globalThis.clearTimeout(n)}function Ur(t){let e=t.mediaKind==="demo-render",n=t.generated||t.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":e?t.coverage==="exact-seat"?"AI-generated exact-seat demo":t.coverage==="row-representative"?"AI-generated representative row demo":t.coverage==="section-representative"?"AI-generated representative section demo":"AI-generated illustrative venue demo":t.coverage==="exact-seat"?"Exact seat photo":t.coverage==="row-representative"?"Representative row view":t.coverage==="section-representative"?"Representative section view":t.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=t.capturedAt&&/^\d{4}/.test(t.capturedAt)?t.capturedAt.slice(0,4):"";return[n,r?`${e?"created":"captured"} ${r}`:"",t.sourceLabel??""].filter(Boolean).join(" \xB7 ")}var qt=70,Ls=35,Os=90;function Fn(t){return Math.max(Ls,Math.min(Os,t))}var Se=35;function _s(t,e,n){let r=(.5+t/360)*n;return e/2-r}function Bs(t,e=qt){return t*(180/e)}function Hr(t,e,n){return(t-e)/2+Kt(n,e)}function Kt(t,e){let n=Se/180*e;return Math.max(-n,Math.min(n,t))}function jr(t,e,n={}){let r=n.fadeMs??400,o=e.initialBearingDeg??0,i=Xt(e,Yt()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let u=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;u.setAttribute("role","dialog"),u.setAttribute("aria-modal","true"),u.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),u.tabIndex=-1,Object.assign(u.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let m=document.createElement("div");Object.assign(m.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),u.appendChild(m);let d=document.createElement("button");if(d.type="button",d.setAttribute("aria-label","Close"),d.textContent="\u2715",Object.assign(d.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),u.appendChild(d),n.disclosure){let z=document.createElement("div");z.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(z.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),u.appendChild(z)}let p=document.createElement("div");p.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(p.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),u.appendChild(p),t.appendChild(u),d.focus({preventScroll:!0});let c=0,f=0,h=0,b=0,g=qt,y=()=>{let z=u.clientHeight||1,_=u.clientWidth||1,U=R.naturalWidth||_*2,W=R.naturalHeight||z,Q=c>0?(_/2-h)/c:0,$=f>0?b/f:0;f=Bs(z,g),c=f*(U/W),m.style.backgroundSize=`${c}px ${f}px`,x?h=_/2-Q*c:(h=_s(o,_,c),b=Kt((e.initialPitchDeg??0)/180*f,f),x=!0),b=Kt($*f,f),m.style.backgroundPosition=`${h}px ${Hr(z,f,b)}px`},x=!1,P=()=>{let z=u.clientHeight||1;b=Kt(b,f),m.style.backgroundPosition=`${h}px ${Hr(z,f,b)}px`},R=new Image;R.onload=y,R.src=i.initialUrl;let S=()=>{};i.upgradeUrl&&(S=Wt(()=>{(e.resolveUrl?e.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(_=>!_||a.signal.aborted?null:Mt(_,a.signal).then(U=>({full:U,url:_}))).then(_=>{_&&(I||a.signal.aborted||(R=_.full,m.style.backgroundImage=`url("${_.url}")`,y()))}).catch(()=>{})})),requestAnimationFrame(y);let F=!1,B=0,L=0,H=0,O=new Map,N=()=>{let[z,_]=[...O.values()];return z&&_?Math.hypot(z.x-_.x,z.y-_.y):0},v=z=>{let _=Fn(z);_!==g&&(g=_,y())},M=z=>{O.set(z.pointerId,{x:z.clientX,y:z.clientY}),F=O.size===1,B=z.clientX,L=z.clientY,O.size===2&&(H=N()),m.style.cursor="grabbing";try{m.setPointerCapture?.(z.pointerId)}catch{}},C=z=>{if(O.has(z.pointerId)){if(O.set(z.pointerId,{x:z.clientX,y:z.clientY}),O.size>=2){let _=N();H>0&&_>0&&v(g*(H/_)),H=_,F=!1;return}F&&(h+=z.clientX-B,b+=z.clientY-L,B=z.clientX,L=z.clientY,P())}},G=z=>{O.delete(z.pointerId),H=O.size===2?N():0;let _=O.values().next().value;F=O.size===1,_?(B=_.x,L=_.y):m.style.cursor="grab";try{m.releasePointerCapture?.(z.pointerId)}catch{}},w=z=>{z.preventDefault(),v(g+z.deltaY*.04)};m.addEventListener("pointerdown",M),m.addEventListener("pointermove",C),m.addEventListener("pointerup",G),m.addEventListener("pointercancel",G),m.addEventListener("wheel",w,{passive:!1});let E=!1,I=!1,T=0,A=()=>{m.removeEventListener("pointerdown",M),m.removeEventListener("pointermove",C),m.removeEventListener("pointerup",G),m.removeEventListener("pointercancel",G),m.removeEventListener("wheel",w),window.removeEventListener("keydown",Y)},k=()=>{S(),a.abort(),n.signal?.removeEventListener("abort",s),T&&(window.clearTimeout(T),T=0),A(),u.parentNode&&u.parentNode.removeChild(u),l?.isConnected&&l.focus({preventScroll:!0})},V=()=>{if(E)return;E=!0,u.style.opacity="0";let z=()=>{T=0,!I&&(k(),n.onClose?.())};T=window.setTimeout(z,r)},Y=z=>{if(z.key==="Tab"){z.preventDefault(),d.focus({preventScroll:!0});return}if(z.key==="Escape"){z.stopPropagation(),V();return}if(z.key==="ArrowLeft"||z.key==="ArrowRight")h+=z.key==="ArrowLeft"?-32:32;else if(z.key==="ArrowUp"||z.key==="ArrowDown")b+=(z.key==="ArrowUp"?4:-4)*(f/180);else if(z.key==="+"||z.key==="="){v(g-5),z.preventDefault();return}else if(z.key==="-"){v(g+5),z.preventDefault();return}else return;z.preventDefault(),P()};return window.addEventListener("keydown",Y),d.addEventListener("click",V),requestAnimationFrame(()=>{u.style.opacity="1"}),{close:V,dispose(){E=!0,I=!0,k()}}}var Ne=require("ogl"),Ns=64,Vs=32,zs=500;function Gs(t=Ns,e=Vs,n=zs){let r=t+1,o=e+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let m=0;m<o;m++){let d=m/e,p=d*Math.PI,c=Math.sin(p),f=Math.cos(p);for(let h=0;h<r;h++){let b=h/t,g=(b-.5)*Math.PI*2,y=m*r+h;a[y*3]=n*c*Math.sin(g),a[y*3+1]=n*f,a[y*3+2]=-n*c*Math.cos(g),s[y*2]=b,s[y*2+1]=d}}let u=new Uint16Array(t*e*6),l=0;for(let m=0;m<e;m++)for(let d=0;d<t;d++){let p=m*r+d,c=p+r;u[l++]=p,u[l++]=c,u[l++]=p+1,u[l++]=p+1,u[l++]=c,u[l++]=c+1}return{position:a,uv:s,index:u}}function Yr(t,e){let n=t*Math.PI/180,r=e*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}var Hs=`#version 300 es
535
535
  precision highp float;
536
536
  in vec3 position;
537
537
  in vec2 uv;
@@ -541,7 +541,7 @@ out vec2 vUv;
541
541
  void main() {
542
542
  vUv = uv;
543
543
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
544
- }`,Hs=`#version 300 es
544
+ }`,Us=`#version 300 es
545
545
  precision highp float;
546
546
  in vec2 vUv;
547
547
  uniform sampler2D uPano;
@@ -550,4 +550,4 @@ out vec4 fragColor;
550
550
  void main() {
551
551
  vec3 rgb = texture(uPano, vUv).rgb;
552
552
  fragColor = vec4(rgb, uOpacity);
553
- }`;function Wr(t,e){let{position:n,uv:r,index:o}=zs(),i=new Ue.Geometry(t,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ue.Texture(t,{image:e,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ue.Program(t,{vertex:Gs,fragment:Hs,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),u=new Ue.Mesh(t,{geometry:i,program:s});return{mesh:u,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){u.setParent(null),i.remove(),a.texture&&t.deleteTexture(a.texture),s.remove()}}}var Kr=.15;async function qr(t,e,n,r={}){let o=r.fadeMs??400,i=e?.initialBearingDeg??0,a=Math.max(-Re,Math.min(Re,e?.initialPitchDeg??0)),s=Zt,u=!1,l=new AbortController,d=()=>l.abort();r.signal?.addEventListener("abort",d,{once:!0});let m=()=>{},p=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!e&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!e&&n.focalWorld){let A=n.camera.position,F=n.focalWorld[0]-A.x,N=n.focalWorld[1]-A.y,Y=n.focalWorld[2]-A.z,V=Math.hypot(F,Y);V>.001&&(i=Math.atan2(F,-Y)*180/Math.PI,a=Math.max(-Re,Math.min(Re,Math.atan2(N,V)*180/Math.PI)))}let c=null;if(e){let A=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),F=Kt(e,Wt(A)),N;try{let Y=e.resolveUrl?await e.resolveUrl(F.initialUrl):F.initialUrl;if(!Y)throw new Error("panorama_asset_unavailable");N=await Mt(Y,l.signal)}catch{return r.signal?.removeEventListener("abort",d),null}try{c=Wr(n.gl,N)}catch{return l.abort(),r.signal?.removeEventListener("abort",d),null}c.mesh.renderOrder=999,c.mesh.setParent(n.scene),F.upgradeUrl&&(m=qt(()=>{(e.resolveUrl?e.resolveUrl(F.upgradeUrl):Promise.resolve(F.upgradeUrl)).then(V=>!V||l.signal.aborted?null:Mt(V,l.signal)).then(V=>{V&&(u||l.signal.aborted||(c?.setImage(V),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),b=()=>{let A=n.camera.position;c?.mesh.position.set(A.x,A.y,A.z);let[F,N,Y]=Xr(i,a);n.camera.lookAt([A.x+F,A.y+N,A.z+Y]),n.requestRender()};b();let g=document.createElement("div"),y=document.activeElement instanceof HTMLElement?document.activeElement:null;g.setAttribute("role","dialog"),g.setAttribute("aria-modal","true"),g.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),g.tabIndex=-1,Object.assign(g.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),g.appendChild(x),r.disclosure){let A=document.createElement("div");A.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(A.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),g.appendChild(A)}let w=document.createElement("div");w.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(w.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),g.appendChild(w),t.appendChild(g),x.focus({preventScroll:!0});let R=!1,M=0,k=0,O=0,L=new Map,U=()=>{let[A,F]=[...L.values()];return A&&F?Math.hypot(A.x-F.x,A.y-F.y):0},z=A=>{let F=Ln(A);F!==s&&(s=F,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},_=A=>{A.target!==x&&(L.set(A.pointerId,{x:A.clientX,y:A.clientY}),R=L.size===1,M=A.clientX,k=A.clientY,L.size===2&&(O=U()),g.setPointerCapture?.(A.pointerId),g.style.cursor="grabbing")},v=A=>{if(L.has(A.pointerId)){if(L.set(A.pointerId,{x:A.clientX,y:A.clientY}),L.size>=2){let F=U();O>0&&F>0&&z(s*(O/F)),O=F,R=!1;return}R&&(i+=(A.clientX-M)*Kr,a=Math.max(-Re,Math.min(Re,a+(A.clientY-k)*Kr)),M=A.clientX,k=A.clientY,b())}},S=A=>{L.delete(A.pointerId),O=L.size===2?U():0;let F=L.values().next().value;R=L.size===1,F?(M=F.x,k=F.y):g.style.cursor="grab";try{g.releasePointerCapture?.(A.pointerId)}catch{}},C=A=>{A.preventDefault(),z(s+A.deltaY*.04)};g.addEventListener("pointerdown",_),g.addEventListener("pointermove",v),g.addEventListener("pointerup",S),g.addEventListener("pointercancel",S),g.addEventListener("wheel",C,{passive:!1});let G=A=>{if(!u){if(A.key==="Tab"){A.preventDefault(),x.focus({preventScroll:!0});return}if(A.key==="Escape"){A.stopPropagation(),E.close();return}if(A.key==="ArrowLeft"||A.key==="ArrowRight")i+=A.key==="ArrowLeft"?-4:4;else if(A.key==="ArrowUp"||A.key==="ArrowDown")a=Math.max(-Re,Math.min(Re,a+(A.key==="ArrowUp"?4:-4)));else if(A.key==="+"||A.key==="="){z(s-5),A.preventDefault();return}else if(A.key==="-"){z(s+5),A.preventDefault();return}else return;A.preventDefault(),b()}};window.addEventListener("keydown",G);let P=0,T=(A,F)=>{if(!c){F?.();return}let N=A===1?0:1,Y=performance.now(),V=()=>{if(u)return;let B=o<=0?1:Math.min(1,(performance.now()-Y)/o);c?.setOpacity(N+(A-N)*B),n.requestRender(),B<1?P=requestAnimationFrame(V):F?.()};P=requestAnimationFrame(V)};T(1);let I=()=>{u||(u=!0,m(),l.abort(),r.signal?.removeEventListener("abort",d),cancelAnimationFrame(P),g.removeEventListener("pointerdown",_),g.removeEventListener("pointermove",v),g.removeEventListener("pointerup",S),g.removeEventListener("pointercancel",S),g.removeEventListener("wheel",C),window.removeEventListener("keydown",G),g.remove(),y?.isConnected&&y.focus({preventScroll:!0}),c?.dispose(),n.camera.position.set(p[0],p[1],p[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},E={close(){if(u)return;let A=()=>{I(),r.onClose?.()};cancelAnimationFrame(P),T(0,A)},dispose:I};return x.addEventListener("click",()=>E.close()),E}var $r=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Qt=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,o){this.emit("3d_opened",{seats:e,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(e,n){this.emit("3d_seat_picked",{seatId:e,sectionId:n})}cinematicPlayed(e){this.emit("3d_cinematic_played",{durationMs:e,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=$r(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round($r()-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 Zr(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function Qr(t){let{container:e,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=t,s=null,u=()=>{if(!s)return;let m=a();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"})},l=()=>{s?.remove(),s=null};return{show:(m,p,c=!1)=>{if(l(),t.isDisposed())return null;let f=document.createElement("div");f.setAttribute("role","group"),Object.assign(f.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let h=o.get(m),b=h?.sectionId?n.sections.find(O=>O.id===h.sectionId):void 0,g=h?.label??m;f.setAttribute("aria-label",`Explore views near ${b?.label?`${b.label}, `:""}seat ${g}`);let y=document.createElement("span");y.textContent=["Live 3D seat view",b?.label,g].filter(Boolean).join(" \xB7 "),Object.assign(y.style,{maxWidth:"min(320px, calc(100vw - 32px))",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),f.appendChild(y);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(x);let w=h?.rowId?i.get(h.rowId):void 0,R=w?.indexOf(m)??-1,M=R>=0?[w?.[R-1],w?.[R+1]]:[void 0,void 0],k=(O,L,U,z=!1)=>{let _=document.createElement("button");_.type="button",_.textContent=O,_.setAttribute("aria-label",L),Object.assign(_.style,{minHeight:"44px",padding:z?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),z||(_.style.minWidth="44px"),z&&(_.dataset.panoramaTrigger=""),_.addEventListener("click",U),x.appendChild(_)};if(M[0]){let O=o.get(M[0])?.label??M[0];k("\u2039",`View previous seat ${O}`,()=>{t.flyToSeat(M[0])})}if(r.getSeatView){let O=r.seatViewActionLabel?.(m)??"Open 360\xB0 panorama";k(c?`\u21BB Retry ${O}`:`\u25C9 ${O}`,`${c?"Retry":O} from seat ${g}`,()=>{if(t.isDisposed()||p!==t.flightGen()){l();return}l(),t.openPanorama(m,400,p)},!0)}if(M[1]){let O=o.get(M[1])?.label??M[1];k("\u203A",`View next seat ${O}`,()=>{t.flyToSeat(M[1])})}return x.childElementCount?(e.appendChild(f),s=f,u(),f):null},remove:l,layout:u}}function Jr(t){let{container:e,orbit:n,isNarrow:r}=t,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("button");u.type="button",u.textContent="\u21BB",u.setAttribute("aria-label","Drag to rotate the 3D venue"),u.dataset.tooltip="Rotate venue";let l=document.createElement("button");l.type="button",l.textContent="\u2725",l.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),l.dataset.tooltip="Move venue";let d=document.createElement("button");d.type="button",d.textContent="\u2212",d.setAttribute("aria-label","Zoom out of the 3D venue"),d.dataset.tooltip="Zoom out";let m=document.createElement("button");m.type="button",m.textContent="+",m.setAttribute("aria-label","Zoom into the 3D venue"),m.dataset.tooltip="Zoom in";for(let h of[u,l,d,m])h.className="sl-3d-icon-control",Object.assign(h.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"});a.append(u,l),s.append(m,d);let p=h=>{n.setPrimaryDragMode(h);let b=h==="orbit";u.setAttribute("aria-pressed",String(b)),l.setAttribute("aria-pressed",String(!b)),u.style.background=b?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=b?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=b?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};u.addEventListener("click",()=>p("orbit")),l.addEventListener("click",()=>p("pan")),d.addEventListener("click",()=>n.zoomBy(1.22)),m.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),p("orbit"),e.appendChild(o);let c=()=>{let h=r();o.style.display=i?"none":"flex",o.style.right=h?"12px":"14px",o.style.bottom=h?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=h?"none":"flex",m.style.display=h?"none":"",d.style.display=h?"none":""};return c(),{element:o,utilityControls:s,setNavigationMode:p,setSeatViewLocked:h=>{i=h,n.setInteractionEnabled(!h),c()},seatViewLocked:()=>i,layout:c}}function ei(t){let{glctx:e,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:u,sectionIdBySeatId:l,tapSlop:d,tapMs:m,cancelFlight:p,focusSectionCamera:c,setSelection:f,ensureSeatView:h}=t,b=0,g=0,y=0,x=-1,w=!1,R=!1,M=z=>{t.seatViewLocked()||x===-1&&(x=z.pointerId,b=z.clientX,g=z.clientY,y=performance.now(),w=!1,R=a.active,a.active&&(s.cinematicCancelled(),p(),i.onViewTargetChange?.(null)))},k=z=>{z.pointerId===x&&Math.hypot(z.clientX-b,z.clientY-g)>d&&(w=!0)},O=(z,_,v,S,C)=>{let G=e.canvas.getBoundingClientRect(),P=e.canvas.clientWidth||G.width||1,T=e.canvas.clientHeight||G.height||1,I=z-G.left,E=_-G.top,A=S*S,F=-1,N=A,Y=1/0;for(let V of o){if(v&&V.sectionId!==v)continue;let B=r.seats.idToIndex.get(V.id);if(B===void 0)continue;if(C){let Q=Math.round(r.seats.iState[B]??0);if(Q!==0&&Q!==3)continue}let j=B*3,K=Ht(n.camera.projectionViewMatrix,[r.seats.iPosition[j],r.seats.iPosition[j+1]+.55,r.seats.iPosition[j+2]],P,T);if(!K.visible)continue;let J=K.x-I,Z=K.y-E,ee=J*J+Z*Z;(ee<N||Math.abs(ee-N)<1&&K.depth<Y)&&(F=B,N=ee,Y=K.depth)}return F},L=(z,_)=>{let v=t.gpu(),S=t.pick();if(!v||!S)return-1;S.syncFromSeatProgram(v.seatProgram);let C=e.canvas.getBoundingClientRect(),G=e.renderer.dpr,{x:P,y:T}=Fr(z,_,C,G,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),I=Math.max(2,Math.round(8*G));return S.pick(n.camera,P,T,I)};return{onDown:M,onMove:k,onUp:z=>{if(z.pointerId!==x)return;let _=!w&&performance.now()-y<m;if(x=-1,R){R=!1;return}let v=t.gpu(),S=t.pick();if(!_||!v||!S)return;let C=L(z.clientX,z.clientY);if(t.focusedSectionId()&&C>=0){let T=u[C],I=T?l.get(T):void 0;if(I&&I!==t.focusedSectionId()&&c(I))return}if(t.focusedSectionId()&&C<0&&(C=O(z.clientX,z.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&C<0){let T=O(z.clientX,z.clientY,null,72,!1),I=T>=0?u[T]:void 0,E=I?l.get(I):void 0;if(E&&E!==t.focusedSectionId()&&c(E))return}if(!t.focusedSectionId()){C<0&&(C=O(z.clientX,z.clientY,null,42,!1));let T=C>=0?u[C]:void 0,I=T?l.get(T):void 0;if(I&&c(I))return}if(C<0||C>=u.length){t.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let G=u[C],P=Me[Math.round(r.seats.iState[C]??0)]??"available";if(P!=="available"&&P!=="selected"){i.onSeatInspect?.(G,P);return}if(t.selection().has(G)&&t.selection().size===1){f([]),i.onViewTargetChange?.(null);return}f([G]),h(G),s.seatPicked(G,l.get(G)),i.onSeatPick?.(G)}}}var Jt=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,o=-1/0,i=-1/0;for(let c=0;c<this.count;c++){let f=e[c*3],h=e[c*3+2];f<n&&(n=f),f>o&&(o=f),h<r&&(r=h),h>i&&(i=h)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let u=this.cols*this.rows,l=new Int32Array(u+1),d=c=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((e[c*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[c*3+2]-r)/this.cell)))*this.cols+f};for(let c=0;c<this.count;c++)l[d(c)+1]++;for(let c=0;c<u;c++)l[c+1]+=l[c];let m=new Int32Array(this.count),p=l.slice(0,u);for(let c=0;c<this.count;c++)m[p[d(c)]++]=c;this.cellStart=l,this.cellItems=m}gather(e,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,u=r*r,l=Math.floor((e-this.minX)/this.cell),d=Math.floor((n-this.minZ)/this.cell),m=Math.ceil(r/this.cell)+1,p=this.iPosition,c=0;for(let f=0;f<=m&&c<s;f++){let h=d-f,b=d+f,g=l-f,y=l+f;for(let x=h;x<=b&&c<s;x++){if(x<0||x>=this.rows)continue;let w=x===h||x===b;for(let R=g;R<=y&&c<s;R++){if(!w&&R!==g&&R!==y){R=y-1;continue}if(R<0||R>=this.cols)continue;let M=x*this.cols+R;for(let k=i[M],O=i[M+1];k<O&&c<s;k++){let L=a[k],U=p[L*3]-e,z=p[L*3+2]-n;U*U+z*z<=u&&(o[c++]=L)}}}}return c}};var en=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(It);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new Jt(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 o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<ln)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>cn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,cn,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(e,n,r){let o=1-Math.exp(-e*9),i=1-Math.exp(-e*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?o:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};var tn=require("ogl");function ti(t){let{container:e,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:u,stageAzimuth:l,overviewFraming:d}=t,m=0,p=-1,c=(R,M,k=28)=>{o.camera.position.set(R[0],R[1],R[2]),o.camera.lookAt(new tn.Vec3(M[0],M[1],M[2])),o.camera.fov=k,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.textContent="\u2302",f.setAttribute("aria-label","Fit the active level or whole venue in view"),f.dataset.tooltip="Fit view",Object.assign(f.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 h=()=>{f.textContent="\u2302"};h();let b=R=>{p=R;let M=t.gpu();M&&(M.seatProgram.uniforms.uFocusFloor.value=R,M.solidProgram.uniforms.uFocusFloor.value=R,M.chairProgram.uniforms.uFocusFloor.value=R),t.showSectionSeatLabels(null)},g=()=>{if(t.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),a.panoramaClosed()),t.setPanoramaSphereVisible(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.restorePanoramaLayer(),f.style.display="",u.setVisible(!0),t.setFrozen(!1);let R=p>=0?n.floors[p]:null;if(t.setNearFieldDetailEnabled(!!R),t.setSeatViewLocked(!1),y(),t.removeArriveChip(),t.setNavigationMode("orbit"),R){let M=R.focalWorld[0]-R.center[0],k=R.focalWorld[2]-R.center[2],O=Math.hypot(M,k)>R.radius*.12?Math.atan2(M,k):l,L={center:R.center,radius:R.radius,box:R.box},U={polarDeg:58,margin:1.12};t.reducedMotion()?o.frame(L,!1,O,!1,U):o.frameSoft(L,O,!1,U)}else t.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,d):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,d);t.showSectionSeatLabels(null),s.requestRender()},y=()=>{m++,t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=R=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let M=n.seats.idToIndex.get(R);if(M===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(R),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),f.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1),t.setSeatViewLocked(!1);let k=++m;t.removeArriveChip();let{eye:O,focal:L}=t.resolvedSeatViewPose(R,M),U=[o.camera.position.x,o.camera.position.y,o.camera.position.z],z=Fn(U,O,L,n.bounds.center,n.bounds.radius),_=r.arriveAtSeatEye?O:z.finalPos,v=r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?90:65:28,S=[z.waypoints[0],z.waypoints[1],_];if(u.setVisible(!1),t.reducedMotion())return c(_,L,v),s.requestRender(),a.cinematicSkipped(),t.isDisposed()||o.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),t.showArriveChip(R,k),Promise.resolve();let C=new tn.Quat().copy(o.camera.quaternion),G=zr(o.camera,_,L);return s.requestRender(),i.start(S,C,G,2500,v).then(()=>{t.isDisposed()||k!==m||(a.cinematicPlayed(2500),o.resumeAfterFlight(L),t.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),t.showArriveChip(R,k))})},w=R=>{let M=n.sections.find(U=>U.id===R);if(!M||M.seatCount===0)return!1;t.setNearFieldDetailEnabled(!0),t.setSeatViewLocked(!1),i.cancel(),t.removeArriveChip(),n.floors.length>1&&p!==M.floorIndex&&b(M.floorIndex),t.setNavigationMode("pan"),t.showSectionSeatLabels(R);let k=M.focalWorld[0]-M.center[0],O=M.focalWorld[2]-M.center[2],L=Math.hypot(k,O)>M.radius*.12?Math.atan2(k,O):void 0;return o.frame({center:M.center,radius:Math.max(5,M.radius*.5)},!1,L),r.onSectionFocusChange?.(R),s.requestRender(),!0};return f.addEventListener("click",g),{overviewChip:f,layoutOverviewChip:h,flightGen:()=>m,focusedFloor:()=>p,applyFloorFocus:b,placeCameraFinal:c,cancelFlight:y,focusOverview:g,flyToSeat:x,focusSectionCamera:w}}var Us={};function ni(t){let e=performance.now();return{model:it(t),buildMs:performance.now()-e,source:"main"}}function oi(t){return typeof Worker>"u"?Promise.resolve(ni(t)):new Promise(e=>{let n=new Worker(new URL("./scene/scene.worker.ts",Us.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),e(s))},i=()=>o(ni(t)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(t)})}var js=Math.PI/180,Ys=6,Xs=500;function Ws(t,e,n={}){let r=performance.now(),o=e.prepared?.model??it(e),i=new Qt(n.onAnalytics),a=new Array(o.seats.count);for(let[H,X]of o.seats.idToIndex)a[X]=H;let s=new Map(e.seats.map(H=>[H.id,H])),u=new Map;for(let H of e.seats){if(!H.rowId)continue;let X=u.get(H.rowId);X?X.push(H.id):u.set(H.rowId,[H.id])}let l=new Map;for(let H of e.seats)l.set(H.id,H.sectionId);let d=e.doc.floors?.some(X=>(X.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(X=>X.objects)??e.doc.objects).some(X=>X.type==="section"&&((X.height??0)>0||(X.rake??0)>0)),m=null,p=null,c=!1,f=!1,h=!1,b=new Map,g=null,y=null,x=null,w=new Map,R=null,M=()=>{x===null&&(x=t.style.zIndex,t.style.zIndex="20")},k=()=>{x!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=x),x=null)},O=!1,L=()=>O?ie.focusedFloor():-1,U=()=>{m=Er(S.gl,o),p=new Yt(S.renderer,m.seatGeometry,m.chairGeometry,m.solidGeometry,o.seats.count),S.setClearColor(o.theme.background.top),p.setRestoreClear(o.theme.background.top),m.seatProgram.uniforms.uSeatRadius.value=ke*o.theme.seatScale,m.seatProgram.uniforms.uFocusFloor.value=L(),m.solidProgram.uniforms.uFocusFloor.value=L(),m.chairProgram.uniforms.uFocusFloor.value=L(),_.forceRegather()},z=!1,_=new en({model:o,orbit:()=>C,gpu:()=>m}),v=H=>_.setDetailEnabled(H),S=new Ct(t,{onContextLost:()=>{h||i.contextLost(),c=!0,j.stop(),m=null,p=null},onContextRestored:()=>{U(),c=!1,h||i.contextRestored(),j.requestRender()}}),C=new At(S.gl,S.canvas,()=>j.requestRender(),()=>i.orbitEngaged());C.setAspect(S.aspect);let G=(e.doc.floors?.flatMap(H=>H.objects)??e.doc.objects).some(H=>H.type==="section"&&H.physical3dProvenance?.surfaceKind?.status==="inferred"),P=(()=>{if(G&&o.stages.length===0)return;let H=o.focalWorld[0]-o.bounds.center[0],X=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(H,X)>o.bounds.radius*.12?Math.atan2(H,X):void 0})(),T=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;C.frame(o.bounds,!I,P,n.portraitOverviewCrop===!0,T);let E=new Xt(C.camera),A=Zr(t),F=new Ut(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),N=o.labels,Y=()=>rr(N,o.floors.length,L());F.setLabels(Y());let V=null,B=H=>{if(V=H,F.setForcedDense(!!H),!H){F.setLabels(Y());return}let X=e.seats.filter(q=>q.sectionId===H),W=new Set(X.map(q=>q.id)),$=new Set(X.map(q=>q.rowId)),re=new Set(b.keys()),oe=new Set(X.filter(q=>re.has(q.id)).map(q=>q.id)),ue=Y().filter(q=>q.kind!=="row"&&q.kind!=="seat"||(q.kind==="row"?$.has(q.id.slice(4)):W.has(q.id.slice(5))&&(oe.size===0||oe.has(q.id.slice(5)))));if(o.seatCount<=6e3&&oe.size===0){F.setLabels(ue);return}let xe=oe.size?X.filter(q=>oe.has(q.id)):X,ve=new Set(xe.map(q=>`seat:${q.id}`)),Ee=xe.flatMap(q=>{let Se=o.seats.idToIndex.get(q.id);if(Se===void 0)return[];let Be=Se*3;return[{id:`seat:${q.id}`,kind:"seat",text:q.displayLabel||q.label,anchor:[o.seats.iPosition[Be],o.seats.iPosition[Be+1]+(re.has(q.id)?1.05:.55),o.seats.iPosition[Be+2]]}]});F.setLabels([...ue.filter(q=>!ve.has(q.id)),...Ee])};U();let j=new Rt(H=>{if(c||!m||f)return!1;let W=E.active?E.update(performance.now()):C.update(),$=L()>=0?o.floors[L()]:null,re=$?.radius??o.bounds.radius,oe=Zn(C.currentDistance,re),ue=z?{center:[C.camera.position.x,C.camera.position.y,C.camera.position.z],radius:520}:o.renderBounds;C.updateClipping(ue);let xe=$?.center??o.renderBounds.center,ve=$?.radius??o.renderBounds.radius,Ee=(Ye,nn)=>Math.hypot(C.camera.position.x-Ye[0],C.camera.position.y-Ye[1],C.camera.position.z-Ye[2])<=nn*(_.detailVisible?1.8:1.55),q=Ee(xe,ve);if(!q&&V){let Ye=o.sections.find(nn=>nn.id===V);Ye&&(q=Ee(Ye.center,Math.max(12,Ye.radius*2)))}_.detailVisible=q;let Se=m.seatProgram.uniforms;Se.uSeatScale.value=oe.scale,Se.uSeatFade.value=oe.fade;let Be=!!$&&Qn($.seatCount,S.canvas.clientWidth||1,S.canvas.clientHeight||1),lt=Jn(o.seats.count,re,C.currentDistance,C.camera.fov,S.canvas.clientHeight||1),Ne=_.detailVisible||Be||lt?1:0,Vn=_.detailVisible||L()>=0||o.floors.length>1?1:0;return _.ease(H,Ne,Vn),Se.uSeatDetail.value=_.seatDetailMix,m.solidProgram.uniforms.uStructureDetail.value=_.structureDetailMix,Se.uMinPixels.value=oe.minPixels,Se.uPixelToWorld.value=2*Math.tan(C.camera.fov*js/2)/Math.max(1,S.pixelHeight),_.update(_.detailVisible),S.renderer.render({scene:m.background,clear:!0}),S.renderer.render({scene:m.main,camera:C.camera,clear:!1}),F.update(C.camera.projectionViewMatrix,S.canvas.clientWidth||1,S.canvas.clientHeight||1,C.currentDistance,re,[C.camera.position.x,C.camera.position.y,C.camera.position.z]),W||_.seatDetailMix!==Ne||_.structureDetailMix!==Vn}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>Nn.resize()):null;K?.observe(t);let J=H=>{let X=re=>{let oe=o.seats.idToIndex.get(re);return oe===void 0?void 0:o.seats.iState[oe]},{updates:W,next:$}=Lr(b,H,X);if(b=$,F.setSelectedSeatIds(b.keys()),V&&B(V),W.length){let re=bn(o.seats,W);m&&m.uploadSeatStateRuns(re),j.requestRender()}},Z=()=>R!==null?R:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ee=8,Q=H=>{if(!n.getSeatView)return null;let X=w.get(H);if(!X)for(X=Promise.resolve(n.getSeatView(H)),w.set(H,X),X.catch(()=>{w.get(H)===X&&w.delete(H)});w.size>ee;){let W=w.keys().next().value;if(W===void 0)break;w.delete(W)}return X},he=(H,X)=>{let W=s.get(H),$=Math.max(0,Math.round(o.seats.iFloor[X]??0)),re=e.doc.floors?.[$],oe=o.floors[$],ue=re?.focalPoint??e.doc.focalPoint,xe=oe?{x:oe.focalWorld[0]/D,y:oe.focalWorld[2]/D}:ue,ve=W?.focalPoint?{x:W.focalPoint.x+xe.x-ue.x,y:W.focalPoint.y+xe.y-ue.y}:xe,Ee=[o.seats.iPosition[X*3],o.seats.iPosition[X*3+1],o.seats.iPosition[X*3+2]];return Gr(Ee,ve,re?.baseHeightM??0,W?.eyeHeightM)},je=()=>(t.clientWidth||S.canvas.clientWidth)<=520,Le=Qr({container:t,model:o,opts:n,expandedSeatById:s,seatIdsByRow:u,isNarrow:je,isDisposed:()=>h,flightGen:()=>ie.flightGen(),flyToSeat:H=>_n(H),openPanorama:(H,X,W)=>ai(H,X,W)}),ge=Le.show,Ie=Le.remove,Oe=Le.layout,me=Jr({container:t,orbit:C,isNarrow:je}),we=me.element,ce=me.setNavigationMode,Te=me.setSeatViewLocked,ct=me.layout,$e=me.utilityControls,ie=ti({container:t,model:o,opts:n,orbit:C,cinematic:E,analytics:i,loop:j,labelOverlay:F,stageAzimuth:P,overviewFraming:T,gpu:()=>m,isDisposed:()=>h,panorama:()=>g,setPanorama:H=>{g=H},setPanoramaSphereVisible:H=>{z=H},panoramaLoadAbort:()=>y,setPanoramaLoadAbort:H=>{y=H},setFrozen:H=>{f=H},restorePanoramaLayer:k,reducedMotion:Z,resolvedSeatViewPose:he,showSectionSeatLabels:B,setNearFieldDetailEnabled:v,setSeatViewLocked:Te,setNavigationMode:ce,showArriveChip:ge,removeArriveChip:Ie});O=!0;let Pe=ie.overviewChip,wt=ie.layoutOverviewChip,ri=ie.applyFloorFocus,ii=ie.focusOverview,On=ie.cancelFlight,_n=ie.flyToSeat,Bn=ie.focusSectionCamera;$e.appendChild(Pe);let ai=async(H,X,W)=>{y?.abort();let $=new AbortController;y=$;let re=o.seats.idToIndex.get(H);if(re===void 0){C.syncFromCamera();return}let oe=s.get(H)?.label??H,ue=he(H,re),xe=Q(H);if(!xe){$.abort(),y===$&&(y=null),C.syncFromCamera();return}f=!0,j.stop();let ve;try{ve=await xe}catch{if(y===$&&(y=null),i.panoramaFailed(H,"source"),!h&&W===ie.flightGen()){f=!1,C.resumeAfterFlight(ue.focal),j.requestRender();let Ne=ge(H,W,!0);requestAnimationFrame(()=>Ne?.querySelector("[data-panorama-trigger]")?.focus())}return}if(h||W!==ie.flightGen()){$.abort(),y===$&&(y=null);return}Ie();let Ee=()=>{$.abort(),y===$&&(y=null),g=null,z=!1,k(),Pe.style.display="",F.setVisible(!n.arriveAtSeatEye),f=!1,i.panoramaClosed(),C.resumeAfterFlight(ue.focal),j.requestRender();let Ne=ge(H,ie.flightGen());requestAnimationFrame(()=>Ne?.querySelector("[data-panorama-trigger]")?.focus())},q=ve.generated===!0,Se=jr(ve);M(),z=!q,Pe.style.display="none";let Be=Z()?0:X,lt=m&&!c?await qr(t,q?null:ve,{gl:S.gl,scene:m.main,camera:C.camera,requestRender:()=>j.requestRender(),cameraOriginWorld:q?ue.eye:void 0,focalWorld:ue.focal},{fadeMs:Be,seatLabel:oe,disclosure:Se,disclosurePrefix:q?"Live seat-eye view":"360\xB0 panorama",onClose:Ee,signal:$.signal}):null;if(h||W!==ie.flightGen()){$.abort(),z=!1,y===$&&(y=null),lt?.dispose(),Pe.style.display="",k();return}if(lt)C.syncFromCamera(),F.setVisible(!1),f=!1,j.requestRender(),g=lt;else if(q){k(),Pe.style.display="",f=!1,C.resumeAfterFlight(ue.focal),j.requestRender(),g=null,z=!1,i.panoramaFailed(H,"mount");let Ne=ge(H,ie.flightGen(),!0);requestAnimationFrame(()=>Ne?.querySelector("[data-panorama-trigger]")?.focus()),y===$&&(y=null);return}else z=!1,i.panoramaFallback(H),g=Yr(t,ve,{fadeMs:Be,seatLabel:oe,disclosure:Se,onClose:Ee,signal:$.signal});i.panoramaOpened()},_e=ei({glctx:S,orbit:C,model:o,seats:e.seats,opts:n,cinematic:E,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:Ys,tapMs:Xs,gpu:()=>m,pick:()=>p,seatViewLocked:()=>me.seatViewLocked(),focusedSectionId:()=>V,selection:()=>b,cancelFlight:On,focusSectionCamera:Bn,setSelection:J,ensureSeatView:Q});S.canvas.addEventListener("pointerdown",_e.onDown),S.canvas.addEventListener("pointermove",_e.onMove),S.canvas.addEventListener("pointerup",_e.onUp),S.canvas.addEventListener("pointercancel",_e.onUp),j.requestRender();let Nn={setAvailability(H){let X=Dr(b,H),W=bn(o.seats,X);W.length&&m&&m.uploadSeatStateRuns(W),j.requestRender()},setSelection:J,flyToSeat:_n,focusOverview:ii,resize(){let{width:H,height:X}=S.resize();C.setAspect(H/Math.max(1,X)),Oe(),ct(),wt(),j.requestRender()},stats(){return{...j.stats(),drawCalls:m?m.drawCalls:0,seatCount:o.seatCount}},loseContextForTest(){S.simulateContextLossCycle()},floors(){return o.floors},focusFloor(H){if(H!==null&&!o.floors.some(W=>W.index===H))return!1;let X=H??-1;if(v(H!==null),Te(!1),ri(X),ce("orbit"),H===null)E.cancel(),Z()?C.frame(o.bounds,!1,P,n.portraitOverviewCrop===!0,T):C.frameSoft(o.bounds,P,n.portraitOverviewCrop===!0,T);else{let W=o.floors[H];if(W.seatCount>0){E.cancel();let $=W.focalWorld[0]-W.center[0],re=W.focalWorld[2]-W.center[2],oe=Math.hypot($,re)>W.radius*.12?Math.atan2($,re):P;C.frame({center:W.center,radius:W.radius,box:W.box},!1,oe,!1,{polarDeg:58,margin:1.12})}}return j.requestRender(),!0},zones(){return o.zones},focusZone(H){let X=o.zones.find(oe=>oe.id===H);if(!X||X.seatCount===0)return!1;v(!1),Te(!1),E.cancel(),ce("orbit"),B(null),n.onSectionFocusChange?.(null);let W=X.focalWorld[0]-X.center[0],$=X.focalWorld[2]-X.center[2],re=Math.hypot(W,$)>X.radius*.12?Math.atan2(W,$):void 0;return C.frame({center:X.center,radius:X.radius*1.25},!1,re),j.requestRender(),!0},sections(){return o.sections},focusSection(H){return Bn(H)},rows(H){return H?o.rows.filter(X=>X.sectionId===H):o.rows},seatsInRow(H){return e.seats.filter(X=>X.rowId===H).map(X=>({id:X.id,label:X.displayLabel||X.label}))},focusRow(H){let X=o.rows.find(W=>W.id===H);return!X||X.seatCount===0?!1:(v(!0),Te(!1),E.cancel(),ce("pan"),X.sectionId&&(B(X.sectionId),n.onSectionFocusChange?.(X.sectionId)),C.frame({center:X.center,radius:Math.max(2.5,X.radius*.65)}),j.requestRender(),!0)},setReducedMotionForTest(H){R=H},dispose(){h=!0,Ie(),Pe.remove(),we.remove(),On(),j.stop(),F.dispose(),K?.disconnect(),g&&(g.dispose(),g=null),k(),A(),S.canvas.removeEventListener("pointerdown",_e.onDown),S.canvas.removeEventListener("pointermove",_e.onMove),S.canvas.removeEventListener("pointerup",_e.onUp),S.canvas.removeEventListener("pointercancel",_e.onUp),C.dispose(),p&&p.dispose(),m&&m.dispose(),m=null,p=null,S.dispose()}};return i.opened(o.seatCount,d,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),Nn}0&&(module.exports={buildSceneModel,mountVenue3D,prepareVenue3D});
553
+ }`;function Xr(t,e){let{position:n,uv:r,index:o}=Gs(),i=new Ne.Geometry(t,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ne.Texture(t,{image:e,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ne.Program(t,{vertex:Hs,fragment:Us,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),u=new Ne.Mesh(t,{geometry:i,program:s});return{mesh:u,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){u.setParent(null),i.remove(),a.texture&&t.deleteTexture(a.texture),s.remove()}}}var Wr=.15;async function Kr(t,e,n,r={}){let o=r.fadeMs??400,i=e?.initialBearingDeg??0,a=Math.max(-Se,Math.min(Se,e?.initialPitchDeg??0)),s=qt,u=!1,l=new AbortController,m=()=>l.abort();r.signal?.addEventListener("abort",m,{once:!0});let d=()=>{},p=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!e&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!e&&n.focalWorld){let A=n.camera.position,k=n.focalWorld[0]-A.x,V=n.focalWorld[1]-A.y,Y=n.focalWorld[2]-A.z,z=Math.hypot(k,Y);z>.001&&(i=Math.atan2(k,-Y)*180/Math.PI,a=Math.max(-Se,Math.min(Se,Math.atan2(V,z)*180/Math.PI)))}let c=null;if(e){let A=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),k=Xt(e,Yt(A)),V;try{let Y=e.resolveUrl?await e.resolveUrl(k.initialUrl):k.initialUrl;if(!Y)throw new Error("panorama_asset_unavailable");V=await Mt(Y,l.signal)}catch{return r.signal?.removeEventListener("abort",m),null}try{c=Xr(n.gl,V)}catch{return l.abort(),r.signal?.removeEventListener("abort",m),null}c.mesh.renderOrder=999,c.mesh.setParent(n.scene),k.upgradeUrl&&(d=Wt(()=>{(e.resolveUrl?e.resolveUrl(k.upgradeUrl):Promise.resolve(k.upgradeUrl)).then(z=>!z||l.signal.aborted?null:Mt(z,l.signal)).then(z=>{z&&(u||l.signal.aborted||(c?.setImage(z),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),b=()=>{let A=n.camera.position;c?.mesh.position.set(A.x,A.y,A.z);let[k,V,Y]=Yr(i,a);n.camera.lookAt([A.x+k,A.y+V,A.z+Y]),n.requestRender()};b();let g=document.createElement("div"),y=document.activeElement instanceof HTMLElement?document.activeElement:null;g.setAttribute("role","dialog"),g.setAttribute("aria-modal","true"),g.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),g.tabIndex=-1,Object.assign(g.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),g.appendChild(x),r.disclosure){let A=document.createElement("div");A.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(A.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),g.appendChild(A)}let P=document.createElement("div");P.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(P.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),g.appendChild(P),t.appendChild(g),x.focus({preventScroll:!0});let R=!1,S=0,F=0,B=0,L=new Map,H=()=>{let[A,k]=[...L.values()];return A&&k?Math.hypot(A.x-k.x,A.y-k.y):0},O=A=>{let k=Fn(A);k!==s&&(s=k,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},N=A=>{A.target!==x&&(L.set(A.pointerId,{x:A.clientX,y:A.clientY}),R=L.size===1,S=A.clientX,F=A.clientY,L.size===2&&(B=H()),g.setPointerCapture?.(A.pointerId),g.style.cursor="grabbing")},v=A=>{if(L.has(A.pointerId)){if(L.set(A.pointerId,{x:A.clientX,y:A.clientY}),L.size>=2){let k=H();B>0&&k>0&&O(s*(B/k)),B=k,R=!1;return}R&&(i+=(A.clientX-S)*Wr,a=Math.max(-Se,Math.min(Se,a+(A.clientY-F)*Wr)),S=A.clientX,F=A.clientY,b())}},M=A=>{L.delete(A.pointerId),B=L.size===2?H():0;let k=L.values().next().value;R=L.size===1,k?(S=k.x,F=k.y):g.style.cursor="grab";try{g.releasePointerCapture?.(A.pointerId)}catch{}},C=A=>{A.preventDefault(),O(s+A.deltaY*.04)};g.addEventListener("pointerdown",N),g.addEventListener("pointermove",v),g.addEventListener("pointerup",M),g.addEventListener("pointercancel",M),g.addEventListener("wheel",C,{passive:!1});let G=A=>{if(!u){if(A.key==="Tab"){A.preventDefault(),x.focus({preventScroll:!0});return}if(A.key==="Escape"){A.stopPropagation(),T.close();return}if(A.key==="ArrowLeft"||A.key==="ArrowRight")i+=A.key==="ArrowLeft"?-4:4;else if(A.key==="ArrowUp"||A.key==="ArrowDown")a=Math.max(-Se,Math.min(Se,a+(A.key==="ArrowUp"?4:-4)));else if(A.key==="+"||A.key==="="){O(s-5),A.preventDefault();return}else if(A.key==="-"){O(s+5),A.preventDefault();return}else return;A.preventDefault(),b()}};window.addEventListener("keydown",G);let w=0,E=(A,k)=>{if(!c){k?.();return}let V=A===1?0:1,Y=performance.now(),z=()=>{if(u)return;let _=o<=0?1:Math.min(1,(performance.now()-Y)/o);c?.setOpacity(V+(A-V)*_),n.requestRender(),_<1?w=requestAnimationFrame(z):k?.()};w=requestAnimationFrame(z)};E(1);let I=()=>{u||(u=!0,d(),l.abort(),r.signal?.removeEventListener("abort",m),cancelAnimationFrame(w),g.removeEventListener("pointerdown",N),g.removeEventListener("pointermove",v),g.removeEventListener("pointerup",M),g.removeEventListener("pointercancel",M),g.removeEventListener("wheel",C),window.removeEventListener("keydown",G),g.remove(),y?.isConnected&&y.focus({preventScroll:!0}),c?.dispose(),n.camera.position.set(p[0],p[1],p[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},T={close(){if(u)return;let A=()=>{I(),r.onClose?.()};cancelAnimationFrame(w),E(0,A)},dispose:I};return x.addEventListener("click",()=>T.close()),T}function qr(t){let{container:e,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:u,resolvedSeatViewPose:l,gpu:m,gl:d,isContextLost:p,isDisposed:c,flightGen:f,setPanorama:h,getLoadAbort:b,setLoadAbort:g,setPanoramaSphereVisible:y,setFrozen:x,raisePanoramaLayer:P,restorePanoramaLayer:R,getOverviewChip:S,labelOverlay:F,reducedMotion:B,removeArriveChip:L,showArriveChip:H}=t;return async(O,N,v)=>{b()?.abort();let M=new AbortController;g(M);let C=n.seats.idToIndex.get(O);if(C===void 0){i.syncFromCamera();return}let G=s.get(O)?.label??O,w=l(O,C),E=u(O);if(!E){M.abort(),b()===M&&g(null),i.syncFromCamera();return}x(!0),a.stop();let I;try{I=await E}catch{if(b()===M&&g(null),o.panoramaFailed(O,"source"),!c()&&v===f()){x(!1),i.resumeAfterFlight(w.focal),a.requestRender();let U=H(O,v,!0);requestAnimationFrame(()=>U?.querySelector("[data-panorama-trigger]")?.focus())}return}if(c()||v!==f()){M.abort(),b()===M&&g(null);return}L();let T=S(),A=()=>{M.abort(),b()===M&&g(null),h(null),y(!1),R(),T.style.display="",F.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(w.focal),a.requestRender();let U=H(O,f());requestAnimationFrame(()=>U?.querySelector("[data-panorama-trigger]")?.focus())},k=I.generated===!0,V=Ur(I);P(),y(!k),T.style.display="none";let Y=B()?0:N,z=m(),_=z&&!p()?await Kr(e,k?null:I,{gl:d,scene:z.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:k?w.eye:void 0,focalWorld:w.focal},{fadeMs:Y,seatLabel:G,disclosure:V,disclosurePrefix:k?"Live seat-eye view":"360\xB0 panorama",onClose:A,signal:M.signal}):null;if(c()||v!==f()){M.abort(),y(!1),b()===M&&g(null),_?.dispose(),T.style.display="",R();return}if(_)i.syncFromCamera(),F.setVisible(!1),x(!1),a.requestRender(),h(_);else if(k){R(),T.style.display="",x(!1),i.resumeAfterFlight(w.focal),a.requestRender(),h(null),y(!1),o.panoramaFailed(O,"mount");let U=H(O,f(),!0);requestAnimationFrame(()=>U?.querySelector("[data-panorama-trigger]")?.focus()),b()===M&&g(null);return}else y(!1),o.panoramaFallback(O),h(jr(e,I,{fadeMs:Y,seatLabel:G,disclosure:V,onClose:A,signal:M.signal}));o.panoramaOpened()}}var $r=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),$t=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,o){this.emit("3d_opened",{seats:e,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(e,n){this.emit("3d_seat_picked",{seatId:e,sectionId:n})}cinematicPlayed(e){this.emit("3d_cinematic_played",{durationMs:e,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=$r(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round($r()-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 Zr(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function Qr(t){let{container:e,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=t,s=null,u=()=>{if(!s)return;let d=a();Object.assign(s.style,d?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},l=()=>{s?.remove(),s=null};return{show:(d,p,c=!1)=>{if(l(),t.isDisposed())return null;let f=document.createElement("div");f.setAttribute("role","group"),Object.assign(f.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let h=o.get(d),b=h?.sectionId?n.sections.find(B=>B.id===h.sectionId):void 0,g=h?.label??d;f.setAttribute("aria-label",`Explore views near ${b?.label?`${b.label}, `:""}seat ${g}`);let y=document.createElement("span");y.textContent=["Live 3D seat view",b?.label,g].filter(Boolean).join(" \xB7 "),Object.assign(y.style,{maxWidth:"min(320px, calc(100vw - 32px))",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),f.appendChild(y);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(x);let P=h?.rowId?i.get(h.rowId):void 0,R=P?.indexOf(d)??-1,S=R>=0?[P?.[R-1],P?.[R+1]]:[void 0,void 0],F=(B,L,H,O=!1)=>{let N=document.createElement("button");N.type="button",N.textContent=B,N.setAttribute("aria-label",L),Object.assign(N.style,{minHeight:"44px",padding:O?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),O||(N.style.minWidth="44px"),O&&(N.dataset.panoramaTrigger=""),N.addEventListener("click",H),x.appendChild(N)};if(S[0]){let B=o.get(S[0])?.label??S[0];F("\u2039",`View previous seat ${B}`,()=>{t.flyToSeat(S[0])})}if(r.getSeatView){let B=r.seatViewActionLabel?.(d)??"Open 360\xB0 panorama";F(c?`\u21BB Retry ${B}`:`\u25C9 ${B}`,`${c?"Retry":B} from seat ${g}`,()=>{if(t.isDisposed()||p!==t.flightGen()){l();return}l(),t.openPanorama(d,400,p)},!0)}if(S[1]){let B=o.get(S[1])?.label??S[1];F("\u203A",`View next seat ${B}`,()=>{t.flyToSeat(S[1])})}return x.childElementCount?(e.appendChild(f),s=f,u(),f):null},remove:l,layout:u}}function Jr(t){let{container:e,orbit:n,isNarrow:r}=t,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("button");u.type="button",u.textContent="\u21BB",u.setAttribute("aria-label","Drag to rotate the 3D venue"),u.dataset.tooltip="Rotate venue";let l=document.createElement("button");l.type="button",l.textContent="\u2725",l.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),l.dataset.tooltip="Move venue";let m=document.createElement("button");m.type="button",m.textContent="\u2212",m.setAttribute("aria-label","Zoom out of the 3D venue"),m.dataset.tooltip="Zoom out";let d=document.createElement("button");d.type="button",d.textContent="+",d.setAttribute("aria-label","Zoom into the 3D venue"),d.dataset.tooltip="Zoom in";for(let h of[u,l,m,d])h.className="sl-3d-icon-control",Object.assign(h.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"});a.append(u,l),s.append(d,m);let p=h=>{n.setPrimaryDragMode(h);let b=h==="orbit";u.setAttribute("aria-pressed",String(b)),l.setAttribute("aria-pressed",String(!b)),u.style.background=b?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=b?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=b?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};u.addEventListener("click",()=>p("orbit")),l.addEventListener("click",()=>p("pan")),m.addEventListener("click",()=>n.zoomBy(1.22)),d.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),p("orbit"),e.appendChild(o);let c=()=>{let h=r();o.style.display=i?"none":"flex",o.style.right=h?"12px":"14px",o.style.bottom=h?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=h?"none":"flex",d.style.display=h?"none":"",m.style.display=h?"none":""};return c(),{element:o,utilityControls:s,setNavigationMode:p,setSeatViewLocked:h=>{i=h,n.setInteractionEnabled(!h),c()},seatViewLocked:()=>i,layout:c}}function ei(t){let{glctx:e,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:u,sectionIdBySeatId:l,tapSlop:m,tapMs:d,cancelFlight:p,focusSectionCamera:c,setSelection:f,ensureSeatView:h}=t,b=0,g=0,y=0,x=-1,P=!1,R=!1,S=O=>{t.seatViewLocked()||x===-1&&(x=O.pointerId,b=O.clientX,g=O.clientY,y=performance.now(),P=!1,R=a.active,a.active&&(s.cinematicCancelled(),p(),i.onViewTargetChange?.(null)))},F=O=>{O.pointerId===x&&Math.hypot(O.clientX-b,O.clientY-g)>m&&(P=!0)},B=(O,N,v,M,C)=>{let G=e.canvas.getBoundingClientRect(),w=e.canvas.clientWidth||G.width||1,E=e.canvas.clientHeight||G.height||1,I=O-G.left,T=N-G.top,A=M*M,k=-1,V=A,Y=1/0;for(let z of o){if(v&&z.sectionId!==v)continue;let _=r.seats.idToIndex.get(z.id);if(_===void 0)continue;if(C){let Z=Math.round(r.seats.iState[_]??0);if(Z!==0&&Z!==3)continue}let U=_*3,W=zt(n.camera.projectionViewMatrix,[r.seats.iPosition[U],r.seats.iPosition[U+1]+.55,r.seats.iPosition[U+2]],w,E);if(!W.visible)continue;let Q=W.x-I,$=W.y-T,J=Q*Q+$*$;(J<V||Math.abs(J-V)<1&&W.depth<Y)&&(k=_,V=J,Y=W.depth)}return k},L=(O,N)=>{let v=t.gpu(),M=t.pick();if(!v||!M)return-1;M.syncFromSeatProgram(v.seatProgram);let C=e.canvas.getBoundingClientRect(),G=e.renderer.dpr,{x:w,y:E}=kr(O,N,C,G,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),I=Math.max(2,Math.round(8*G));return M.pick(n.camera,w,E,I)};return{onDown:S,onMove:F,onUp:O=>{if(O.pointerId!==x)return;let N=!P&&performance.now()-y<d;if(x=-1,R){R=!1;return}let v=t.gpu(),M=t.pick();if(!N||!v||!M)return;let C=L(O.clientX,O.clientY);if(t.focusedSectionId()&&C>=0){let E=u[C],I=E?l.get(E):void 0;if(I&&I!==t.focusedSectionId()&&c(I))return}if(t.focusedSectionId()&&C<0&&(C=B(O.clientX,O.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&C<0){let E=B(O.clientX,O.clientY,null,72,!1),I=E>=0?u[E]:void 0,T=I?l.get(I):void 0;if(T&&T!==t.focusedSectionId()&&c(T))return}if(!t.focusedSectionId()){C<0&&(C=B(O.clientX,O.clientY,null,42,!1));let E=C>=0?u[C]:void 0,I=E?l.get(E):void 0;if(I&&c(I))return}if(C<0||C>=u.length){t.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let G=u[C],w=ye[Math.round(r.seats.iState[C]??0)]??"available";if(w!=="available"&&w!=="selected"){i.onSeatInspect?.(G,w);return}if(t.selection().has(G)&&t.selection().size===1){f([]),i.onViewTargetChange?.(null);return}f([G]),h(G),s.seatPicked(G,l.get(G)),i.onSeatPick?.(G)}}}var Zt=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,o=-1/0,i=-1/0;for(let c=0;c<this.count;c++){let f=e[c*3],h=e[c*3+2];f<n&&(n=f),f>o&&(o=f),h<r&&(r=h),h>i&&(i=h)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let u=this.cols*this.rows,l=new Int32Array(u+1),m=c=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((e[c*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((e[c*3+2]-r)/this.cell)))*this.cols+f};for(let c=0;c<this.count;c++)l[m(c)+1]++;for(let c=0;c<u;c++)l[c+1]+=l[c];let d=new Int32Array(this.count),p=l.slice(0,u);for(let c=0;c<this.count;c++)d[p[m(c)]++]=c;this.cellStart=l,this.cellItems=d}gather(e,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,u=r*r,l=Math.floor((e-this.minX)/this.cell),m=Math.floor((n-this.minZ)/this.cell),d=Math.ceil(r/this.cell)+1,p=this.iPosition,c=0;for(let f=0;f<=d&&c<s;f++){let h=m-f,b=m+f,g=l-f,y=l+f;for(let x=h;x<=b&&c<s;x++){if(x<0||x>=this.rows)continue;let P=x===h||x===b;for(let R=g;R<=y&&c<s;R++){if(!P&&R!==g&&R!==y){R=y-1;continue}if(R<0||R>=this.cols)continue;let S=x*this.cols+R;for(let F=i[S],B=i[S+1];F<B&&c<s;F++){let L=a[F],H=p[L*3]-e,O=p[L*3+2]-n;H*H+O*O<=u&&(o[c++]=L)}}}}return c}};var Qt=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(At);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new Zt(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 o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<sn)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>an){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,an,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(e,n,r){let o=1-Math.exp(-e*9),i=1-Math.exp(-e*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?o:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};var Jt=require("ogl");function ti(t){let{container:e,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:u,stageAzimuth:l,overviewFraming:m}=t,d=0,p=-1,c=(R,S,F=28)=>{o.camera.position.set(R[0],R[1],R[2]),o.camera.lookAt(new Jt.Vec3(S[0],S[1],S[2])),o.camera.fov=F,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.textContent="\u2302",f.setAttribute("aria-label","Fit the active level or whole venue in view"),f.dataset.tooltip="Fit view",Object.assign(f.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 h=()=>{f.textContent="\u2302"};h();let b=R=>{p=R;let S=t.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=R,S.solidProgram.uniforms.uFocusFloor.value=R,S.chairProgram.uniforms.uFocusFloor.value=R),t.showSectionSeatLabels(null)},g=()=>{if(t.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),a.panoramaClosed()),t.setPanoramaSphereVisible(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.restorePanoramaLayer(),f.style.display="",u.setVisible(!0),t.setFrozen(!1);let R=p>=0?n.floors[p]:null;if(t.setNearFieldDetailEnabled(!!R),t.setSeatViewLocked(!1),y(),t.removeArriveChip(),t.setNavigationMode("orbit"),R){let S=R.focalWorld[0]-R.center[0],F=R.focalWorld[2]-R.center[2],B=Math.hypot(S,F)>R.radius*.12?Math.atan2(S,F):l,L={center:R.center,radius:R.radius,box:R.box},H={polarDeg:58,margin:1.12};t.reducedMotion()?o.frame(L,!1,B,!1,H):o.frameSoft(L,B,!1,H)}else t.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,m):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,m);t.showSectionSeatLabels(null),s.requestRender()},y=()=>{d++,t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=R=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let S=n.seats.idToIndex.get(R);if(S===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(R),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),f.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1),t.setSeatViewLocked(!1);let F=++d;t.removeArriveChip();let{eye:B,focal:L}=t.resolvedSeatViewPose(R,S),H=[o.camera.position.x,o.camera.position.y,o.camera.position.z],O=En(H,B,L,n.bounds.center,n.bounds.radius),N=r.arriveAtSeatEye?B:O.finalPos,v=r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?90:65:28,M=[O.waypoints[0],O.waypoints[1],N];if(u.setVisible(!1),t.reducedMotion())return c(N,L,v),s.requestRender(),a.cinematicSkipped(),t.isDisposed()||o.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),t.showArriveChip(R,F),Promise.resolve();let C=new Jt.Quat().copy(o.camera.quaternion),G=Vr(o.camera,N,L);return s.requestRender(),i.start(M,C,G,2500,v).then(()=>{t.isDisposed()||F!==d||(a.cinematicPlayed(2500),o.resumeAfterFlight(L),t.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),t.showArriveChip(R,F))})},P=R=>{let S=n.sections.find(H=>H.id===R);if(!S||S.seatCount===0)return!1;t.setNearFieldDetailEnabled(!0),t.setSeatViewLocked(!1),i.cancel(),t.removeArriveChip(),n.floors.length>1&&p!==S.floorIndex&&b(S.floorIndex),t.setNavigationMode("pan"),t.showSectionSeatLabels(R);let F=S.focalWorld[0]-S.center[0],B=S.focalWorld[2]-S.center[2],L=Math.hypot(F,B)>S.radius*.12?Math.atan2(F,B):void 0;return o.frame({center:S.center,radius:Math.max(5,S.radius*.5)},!1,L),r.onSectionFocusChange?.(R),s.requestRender(),!0};return f.addEventListener("click",g),{overviewChip:f,layoutOverviewChip:h,flightGen:()=>d,focusedFloor:()=>p,applyFloorFocus:b,placeCameraFinal:c,cancelFlight:y,focusOverview:g,flyToSeat:x,focusSectionCamera:P}}var js={};function ni(t){let e=performance.now();return{model:rt(t),buildMs:performance.now()-e,source:"main"}}function oi(t){return typeof Worker>"u"?Promise.resolve(ni(t)):new Promise(e=>{let n=new Worker(new URL("./scene/scene.worker.ts",js.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),e(s))},i=()=>o(ni(t)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(t)})}var Ys=Math.PI/180,Xs=6,Ws=500;function Ks(t,e,n={}){let r=performance.now(),o=e.prepared?.model??rt(e),i=new $t(n.onAnalytics),a=new Array(o.seats.count);for(let[j,X]of o.seats.idToIndex)a[X]=j;let s=new Map(e.seats.map(j=>[j.id,j])),u=new Map;for(let j of e.seats){if(!j.rowId)continue;let X=u.get(j.rowId);X?X.push(j.id):u.set(j.rowId,[j.id])}let l=new Map;for(let j of e.seats)l.set(j.id,j.sectionId);let m=e.doc.floors?.some(X=>(X.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(X=>X.objects)??e.doc.objects).some(X=>X.type==="section"&&((X.height??0)>0||(X.rake??0)>0)),d=null,p=null,c=!1,f=!1,h=!1,b=new Map,g=null,y=null,x=null,P=new Map,R=null,S=()=>{x===null&&(x=t.style.zIndex,t.style.zIndex="20")},F=()=>{x!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=x),x=null)},B=!1,L=()=>B?le.focusedFloor():-1,H=()=>{d=Tr(M.gl,o),p=new Ut(M.renderer,d.seatGeometry,d.chairGeometry,d.solidGeometry,o.seats.count),M.setClearColor(o.theme.background.top),p.setRestoreClear(o.theme.background.top),d.seatProgram.uniforms.uSeatRadius.value=Pe*o.theme.seatScale,d.seatProgram.uniforms.uFocusFloor.value=L(),d.solidProgram.uniforms.uFocusFloor.value=L(),d.chairProgram.uniforms.uFocusFloor.value=L(),N.forceRegather()},O=!1,N=new Qt({model:o,orbit:()=>C,gpu:()=>d}),v=j=>N.setDetailEnabled(j),M=new wt(t,{onContextLost:()=>{h||i.contextLost(),c=!0,U.stop(),d=null,p=null},onContextRestored:()=>{H(),c=!1,h||i.contextRestored(),U.requestRender()}}),C=new Pt(M.gl,M.canvas,()=>U.requestRender(),()=>i.orbitEngaged());C.setAspect(M.aspect);let G=(e.doc.floors?.flatMap(j=>j.objects)??e.doc.objects).some(j=>j.type==="section"&&j.physical3dProvenance?.surfaceKind?.status==="inferred"),w=(()=>{if(G&&o.stages.length===0)return;let j=o.focalWorld[0]-o.bounds.center[0],X=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(j,X)>o.bounds.radius*.12?Math.atan2(j,X):void 0})(),E=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;C.frame(o.bounds,!I,w,n.portraitOverviewCrop===!0,E);let T=new jt(C.camera),A=Zr(t),k=new Gt(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),V=o.labels,Y=()=>or(V,o.floors.length,L());k.setLabels(Y());let z=null,_=j=>{if(z=j,k.setForcedDense(!!j),!j){k.setLabels(Y());return}let X=e.seats.filter(q=>q.sectionId===j),K=new Set(X.map(q=>q.id)),oe=new Set(X.map(q=>q.rowId)),re=new Set(b.keys()),ne=new Set(X.filter(q=>re.has(q.id)).map(q=>q.id)),ke=Y().filter(q=>q.kind!=="row"&&q.kind!=="seat"||(q.kind==="row"?oe.has(q.id.slice(4)):K.has(q.id.slice(5))&&(ne.size===0||ne.has(q.id.slice(5)))));if(o.seatCount<=6e3&&ne.size===0){k.setLabels(ke);return}let Fe=ne.size?X.filter(q=>ne.has(q.id)):X,st=new Set(Fe.map(q=>`seat:${q.id}`)),qe=Fe.flatMap(q=>{let De=o.seats.idToIndex.get(q.id);if(De===void 0)return[];let ct=De*3;return[{id:`seat:${q.id}`,kind:"seat",text:q.displayLabel||q.label,anchor:[o.seats.iPosition[ct],o.seats.iPosition[ct+1]+(re.has(q.id)?1.05:.55),o.seats.iPosition[ct+2]]}]});k.setLabels([...ke.filter(q=>!st.has(q.id)),...qe])};H();let U=new Ct(j=>{if(c||!d||f)return!1;let K=T.active?T.update(performance.now()):C.update(),oe=L()>=0?o.floors[L()]:null,re=oe?.radius??o.bounds.radius,ne=$n(C.currentDistance,re),ke=O?{center:[C.camera.position.x,C.camera.position.y,C.camera.position.z],radius:520}:o.renderBounds;C.updateClipping(ke);let Fe=oe?.center??o.renderBounds.center,st=oe?.radius??o.renderBounds.radius,qe=(He,en)=>Math.hypot(C.camera.position.x-He[0],C.camera.position.y-He[1],C.camera.position.z-He[2])<=en*(N.detailVisible?1.8:1.55),q=qe(Fe,st);if(!q&&z){let He=o.sections.find(en=>en.id===z);He&&(q=qe(He.center,Math.max(12,He.radius*2)))}N.detailVisible=q;let De=d.seatProgram.uniforms;De.uSeatScale.value=ne.scale,De.uSeatFade.value=ne.fade;let ct=!!oe&&Zn(oe.seatCount,M.canvas.clientWidth||1,M.canvas.clientHeight||1),si=Qn(o.seats.count,re,C.currentDistance,C.camera.fov,M.canvas.clientHeight||1),Bn=N.detailVisible||ct||si?1:0,Nn=N.detailVisible||L()>=0||o.floors.length>1?1:0;return N.ease(j,Bn,Nn),De.uSeatDetail.value=N.seatDetailMix,d.solidProgram.uniforms.uStructureDetail.value=N.structureDetailMix,De.uMinPixels.value=ne.minPixels,De.uPixelToWorld.value=2*Math.tan(C.camera.fov*Ys/2)/Math.max(1,M.pixelHeight),N.update(N.detailVisible),M.renderer.render({scene:d.background,clear:!0}),M.renderer.render({scene:d.main,camera:C.camera,clear:!1}),k.update(C.camera.projectionViewMatrix,M.canvas.clientWidth||1,M.canvas.clientHeight||1,C.currentDistance,re,[C.camera.position.x,C.camera.position.y,C.camera.position.z]),K||N.seatDetailMix!==Bn||N.structureDetailMix!==Nn}),W=typeof ResizeObserver<"u"?new ResizeObserver(()=>_n.resize()):null;W?.observe(t);let Q=j=>{let X=re=>{let ne=o.seats.idToIndex.get(re);return ne===void 0?void 0:o.seats.iState[ne]},{updates:K,next:oe}=Dr(b,j,X);if(b=oe,k.setSelectedSeatIds(b.keys()),z&&_(z),K.length){let re=pn(o.seats,K);d&&d.uploadSeatStateRuns(re),U.requestRender()}},$=()=>R!==null?R:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,J=8,Z=j=>{if(!n.getSeatView)return null;let X=P.get(j);if(!X)for(X=Promise.resolve(n.getSeatView(j)),P.set(j,X),X.catch(()=>{P.get(j)===X&&P.delete(j)});P.size>J;){let K=P.keys().next().value;if(K===void 0)break;P.delete(K)}return X},pe=(j,X)=>{let K=s.get(j),oe=Math.max(0,Math.round(o.seats.iFloor[X]??0)),re=e.doc.floors?.[oe],ne=o.floors[oe],ke=re?.focalPoint??e.doc.focalPoint,Fe=ne?{x:ne.focalWorld[0]/D,y:ne.focalWorld[2]/D}:ke,st=K?.focalPoint?{x:K.focalPoint.x+Fe.x-ke.x,y:K.focalPoint.y+Fe.y-ke.y}:Fe,qe=[o.seats.iPosition[X*3],o.seats.iPosition[X*3+1],o.seats.iPosition[X*3+2]];return zr(qe,st,re?.baseHeightM??0,K?.eyeHeightM)},Ve=()=>(t.clientWidth||M.canvas.clientWidth)<=520,ze,ge=Qr({container:t,model:o,opts:n,expandedSeatById:s,seatIdsByRow:u,isNarrow:Ve,isDisposed:()=>h,flightGen:()=>le.flightGen(),flyToSeat:j=>Ln(j),openPanorama:(j,X,K)=>ze(j,X,K)}),Re=ge.show,xe=ge.remove,Ie=ge.layout,se=Jr({container:t,orbit:C,isNarrow:Ve}),me=se.element,we=se.setNavigationMode,Te=se.setSeatViewLocked,We=se.layout,Ge=se.utilityControls,le=ti({container:t,model:o,opts:n,orbit:C,cinematic:T,analytics:i,loop:U,labelOverlay:k,stageAzimuth:w,overviewFraming:E,gpu:()=>d,isDisposed:()=>h,panorama:()=>g,setPanorama:j=>{g=j},setPanoramaSphereVisible:j=>{O=j},panoramaLoadAbort:()=>y,setPanoramaLoadAbort:j=>{y=j},setFrozen:j=>{f=j},restorePanoramaLayer:F,reducedMotion:$,resolvedSeatViewPose:pe,showSectionSeatLabels:_,setNearFieldDetailEnabled:v,setSeatViewLocked:Te,setNavigationMode:we,showArriveChip:Re,removeArriveChip:xe});B=!0;let Ke=le.overviewChip,ri=le.layoutOverviewChip,ii=le.applyFloorFocus,ai=le.focusOverview,Dn=le.cancelFlight,Ln=le.flyToSeat,On=le.focusSectionCamera;Ge.appendChild(Ke),ze=qr({container:t,model:o,opts:n,analytics:i,orbit:C,loop:U,seatsById:s,ensureSeatView:Z,resolvedSeatViewPose:pe,gpu:()=>d,gl:M.gl,isContextLost:()=>c,isDisposed:()=>h,flightGen:()=>le.flightGen(),setPanorama:j=>{g=j},getLoadAbort:()=>y,setLoadAbort:j=>{y=j},setPanoramaSphereVisible:j=>{O=j},setFrozen:j=>{f=j},raisePanoramaLayer:S,restorePanoramaLayer:F,getOverviewChip:()=>Ke,labelOverlay:k,reducedMotion:$,removeArriveChip:xe,showArriveChip:Re});let Ee=ei({glctx:M,orbit:C,model:o,seats:e.seats,opts:n,cinematic:T,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:Xs,tapMs:Ws,gpu:()=>d,pick:()=>p,seatViewLocked:()=>se.seatViewLocked(),focusedSectionId:()=>z,selection:()=>b,cancelFlight:Dn,focusSectionCamera:On,setSelection:Q,ensureSeatView:Z});M.canvas.addEventListener("pointerdown",Ee.onDown),M.canvas.addEventListener("pointermove",Ee.onMove),M.canvas.addEventListener("pointerup",Ee.onUp),M.canvas.addEventListener("pointercancel",Ee.onUp),U.requestRender();let _n={setAvailability(j){let X=Fr(b,j),K=pn(o.seats,X);K.length&&d&&d.uploadSeatStateRuns(K),U.requestRender()},setSelection:Q,flyToSeat:Ln,focusOverview:ai,resize(){let{width:j,height:X}=M.resize();C.setAspect(j/Math.max(1,X)),Ie(),We(),ri(),U.requestRender()},stats(){return{...U.stats(),drawCalls:d?d.drawCalls:0,seatCount:o.seatCount}},loseContextForTest(){M.simulateContextLossCycle()},floors(){return o.floors},focusFloor(j){if(j!==null&&!o.floors.some(K=>K.index===j))return!1;let X=j??-1;if(v(j!==null),Te(!1),ii(X),we("orbit"),j===null)T.cancel(),$()?C.frame(o.bounds,!1,w,n.portraitOverviewCrop===!0,E):C.frameSoft(o.bounds,w,n.portraitOverviewCrop===!0,E);else{let K=o.floors[j];if(K.seatCount>0){T.cancel();let oe=K.focalWorld[0]-K.center[0],re=K.focalWorld[2]-K.center[2],ne=Math.hypot(oe,re)>K.radius*.12?Math.atan2(oe,re):w;C.frame({center:K.center,radius:K.radius,box:K.box},!1,ne,!1,{polarDeg:58,margin:1.12})}}return U.requestRender(),!0},zones(){return o.zones},focusZone(j){let X=o.zones.find(ne=>ne.id===j);if(!X||X.seatCount===0)return!1;v(!1),Te(!1),T.cancel(),we("orbit"),_(null),n.onSectionFocusChange?.(null);let K=X.focalWorld[0]-X.center[0],oe=X.focalWorld[2]-X.center[2],re=Math.hypot(K,oe)>X.radius*.12?Math.atan2(K,oe):void 0;return C.frame({center:X.center,radius:X.radius*1.25},!1,re),U.requestRender(),!0},sections(){return o.sections},focusSection(j){return On(j)},rows(j){return j?o.rows.filter(X=>X.sectionId===j):o.rows},seatsInRow(j){return e.seats.filter(X=>X.rowId===j).map(X=>({id:X.id,label:X.displayLabel||X.label}))},focusRow(j){let X=o.rows.find(K=>K.id===j);return!X||X.seatCount===0?!1:(v(!0),Te(!1),T.cancel(),we("pan"),X.sectionId&&(_(X.sectionId),n.onSectionFocusChange?.(X.sectionId)),C.frame({center:X.center,radius:Math.max(2.5,X.radius*.65)}),U.requestRender(),!0)},setReducedMotionForTest(j){R=j},dispose(){h=!0,xe(),Ke.remove(),me.remove(),Dn(),U.stop(),k.dispose(),W?.disconnect(),g&&(g.dispose(),g=null),F(),A(),M.canvas.removeEventListener("pointerdown",Ee.onDown),M.canvas.removeEventListener("pointermove",Ee.onMove),M.canvas.removeEventListener("pointerup",Ee.onUp),M.canvas.removeEventListener("pointercancel",Ee.onUp),C.dispose(),p&&p.dispose(),d&&d.dispose(),d=null,p=null,M.dispose()}};return i.opened(o.seatCount,m,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),_n}0&&(module.exports={buildSceneModel,mountVenue3D,prepareVenue3D});