@seatlayer/core 0.66.0 → 0.67.1
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.
- package/dist/openPanorama-ALLZ6ADE.js +20 -0
- package/dist/view3d/index.cjs +47 -47
- package/dist/view3d/index.js +28 -47
- package/package.json +1 -1
package/dist/view3d/index.cjs
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
"use strict";var Ri=Object.create;var Tt=Object.defineProperty;var Ii=Object.getOwnPropertyDescriptor;var Ei=Object.getOwnPropertyNames;var Ti=Object.getPrototypeOf,ki=Object.prototype.hasOwnProperty;var Li=(e,t)=>{for(var n in t)Tt(e,n,{get:t[n],enumerable:!0})},qn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ei(t))!ki.call(e,o)&&o!==n&&Tt(e,o,{get:()=>t[o],enumerable:!(r=Ii(t,o))||r.enumerable});return e};var et=(e,t,n)=>(n=e!=null?Ri(Ti(e)):{},qn(t||!e||!e.__esModule?Tt(n,"default",{value:e,enumerable:!0}):n,e)),Fi=e=>qn(Tt({},"__esModule",{value:!0}),e);var xc={};Li(xc,{VENUE3D_QUALITY_REPORT_VERSION:()=>Nr,buildSceneModel:()=>ct,inspectVenue3DQualityEvidence:()=>Zt,mountVenue3D:()=>gc,prepareVenue3D:()=>wi});module.exports=Fi(xc);var eo=require("ogl");var Di=/^#?([\da-f]{3}|[\da-f]{6})$/i;function _i(e){let t=Di.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function ee(e){let t=_i(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function fn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Oi(e){return .2126*fn(e[0])+.7152*fn(e[1])+.0722*fn(e[2])}function Zn(e){return Oi([e[0]*255,e[1]*255,e[2]*255])}function Bi(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function fe(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function ft(e,t){let n=Bi(e);return fe(e,[n,n,n],t)}var ge=["available","held","sold","selected","dimmed"];function pt(e){let t=ge.indexOf(e);return t<0?0:t}var $n={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Jn(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.42,r=.62;return[(t+(e[0]-t)*n)*r,(t+(e[1]-t)*n)*r,(t+(e[2]-t)*n)*r]}var pn={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]},Ke={top:[.05,.06,.08],bottom:[.1,.12,.15]};function be(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Ni(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var kt=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,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 eo.Renderer({canvas:this.canvas,dpr:Ni(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ke.top[0],Ke.top[1],Ke.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.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(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=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(t,n),{width:t,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 t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var nt=require("ogl"),de=Math.PI/180,bn=15*de,yn=80*de,tt=.12,to=35,no=1.25,Lt=class{constructor(t,n,r,o){this.fovY=to;this.target=new nt.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 nt.Vec3;this.panAnchor=new nt.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new nt.Camera(t,{fov:to,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 c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;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(bn,Math.min(yn,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(bn,Math.min(yn,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 t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,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,c=-i,l=Math.cos(this.polar),u=Math.sin(this.polar),d=-i*l,m=-a*l;this.targetT.x+=(-t*s+n*d)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*u*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*de/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=r??-30*de,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*de;let u=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??no)),this.minDist=Math.max(2,a*.12),this.maxDist=u*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(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.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 c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??no))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let l=Math.sin(i),u=-l*Math.sin(o),d=-Math.cos(i),m=-l*Math.cos(o);if(Math.abs(d)>.999)return s;let h=-m,f=u,p=Math.hypot(h,f);h/=p,f/=p;let b=-f*d,y=f*u-h*m,g=h*d,x=Math.tan(r),S=Math.tan(n),C=1;for(let M=0;M<8;M++){let k=(M&1?c.max[0]:c.min[0])-t.center[0],O=(M&2?c.max[1]:c.min[1])-t.center[1],V=(M&4?c.max[2]:c.min[2])-t.center[2],H=k*u+O*d+V*m,N=Math.abs(k*h+V*f),A=Math.abs(k*b+O*y+V*g);C=Math.max(C,N/x-H,A/S-H)}return Math.min(s,Math.max(C,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=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),c=Math.abs(t)>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+=t*tt,this.polar+=n*tt,this.distance+=r*tt,this.target.x+=o*tt,this.target.y+=i*tt,this.target.z+=a*tt,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=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(t,n,r)||1,i=Math.max(bn,Math.min(yn,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(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*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 Ft=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,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=t}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 ot=2.5,Gi=1.15,bt=6,rt=10,oo=6,ro=9.5,io=.9,ao=2.2,gn=30,xn=4,Dt=8192;var Ic=rt+xn;function so(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ot};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ot+o*(Gi-ot)}}function co(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function lo(e,t,n,r,o){if(!(e>0)||!(t>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=t/(n*i)*(o/2);return Math.PI*a*a/e>=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:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{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:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{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"}],Tc=new Map(Vi.map(e=>[e.key,e]));var zi={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function uo(e){let t=e?.[0];return t&&zi[t]||"#3b82f6"}var Hi=[{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"}],kc=new Map(Hi.map(e=>[e.key,e]));var Ui=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Lc=new Set(Ui);var ho=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],fo=ho.map(e=>e.key),ji=new Map(ho.map(e=>[e.key,e]));function mo(e){return typeof e=="string"&&ji.has(e)}function po(e,t){return mo(e)?e:mo(t?.seatGlyph)?t.seatGlyph:"circle"}var we=.02291666666666667,Be=1/we,Yi=58,Xi=Yi*we;var Wi=3,bo=0,vn=120,Ki=0,Qi=45,qi=7,_t=1.2;function Mn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Zi(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=qi?e:Wi}function yo(e,t={}){let n=Mn(t.floorBaseHeightM,bo,vn,0),r=Math.min(vn,n+Zi(e.elevation)*Xi),o=e.height===void 0?r:Mn(e.height,bo,vn,r),i=Mn(e.rake,Ki,Qi,0);return{height:o,rake:i}}var xo=et(require("earcut"),1),vo=et(require("polygon-clipping"),1);var Nc=Math.PI/180;function Sn(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function yt(e){return e.length?Sn(e):null}function Qe(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function gt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var _=we,$i=.002;function Ji(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[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<$i}var qe=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)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)}},Nt=class{constructor(){this.pos=new qe;this.nor=new qe;this.col=new qe;this.flr=new qe;this.mat=new qe;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){Ji(t,n,r)||(this.pos.push3(t[0],t[1],t[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(t,n,r,o,i,a,s,c=s,l=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[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(c[0],c[1],c[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 ea(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],l=o*c-i*s,u=i*a-r*c,d=r*s-o*a,m=Math.hypot(l,u,d)||1;return l/=m,u/=m,d/=m,[l,u,d]}function ta(e,t){let n=[...e],r=[];for(let a of e)r.push(a.x,a.y);let o=[];if(t){for(let a of t)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,xo.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function wn(e){return Qe(e)<0?[...e].reverse():e}var na=3;function oa(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(h,f,p,b)=>Math.abs(r({x:(h.x+f.x)/2,y:(h.y+f.y)/2})-(p+b)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(o+i+a)/3,d=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:l})-u)),m=(h,f,p)=>{let b=Math.abs(r({x:(h+c)/2,y:(f+l)/2})-(p+u)/2);b>d&&(d=b)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),d}function xt(e,t,n,r,o){if(o<=0)return oa(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},s={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(xt(e,i,s,r,o-1),xt(i,t,a,r,o-1),xt(s,a,n,r,o-1),xt(i,a,s,r,o-1))}function vt(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},h={x:(n.x+r.x)/2,y:(n.y+r.y)/2},f={x:(r.x+t.x)/2,y:(r.y+t.y)/2};vt(e,t,m,f,o,i,a-1,s),vt(e,m,n,h,o,i,a-1,s),vt(e,f,h,r,o,i,a-1,s),vt(e,m,h,f,o,i,a-1,s);return}let c=[t.x*_,o(t),t.y*_],l=[n.x*_,o(n),n.y*_],u=[r.x*_,o(r),r.y*_];if(s){e.triN(c,l,u,s(t),s(n),s(r),i);return}let d=ea(c,l,u);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),e.tri(c,l,u,d,i)}var ra=8;function go(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,l)=>{if(l>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},d=t(u);if(Math.abs(d-(s+c)/2)>n){o(i,u,s,d,l-1),o(u,a,d,c,l-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),ra)}return r}function Ot(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||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)<t;)n.pop();if(n.length<3)return e;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],c=s.x-i.x,l=s.y-i.y,u=Math.hypot(c,l);u>t&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/u<t||r.push(a)}return r.length>=3?r:n}var Bt=.001*Be*.1;function ce(e,t,n,r,o,i,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Qe(t))<1e-4))return;let u=Ot(go(Ot(wn(t),Bt),r,c),Bt),d=n?.map(M=>Ot(go(Ot(wn(M),Bt),r,c),Bt)).filter(M=>M.length>=3&&Math.abs(Qe(M))>=1e-4),{pts:m,tris:h}=ta(u,d),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],p=[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],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<na;g++){let M=0;for(let k=0;k<h.length;k+=3){let O=xt(m[h[k]],m[h[k+1]],m[h[k+2]],r,g);O>M&&(M=O)}if(M<=c)break}for(let M=0;M<h.length;M+=3){let k=m[h[M]],O=m[h[M+1]],V=m[h[M+2]];vt(e,k,O,V,r,f,g,l);let H=[k.x*_,o,k.y*_],N=[O.x*_,o,O.y*_],A=[V.x*_,o,V.y*_];e.tri(H,A,N,[0,-1,0],p)}let x=M=>{if(g<=0)return M;let k=1<<g,O=[];for(let V=0;V<M.length;V++){let H=M[V],N=M[(V+1)%M.length];for(let A=0;A<k;A++){let v=A/k;O.push({x:H.x+(N.x-H.x)*v,y:H.y+(N.y-H.y)*v})}}return O},S=Sn(u),C=[{ring:x(u),flip:!1}];if(d)for(let M of d)M.length>=3&&C.push({ring:x(M),flip:!0});for(let{ring:M,flip:k}of C)for(let O=0;O<M.length;O++){let V=M[O],H=M[(O+1)%M.length],N=(H.x-V.x)*_,v=(H.y-V.y)*_,w=-N,P=Math.hypot(v,w)||1;v/=P,w/=P;let T=(V.x+H.x)/2-S.x,L=(V.y+H.y)/2-S.y,E=v*T+w*L;k&&(E=-E),E<0&&(v=-v,w=-w);let R=[v,0,w],z=[V.x*_,r(V),V.y*_],I=[H.x*_,r(H),H.y*_],D=[V.x*_,o,V.y*_],B=[H.x*_,o,H.y*_];e.tri(z,I,B,R,b,b,y),e.tri(z,B,D,R,b,y,y)}}function Mo(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:t}}function Gt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=wn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],u=l.x-c.x,d=l.y-c.y,m=Math.hypot(u,d)||1;i.push({x:d/m,y:-u/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],u=i[s],d=l.x+u.x,m=l.y+u.y,h=Math.hypot(d,m),f=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+u.x*t,c.y+u.y*t])};if(h<1e-9){f();continue}d/=h,m/=h;let p=d*l.x+m*l.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){f();continue}a.push([c.x+d*t*b,c.y+m*t*b])}if(a.length<3)return e;try{let s=vo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let d of s){let m=Math.abs(Qe(d[0].map(([h,f])=>({x:h,y:f}))));m>l&&(l=m,c=d[0])}if(!c)return e;let u=c.map(([d,m])=>({x:d,y:m}));if(u.length>1){let d=u[0],m=u[u.length-1];Math.abs(d.x-m.x)<1e-9&&Math.abs(d.y-m.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function Vt(e,t,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+r*Math.sin(s)})}return i}function Mt(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var re={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},ia=.44,aa=.15,sa=.3,ca=.24;function So(e){return e===void 0||!Number.isFinite(e)||e<=0?ca:Math.min(sa,Math.max(aa,e*ia))}var Pn=.21,la=.05,Cn=.45,zt=Cn+la,ua=[{part:re.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:re.pad,min:[-1,.36,-.95],max:[1,Cn,1]},{part:re.back,min:[-1,zt,-1],max:[1,.92,-.72]},{part:re.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:re.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:re.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:re.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:re.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:re.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:re.leg,min:[.62,0,.48],max:[.82,.37,.7]}],da=[{part:re.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:re.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:re.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:re.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:re.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],ma=[{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 wo(){let e=[],t=[],n=[],r=[],o=(P,T,L)=>{let E=n.length,[R,z,I]=P,D=[z[0]-R[0],z[1]-R[1],z[2]-R[2]],B=[I[0]-R[0],I[1]-R[1],I[2]-R[2]],U=D[1]*B[2]-D[2]*B[1],G=D[2]*B[0]-D[0]*B[2],F=D[0]*B[1]-D[1]*B[0],X=Math.hypot(U,G,F);X>1e-9?(U/=X,G/=X,F/=X):[U,G,F]=T,U*T[0]+G*T[1]+F*T[2]<0&&(U=-U,G=-G,F=-F);for(let K of P)e.push(...K),t.push(U,G,F),n.push(L);r.push(E,E+1,E+2,E,E+2,E+3)},i=P=>{for(let T of ma){let L=T.c.map(E=>E.map((R,z)=>R?P.max[z]:P.min[z]));o(L,T.n,P.part)}};for(let P of ua)i(P);for(let P of da)i(P);let a=Cn,s=1.08,c=.47,l=.69,u=-.55,d=.08,m=-.48,h=.01,f=[-c,a,u],p=[c,a,u],b=[-c,a,d],y=[c,a,d],g=[-l,s,m],x=[l,s,m],S=[-l,s,h],C=[l,s,h];o([p,x,C,y],[1,0,0],re.body),o([b,S,g,f],[-1,0,0],re.body),o([S,C,x,g],[0,1,0],re.body),o([f,p,y,b],[0,-1,0],re.body),o([y,C,S,b],[0,0,1],re.body),o([f,g,x,p],[0,0,-1],re.body);let M=10,k=8,O=[0,1.205,-.23],V=[.42,.115,.38],H=n.length;for(let P=0;P<=k;P++){let T=Math.PI*P/k,L=Math.cos(T),E=Math.sin(T);for(let R=0;R<=M;R++){let z=Math.PI*2*R/M,I=E*Math.cos(z),D=E*Math.sin(z);e.push(O[0]+V[0]*I,O[1]+V[1]*L,O[2]+V[2]*D);let B=I/V[0],U=L/V[1],G=D/V[2],F=Math.hypot(B,U,G)||1;B/=F,U/=F,G/=F,t.push(B,U,G),n.push(re.head)}}for(let P=0;P<k;P++)for(let T=0;T<M;T++){let L=H+P*(M+1)+T,E=L+M+1;r.push(L,E,L+1,L+1,E,E+1)}let N=new Float32Array(e),A=new Float32Array(t),v=new Float32Array(n),w=new Uint16Array(r);return{position:N,normal:A,part:v,index:w,vertexCount:n.length,indexCount:r.length}}function Po(e,t,n,r){let o=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,u)=>{let d=u-l;for(let m=l;m<u;m++){let[h,f]=r(m),p=h-i(m),b=f-a(m);if(d>=2){let y=Math.max(l,m-1),g=Math.min(u-1,m+1),x=i(g)-i(y),S=a(g)-a(y),C=Math.hypot(x,S);if(C>1e-6){let M=-S/C,k=x/C;M*p+k*b<0&&(M=-M,k=-k),p=M,b=k}}o[m]=p===0&&b===0?0:Math.atan2(p,b)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var ke=.22;function Co(e,t){let n=ge[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var ha=.42;function fa(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let f of e)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),c=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/l)+1),d=Math.max(1,Math.ceil(c/l)+1),m=new Map,h=(f,p)=>{let b=Math.min(u-1,Math.max(0,Math.floor((f-r)/l)));return Math.min(d-1,Math.max(0,Math.floor((p-o)/l)))*u+b};for(let f=0;f<t;f++){let p=h(e[f].x,e[f].y),b=m.get(p);b?b.push(f):m.set(p,[f])}for(let f=0;f<t;f++){let p=e[f],b=Math.min(u-1,Math.max(0,Math.floor((p.x-r)/l))),y=Math.min(d-1,Math.max(0,Math.floor((p.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let S=y-x;S<=y+x;S++)if(!(S<0||S>=d))for(let C=b-x;C<=b+x;C++){if(C<0||C>=u||x>1&&Math.abs(S-y)<x&&Math.abs(C-b)<x)continue;let M=m.get(S*u+C);if(M)for(let k of M){if(k===f)continue;let O=Math.hypot(e[k].x-p.x,e[k].y-p.y);O<g&&(g=O)}}if(Number.isFinite(g)&&g<=x*l)break}n[f]=g}return n}function pa(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-_t):0}function Ao(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),u=new Float32Array(a),d=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a),f=new Float32Array(a*3),p=new Map,b=fa(e);for(let y=0;y<a;y++){let g=e[y],S=(n?.seatPitchU(y)??b[y])*_;u[y]=Number.isFinite(S)?Math.max(.06,Math.min(ke,S*ha)):ke,d[y]=So(Number.isFinite(S)?S:void 0);let C=po(g.glyph,{seatGlyph:i?.get(g.categoryKey)});m[y]=fo.indexOf(C),h[y]=g.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=g.x*_,s[y*3+1]=n?n.seatDeckY(y):pa(g),s[y*3+2]=g.y*_,c[y]=pt(t?t(g):"available");let M=ee(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[y*3]=M[0],l[y*3+1]=M[1],l[y*3+2]=M[2],g.accessibility?.length){let k=ee(uo(g.accessibility));k&&(f[y*3]=k[0],f[y*3+1]=k[1],f[y*3+2]=k[2])}p.set(g.id,y)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:f,idToIndex:p,iChairWidth:d,iGlyph:m,iPhysicalSeat:h,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var ba=64;function An(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=pt(a.state);e.iState[s]!==c&&(e.iState[s]=c,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+ba){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 ya=.15,ga=.9,xa=1.76,va=.7,Ma=1.6;function Sa(){return{background:{top:[...Ke.top],bottom:[...Ke.bottom]},structure:pn,seatStates:{...$n},seatScale:1}}function Ro(e){let t=Sa();if(!e)return t;let n=ee(e.background);if(n){t.background={top:be(n,ga),bottom:be(n,xa)};let i={};for(let[a,s]of Object.entries(pn))i[a]=fe(s,n,ya);t.structure=i}let r=ee(e.selectionColor)??ee(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(Ma,Math.max(va,o))),t}function Io(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Eo(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function it(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));d<r&&(r=d)}return r}function wa(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function To(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Rn(e,t){let n=1/0;for(let r of Eo(e)){let o=it(t,r.x,r.y);o<n&&(n=o)}for(let r of Eo(t)){let o=it(e,r.x,r.y);o<n&&(n=o)}return n}function Pa(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let u of e)n+=u.x,r+=u.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let u of e){let d=Math.hypot(u.x-n,u.y-r);d>o&&(o=d,i=u)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((u,d)=>({p:u,i:d,t:(u.x-n)*a+(u.y-r)*s})).sort((u,d)=>u.t-d.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function In(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let g of e)n+=g.x,r+=g.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,l=0,u=0;for(let g of e){let x=g.x-n,S=g.y-r;o+=x*x,a+=S*S,i+=x*S,s+=x*x*x,c+=S*S*S,l+=x*S*S,u+=S*x*x}let d=o*a-i*i;if(Math.abs(d)<1e-9)return null;let m=(s+l)/2,h=(c+u)/2,f=(m*a-h*i)/d,p=(h*o-m*i)/d,b=f+n,y=p+r;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var Ca=.15;function Aa(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,S=0;for(let C of g.pts)x+=C.x,S+=C.y;return{x:x/g.pts.length,y:S/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let g of t){let x=g.x-n,S=g.y-r;o+=x*x,i+=x*S,a+=S*S}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,d;Math.abs(i)>1e-12?(u=l-a,d=i):o>=a?(u=1,d=0):(u=0,d=1);let m=Math.hypot(u,d);if(!(m>1e-12))return null;u/=m,d/=m;let h=1/0,f=-1/0,p=[];for(let g of e){let x=1/0,S=-1/0;for(let C of g.pts){let M=C.x*u+C.y*d;M<x&&(x=M),M>S&&(S=M),M<h&&(h=M),M>f&&(f=M)}p.push(S-x)}let b=f-h;return b>1e-9?(p.sort((g,x)=>g-x),p[Math.min(p.length-1,Math.floor(p.length*.9))]/b<=Ra?{x:u,y:d}:null):null}var Ra=.35;function ko(e,t,n,r){let o=new Map;for(let b of n){let y=t[b],g=y.rowId||`__seat-${b}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:y.x,y:y.y}),x.idx.push(b)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,y]of o){let g=Pa(y.pts,y.idx),x=0;for(let S of g.pts)x+=Math.hypot(S.x-r.x,S.y-r.y);i.push({id:b,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(b=>wa(b.pts)),s=[];for(let b=0;b<i.length;b++){let y=1/0;for(let g=0;g<i.length;g++){if(b===g||To(a[b],a[g])>=y)continue;let x=Rn(i[b].pts,i[g].pts);x<y&&(y=x)}Number.isFinite(y)&&s.push(y)}s.sort((b,y)=>b-y);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),u=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let y=b+1;y<i.length;y++)To(a[b],a[y])>l||Rn(i[b].pts,i[y].pts)<=l&&(u[b].push(y),u[y].push(b));let d=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let y=d++,g=[b];for(i[b].blockId=y;g.length;){let x=g.pop();for(let S of u[x])i[S].blockId===-1&&(i[S].blockId=y,g.push(S))}}let m=new Map;for(let b of i){let y=m.get(b.blockId)??[];y.push(b),m.set(b.blockId,y)}let h=[];for(let b of i){if(b.pts.length<4)continue;let y=In(b.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||h.push({x:y.cx,y:y.cy}))}let f=h.length>=2?(()=>{let b=h.map(x=>x.x).sort((x,S)=>x-S),y=h.map(x=>x.y).sort((x,S)=>x-S),g=Math.floor(h.length/2);return{cx:b[g],cy:y[g]}})():null;if(f){let b=M=>Math.hypot(M.x-f.cx,M.y-f.cy),y=1/0,g=-1/0,x=[];for(let M of i){let k=1/0,O=-1/0;for(let V of M.pts){let H=b(V);H<k&&(k=H),H>O&&(O=H)}x.push(O-k),k<y&&(y=k),O>g&&(g=O)}let S=g-y;x.sort((M,k)=>M-k);let C=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(S>1e-9&&C/S<=Ca){let M=i.map(T=>{let L=0;for(let E of T.pts)L+=b(E);return{row:T,radius:L/T.pts.length}}),k=0,O=0;for(let T of M)k+=T.radius,O+=T.row.focalDistance;k/=M.length,O/=M.length;let V=0;for(let T of M)V+=(T.radius-k)*(T.row.focalDistance-O);if(V<0)for(let T of M)T.radius=-T.radius;let N=1/0;for(let T of M)T.radius<N&&(N=T.radius);M.sort((T,L)=>T.radius-L.radius);let A=-1,v=-1/0,w=S/Math.max(1,M.length)*.5,P=[];for(let T of M)T.radius-v>w&&(A++,v=T.radius),T.row.ordinal=A,T.row.blockDepth=T.radius-N,P.push(T.row);return{sectionId:e,rows:P,blockCount:d}}}let p=[];for(let[,b]of m){let y=Aa(b);if(y){let g=S=>{let C=0;for(let M of S.pts)C+=M.x*y.x+M.y*y.y;return C/S.pts.length};b.sort((S,C)=>g(S)-g(C)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let x=0;for(let S=0;S<b.length;S++)S>0&&(x+=Rn(b[S-1].pts,b[S].pts)),b[S].ordinal=S,b[S].blockDepth=x,p.push(b[S])}else{let g=1/0;for(let x of b)x.focalDistance<g&&(g=x.focalDistance);b.sort((x,S)=>x.focalDistance-S.focalDistance);for(let x=0;x<b.length;x++)b[x].ordinal=x,b[x].blockDepth=Math.max(0,b[x].focalDistance-g),p.push(b[x])}}return{sectionId:e,rows:p,blockCount:d}}var ol=Math.PI/180;function Lo(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function Ia(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.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 Fo(e,t,n){return Lo(e,t)&&!(n??[]).some(r=>Lo(e,r)||Ia(e,r))}function Ea(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function Ta(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let h of e)n+=h.x,r+=h.y,o+=Math.hypot(h.x-t.x,h.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let h of e){let f=Math.hypot(h.x-n,h.y-r);f>s&&(s=f,a=h)}let c=a.x-n,l=a.y-r,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let d=[...e].sort((h,f)=>(h.x-n)*c+(h.y-r)*l-((f.x-n)*c+(f.y-r)*l)),m=0;for(let h of d){let f=Math.hypot(h.x-n,h.y-r);f>m&&(m=f)}return{pts:d,cx:n,cy:r,radius:m,depth:o}}function Do(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-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],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,d=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;d<0?d=0:d>1&&(d=1);let m=Math.hypot(t-(a.x+d*c),n-(a.y+d*l));m<o&&(o=m)}return o}var Ht=8;function ka(e,t,n){let r=new Array(Ht).fill(1/0),o=new Array(Ht).fill(-1);for(let u=0;u<e.length;u++){let d=e[u],m=Math.hypot(t-d.cx,n-d.cy)-d.radius;for(let h=0;h<Ht;h++)if(m<r[h]){for(let f=Ht-1;f>h;f--)r[f]=r[f-1],o[f]=o[f-1];r[h]=m,o[h]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of o){if(u<0)continue;let d=Do(e[u],t,n);for(let m=0;m<3;m++)if(d<i[m]){for(let h=2;h>m;h--)i[h]=i[h-1],a[h]=a[h-1];i[m]=d,a[m]=u;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,l=0;for(let u=0;u<3;u++){let d=a[u];if(d<0||i[u]>s)continue;let m=1/(i[u]*i[u]);c+=m*e[d].depth,l+=m}return l>0?c/l:e[a[0]].depth}function La(e){let t=(r,o)=>ka(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let l=Do(c,r,o);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function _o(e,t){let n=[];for(let r of e){let o=Ta(r.points,t);o&&n.push(o)}return n.length<2?Ea(t):(n.sort((r,o)=>r.depth-o.depth),La(n))}var kn=et(require("polygon-clipping"),1);var Go=et(require("earcut"),1);var Fa=.58,Oo=.01,ye=ke*1.5*Be,Da=.5,_a=.6;function Oa(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],l=c.x-s.x,u=c.y-s.y,d=Math.hypot(l,u);if(d<1e-9){r.push([0,0]);continue}l/=d,u/=d,r.push([-u,l])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function Ba(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,l=s.y-a.y,u=Math.hypot(c,l)||1;return{x:c/u,y:l/u}},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*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Bo=Math.PI/12;function Na(e){if(e.length<3)return[...e];let t=[...e].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(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function Vo(e,t){if(!e.length||!(t>0))return[];let n=Na(e),r=(s,c,l,u)=>{let d=l-c;for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;let m=Math.max(1,Math.ceil(d/Bo)),h=t/Math.cos(d/m/2);for(let f=0;f<=m;f++){let p=c+d*f/m;u.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(n.length<3){let s=0,c=0;for(let h of n)s+=h.x,c+=h.y;s/=n.length||1,c/=n.length||1;let l=0;for(let h of n)l=Math.max(l,Math.hypot(h.x-s,h.y-c));let u=[],d=Math.max(3,Math.ceil(Math.PI*2/Bo)),m=(l+t)/Math.cos(Math.PI/d);for(let h=0;h<d;h++){let f=h/d*Math.PI*2;u.push({x:s+Math.cos(f)*m,y:c+Math.sin(f)*m})}return u}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return Yo(a)}function Ga(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));d<r&&(r=d)}return r}function Ut(e){let t=e.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 c=0;for(let l of o.pts){let u=Math.hypot(l.x-i,l.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),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<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let u of i){let d=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let h=t[m],f=Math.hypot(u.x-h.cx,u.y-h.cy)-h.rad;if(f>=d&&f>=s)continue;let p=Ga(e[m].pts,u.x,u.y);p<d&&(d=p),e[m].depth<e[o].depth&&p<s&&(s=p,c=e[m].y)}Number.isFinite(d)&&d>0&&a.push(d)}a.sort((u,d)=>u-d);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function zo(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],d=u.x-r.x,m=u.y-r.y,h=Math.hypot(d,m)||1;d/=h,m/=h;let f=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+m*f,y:u.y-d*f},{x:u.x-m*f,y:u.y+d*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let d=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);d>1e-6&&(a+=d,s++)}let c=s>0?a/s:0,l=Ba(i,Math.max(c*_a,ye));return{pts:l,nrm:Oa(l,r),front:Math.max(n[t].pitch*Fa,ye),back:Math.max(n[t].pitch*Da,ye)}}var at=1.5,Ho=.3;function En(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let d=1;d<e.length-1;d++){let m=e[d],h=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);h>s&&(s=h,c=d)}if(s<=t||c<0)return[n,r];let l=En(e.slice(0,c+1),t),u=En(e.slice(c),t);return[...l.slice(0,-1),...u]}function Uo(e,t){if(e.length<4)return e;let n=En([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function jo(e,t,n){if(e.length<2)return[];let r=n??Ut(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let g of a){let x=e[g].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,x)=>e[g].depth-e[x].depth);let l=s.map(g=>zo(e,g,r,t)).filter(g=>g!==null);if(!l.length)continue;let u=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+at),y:g.pts[x].y-g.nrm[x][1]*(g.front+at)}),d=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+at),y:g.pts[x].y+g.nrm[x][1]*(g.back+at)}),m=l[0],h=l[l.length-1],f=[];for(let g=0;g<m.pts.length;g++)f.push(u(m,g));for(let g of l)f.push(d(g,g.pts.length-1));for(let g=h.pts.length-1;g>=0;g--)f.push(d(h,g));for(let g=l.length-1;g>=0;g--)f.push(u(l[g],0));let p=Yo(f),b=1/0;for(let g of s)e[g].y<b&&(b=e[g].y);if(!Number.isFinite(b))continue;if(p.length>=3&&Math.abs(Qe(p))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return gt(p,x.x,x.y)})){i.push({outline:Uo(p,Ho),holes:[],topY:b});continue}for(let g of Va(l))i.push({outline:g,holes:[],topY:b})}return i}function Va(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+at,a=n.back+at;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];r.push([l.x-u[0]*i,l.y-u[1]*i]),o.push([l.x+u[0]*a,l.y+u[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=kn.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,l])=>({x:c,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(Uo(i,Ho))}return r}catch{return[]}}function Yo(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var Tn=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)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(t){for(let n of t)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 t)if(!gt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function No(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],u=r[0];for(let d=1;d+1<r.length;d++){let m=r[d],h=r[d+1];e.tri([u.x*_,o,u.y*_],[m.x*_,o,m.y*_],[h.x*_,o,h.y*_],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=kn.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let u=l[0],d=[],m=[];for(let f=0;f<u.length-1;f++)d.push(u[f][0],u[f][1]),m.push([u[f][0],u[f][1]]);if(m.length<3)continue;let h=(0,Go.default)(d,void 0,2);for(let f=0;f<h.length;f+=3){let p=m[h[f]],b=m[h[f+1]],y=m[h[f+2]];e.tri([p[0]*_,o,p[1]*_],[b[0]*_,o,b[1]*_],[y[0]*_,o,y[1]*_],c,i)}}}function Xo(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??Ut(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(h=>[h.x,h.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new Tn([[...i]]):null,d=h=>{e.setMaterial(2),h(),e.setMaterial(0)},m=h=>{e.setMaterial(3),h(),e.setMaterial(0)};for(let h=0;h<t.length;h++){let f=t[h];if(f.patch&&f.patch.length>=3){let C=[...f.patch],M=s[h].belowY??r;if(m(()=>{if(l&&u)No(e,l,u,C,f.y,o.tread);else{let k=C[0];for(let O=1;O+1<C.length;O++){let V=C[O],H=C[O+1];e.tri([k.x*_,f.y,k.y*_],[V.x*_,f.y,V.y*_],[H.x*_,f.y,H.y*_],c,o.tread)}}}),f.y>M+Oo){let k=0,O=0;for(let V of C)k+=V.x,O+=V.y;k/=C.length,O/=C.length,d(()=>{for(let V=0;V<C.length;V++){let H=C[V],N=C[(V+1)%C.length],A=N.x-H.x,v=N.y-H.y,w=Math.hypot(A,v);if(w<1e-6)continue;let P=v/w,T=-A/w;(H.x-k)*P+(H.y-O)*T<0&&(P=-P,T=-T);let L=[P,0,T],E=[H.x*_,f.y,H.y*_],R=[N.x*_,f.y,N.y*_],z=[H.x*_,M,H.y*_],I=[N.x*_,M,N.y*_];e.tri(E,R,I,L,o.riser),e.tri(E,I,z,L,o.riser)}})}continue}let p=zo(t,h,s,n);if(!p)continue;let{pts:b,nrm:y,front:g,back:x}=p,S=s[h].belowY??r;for(let C=0;C+1<b.length;C++){let M=b[C],k=b[C+1],O=y[C],V=y[C+1];if(Math.hypot(k.x-M.x,k.y-M.y)<1e-6||O[0]===0&&O[1]===0||V[0]===0&&V[1]===0)continue;let H=[(M.x-O[0]*g)*_,f.y,(M.y-O[1]*g)*_],N=[(k.x-V[0]*g)*_,f.y,(k.y-V[1]*g)*_],A=[(M.x+O[0]*x)*_,f.y,(M.y+O[1]*x)*_],v=[(k.x+V[0]*x)*_,f.y,(k.y+V[1]*x)*_];if(m(()=>{l&&u?No(e,l,u,[{x:M.x-O[0]*g,y:M.y-O[1]*g},{x:k.x-V[0]*g,y:k.y-V[1]*g},{x:k.x+V[0]*x,y:k.y+V[1]*x},{x:M.x+O[0]*x,y:M.y+O[1]*x}],f.y,o.tread):(e.tri(H,N,v,c,o.tread),e.tri(H,v,A,c,o.tread))}),f.y>S+Oo){let w=[H[0],S,H[2]],P=[N[0],S,N[2]],T=[-O[0],0,-O[1]];d(()=>{e.tri(H,N,P,T,o.riser),e.tri(H,P,w,T,o.riser)})}}}}function Wo(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function jt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Ln=et(require("polygon-clipping"),1);function za(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Ko(e,t){return e.filter(n=>n.type!=="shape"||za(n,t))}function Qo(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:Ko(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Ko(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Ha={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function st(e){return Wo(e)??Ha}function qo(e,t){let n=Gt(e.outline,ye),r=st(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&jt(r,st(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=Ln.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,d])=>({x:u,y:d}));if(l.length>1){let u=l[0],d=l[l.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function Zo(e,t){if(!t.length)return e;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=t.map(i=>[n(i)]),o=[];for(let i of e){let a;try{a=Ln.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([l,u])=>({x:l,y:u}));if(c.length>1){let l=c[0],u=c[c.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var Ua=.05,$o=.05,ja=.15,Fn=25;function Jo(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,l=[],u=new Set;for(let d=0;d<e.length;d+=1){let m=e[d];for(let h of m.objects){if(h.type==="table"&&u.add(h.id),h.type!=="section"||!h.outline||h.outline.length<3)continue;let f=Gt(h.outline,ye);c.set(h.id,{section:h,unit:m,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:h.id,floorIndex:d,box:st(f),section:h,unit:m,outline:f})}}for(let d=0;d<t.length;d++){let m=t[d];for(let h of l){if(n&&h.floorIndex!==n[d]||m.x<h.box.minX||m.x>h.box.maxX||m.y<h.box.minY||m.y>h.box.maxY||!Fo({x:m.x,y:m.y},h.outline,h.section.holes))continue;o[d]=h.id;let f=c.get(h.id);f.hasSeats=!0;let p=m.focalPoint??h.unit.focal,b=Math.hypot(m.x-p.x,m.y-p.y);b<f.frontU&&(f.frontU=b),f.seatIndices.push(d);let y=m.rowId||`__seat-${d}`,g=f.rows.get(y);g?g.push({x:m.x,y:m.y}):f.rows.set(y,[{x:m.x,y:m.y}]);break}}for(let[d,m]of c){let h=yo(m.section,{floorBaseHeightM:m.unit.baseHeightM}),f=m.unit.baseHeightM,p=h.rake>0?Math.tan(h.rake*Math.PI/180):0,b=h.rake<=.01&&h.height<=f+.001,y=m.section.surfaceKind,g=y==="flat"?!0:y==="rakedRows"&&h.rake>.01?!1:b,x=m.hasSeats?ko(d,t,m.seatIndices,m.unit.focal):{sectionId:d,rows:[],blockCount:0},C=x.rows.length<2?_o([...m.rows.values()].map(L=>({points:L})),m.unit.focal):null,M=1/0;if(C){if(m.hasSeats)for(let L of m.rows.values())for(let E of L){let R=C.depthAt(E.x,E.y);R<M&&(M=R)}if(!m.hasSeats||!Number.isFinite(M)){M=1/0;for(let L of m.section.outline){let E=C.depthAt(L.x,L.y);E<M&&(M=E)}}}let k=f+Ua,O=Math.max(k,h.height),V=L=>{let E=Math.max(0,L-M)*we,R=Math.min(E*p,Fn);return Math.max(k,h.height+R)},H=L=>{let E=Math.max(0,L)*we,R=Math.min(E*p,Fn);return Math.max(k,h.height+R)},N=g?[]:x.rows.map(L=>({pts:L.pts,y:H(L.blockDepth),depth:L.blockDepth,blockId:L.blockId,...u.has(L.id)?{patch:Vo(L.pts,ye)}:{}})),A=N.length?N[0].y:O,v=N.map(L=>{let E=L.patch&&L.patch.length>=3?L.patch:L.pts,R=0,z=0;for(let B of E)R+=B.x,z+=B.y;let I=E.length||1;R/=I,z/=I;let D=0;for(let B of E){let U=Math.hypot(B.x-R,B.y-z);U>D&&(D=U)}return{cx:R,cy:z,rad:D}}),w=g?()=>O:N.length>=2?(L,E)=>{let R=1/0,z=A;for(let I=0;I<N.length;I++){let D=v[I];if(Math.hypot(L-D.cx,E-D.cy)-D.rad>=R)continue;let B=N[I].patch,U=B&&B.length>=3?gt(B,L,E)?0:it(B,L,E):it(N[I].pts,L,E);U<R&&(R=U,z=N[I].y)}return z}:(L,E)=>C?V(C.depthAt(L,E)):O,P=[0,1,0],T=N.length>=2||g?()=>P:(L,E)=>{if(!C)return P;let R=C.depthAt(L,E);if(R<=M)return P;let z=(R-M)*we;if(z*p>=Fn||h.height+z*p<=k)return P;let[I,D]=C.gradientAt(L,E);if(I===0&&D===0)return P;let B=1/Math.hypot(p,1);return[-I*p*B,B,-D*p*B]};if(!g)for(let L of x.rows){let E=H(L.blockDepth);for(let R of L.seatIndices)a[R]=E}for(let L of x.rows){let E=[];for(let B=1;B<L.pts.length;B++){let U=Math.hypot(L.pts[B].x-L.pts[B-1].x,L.pts[B].y-L.pts[B-1].y);U>1e-6&&E.push(U)}E.sort((B,U)=>B-U);let R=E.length?E[Math.floor(E.length/2)]:1/0,z=1/0,I=L.pts[Math.floor(L.pts.length/2)];if(I)for(let B of x.rows){if(B===L||B.blockId!==L.blockId)continue;let U=it(B.pts,I.x,I.y);U>1e-6&&U<z&&(z=U)}let D=Math.min(R,Math.max(z,R*.5));if(Number.isFinite(D)&&D>0)for(let B of L.seatIndices)s[B]=D}r.set(d,{sectionId:d,deckAt:w,normalAt:T,flat:g,bottomY:f,rowLevels:N,landingY:A})}for(let d=0;d<t.length;d++){let m=o[d],h=t[d];if(m){let p=a[d];i[d]=(p??r.get(m).deckAt(h.x,h.y))+ja;continue}let f=h.eyeHeightM;i[d]=Number.isFinite(f)?Math.max(0,f-_t):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var se={top:1,wallBottom:.5,bottomCap:.4};function Le(e,t){if(!e)return t;let n=be(ft(e,.4),.62);return fe(t,n,.72)}function er(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){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,c=0,l=0,u=0;for(let[d,m]of a){let h=ee(n.get(d));h&&(s+=h[0]*m,c+=h[1]*m,l+=h[2]*m,u+=m)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function tr(e,t){return ee(e.color)??t.get(e.logicalSectionId??e.id)??null}var Il=Math.PI*2;function nr(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var or=et(require("polygon-clipping"),1);function Ya(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Yt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=st(t),i=this.rings.filter((c,l)=>jt(o,this.boxes[l])&&Ya(n,this.levels[l])),a=[[r]];if(i.length)try{a=or.default.difference([r],...i).map(l=>l.map(u=>u.map(([d,m])=>[d,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,d])=>({x:u,y:d}));if(l.length>1){let u=l[0],d=l[l.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Xa(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let d of e)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,c=t*Math.PI/180,l=Math.cos(c),u=Math.sin(c);return e.map(d=>{let m=d.x-a,h=d.y-s;return{x:a+m*l-h*u,y:s+m*u+h*l}})}function St(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=Mt(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=Vt(n,r,e.width/2,e.height/2)}return t?Xa(t,e.rotation):null}function wt(e){let t=e.role??"",n={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}},r=t==="stage"&&nr(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Wa=.08;function rr(e,t){let n=St(e),r=wt(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let u of n)i=Math.min(i,u.x),a=Math.min(a,u.y),s=Math.max(s,u.x),c=Math.max(c,u.y);let l=o;for(let u of t)s>u.minX&&i<u.maxX&&c>u.minY&&a<u.maxY&&l<=u.topOffsetM+1e-6&&(l=u.topOffsetM+Wa);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function Ne(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function ir(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function Pt(e,t,n){return[Ne(e[0],e[1],t),Ne(e[0],e[1],n),Ne(e[3],e[2],n),Ne(e[3],e[2],t)]}function ar(e,t,n){return[Ne(e[0],e[3],t),Ne(e[1],e[2],t),Ne(e[1],e[2],n),Ne(e[0],e[3],n)]}function Fe(e,t,n,r,o,i){ce(e,t,void 0,()=>n,r,o,i,se)}var Dn=2.4,Ka=.75,Qa=.15;function Ct(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=r/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,d])=>({x:t.x+u*a-d*s,y:t.y+u*s+d*a}))}function sr(e,t,n,r,o){let i=Ct(t);i&&ce(e,i,void 0,()=>n+Dn,n,Le(r,o.boothTop),o.boothWall,se)}function _n(e){if(e.shape==="round"){let u=e.radius;return u?Vt(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,d])=>({x:o.x+u*a-d*s,y:o.y+u*s+d*a}))}function cr(e,t,n,r,o){let i=_n(t);i&&ce(e,i,void 0,()=>n+Ka,n,Le(r,o.tableTop),o.tableWall,se)}function lr(e,t,n,r,o,i,a){let s=St(t);if(!s)return;let c=t.role==="stage",l=wt(t),u=n+r;if(c&&a){let p=1/0,b=-1/0,y=1/0,g=-1/0;for(let x of s)x.x<p&&(p=x.x),x.x>b&&(b=x.x),x.y<y&&(y=x.y),x.y>g&&(g=x.y);a.push({cx:(p+b)/2*_,cz:(y+g)/2*_,y:u,halfX:Math.max((b-p)/2*_,.5),halfZ:Math.max((g-y)/2*_,.5)})}let d=ee(t.fill),m=c&&d?fe(o.stageTop,be(ft(d,.18),.9),.9):Le(d,c?o.stageTop:o.decorTop),h=t.role==="screen"?d:null,f=c?d?fe(o.stageWall,be(d,.58),.82):o.stageWall:t.role==="screen"?h?fe(be(h,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Le(ee(t.fill),o.decorWall);if(l.kind==="portal"&&s.length===4){let p=ir(s);Fe(e,Pt(p,0,.16),u,n,m,f),Fe(e,Pt(p,.84,1),u,n,m,f),Fe(e,p,u,Math.max(n,u-.35),m,f);return}if(l.kind==="suite"&&s.length===4){let p=s.map((g,x)=>{let S=s[(x+1)%4],C=(g.x+S.x)/2,M=(g.y+S.y)/2;return Math.hypot(C-i.x,M-i.y)}),b=p.indexOf(Math.min(...p)),y=[0,1,2,3].map(g=>s[(b+g)%4]);Fe(e,Pt(y,0,.08),u,n,m,f),Fe(e,Pt(y,.92,1),u,n,m,f),Fe(e,ar(y,.88,1),u,n,m,f),Fe(e,y,u,Math.max(n,u-.18),m,f);return}Fe(e,s,u,n,m,f)}function On(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=r/2,d=o/2;return[[-u,-d],[u,-d],[u,d],[-u,d]].map(([m,h])=>({x:i+m*c-h*l,y:a+m*l+h*c}))}function qa(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.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 ee(r);let i=t.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 c=ee(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>fe(s,c,1/(l+1)),a[0]):null}function ur(e,t,n,r){if(t.layer==="foreground")return;let o=On(t);if(!o)return;let i=n+Qa,a=Le(qa(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=fe(r.ground,a,s)),ce(e,o,void 0,()=>i,n,a,fe(a,r.decorWall,.5),se)}function dr(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Le(r,o.gaTop);ce(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,se)}var Za=Math.PI/180,$=96,$a=6,Ja=60,es=150,mr=.2,ts=.35;function ns(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Za;return n<0?n+360:n}function Xt(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function Wt(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%r+r)%r;else if(l<0||l>=r)continue;a+=e[l],s++}o[i]=a/s}return o}function hr(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let h of m.rows){for(let f of h.pts)o+=f.x,i+=f.y,a++;if(h.pts.length>=4){let f=In(h.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},c=s;if(r.length>=8){let m=Xt(r.map(y=>y.x)),h=Xt(r.map(y=>y.y)),f=0;for(let y of n)for(let g of y.rows)for(let x of g.pts){let S=Math.hypot(x.x-s.x,x.y-s.y);S>f&&(f=S)}let p=0,b=f*.2;for(let y of n)for(let g of y.rows)for(let x of g.pts)Math.hypot(x.x-m,x.y-h)<b&&p++;Math.hypot(m-s.x,h-s.y)<=f&&p/a<.01&&(c={x:m,y:h})}let l=[];for(let m of n){let h={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of m.rows)for(let p of f.pts){let b=Math.hypot(p.x-c.x,p.y-c.y),y=Math.min($-1,Math.floor(ns(c,p)/(360/$)));h.samples.push({r:b,bin:y,levelM:f.levelM}),b<h.rMin&&(h.rMin=b),b>h.rMax&&(h.rMax=b)}h.samples.length&&l.push(h)}if(!l.length)return null;l.sort((m,h)=>m.rMin+m.rMax-(h.rMin+h.rMax));let u=[];for(let m of l){let h=!1;for(let f of u){let p=Math.min(m.rMax,f.rMax)-Math.max(m.rMin,f.rMin),b=Math.min(m.rMax-m.rMin,f.rMax-f.rMin);if(b>1e-9&&p>=ts*b){f.members.push(m),f.rMin=Math.min(f.rMin,m.rMin),f.rMax=Math.max(f.rMax,m.rMax),h=!0;break}}h||u.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let d=[];for(let m of u){let h=new Array($).fill(null);for(let v of m.members)for(let w of v.samples){let P=h[w.bin];P||(P={samples:[]},h[w.bin]=P),P.samples.push({r:w.r,levelM:w.levelM})}let f=h.map(v=>!!v);if(!f.filter(Boolean).length)continue;let b=[],y=[];for(let v of h){if(!v)continue;let w=1/0,P=-1/0;for(let T of v.samples)T.r<w&&(w=T.r),T.r>P&&(P=T.r);b.push(w),y.push(P)}let g=Xt(b),x=Xt(y);if(!(g>=mr*x)||!(x>0))continue;let S=[...b].sort((v,w)=>v-w);if(!(S[Math.floor(S.length*.1)]>=mr*x))continue;let M=h.map(v=>{if(!v)return null;let w=[...v.samples].sort((D,B)=>D.r-B.r),P=w[0].r,T=w[w.length-1].r,L=w[0].levelM,E=-1/0;for(let D of w)D.levelM>E&&(E=D.levelM);let R=[];for(let D of w){let B={r:D.r,l:D.levelM};for(;R.length&&Math.abs(R[R.length-1].r-B.r)<1e-9;){if(R[R.length-1].l<=B.l){B.skip=!0;break}R.pop()}if(!B.skip){for(;R.length>=2;){let U=R[R.length-2],G=R[R.length-1];if((G.r-U.r)*(B.l-U.l)-(G.l-U.l)*(B.r-U.r)<=0)R.pop();else break}R.push(B)}}let z=R.map(D=>D.r),I=R.map(D=>D.l);return{inner:P,outer:T,front:L,top:E,profile:{rs:z,ls:I}}}),k=f.slice();for(let v=0;v<$;v++){if(k[v])continue;let w=-1,P=-1,T=0;for(let F=1;F<=$;F++){let X=(v-F+$*2)%$;if(k[X]){w=X;break}}for(let F=1;F<=$;F++){let X=(v+F)%$;if(k[X]){P=X,T=F;break}}if(w<0||P<0)continue;let L=0;for(let F=1;F<=$;F++){let X=(v-F+$*2)%$;if(f[X]){L=F;break}}if(L-1+T>$a)continue;let R=M[w],z=M[P],I=L/(L+T),D=R.inner+(z.inner-R.inner)*I,B=R.outer+(z.outer-R.outer)*I,U=R.front+(z.front-R.front)*I,G=R.top+(z.top-R.top)*I;M[v]={inner:D,outer:B,front:U,top:G,profile:{rs:[D,B],ls:[U,G]}}}for(let v=0;v<$;v++)M[v]&&(k[v]=!0);let O=360/$,V=[],H=k.filter(Boolean).length,N=[];if(H===$)N.push({start:0,len:$});else{let v=0;for(;k[v];)v=(v+1)%$;let w=-1;for(let P=0;P<=$;P++){let T=(v+P)%$,L=P<$&&k[T];if(L&&w<0)w=T;else if(!L&&w>=0){let E=(T-w+$)%$||$;N.push({start:w,len:E}),w=-1}}}for(let v of N){if(v.len*O<Ja&&v.len<$)continue;let w=v.len===$,P=new Float64Array(v.len),T=new Float64Array(v.len),L=new Float64Array(v.len),E=new Float64Array(v.len),R=[];for(let F=0;F<v.len;F++){let X=M[(v.start+F)%$];P[F]=X.inner,T[F]=X.outer,L[F]=X.front,E[F]=X.top,R.push(X.profile??{rs:[X.inner,X.outer],ls:[X.front,X.top]})}let z=Wt(P,w),I=Wt(T,w),D=Wt(L,w),B=Wt(E,w);for(let F=0;F<v.len;F++)z[F]>P[F]&&(z[F]=P[F]),I[F]<T[F]&&(I[F]=T[F]),z[F]>I[F]-1e-6&&(z[F]=Math.max(0,I[F]-1e-6)),B[F]<D[F]&&(B[F]=D[F]);let U={startBin:v.start,binCount:v.len,closed:w,innerR:z,outerR:I,frontLevelM:D,topLevelM:B,profiles:R},G=(F,X,K)=>{let J=R[F],Z=J.rs,q=J.ls;if(X<=Z[0]){q[0]>K&&(q[0]=K);return}if(X>=Z[Z.length-1]){q[q.length-1]>K&&(q[q.length-1]=K);return}for(let te=0;te+1<Z.length;te++)if(X<=Z[te+1]){q[te]>K&&(q[te]=K),q[te+1]>K&&(q[te+1]=K);return}};for(let F=0;F<v.len;F++){let X=h[(v.start+F)%$];if(X)for(let K of X.samples){G(F,K.r,K.levelM);let J=w?(F-1+v.len)%v.len:F-1,Z=w?(F+1)%v.len:F+1;J>=0&&G(J,K.r,K.levelM),Z<v.len&&G(Z,K.r,K.levelM)}}V.push(U)}V.reduce((v,w)=>v+w.binCount*O,0)<es||d.push({arcs:V,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:g,outerRMedian:x})}if(!d.length)return null;if(d.sort((m,h)=>m.innerRMedian-h.innerRMedian),t){let m=d[d.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:$,binStepDeg:360/$,rings:d}}function fr(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,l=u=>{let d=t.profiles[u],m=d.rs,h=d.ls;if(r<=m[0])return h[0];if(r>=m[m.length-1])return h[h.length-1];for(let f=0;f+1<m.length;f++)if(r<=m[f+1]){let p=m[f+1]-m[f],b=p>1e-9?(r-m[f])/p:0;return h[f]+(h[f+1]-h[f])*b}return h[h.length-1]};return l(a)*(1-c)+l(s)*c}var os=.25,rs=1.2,is=.6,as=.45,ss=2.3,cs=Math.PI/180;function Ze(e,t,n){let r=n*cs;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function ls(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){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-t.centre.x,s.y-t.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var us=24;function ds(e,t,n,r,o,i,a,s){let c=n.binCount,l=us,u=we,d=i+.02,m=[];for(let A=0;A<c;A++){let v=(n.startBin+A+.5)*t.binStepDeg,w=new Float64Array(l+1);for(let P=0;P<=l;P++){let T=r[A]+(o[A]-r[A])*P/l;w[P]=Math.max(d,fr(t,n,v,T)-os)}m.push(w)}let h=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],f=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],p=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],b=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(A,v)=>{let w=(n.startBin+A+.5)*t.binStepDeg,P=r[A]+(o[A]-r[A])*v/l,T=Ze(t.centre,P,w);return[T.x*u,m[A][v],T.y*u]};{let A=Math.tan(12*Math.PI/180);for(let v=0;v<6;v++){let w=!1;for(let T=0;T<c;T++)for(let L=l-1;L>=0;L--)m[T][L]>m[T][L+1]&&(m[T][L]=m[T][L+1],w=!0);let P=n.closed?c:c-1;for(let T=0;T<P;T++){let L=(T+1)%c;for(let E=0;E<=l;E++){let R=m[L][E]-m[T][E];if(Math.abs(R)>1)continue;let z=r[T]+(o[T]-r[T])*E/l,I=r[L]+(o[L]-r[L])*E/l,D=Ze(t.centre,z,(n.startBin+T+.5)*t.binStepDeg),B=Ze(t.centre,I,(n.startBin+L+.5)*t.binStepDeg),U=A*Math.hypot(B.x-D.x,B.y-D.y)*u;R>U?(m[L][E]=m[T][E]+U,w=!0):-R>U&&(m[T][E]=m[L][E]+U,w=!0)}}if(!w)break}}let g=1,x=(A,v)=>{for(let w=0;w<=l;w+=4)if(Math.abs(m[A][w]-m[v][w])>g)return!0;return Math.abs(m[A][l]-m[v][l])>g},S=Math.tan(38*Math.PI/180),C=A=>(o[A]-r[A])/l*u,M=(A,v)=>m[A][v+1]-m[A][v]>S*Math.max(1e-6,C(A)),k=(A,v)=>{let w=n.closed?(A-1+c)%c:Math.max(0,A-1),P=n.closed?(A+1)%c:Math.min(c-1,A+1);Math.abs(m[w][v]-m[A][v])>g&&(w=A),Math.abs(m[P][v]-m[A][v])>g&&(P=A);let T=Math.max(0,v-1),L=Math.min(l,v+1);T<v&&M(A,T)&&(T=v),L>v&&M(A,v)&&(L=v);let E=y(w,v),R=y(P,v),z=y(A,T),I=y(A,L),D=R[0]-E[0],B=R[1]-E[1],U=R[2]-E[2],G=I[0]-z[0],F=I[1]-z[1],X=I[2]-z[2],K=B*X-U*F,J=U*G-D*X,Z=D*F-B*G,q=Math.hypot(K,J,Z);return q>1e-12?(K/=q,J/=q,Z/=q,J<0&&(K=-K,J=-J,Z=-Z),[K,J,Z]):[0,1,0]},O=(A,v)=>{let w=[A[0],i,A[2]],P=[v[0],i,v[2]],T=v[0]-A[0],L=v[2]-A[2],E=Math.hypot(T,L);if(!(E>1e-12))return;let R=[L/E,0,-T/E];e.tri(A,v,P,R,p,p,b),e.tri(A,P,w,R,p,b,b)},V=.05*Be,H=A=>o[A]-r[A]<V,N=n.closed?c:c-1;for(let A=0;A<N;A++){let v=(A+1)%c;if(H(A)||H(v))continue;if(x(A,v)){let R=(n.startBin+A+1)*t.binStepDeg,z=(F,X)=>{let K=(r[A]+r[v])/2,J=(o[A]+o[v])/2,Z=K+(J-K)*X/l,q=Ze(t.centre,Z,R);return[q.x*u,m[F][X],q.y*u]};for(let F=0;F<l;F++){let X=y(A,F),K=y(A,F+1),J=z(A,F),Z=z(A,F+1),q=k(A,F),te=k(A,F+1);e.triN(X,J,Z,q,q,te,h),e.triN(X,Z,K,q,te,te,h);let Ue=y(v,F),je=y(v,F+1),Re=z(v,F),Ie=z(v,F+1),Ee=k(v,F),xe=k(v,F+1);e.triN(Re,Ue,je,Ee,Ee,xe,h),e.triN(Re,je,Ie,Ee,xe,xe,h);let ve=z(A,F),ae=z(A,F+1),Je=z(v,F+1),De=z(v,F),Te=ae[0]-ve[0],Ye=ae[2]-ve[2],dt=Math.hypot(Te,Ye);if(dt>1e-12){let me=[Ye/dt,0,-Te/dt];e.tri(ve,ae,Je,me,p),e.tri(ve,Je,De,me,p)}}let I=y(A,0),D=y(v,0),B=y(v,l),U=y(A,l),G=F=>[F[0],i,F[2]];e.tri(G(I),G(B),G(D),[0,-1,0],f),e.tri(G(I),G(U),G(B),[0,-1,0],f),O(I,D),O(U,B);continue}for(let R=0;R<l;R++){let z=k(A,R),I=k(v,R),D=k(v,R+1),B=k(A,R+1);if(M(A,R)||M(v,R)){let K=(ae,Je)=>{let De=(n.startBin+ae+.5)*t.binStepDeg,Te=r[ae]+(o[ae]-r[ae])*(R+.5)/l,Ye=Ze(t.centre,Te,De);return[Ye.x*u,Je,Ye.y*u]},J=y(A,R),Z=y(v,R),q=K(A,m[A][R]),te=K(v,m[v][R]);e.triN(J,Z,te,z,I,I,h),e.triN(J,te,q,z,I,z,h);let Ue=y(v,R+1),je=y(A,R+1),Re=K(A,m[A][R+1]),Ie=K(v,m[v][R+1]);e.triN(Re,Ie,Ue,B,D,D,h),e.triN(Re,Ue,je,B,D,B,h);let Ee=te[0]-q[0],xe=te[2]-q[2],ve=Math.hypot(Ee,xe);if(ve>1e-12){let ae=[-xe/ve,0,Ee/ve];e.tri(q,te,Ie,ae,p),e.tri(q,Ie,Re,ae,p)}continue}let U=y(A,R),G=y(v,R),F=y(v,R+1),X=y(A,R+1);e.triN(U,G,F,z,I,D,h),e.triN(U,F,X,z,D,B,h)}let w=y(A,0),P=y(v,0),T=y(v,l),L=y(A,l),E=R=>[R[0],i,R[2]];e.tri(E(w),E(T),E(P),[0,-1,0],f),e.tri(E(w),E(L),E(T),[0,-1,0],f),O(w,P),O(L,T)}if(!n.closed)for(let A of[0,c-1])for(let v=0;v<l;v++)O(y(A,v),y(A,v+1))}function pr(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let d of u.arcs){let m=new Float64Array(d.binCount),h=new Float64Array(d.binCount);for(let p=0;p<d.binCount;p++){let b=(d.startBin+p)%t.binCount,y=Math.max(0,d.innerR[p]-ye);m[p]=Math.max(y,a[b]+.001),h[p]=Math.max(m[p]+.001,d.outerR[p]+ye)}let f=0;for(let p=0;p<d.binCount;p++){let b=d.topLevelM[p]-r;b>f&&(f=b)}f>=rs&&ds(e,t,d,m,h,r,o,i);for(let p=0;p<d.binCount;p++){let b=(d.startBin+p)%t.binCount;h[p]>a[b]&&(a[b]=h[p])}}if(ls(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=is*Be,l=as*Be;for(let u of s.arcs){let d=[],m=[];for(let p=0;p<u.binCount;p++){let b=(u.startBin+p+.5)*t.binStepDeg,y=u.outerR[p]+ye+c;d.push(Ze(t.centre,y,b)),m.push(Ze(t.centre,y+l,b))}let h=-1/0;for(let p=0;p<u.binCount;p++)u.topLevelM[p]>h&&(h=u.topLevelM[p]);let f=()=>h+ss;u.closed?ce(e,m,[d.slice().reverse()],f,r,o.shellTop,o.shellWall,i):ce(e,[...m,...d.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function br(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=Le(r,s.tierTop);if(!o)return;let u=b=>o.deckAt(b.x,b.y),d=qo(t,a),m=d[0]??t.outline;if(o.rowLevels.length>=2){let b=Ut(o.rowLevels),y=Zo(jo(o.rowLevels,n.focal,b),d),g=()=>[0,1,0];for(let S of y){let C=Math.max(c,S.topY-.02);for(let M of i.subtract(S.outline,C))ce(e,M,S.holes,()=>C,c,l,s.tierWall,se,void 0,g)}y.length||ce(e,m,t.holes,()=>o.landingY,c,l,s.tierWall,se);let x={tread:[l[0]*se.top,l[1]*se.top,l[2]*se.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let S of d.length?d:[m])Xo(e,o.rowLevels,n.focal,o.landingY,x,S,b);return}let h=o.flat?1/0:$o,f=b=>o.normalAt(b.x,b.y),p=o.flat?o.landingY:void 0;for(let b of i.subtract(m,p))ce(e,b,t.holes,u,c,l,s.tierWall,se,h,f)}function ms(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a],u=o.get(s);u||(u=new Map,o.set(s,u));let d=l.rowId||`__seat-${a}`,m=u.get(d);m||(m={pts:[],levelM:0,n:0},u.set(d,m)),m.pts.push({x:l.x,y:l.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function yr(e,t,n,r,o){let i=ms(t,n,r);if(!i.length)return;let a=hr(i,t.focal);a&&(e.setMaterial(0),pr(e,a,{bottomY:t.baseHeightM,colors:{bandTop:be(o.tierTop,.8),bandWall:o.tierWall,shellTop:be(o.tierWall,1.15),shellWall:o.tierWall},ao:se,shapes:t.objects.filter(s=>s.type==="shape")}))}function gr(e,t,n){return n<0?t>1?e.filter(r=>r.kind==="floor"):[...e]:e.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function xr(e,t){let n=[...e].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(t-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var hs=1.15,fs=3.25,ps=4.5,bs=.85,ys=.5,gs=.26;function vr(e,t,n){let r=Math.max(1e-6,t),o=e/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=hs&&a.add("zone"),o<=(i?fs:ps)&&(a.add("section"),a.add("ga")),o<=bs&&(a.add("annotation"),a.add("booth")),o<=ys&&a.add("row"),o<=gs&&a.add("seat"),a}function Ge(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],l=o[1]*i+o[5]*a+o[9]*s+o[13],u=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 m=c/d,h=l/d,f=u/d,p=m>=-1.05&&m<=1.05&&h>=-1.05&&h<=1.05&&f<=1;return{x:(m*.5+.5)*n,y:(1-(h*.5+.5))*r,depth:f,visible:p}}function Mr(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if(Bn(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var xs=6;function Bn(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+xs):n;return o<a&&i<r}function Sr(e,t,n){return e.length*t*.58+(n?14:0)}var Nn={row:8,seat:14};function wr(e,t,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-r/2)/o);return t*(1+1.5*i)}function Gn(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let l of o)if(Bn(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(Bn(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var vs=6,Ms=2.2,Pr=.1,Ss=.3,ws=1.8,Ps=.9,Cs=.55,As=6e3;function Cr(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let u of n)for(let d of u.objects)d.type==="section"&&d.zone&&c.set(d.id,d.zone);let l=new Map;for(let u=0;u<r.length;u++){let d=r[u],m=o.seatOwner[u],h=d.zoneId??(m?c.get(m):void 0);if(!h)continue;let f=l.get(h);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(h,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(u)}for(let u of a){let d=l.get(u.id),m=[];for(let[h,f]of c)f===u.id&&m.push(h);if(!d||d.n===0){s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*_,1.5,(u.focalPoint??i).y*_]});continue}s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:m,seatCount:d.n,center:[(d.minX+d.maxX)/2*_,d.sumY/d.n,(d.minY+d.maxY)/2*_],radius:.5*Math.hypot((d.maxX-d.minX)*_,(d.maxY-d.minY)*_)||1,focalWorld:[(u.focalPoint??i).x*_,1.5,(u.focalPoint??i).y*_]})}}return s}function Ar(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],d=[];for(let m of s)m.seatCount!==0&&l.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+vs,m.center[2]],color:t.zones?.find(h=>h.id===m.id)?.color});{let m=new Map,h=new Map;for(let f=0;f<r.length;f++){let p=o.seatOwner[f];if(!p)continue;let b=m.get(p);b||(b={n:0,x:0,y:0,deck:0},m.set(p,b)),b.n++,b.x+=r[f].x,b.y+=r[f].y,b.deck+=o.seatDeckY(f);let y=h.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,y)),r[f].x<y.minX&&(y.minX=r[f].x),r[f].x>y.maxX&&(y.maxX=r[f].x),r[f].y<y.minY&&(y.minY=r[f].y),r[f].y>y.maxY&&(y.maxY=r[f].y)}for(let f of n)for(let p of f.objects){if(p.type!=="section")continue;let b=m.get(p.id);if(!b||b.n===0)continue;let y=h.get(p.id),g=[b.x/b.n*_,b.deck/b.n,b.y/b.n*_],x=p.displayLabel||p.label||p.id;u.push({id:p.id,floorIndex:f.index,label:x,seatCount:b.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*_),focalWorld:[f.focal.x*_,f.baseHeightM+1.5,f.focal.y*_]});let S=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&S===x.trim().toLocaleLowerCase()||l.push({id:`section:${p.id}`,kind:"section",text:x,anchor:[g[0],g[1]+Ms,g[2]],floorIndex:f.index})}}{for(let f of n)for(let p of f.objects){if(p.type!=="gaArea")continue;let b=yt(p.points);if(!b)continue;let y=p.displayLabel||p.label||p.id;l.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${y} \xB7 ${p.capacity.toLocaleString()}`:y,anchor:[b.x*_,f.baseHeightM+ws,b.y*_],floorIndex:f.index})}let m=new Map;for(let f=0;f<r.length;f++){let p=r[f],b=Math.hypot(p.x-c.x,p.y-c.y),y=m.get(p.rowId);(!y||b>y.far)&&m.set(p.rowId,{seat:p,index:f,far:b})}for(let[f,p]of m){let b=p.seat.label?p.seat.label.lastIndexOf("-"):-1,y=b>0?p.seat.label.slice(0,b):f;y&&l.push({id:`row:${f}`,kind:"row",text:y,anchor:[p.seat.x*_,o.seatDeckY(p.index)+Ps,p.seat.y*_],floorIndex:a[p.index]})}let h=new Map;for(let f=0;f<r.length;f++){let p=r[f],b=p.label?p.label.lastIndexOf("-"):-1,y=h.get(p.rowId);y||(y={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:b>0?p.label.slice(0,b):p.rowId,sectionId:p.sectionId},h.set(p.rowId,y));let g=f*3,x=i.iPosition[g],S=i.iPosition[g+1],C=i.iPosition[g+2];y.n++,y.x+=x,y.y+=S,y.z+=C,y.minX=Math.min(y.minX,x),y.maxX=Math.max(y.maxX,x),y.minZ=Math.min(y.minZ,C),y.maxZ=Math.max(y.maxZ,C)}for(let[f,p]of h)d.push({id:f,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(r.length<=As)for(let f=0;f<r.length;f++){let p=r[f],b=p.displayLabel||p.label;b&&l.push({id:`seat:${p.id}`,kind:"seat",text:b,anchor:[p.x*_,o.seatDeckY(f)+Cs,p.y*_],floorIndex:a[f]})}}for(let m of n)for(let h of m.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let f=St(h),p=f?yt(f):null;if(!p||!h.label)continue;l.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*_,m.baseHeightM+wt(h).heightM+Pr,p.y*_],color:h.fill,floorIndex:m.index})}else if(h.type==="text"){if(!h.text)continue;l.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*_,m.baseHeightM+Pr,h.position.y*_],color:h.color,rotation:h.rotation,floorIndex:m.index})}else if(h.type==="booth"){let f=Ct(h);if(!f)continue;let p=yt(f);if(!p)continue;l.push({id:`booth:${h.id}`,kind:"booth",text:h.displayLabel||h.label||h.id,anchor:[p.x*_,m.baseHeightM+Dn+Ss,p.y*_],floorIndex:m.index})}return{labels:l,sections:u,rows:d}}function Rr(e,t){if(t.length>1)for(let n of t)e.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 Ir(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let h=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),f=m*3,p=l[h];p.minX=Math.min(p.minX,i.position[f]),p.minY=Math.min(p.minY,i.position[f+1]),p.minZ=Math.min(p.minZ,i.position[f+2]),p.maxX=Math.max(p.maxX,i.position[f]),p.maxY=Math.max(p.maxY,i.position[f+1]),p.maxZ=Math.max(p.maxZ,i.position[f+2])}let u=new Map;for(let m=0;m<n.length;m++)for(let h of n[m].objects)h.type==="section"&&u.set(h.id,m);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 m=0;m<r.length;m++){let h=o.seatOwner[m],f=(h!==null?u.get(h):void 0)??a[m];if(f===void 0)continue;let p=d[f],b=r[m];p.n++,b.x<p.minX&&(p.minX=b.x),b.y<p.minY&&(p.minY=b.y),b.x>p.maxX&&(p.maxX=b.x),b.y>p.maxY&&(p.maxY=b.y);let y=o.seatDeckY(m);p.sumX+=b.x*_,p.sumDeck+=y,p.sumZ+=b.y*_,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),s[m]=f}for(let m=0;m<n.length;m++){let h=d[m],f=t.floors?.[m],p=l[m],b=Math.min(h.n?h.minX*_:n[m].focal.x*_-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(h.n?h.maxX*_:n[m].focal.x*_+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(h.n?h.minY*_:n[m].focal.y*_-1,Number.isFinite(p.minZ)?p.minZ:1/0),x=Math.max(h.n?h.maxY*_:n[m].focal.y*_+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),S=Math.min(h.n?Math.min(n[m].baseHeightM,h.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),C=Math.max(h.n?Math.max(h.maxDeck,S+.5):S+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),M=[h.n?h.sumX/h.n:(b+y)/2,h.n?h.sumDeck/h.n:(S+C)/2,h.n?h.sumZ/h.n:(g+x)/2],k=Math.max(1,.5*Math.hypot(y-b,C-S,x-g));c.push({index:m,id:f?.id??`floor-${m}`,label:f?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:M,radius:k,box:{min:[b,S,g],max:[y,C,x]},focalWorld:[n[m].focal.x*_,n[m].baseHeightM+1.5,n[m].focal.y*_]})}}return c}function Vn(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)a(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)a(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)a(l.x,l.y);else if(c.type==="booth"){let l=Ct(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=_n(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=On(c);if(l)for(let u of l)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Er(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Mt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ce(e,s,void 0,()=>0,-.4,i.ground,i.ground,se)}else{let a=t.reduce((h,f)=>f.baseHeightM<h.baseHeightM?f:h);e.setFloor(a.index);let s=n.filter((h,f)=>r[f]===a.index),c=Vn([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,l*.04)),d=Mt(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),m=a.baseHeightM-.03;ce(e,d,void 0,()=>m,m-.22,i.ground,i.ground,se)}}function Tr(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,d=-1/0,m=(p,b,y)=>{a=Math.min(a,p),l=Math.max(l,p),s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,y),d=Math.max(d,y)};for(let p=0;p<e.position.length;p+=3)m(e.position[p],e.position[p+1],e.position[p+2]);for(let p=0;p<t.count;p++){let b=p*3,y=t.iPosition[b],g=t.iPosition[b+1],x=t.iPosition[b+2],S=Math.max(.35,t.iMaxRadius[p]??.35);m(y-S,g,x-S),m(y+S,g+1.6,x+S)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,d=o+i);let h=[(a+l)/2,(s+u)/2,(c+d)/2],f=Math.max(1,.5*Math.hypot(l-a,u-s,d-c));return{center:h,radius:f,minY:s,maxY:u}}function kr(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let S=0;S<e.count;S++){let C=S*3,M=e.iPosition[C],k=e.iPosition[C+2];M<a&&(a=M),M>c&&(c=M),k<s&&(s=k),k>l&&(l=k)}for(let S of t)a=Math.min(a,S.cx-S.halfX),c=Math.max(c,S.cx+S.halfX),s=Math.min(s,S.cz-S.halfZ),l=Math.max(l,S.cz+S.halfZ);let u=n.minX*_,d=n.maxX*_,m=n.minY*_,h=n.maxY*_,f=u,p=d,b=m,y=h;if(Number.isFinite(a)){let S=Math.max(2,.06*Math.hypot(c-a,l-s));f=Math.max(u,a-S),p=Math.min(d,c+S),b=Math.max(m,s-S),y=Math.min(h,l+S)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[f,g,b],max:[p,x,y]}}function ct(e){let{doc:t}=e,n=Ro(t.theme),r=n.structure,o=Qo(t,e.eventConfigurationId??t.eventConfigurationId),i=e.seats,a=new Nt,s=new Map;for(let v of o)for(let w of v.objects)s.set(w.id,v.index),w.type==="section"&&s.set(w.logicalSectionId??w.id,v.index);let c=i.map(v=>s.get(v.sectionId??"")??s.get(v.rowId??"")??0),l=Vn(o,i);Er(a,o,i,c,l,r);let u=er(t,i),d=new Map,m=new Map;for(let v of t.categories??[])d.set(v.key,v.color),v.seatGlyph&&m.set(v.key,v.seatGlyph);let h=[],f=Jo(o,i,c),p=new Float32Array(i.length);for(let v=0;v<o.length;v++){let w=o[v];a.setFloor(v);let P=new Yt,T=[],L=w.objects.filter(E=>E.type==="section"&&!!E.outline&&E.outline.length>=3);for(let E of w.objects)E.type==="section"?br(a,E,w,tr(E,u),f.bySection.get(E.id),P,L,r):E.type==="shape"?(a.setMaterial(E.role==="screen"?1:0),lr(a,E,w.baseHeightM,rr(E,T),r,w.focal,h),a.setMaterial(0)):E.type==="gaArea"?dr(a,E,w.baseHeightM,ee(d.get(E.categoryKey)),r):E.type==="booth"?sr(a,E,w.baseHeightM,ee(d.get(E.categoryKey)),r):E.type==="table"?cr(a,E,w.baseHeightM,ee(d.get(E.categoryKey)),r):E.type==="decorImage"&&ur(a,E,w.baseHeightM,r);yr(a,w,i,f,r)}let b=o.length>1?{x:o.reduce((v,w)=>v+w.focal.x,0)/o.length,y:o.reduce((v,w)=>v+w.focal.y,0)/o.length}:t.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},y=Mo([a.build()]),g=Ao(i,e.initialState,f,p,d,m),x=Cr({doc:t,units:o,seats:i,surfaces:f,focal:b}),{labels:S,sections:C,rows:M}=Ar({doc:t,units:o,seats:i,surfaces:f,seatData:g,hintedSeatFloor:c,zones:x,focal:b}),k=Ir({doc:t,units:o,seats:i,surfaces:f,solids:y,hintedSeatFloor:c,seatFloor:p});Rr(S,k),g.iYaw=Po(g.iPosition,i.length,v=>i[v].rowId,v=>{let w=o[p[v]]?.focal??b;return[w.x*_,w.y*_]});let O=(l.minX+l.maxX)/2*_,V=(l.minY+l.maxY)/2*_,H=.5*Math.hypot((l.maxX-l.minX)*_,(l.maxY-l.minY)*_)||10,N=Tr(y,g,{cx:O,cz:V,radius:H}),A=kr(g,h,l,N.minY,N.maxY,H);return{solids:y,seats:g,bounds:{center:[(A.min[0]+A.max[0])/2,(A.min[1]+A.max[1])/2,(A.min[2]+A.max[2])/2],radius:H,groundY:0,box:A},renderBounds:{center:N.center,radius:N.radius},stateColorLUT:Io(n,ge),theme:n,seatCount:i.length,focalWorld:[b.x*_,1.5,b.y*_],zones:x,stages:h,sections:C,rows:M,labels:S,floors:k}}var Rs=88,Is=20,Lr={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}},Kt=new Set(["row","seat"]),Fr={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Qt={row:{x:62,y:16},seat:{x:46,y:18}},_r=ee,zn=e=>Zn(e);function Or(e,t){let n=zn(e),r=zn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Dr(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*r+t[o-1]*(1-r))}function Es(e,t=[.04,.06,.1]){let n=zn(t)<.42,r=n?"#f4f7fb":"#0b1220",o=_r(e),i=o&&Or(o,t)>=4.5?e: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 qt=class{constructor(t,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),t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;let s=vr(o,i,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let g of this.labels){if(!s.has(g.kind))continue;let x=Ge(t,g.anchor,n,r);if(!x.visible)continue;let S=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:x,focus:wr(x,S,n,r),halfWidth:Sr(g.text,Lr[g.kind].size,!Kt.has(g.kind))/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let l=xr(c.filter(g=>g.label.kind==="floor"),n),u=[...c.filter(g=>!Kt.has(g.label.kind)&&g.label.kind!=="floor"),...l],d=Mr(u,Rs,Is),m=Gn(c.filter(g=>g.label.kind==="row"),Qt.row.x,Qt.row.y,Nn.row,d),h=Gn(c.filter(g=>g.label.kind==="seat"),Qt.seat.x,Qt.seat.y,Nn.seat,[...d,...m]),f=[...d,...m,...h],p=new Set(f.map(g=>g.label.id));for(let{label:g,screen:x}of f){let C=this.nodeFor(g).style;C.display="",C.transform=`translate(-50%, -50%) translate(${x.x.toFixed(1)}px, ${x.y.toFixed(1)}px)`}let b=f.filter(({label:g})=>!Kt.has(g.kind)).sort((g,x)=>Fr[x.label.kind]-Fr[g.label.kind]||g.screen.depth-x.screen.depth||g.focus-x.focus),y=[];for(let{label:g}of b){let x=this.nodes.get(g.id);if(!x||x.style.display==="none")continue;let S=x.getBoundingClientRect();y.some(M=>S.left<M.right+3&&S.right+3>M.left&&S.top<M.bottom+3&&S.bottom+3>M.top)?x.style.display="none":y.push(S)}for(let[g,x]of this.nodes)p.has(g)||(x.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let d=n.style;d.position="absolute",d.left="0",d.top="0",d.whiteSpace="nowrap",d.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",d.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=Lr[t.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=Es(t.color??this.opts.ink,this.opts.backgroundRgb),s=!Kt.has(t.kind);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=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],l=_r(r?"#ecf8ff":a.ink)??[1,1,1],u=r?Dr("rgba(10,28,45,.9)",c):s?Dr(a.backing,c):c;return n.dataset.qualityContrast=Or(l,u).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Nr=1;var Ts=new Set(["floor","zone","section","ga","booth","annotation"]);function ks(e){return e.every(t=>Number.isFinite(t))}function Ls(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Br(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function $e(e){return Math.round(e*1e4)/1e4}function Fs(e){if(e)return{box:{x:$e(e.box.x),y:$e(e.box.y),width:$e(e.box.width),height:$e(e.box.height)},horizontalFillRatio:$e(e.horizontalFillRatio),verticalFillRatio:$e(e.verticalFillRatio),visibleAreaRatio:$e(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Pe(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function Zt(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Ts.has(s.kind)),r=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,o=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)Ls(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[Pe("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Pe("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Pe("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Pe("viewport-empty","The 3D viewport must have visible dimensions",e.viewport.width>1&&e.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${e.viewport.width}\xD7${e.viewport.height}`}]),Pe("camera-invalid","The capture camera must have a finite physical pose",ks(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Pe("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!e.scene.authoredRelief||e.scene.renderedVerticalSpanM>.05&&e.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:e.scene.projectedReliefPx,minimum:2}]),Pe("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Pe("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Pe("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Pe("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:l})=>({id:s,kind:c,text:l})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:Fs(e.framing)},metrics:{minimumHierarchyFontPx:Br(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Br(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var pe=require("ogl");var Ve=require("ogl");var $t=`
|
|
1
|
+
"use strict";var Ni=Object.create;var Lt=Object.defineProperty;var Gi=Object.getOwnPropertyDescriptor;var Vi=Object.getOwnPropertyNames;var zi=Object.getPrototypeOf,Hi=Object.prototype.hasOwnProperty;var pt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var to=(e,t)=>{for(var n in t)Lt(e,n,{get:t[n],enumerable:!0})},no=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vi(t))!Hi.call(e,o)&&o!==n&&Lt(e,o,{get:()=>t[o],enumerable:!(r=Gi(t,o))||r.enumerable});return e};var tt=(e,t,n)=>(n=e!=null?Ni(zi(e)):{},no(t||!e||!e.__esModule?Lt(n,"default",{value:e,enumerable:!0}):n,e)),Ui=e=>no(Lt({},"__esModule",{value:!0}),e);function mc(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function hc(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function on(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:hc(t?.deviceMemory)}}function rn(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};return t.saveData?{...r,reason:"save-data"}:t.maxTextureSize!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&Math.max(e.sourceWidth,e.sourceHeight)>t.maxTextureSize?{...r,reason:"texture-limit"}:t.maxDecodedBytes!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&mc(e.sourceWidth,e.sourceHeight)>t.maxDecodedBytes?{...r,reason:"memory-limit"}:{...r,upgradeUrl:e.url,reason:"progressive"}}function hi(){return new DOMException("Panorama image load aborted","AbortError")}function Rt(e,t){return new Promise((n,r)=>{if(t?.aborted){r(hi());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=l=>{i||(i=!0,a(),l?r(l):n(o))},c=()=>{o.src="",s(hi())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),o.src=e})}function an(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var Kn=pt(()=>{"use strict"});function fi(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":"AI-generated illustrative venue demo":e.coverage==="exact-seat"?"Exact seat photo":e.coverage==="row-representative"?"Representative row view":e.coverage==="section-representative"?"Representative section view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function Qn(e){return Math.max(pc,Math.min(fc,e))}function bc(e,t,n){let r=(.5+e/360)*n;return t/2-r}function yc(e,t=cn){return e*(180/t)}function pi(e,t,n){return(e-t)/2+sn(n,t)}function sn(e,t){let n=Ee/180*t;return Math.max(-n,Math.min(n,e))}function bi(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=rn(t,on()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let u=document.createElement("div");Object.assign(u.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(u);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"}),c.appendChild(d),n.disclosure){let G=document.createElement("div");G.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(G.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)"}),c.appendChild(G)}let m=document.createElement("div");m.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(m.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"}),c.appendChild(m),e.appendChild(c),d.focus({preventScroll:!0});let h=0,p=0,f=0,b=0,y=cn,g=()=>{let G=c.clientHeight||1,F=c.clientWidth||1,X=C.naturalWidth||F*2,K=C.naturalHeight||G,J=h>0?(F/2-f)/h:0,Z=p>0?b/p:0;p=yc(G,y),h=p*(X/K),u.style.backgroundSize=`${h}px ${p}px`,x?f=F/2-J*h:(f=bc(o,F,h),b=sn((t.initialPitchDeg??0)/180*p,p),x=!0),b=sn(Z*p,p),u.style.backgroundPosition=`${f}px ${pi(G,p,b)}px`},x=!1,S=()=>{let G=c.clientHeight||1;b=sn(b,p),u.style.backgroundPosition=`${f}px ${pi(G,p,b)}px`},C=new Image;C.onload=g,C.src=i.initialUrl;let M=()=>{};i.upgradeUrl&&(M=an(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(F=>!F||a.signal.aborted?null:Rt(F,a.signal).then(X=>({full:X,url:F}))).then(F=>{F&&(R||a.signal.aborted||(C=F.full,u.style.backgroundImage=`url("${F.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let k=!1,O=0,V=0,U=0,N=new Map,A=()=>{let[G,F]=[...N.values()];return G&&F?Math.hypot(G.x-F.x,G.y-F.y):0},v=G=>{let F=Qn(G);F!==y&&(y=F,g())},w=G=>{N.set(G.pointerId,{x:G.clientX,y:G.clientY}),k=N.size===1,O=G.clientX,V=G.clientY,N.size===2&&(U=A()),u.style.cursor="grabbing";try{u.setPointerCapture?.(G.pointerId)}catch{}},P=G=>{if(N.has(G.pointerId)){if(N.set(G.pointerId,{x:G.clientX,y:G.clientY}),N.size>=2){let F=A();U>0&&F>0&&v(y*(U/F)),U=F,k=!1;return}k&&(f+=G.clientX-O,b+=G.clientY-V,O=G.clientX,V=G.clientY,S())}},T=G=>{N.delete(G.pointerId),U=N.size===2?A():0;let F=N.values().next().value;k=N.size===1,F?(O=F.x,V=F.y):u.style.cursor="grab";try{u.releasePointerCapture?.(G.pointerId)}catch{}},L=G=>{G.preventDefault(),v(y+G.deltaY*.04)};u.addEventListener("pointerdown",w),u.addEventListener("pointermove",P),u.addEventListener("pointerup",T),u.addEventListener("pointercancel",T),u.addEventListener("wheel",L,{passive:!1});let E=!1,R=!1,z=0,I=()=>{u.removeEventListener("pointerdown",w),u.removeEventListener("pointermove",P),u.removeEventListener("pointerup",T),u.removeEventListener("pointercancel",T),u.removeEventListener("wheel",L),window.removeEventListener("keydown",j)},D=()=>{M(),a.abort(),n.signal?.removeEventListener("abort",s),z&&(window.clearTimeout(z),z=0),I(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},B=()=>{if(E)return;E=!0,c.style.opacity="0";let G=()=>{z=0,!R&&(D(),n.onClose?.())};z=window.setTimeout(G,r)},j=G=>{if(G.key==="Tab"){G.preventDefault(),d.focus({preventScroll:!0});return}if(G.key==="Escape"){G.stopPropagation(),B();return}if(G.key==="ArrowLeft"||G.key==="ArrowRight")f+=G.key==="ArrowLeft"?-32:32;else if(G.key==="ArrowUp"||G.key==="ArrowDown")b+=(G.key==="ArrowUp"?4:-4)*(p/180);else if(G.key==="+"||G.key==="="){v(y-5),G.preventDefault();return}else if(G.key==="-"){v(y+5),G.preventDefault();return}else return;G.preventDefault(),S()};return window.addEventListener("keydown",j),d.addEventListener("click",B),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:B,dispose(){E=!0,R=!0,D()}}}var cn,pc,fc,Ee,qn=pt(()=>{"use strict";Kn();cn=70,pc=35,fc=90;Ee=35});function Mc(e=gc,t=xc,n=vc){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<o;u++){let d=u/t,m=d*Math.PI,h=Math.sin(m),p=Math.cos(m);for(let f=0;f<r;f++){let b=f/e,y=(b-.5)*Math.PI*2,g=u*r+f;a[g*3]=n*h*Math.sin(y),a[g*3+1]=n*p,a[g*3+2]=-n*h*Math.cos(y),s[g*2]=b,s[g*2+1]=d}}let c=new Uint16Array(e*t*6),l=0;for(let u=0;u<t;u++)for(let d=0;d<e;d++){let m=u*r+d,h=m+r;c[l++]=m,c[l++]=h,c[l++]=m+1,c[l++]=m+1,c[l++]=h,c[l++]=h+1}return{position:a,uv:s,index:c}}function yi(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}function gi(e,t){let{position:n,uv:r,index:o}=Mc(),i=new Ue.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ue.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ue.Program(e,{vertex:Sc,fragment:wc,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new Ue.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var Ue,gc,xc,vc,Sc,wc,xi=pt(()=>{"use strict";Ue=require("ogl"),gc=64,xc=32,vc=500;Sc=`#version 300 es
|
|
2
|
+
precision highp float;
|
|
3
|
+
in vec3 position;
|
|
4
|
+
in vec2 uv;
|
|
5
|
+
uniform mat4 modelViewMatrix;
|
|
6
|
+
uniform mat4 projectionMatrix;
|
|
7
|
+
out vec2 vUv;
|
|
8
|
+
void main() {
|
|
9
|
+
vUv = uv;
|
|
10
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
11
|
+
}`,wc=`#version 300 es
|
|
12
|
+
precision highp float;
|
|
13
|
+
in vec2 vUv;
|
|
14
|
+
uniform sampler2D uPano;
|
|
15
|
+
uniform float uOpacity;
|
|
16
|
+
out vec4 fragColor;
|
|
17
|
+
void main() {
|
|
18
|
+
vec3 rgb = texture(uPano, vUv).rgb;
|
|
19
|
+
fragColor = vec4(rgb, uOpacity);
|
|
20
|
+
}`});async function Mi(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Ee,Math.min(Ee,t?.initialPitchDeg??0)),s=cn,c=!1,l=new AbortController,u=()=>l.abort();r.signal?.addEventListener("abort",u,{once:!0});let d=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let I=n.camera.position,D=n.focalWorld[0]-I.x,B=n.focalWorld[1]-I.y,j=n.focalWorld[2]-I.z,G=Math.hypot(D,j);G>.001&&(i=Math.atan2(D,-j)*180/Math.PI,a=Math.max(-Ee,Math.min(Ee,Math.atan2(B,G)*180/Math.PI)))}let h=null;if(t){let I=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),D=rn(t,on(I)),B;try{let j=t.resolveUrl?await t.resolveUrl(D.initialUrl):D.initialUrl;if(!j)throw new Error("panorama_asset_unavailable");B=await Rt(j,l.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{h=gi(n.gl,B)}catch{return l.abort(),r.signal?.removeEventListener("abort",u),null}h.mesh.renderOrder=999,h.mesh.setParent(n.scene),D.upgradeUrl&&(d=an(()=>{(t.resolveUrl?t.resolveUrl(D.upgradeUrl):Promise.resolve(D.upgradeUrl)).then(G=>!G||l.signal.aborted?null:Rt(G,l.signal)).then(G=>{G&&(c||l.signal.aborted||(h?.setImage(G),n.requestRender()))}).catch(()=>{})}))}let p=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let f=n.camera.quaternion.slice(),b=()=>{let I=n.camera.position;h?.mesh.position.set(I.x,I.y,I.z);let[D,B,j]=yi(i,a);n.camera.lookAt([I.x+D,I.y+B,I.z+j]),n.requestRender()};b();let y=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.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"}),y.appendChild(x),r.disclosure){let I=document.createElement("div");I.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(I.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)"}),y.appendChild(I)}let S=document.createElement("div");S.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(S.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"}),y.appendChild(S),e.appendChild(y),x.focus({preventScroll:!0});let C=!1,M=0,k=0,O=0,V=new Map,U=()=>{let[I,D]=[...V.values()];return I&&D?Math.hypot(I.x-D.x,I.y-D.y):0},N=I=>{let D=Qn(I);D!==s&&(s=D,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},A=I=>{I.target!==x&&(V.set(I.pointerId,{x:I.clientX,y:I.clientY}),C=V.size===1,M=I.clientX,k=I.clientY,V.size===2&&(O=U()),y.setPointerCapture?.(I.pointerId),y.style.cursor="grabbing")},v=I=>{if(V.has(I.pointerId)){if(V.set(I.pointerId,{x:I.clientX,y:I.clientY}),V.size>=2){let D=U();O>0&&D>0&&N(s*(O/D)),O=D,C=!1;return}C&&(i+=(I.clientX-M)*vi,a=Math.max(-Ee,Math.min(Ee,a+(I.clientY-k)*vi)),M=I.clientX,k=I.clientY,b())}},w=I=>{V.delete(I.pointerId),O=V.size===2?U():0;let D=V.values().next().value;C=V.size===1,D?(M=D.x,k=D.y):y.style.cursor="grab";try{y.releasePointerCapture?.(I.pointerId)}catch{}},P=I=>{I.preventDefault(),N(s+I.deltaY*.04)};y.addEventListener("pointerdown",A),y.addEventListener("pointermove",v),y.addEventListener("pointerup",w),y.addEventListener("pointercancel",w),y.addEventListener("wheel",P,{passive:!1});let T=I=>{if(!c){if(I.key==="Tab"){I.preventDefault(),x.focus({preventScroll:!0});return}if(I.key==="Escape"){I.stopPropagation(),z.close();return}if(I.key==="ArrowLeft"||I.key==="ArrowRight")i+=I.key==="ArrowLeft"?-4:4;else if(I.key==="ArrowUp"||I.key==="ArrowDown")a=Math.max(-Ee,Math.min(Ee,a+(I.key==="ArrowUp"?4:-4)));else if(I.key==="+"||I.key==="="){N(s-5),I.preventDefault();return}else if(I.key==="-"){N(s+5),I.preventDefault();return}else return;I.preventDefault(),b()}};window.addEventListener("keydown",T);let L=0,E=(I,D)=>{if(!h){D?.();return}let B=I===1?0:1,j=performance.now(),G=()=>{if(c)return;let F=o<=0?1:Math.min(1,(performance.now()-j)/o);h?.setOpacity(B+(I-B)*F),n.requestRender(),F<1?L=requestAnimationFrame(G):D?.()};L=requestAnimationFrame(G)};E(1);let R=()=>{c||(c=!0,d(),l.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(L),y.removeEventListener("pointerdown",A),y.removeEventListener("pointermove",v),y.removeEventListener("pointerup",w),y.removeEventListener("pointercancel",w),y.removeEventListener("wheel",P),window.removeEventListener("keydown",T),y.remove(),g?.isConnected&&g.focus({preventScroll:!0}),h?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:p,aspect:n.camera.aspect}),n.camera.quaternion.set(f[0],f[1],f[2],f[3]),n.requestRender())},z={close(){if(c)return;let I=()=>{R(),r.onClose?.()};cancelAnimationFrame(L),E(0,I)},dispose:R};return x.addEventListener("click",()=>z.close()),z}var vi,Si=pt(()=>{"use strict";xi();qn();Kn();vi=.15});var wi={};to(wi,{createOpenPanorama:()=>Pc});function Pc(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:d,isContextLost:m,isDisposed:h,flightGen:p,setPanorama:f,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:S,restorePanoramaLayer:C,getOverviewChip:M,labelOverlay:k,reducedMotion:O,removeArriveChip:V,showArriveChip:U}=e;return async(N,A,v)=>{b()?.abort();let w=new AbortController;y(w);let P=n.seats.idToIndex.get(N);if(P===void 0){i.syncFromCamera();return}let T=s.get(N)?.label??N,L=l(N,P),E=c(N);if(!E){w.abort(),b()===w&&y(null),i.syncFromCamera();return}x(!0),a.stop();let R;try{R=await E}catch{if(b()===w&&y(null),o.panoramaFailed(N,"source"),!h()&&v===p()){x(!1),i.resumeAfterFlight(L.focal),a.requestRender();let X=U(N,v,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(h()||v!==p()){w.abort(),b()===w&&y(null);return}V();let z=M(),I=()=>{w.abort(),b()===w&&y(null),f(null),g(!1),C(),z.style.display="",k.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(L.focal),a.requestRender();let X=U(N,p());requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())},D=R.generated===!0,B=fi(R);S(),g(!D),z.style.display="none";let j=O()?0:A,G=u(),F=G&&!m()?await Mi(t,D?null:R,{gl:d,scene:G.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:D?L.eye:void 0,focalWorld:L.focal},{fadeMs:j,seatLabel:T,disclosure:B,disclosurePrefix:D?"Live seat-eye view":"360\xB0 panorama",onClose:I,signal:w.signal}):null;if(h()||v!==p()){w.abort(),g(!1),b()===w&&y(null),F?.dispose(),z.style.display="",C();return}if(F)i.syncFromCamera(),k.setVisible(!1),x(!1),a.requestRender(),f(F);else if(D){C(),z.style.display="",x(!1),i.resumeAfterFlight(L.focal),a.requestRender(),f(null),g(!1),o.panoramaFailed(N,"mount");let X=U(N,p(),!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus()),b()===w&&y(null);return}else g(!1),o.panoramaFallback(N),f(bi(t,R,{fadeMs:j,seatLabel:T,disclosure:B,onClose:I,signal:w.signal}));o.panoramaOpened()}}var Pi=pt(()=>{"use strict";qn();Si()});var Tc={};to(Tc,{VENUE3D_QUALITY_REPORT_VERSION:()=>jr,buildSceneModel:()=>lt,inspectVenue3DQualityEvidence:()=>Jt,mountVenue3D:()=>Ec,prepareVenue3D:()=>Fi});module.exports=Ui(Tc);var ao=require("ogl");var ji=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Yi(e){let t=ji.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function te(e){let t=Yi(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function bn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Xi(e){return .2126*bn(e[0])+.7152*bn(e[1])+.0722*bn(e[2])}function oo(e){return Xi([e[0]*255,e[1]*255,e[2]*255])}function Wi(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function pe(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function ft(e,t){let n=Wi(e);return pe(e,[n,n,n],t)}var xe=["available","held","sold","selected","dimmed"];function bt(e){let t=xe.indexOf(e);return t<0?0:t}var ro={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function io(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.42,r=.62;return[(t+(e[0]-t)*n)*r,(t+(e[1]-t)*n)*r,(t+(e[2]-t)*n)*r]}var yn={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]},Ke={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ye(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Ki(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var Ft=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,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 ao.Renderer({canvas:this.canvas,dpr:Ki(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ke.top[0],Ke.top[1],Ke.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.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(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=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(t,n),{width:t,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 t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var ot=require("ogl"),de=Math.PI/180,gn=15*de,xn=80*de,nt=.12,so=35,co=1.25,Dt=class{constructor(t,n,r,o){this.fovY=so;this.target=new ot.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 ot.Vec3;this.panAnchor=new ot.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new ot.Camera(t,{fov:so,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 c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;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(gn,Math.min(xn,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(gn,Math.min(xn,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 t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,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,c=-i,l=Math.cos(this.polar),u=Math.sin(this.polar),d=-i*l,m=-a*l;this.targetT.x+=(-t*s+n*d)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*u*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*de/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=r??-30*de,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*de;let u=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??co)),this.minDist=Math.max(2,a*.12),this.maxDist=u*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(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.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 c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??co))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let l=Math.sin(i),u=-l*Math.sin(o),d=-Math.cos(i),m=-l*Math.cos(o);if(Math.abs(d)>.999)return s;let h=-m,p=u,f=Math.hypot(h,p);h/=f,p/=f;let b=-p*d,y=p*u-h*m,g=h*d,x=Math.tan(r),S=Math.tan(n),C=1;for(let M=0;M<8;M++){let k=(M&1?c.max[0]:c.min[0])-t.center[0],O=(M&2?c.max[1]:c.min[1])-t.center[1],V=(M&4?c.max[2]:c.min[2])-t.center[2],U=k*u+O*d+V*m,N=Math.abs(k*h+V*p),A=Math.abs(k*b+O*y+V*g);C=Math.max(C,N/x-U,A/S-U)}return Math.min(s,Math.max(C,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=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),c=Math.abs(t)>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+=t*nt,this.polar+=n*nt,this.distance+=r*nt,this.target.x+=o*nt,this.target.y+=i*nt,this.target.z+=a*nt,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=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(t,n,r)||1,i=Math.max(gn,Math.min(xn,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(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*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 _t=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,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=t}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 rt=2.5,Qi=1.15,yt=6,it=10,lo=6,uo=9.5,mo=.9,ho=2.2,vn=30,Mn=4,Ot=8192;var Gc=it+Mn;function po(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:rt};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:rt+o*(Qi-rt)}}function fo(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function bo(e,t,n,r,o){if(!(e>0)||!(t>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=t/(n*i)*(o/2);return Math.PI*a*a/e>=64}var qi=[{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:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{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:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{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"}],zc=new Map(qi.map(e=>[e.key,e]));var Zi={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function yo(e){let t=e?.[0];return t&&Zi[t]||"#3b82f6"}var $i=[{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"}],Hc=new Map($i.map(e=>[e.key,e]));var Ji=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Uc=new Set(Ji);var xo=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],vo=xo.map(e=>e.key),ea=new Map(xo.map(e=>[e.key,e]));function go(e){return typeof e=="string"&&ea.has(e)}function Mo(e,t){return go(e)?e:go(t?.seatGlyph)?t.seatGlyph:"circle"}var Ae=.02291666666666667,Ne=1/Ae,ta=58,na=ta*Ae;var oa=3,So=0,Sn=120,ra=0,ia=45,aa=7,Bt=1.2;function wn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function sa(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=aa?e:oa}function wo(e,t={}){let n=wn(t.floorBaseHeightM,So,Sn,0),r=Math.min(Sn,n+sa(e.elevation)*na),o=e.height===void 0?r:wn(e.height,So,Sn,r),i=wn(e.rake,ra,ia,0);return{height:o,rake:i}}var Co=tt(require("earcut"),1),Ao=tt(require("polygon-clipping"),1);var Qc=Math.PI/180;function Pn(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function gt(e){return e.length?Pn(e):null}function Qe(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function xt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var _=Ae,ca=.002;function la(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[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<ca}var qe=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)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)}},Vt=class{constructor(){this.pos=new qe;this.nor=new qe;this.col=new qe;this.flr=new qe;this.mat=new qe;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){la(t,n,r)||(this.pos.push3(t[0],t[1],t[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(t,n,r,o,i,a,s,c=s,l=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[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(c[0],c[1],c[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 ua(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],l=o*c-i*s,u=i*a-r*c,d=r*s-o*a,m=Math.hypot(l,u,d)||1;return l/=m,u/=m,d/=m,[l,u,d]}function da(e,t){let n=[...e],r=[];for(let a of e)r.push(a.x,a.y);let o=[];if(t){for(let a of t)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,Co.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Cn(e){return Qe(e)<0?[...e].reverse():e}var ma=3;function ha(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(h,p,f,b)=>Math.abs(r({x:(h.x+p.x)/2,y:(h.y+p.y)/2})-(f+b)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(o+i+a)/3,d=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:l})-u)),m=(h,p,f)=>{let b=Math.abs(r({x:(h+c)/2,y:(p+l)/2})-(f+u)/2);b>d&&(d=b)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),d}function vt(e,t,n,r,o){if(o<=0)return ha(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},s={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(vt(e,i,s,r,o-1),vt(i,t,a,r,o-1),vt(s,a,n,r,o-1),vt(i,a,s,r,o-1))}function Mt(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},h={x:(n.x+r.x)/2,y:(n.y+r.y)/2},p={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Mt(e,t,m,p,o,i,a-1,s),Mt(e,m,n,h,o,i,a-1,s),Mt(e,p,h,r,o,i,a-1,s),Mt(e,m,h,p,o,i,a-1,s);return}let c=[t.x*_,o(t),t.y*_],l=[n.x*_,o(n),n.y*_],u=[r.x*_,o(r),r.y*_];if(s){e.triN(c,l,u,s(t),s(n),s(r),i);return}let d=ua(c,l,u);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),e.tri(c,l,u,d,i)}var pa=8;function Po(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,l)=>{if(l>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},d=t(u);if(Math.abs(d-(s+c)/2)>n){o(i,u,s,d,l-1),o(u,a,d,c,l-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),pa)}return r}function Nt(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||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)<t;)n.pop();if(n.length<3)return e;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],c=s.x-i.x,l=s.y-i.y,u=Math.hypot(c,l);u>t&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/u<t||r.push(a)}return r.length>=3?r:n}var Gt=.001*Ne*.1;function se(e,t,n,r,o,i,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Qe(t))<1e-4))return;let u=Nt(Po(Nt(Cn(t),Gt),r,c),Gt),d=n?.map(M=>Nt(Po(Nt(Cn(M),Gt),r,c),Gt)).filter(M=>M.length>=3&&Math.abs(Qe(M))>=1e-4),{pts:m,tris:h}=da(u,d),p=[i[0]*s.top,i[1]*s.top,i[2]*s.top],f=[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],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<ma;g++){let M=0;for(let k=0;k<h.length;k+=3){let O=vt(m[h[k]],m[h[k+1]],m[h[k+2]],r,g);O>M&&(M=O)}if(M<=c)break}for(let M=0;M<h.length;M+=3){let k=m[h[M]],O=m[h[M+1]],V=m[h[M+2]];Mt(e,k,O,V,r,p,g,l);let U=[k.x*_,o,k.y*_],N=[O.x*_,o,O.y*_],A=[V.x*_,o,V.y*_];e.tri(U,A,N,[0,-1,0],f)}let x=M=>{if(g<=0)return M;let k=1<<g,O=[];for(let V=0;V<M.length;V++){let U=M[V],N=M[(V+1)%M.length];for(let A=0;A<k;A++){let v=A/k;O.push({x:U.x+(N.x-U.x)*v,y:U.y+(N.y-U.y)*v})}}return O},S=Pn(u),C=[{ring:x(u),flip:!1}];if(d)for(let M of d)M.length>=3&&C.push({ring:x(M),flip:!0});for(let{ring:M,flip:k}of C)for(let O=0;O<M.length;O++){let V=M[O],U=M[(O+1)%M.length],N=(U.x-V.x)*_,v=(U.y-V.y)*_,w=-N,P=Math.hypot(v,w)||1;v/=P,w/=P;let T=(V.x+U.x)/2-S.x,L=(V.y+U.y)/2-S.y,E=v*T+w*L;k&&(E=-E),E<0&&(v=-v,w=-w);let R=[v,0,w],z=[V.x*_,r(V),V.y*_],I=[U.x*_,r(U),U.y*_],D=[V.x*_,o,V.y*_],B=[U.x*_,o,U.y*_];e.tri(z,I,B,R,b,b,y),e.tri(z,B,D,R,b,y,y)}}function Ro(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:t}}function zt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Cn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],u=l.x-c.x,d=l.y-c.y,m=Math.hypot(u,d)||1;i.push({x:d/m,y:-u/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],u=i[s],d=l.x+u.x,m=l.y+u.y,h=Math.hypot(d,m),p=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+u.x*t,c.y+u.y*t])};if(h<1e-9){p();continue}d/=h,m/=h;let f=d*l.x+m*l.y,b=1/Math.max(f,1e-6);if(!Number.isFinite(b)||b>n){p();continue}a.push([c.x+d*t*b,c.y+m*t*b])}if(a.length<3)return e;try{let s=Ao.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let d of s){let m=Math.abs(Qe(d[0].map(([h,p])=>({x:h,y:p}))));m>l&&(l=m,c=d[0])}if(!c)return e;let u=c.map(([d,m])=>({x:d,y:m}));if(u.length>1){let d=u[0],m=u[u.length-1];Math.abs(d.x-m.x)<1e-9&&Math.abs(d.y-m.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function Ht(e,t,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+r*Math.sin(s)})}return i}function St(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ie={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},fa=.44,ba=.15,ya=.3,ga=.24;function Io(e){return e===void 0||!Number.isFinite(e)||e<=0?ga:Math.min(ya,Math.max(ba,e*fa))}var An=.21,xa=.05,Rn=.45,Ut=Rn+xa,va=[{part:ie.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ie.pad,min:[-1,.36,-.95],max:[1,Rn,1]},{part:ie.back,min:[-1,Ut,-1],max:[1,.92,-.72]},{part:ie.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ie.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ie.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ie.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ie.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ie.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ie.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Ma=[{part:ie.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ie.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ie.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ie.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ie.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Sa=[{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 Eo(){let e=[],t=[],n=[],r=[],o=(P,T,L)=>{let E=n.length,[R,z,I]=P,D=[z[0]-R[0],z[1]-R[1],z[2]-R[2]],B=[I[0]-R[0],I[1]-R[1],I[2]-R[2]],j=D[1]*B[2]-D[2]*B[1],G=D[2]*B[0]-D[0]*B[2],F=D[0]*B[1]-D[1]*B[0],X=Math.hypot(j,G,F);X>1e-9?(j/=X,G/=X,F/=X):[j,G,F]=T,j*T[0]+G*T[1]+F*T[2]<0&&(j=-j,G=-G,F=-F);for(let K of P)e.push(...K),t.push(j,G,F),n.push(L);r.push(E,E+1,E+2,E,E+2,E+3)},i=P=>{for(let T of Sa){let L=T.c.map(E=>E.map((R,z)=>R?P.max[z]:P.min[z]));o(L,T.n,P.part)}};for(let P of va)i(P);for(let P of Ma)i(P);let a=Rn,s=1.08,c=.47,l=.69,u=-.55,d=.08,m=-.48,h=.01,p=[-c,a,u],f=[c,a,u],b=[-c,a,d],y=[c,a,d],g=[-l,s,m],x=[l,s,m],S=[-l,s,h],C=[l,s,h];o([f,x,C,y],[1,0,0],ie.body),o([b,S,g,p],[-1,0,0],ie.body),o([S,C,x,g],[0,1,0],ie.body),o([p,f,y,b],[0,-1,0],ie.body),o([y,C,S,b],[0,0,1],ie.body),o([p,g,x,f],[0,0,-1],ie.body);let M=10,k=8,O=[0,1.205,-.23],V=[.42,.115,.38],U=n.length;for(let P=0;P<=k;P++){let T=Math.PI*P/k,L=Math.cos(T),E=Math.sin(T);for(let R=0;R<=M;R++){let z=Math.PI*2*R/M,I=E*Math.cos(z),D=E*Math.sin(z);e.push(O[0]+V[0]*I,O[1]+V[1]*L,O[2]+V[2]*D);let B=I/V[0],j=L/V[1],G=D/V[2],F=Math.hypot(B,j,G)||1;B/=F,j/=F,G/=F,t.push(B,j,G),n.push(ie.head)}}for(let P=0;P<k;P++)for(let T=0;T<M;T++){let L=U+P*(M+1)+T,E=L+M+1;r.push(L,E,L+1,L+1,E,E+1)}let N=new Float32Array(e),A=new Float32Array(t),v=new Float32Array(n),w=new Uint16Array(r);return{position:N,normal:A,part:v,index:w,vertexCount:n.length,indexCount:r.length}}function To(e,t,n,r){let o=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,u)=>{let d=u-l;for(let m=l;m<u;m++){let[h,p]=r(m),f=h-i(m),b=p-a(m);if(d>=2){let y=Math.max(l,m-1),g=Math.min(u-1,m+1),x=i(g)-i(y),S=a(g)-a(y),C=Math.hypot(x,S);if(C>1e-6){let M=-S/C,k=x/C;M*f+k*b<0&&(M=-M,k=-k),f=M,b=k}}o[m]=f===0&&b===0?0:Math.atan2(f,b)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var Te=.22;function ko(e,t){let n=xe[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var wa=.42;function Pa(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let p of e)p.x<r&&(r=p.x),p.y<o&&(o=p.y),p.x>i&&(i=p.x),p.y>a&&(a=p.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/l)+1),d=Math.max(1,Math.ceil(c/l)+1),m=new Map,h=(p,f)=>{let b=Math.min(u-1,Math.max(0,Math.floor((p-r)/l)));return Math.min(d-1,Math.max(0,Math.floor((f-o)/l)))*u+b};for(let p=0;p<t;p++){let f=h(e[p].x,e[p].y),b=m.get(f);b?b.push(p):m.set(f,[p])}for(let p=0;p<t;p++){let f=e[p],b=Math.min(u-1,Math.max(0,Math.floor((f.x-r)/l))),y=Math.min(d-1,Math.max(0,Math.floor((f.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let S=y-x;S<=y+x;S++)if(!(S<0||S>=d))for(let C=b-x;C<=b+x;C++){if(C<0||C>=u||x>1&&Math.abs(S-y)<x&&Math.abs(C-b)<x)continue;let M=m.get(S*u+C);if(M)for(let k of M){if(k===p)continue;let O=Math.hypot(e[k].x-f.x,e[k].y-f.y);O<g&&(g=O)}}if(Number.isFinite(g)&&g<=x*l)break}n[p]=g}return n}function Ca(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Bt):0}function Lo(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),u=new Float32Array(a),d=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a),p=new Float32Array(a*3),f=new Map,b=Pa(e);for(let y=0;y<a;y++){let g=e[y],S=(n?.seatPitchU(y)??b[y])*_;u[y]=Number.isFinite(S)?Math.max(.06,Math.min(Te,S*wa)):Te,d[y]=Io(Number.isFinite(S)?S:void 0);let C=Mo(g.glyph,{seatGlyph:i?.get(g.categoryKey)});m[y]=vo.indexOf(C),h[y]=g.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=g.x*_,s[y*3+1]=n?n.seatDeckY(y):Ca(g),s[y*3+2]=g.y*_,c[y]=bt(t?t(g):"available");let M=te(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[y*3]=M[0],l[y*3+1]=M[1],l[y*3+2]=M[2],g.accessibility?.length){let k=te(yo(g.accessibility));k&&(p[y*3]=k[0],p[y*3+1]=k[1],p[y*3+2]=k[2])}f.set(g.id,y)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:p,idToIndex:f,iChairWidth:d,iGlyph:m,iPhysicalSeat:h,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var Aa=64;function In(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=bt(a.state);e.iState[s]!==c&&(e.iState[s]=c,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+Aa){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 Ra=.15,Ia=.9,Ea=1.76,Ta=.7,ka=1.6;function La(){return{background:{top:[...Ke.top],bottom:[...Ke.bottom]},structure:yn,seatStates:{...ro},seatScale:1}}function Fo(e){let t=La();if(!e)return t;let n=te(e.background);if(n){t.background={top:ye(n,Ia),bottom:ye(n,Ea)};let i={};for(let[a,s]of Object.entries(yn))i[a]=pe(s,n,Ra);t.structure=i}let r=te(e.selectionColor)??te(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(ka,Math.max(Ta,o))),t}function Do(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function _o(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function at(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));d<r&&(r=d)}return r}function Fa(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function Oo(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function En(e,t){let n=1/0;for(let r of _o(e)){let o=at(t,r.x,r.y);o<n&&(n=o)}for(let r of _o(t)){let o=at(e,r.x,r.y);o<n&&(n=o)}return n}function Da(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let u of e)n+=u.x,r+=u.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let u of e){let d=Math.hypot(u.x-n,u.y-r);d>o&&(o=d,i=u)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((u,d)=>({p:u,i:d,t:(u.x-n)*a+(u.y-r)*s})).sort((u,d)=>u.t-d.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function Tn(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let g of e)n+=g.x,r+=g.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,l=0,u=0;for(let g of e){let x=g.x-n,S=g.y-r;o+=x*x,a+=S*S,i+=x*S,s+=x*x*x,c+=S*S*S,l+=x*S*S,u+=S*x*x}let d=o*a-i*i;if(Math.abs(d)<1e-9)return null;let m=(s+l)/2,h=(c+u)/2,p=(m*a-h*i)/d,f=(h*o-m*i)/d,b=p+n,y=f+r;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var _a=.15;function Oa(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,S=0;for(let C of g.pts)x+=C.x,S+=C.y;return{x:x/g.pts.length,y:S/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let g of t){let x=g.x-n,S=g.y-r;o+=x*x,i+=x*S,a+=S*S}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,d;Math.abs(i)>1e-12?(u=l-a,d=i):o>=a?(u=1,d=0):(u=0,d=1);let m=Math.hypot(u,d);if(!(m>1e-12))return null;u/=m,d/=m;let h=1/0,p=-1/0,f=[];for(let g of e){let x=1/0,S=-1/0;for(let C of g.pts){let M=C.x*u+C.y*d;M<x&&(x=M),M>S&&(S=M),M<h&&(h=M),M>p&&(p=M)}f.push(S-x)}let b=p-h;return b>1e-9?(f.sort((g,x)=>g-x),f[Math.min(f.length-1,Math.floor(f.length*.9))]/b<=Ba?{x:u,y:d}:null):null}var Ba=.35;function Bo(e,t,n,r){let o=new Map;for(let b of n){let y=t[b],g=y.rowId||`__seat-${b}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:y.x,y:y.y}),x.idx.push(b)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,y]of o){let g=Da(y.pts,y.idx),x=0;for(let S of g.pts)x+=Math.hypot(S.x-r.x,S.y-r.y);i.push({id:b,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(b=>Fa(b.pts)),s=[];for(let b=0;b<i.length;b++){let y=1/0;for(let g=0;g<i.length;g++){if(b===g||Oo(a[b],a[g])>=y)continue;let x=En(i[b].pts,i[g].pts);x<y&&(y=x)}Number.isFinite(y)&&s.push(y)}s.sort((b,y)=>b-y);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),u=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let y=b+1;y<i.length;y++)Oo(a[b],a[y])>l||En(i[b].pts,i[y].pts)<=l&&(u[b].push(y),u[y].push(b));let d=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let y=d++,g=[b];for(i[b].blockId=y;g.length;){let x=g.pop();for(let S of u[x])i[S].blockId===-1&&(i[S].blockId=y,g.push(S))}}let m=new Map;for(let b of i){let y=m.get(b.blockId)??[];y.push(b),m.set(b.blockId,y)}let h=[];for(let b of i){if(b.pts.length<4)continue;let y=Tn(b.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||h.push({x:y.cx,y:y.cy}))}let p=h.length>=2?(()=>{let b=h.map(x=>x.x).sort((x,S)=>x-S),y=h.map(x=>x.y).sort((x,S)=>x-S),g=Math.floor(h.length/2);return{cx:b[g],cy:y[g]}})():null;if(p){let b=M=>Math.hypot(M.x-p.cx,M.y-p.cy),y=1/0,g=-1/0,x=[];for(let M of i){let k=1/0,O=-1/0;for(let V of M.pts){let U=b(V);U<k&&(k=U),U>O&&(O=U)}x.push(O-k),k<y&&(y=k),O>g&&(g=O)}let S=g-y;x.sort((M,k)=>M-k);let C=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(S>1e-9&&C/S<=_a){let M=i.map(T=>{let L=0;for(let E of T.pts)L+=b(E);return{row:T,radius:L/T.pts.length}}),k=0,O=0;for(let T of M)k+=T.radius,O+=T.row.focalDistance;k/=M.length,O/=M.length;let V=0;for(let T of M)V+=(T.radius-k)*(T.row.focalDistance-O);if(V<0)for(let T of M)T.radius=-T.radius;let N=1/0;for(let T of M)T.radius<N&&(N=T.radius);M.sort((T,L)=>T.radius-L.radius);let A=-1,v=-1/0,w=S/Math.max(1,M.length)*.5,P=[];for(let T of M)T.radius-v>w&&(A++,v=T.radius),T.row.ordinal=A,T.row.blockDepth=T.radius-N,P.push(T.row);return{sectionId:e,rows:P,blockCount:d}}}let f=[];for(let[,b]of m){let y=Oa(b);if(y){let g=S=>{let C=0;for(let M of S.pts)C+=M.x*y.x+M.y*y.y;return C/S.pts.length};b.sort((S,C)=>g(S)-g(C)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let x=0;for(let S=0;S<b.length;S++)S>0&&(x+=En(b[S-1].pts,b[S].pts)),b[S].ordinal=S,b[S].blockDepth=x,f.push(b[S])}else{let g=1/0;for(let x of b)x.focalDistance<g&&(g=x.focalDistance);b.sort((x,S)=>x.focalDistance-S.focalDistance);for(let x=0;x<b.length;x++)b[x].ordinal=x,b[x].blockDepth=Math.max(0,b[x].focalDistance-g),f.push(b[x])}}return{sectionId:e,rows:f,blockCount:d}}var pl=Math.PI/180;function No(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function Na(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.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(e,t,n){return No(e,t)&&!(n??[]).some(r=>No(e,r)||Na(e,r))}function Ga(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function Va(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let h of e)n+=h.x,r+=h.y,o+=Math.hypot(h.x-t.x,h.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let h of e){let p=Math.hypot(h.x-n,h.y-r);p>s&&(s=p,a=h)}let c=a.x-n,l=a.y-r,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let d=[...e].sort((h,p)=>(h.x-n)*c+(h.y-r)*l-((p.x-n)*c+(p.y-r)*l)),m=0;for(let h of d){let p=Math.hypot(h.x-n,h.y-r);p>m&&(m=p)}return{pts:d,cx:n,cy:r,radius:m,depth:o}}function Vo(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-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],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,d=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;d<0?d=0:d>1&&(d=1);let m=Math.hypot(t-(a.x+d*c),n-(a.y+d*l));m<o&&(o=m)}return o}var jt=8;function za(e,t,n){let r=new Array(jt).fill(1/0),o=new Array(jt).fill(-1);for(let u=0;u<e.length;u++){let d=e[u],m=Math.hypot(t-d.cx,n-d.cy)-d.radius;for(let h=0;h<jt;h++)if(m<r[h]){for(let p=jt-1;p>h;p--)r[p]=r[p-1],o[p]=o[p-1];r[h]=m,o[h]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of o){if(u<0)continue;let d=Vo(e[u],t,n);for(let m=0;m<3;m++)if(d<i[m]){for(let h=2;h>m;h--)i[h]=i[h-1],a[h]=a[h-1];i[m]=d,a[m]=u;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,l=0;for(let u=0;u<3;u++){let d=a[u];if(d<0||i[u]>s)continue;let m=1/(i[u]*i[u]);c+=m*e[d].depth,l+=m}return l>0?c/l:e[a[0]].depth}function Ha(e){let t=(r,o)=>za(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let l=Vo(c,r,o);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function zo(e,t){let n=[];for(let r of e){let o=Va(r.points,t);o&&n.push(o)}return n.length<2?Ga(t):(n.sort((r,o)=>r.depth-o.depth),Ha(n))}var Fn=tt(require("polygon-clipping"),1);var Yo=tt(require("earcut"),1);var Ua=.58,Ho=.01,ge=Te*1.5*Ne,ja=.5,Ya=.6;function Xa(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],l=c.x-s.x,u=c.y-s.y,d=Math.hypot(l,u);if(d<1e-9){r.push([0,0]);continue}l/=d,u/=d,r.push([-u,l])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function Wa(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,l=s.y-a.y,u=Math.hypot(c,l)||1;return{x:c/u,y:l/u}},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*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Uo=Math.PI/12;function Ka(e){if(e.length<3)return[...e];let t=[...e].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(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function Xo(e,t){if(!e.length||!(t>0))return[];let n=Ka(e),r=(s,c,l,u)=>{let d=l-c;for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;let m=Math.max(1,Math.ceil(d/Uo)),h=t/Math.cos(d/m/2);for(let p=0;p<=m;p++){let f=c+d*p/m;u.push({x:s.x+Math.cos(f)*h,y:s.y+Math.sin(f)*h})}};if(n.length<3){let s=0,c=0;for(let h of n)s+=h.x,c+=h.y;s/=n.length||1,c/=n.length||1;let l=0;for(let h of n)l=Math.max(l,Math.hypot(h.x-s,h.y-c));let u=[],d=Math.max(3,Math.ceil(Math.PI*2/Uo)),m=(l+t)/Math.cos(Math.PI/d);for(let h=0;h<d;h++){let p=h/d*Math.PI*2;u.push({x:s+Math.cos(p)*m,y:c+Math.sin(p)*m})}return u}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return Zo(a)}function Qa(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));d<r&&(r=d)}return r}function Yt(e){let t=e.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 c=0;for(let l of o.pts){let u=Math.hypot(l.x-i,l.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),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<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let u of i){let d=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let h=t[m],p=Math.hypot(u.x-h.cx,u.y-h.cy)-h.rad;if(p>=d&&p>=s)continue;let f=Qa(e[m].pts,u.x,u.y);f<d&&(d=f),e[m].depth<e[o].depth&&f<s&&(s=f,c=e[m].y)}Number.isFinite(d)&&d>0&&a.push(d)}a.sort((u,d)=>u-d);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function Wo(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],d=u.x-r.x,m=u.y-r.y,h=Math.hypot(d,m)||1;d/=h,m/=h;let p=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+m*p,y:u.y-d*p},{x:u.x-m*p,y:u.y+d*p}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let d=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);d>1e-6&&(a+=d,s++)}let c=s>0?a/s:0,l=Wa(i,Math.max(c*Ya,ge));return{pts:l,nrm:Xa(l,r),front:Math.max(n[t].pitch*Ua,ge),back:Math.max(n[t].pitch*ja,ge)}}var st=1.5,Ko=.3;function kn(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let d=1;d<e.length-1;d++){let m=e[d],h=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);h>s&&(s=h,c=d)}if(s<=t||c<0)return[n,r];let l=kn(e.slice(0,c+1),t),u=kn(e.slice(c),t);return[...l.slice(0,-1),...u]}function Qo(e,t){if(e.length<4)return e;let n=kn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function qo(e,t,n){if(e.length<2)return[];let r=n??Yt(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let g of a){let x=e[g].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,x)=>e[g].depth-e[x].depth);let l=s.map(g=>Wo(e,g,r,t)).filter(g=>g!==null);if(!l.length)continue;let u=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+st),y:g.pts[x].y-g.nrm[x][1]*(g.front+st)}),d=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+st),y:g.pts[x].y+g.nrm[x][1]*(g.back+st)}),m=l[0],h=l[l.length-1],p=[];for(let g=0;g<m.pts.length;g++)p.push(u(m,g));for(let g of l)p.push(d(g,g.pts.length-1));for(let g=h.pts.length-1;g>=0;g--)p.push(d(h,g));for(let g=l.length-1;g>=0;g--)p.push(u(l[g],0));let f=Zo(p),b=1/0;for(let g of s)e[g].y<b&&(b=e[g].y);if(!Number.isFinite(b))continue;if(f.length>=3&&Math.abs(Qe(f))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return xt(f,x.x,x.y)})){i.push({outline:Qo(f,Ko),holes:[],topY:b});continue}for(let g of qa(l))i.push({outline:g,holes:[],topY:b})}return i}function qa(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+st,a=n.back+st;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];r.push([l.x-u[0]*i,l.y-u[1]*i]),o.push([l.x+u[0]*a,l.y+u[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=Fn.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,l])=>({x:c,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(Qo(i,Ko))}return r}catch{return[]}}function Zo(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var Ln=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)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(t){for(let n of t)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 t)if(!xt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function jo(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],u=r[0];for(let d=1;d+1<r.length;d++){let m=r[d],h=r[d+1];e.tri([u.x*_,o,u.y*_],[m.x*_,o,m.y*_],[h.x*_,o,h.y*_],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=Fn.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let u=l[0],d=[],m=[];for(let p=0;p<u.length-1;p++)d.push(u[p][0],u[p][1]),m.push([u[p][0],u[p][1]]);if(m.length<3)continue;let h=(0,Yo.default)(d,void 0,2);for(let p=0;p<h.length;p+=3){let f=m[h[p]],b=m[h[p+1]],y=m[h[p+2]];e.tri([f[0]*_,o,f[1]*_],[b[0]*_,o,b[1]*_],[y[0]*_,o,y[1]*_],c,i)}}}function $o(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??Yt(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(h=>[h.x,h.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new Ln([[...i]]):null,d=h=>{e.setMaterial(2),h(),e.setMaterial(0)},m=h=>{e.setMaterial(3),h(),e.setMaterial(0)};for(let h=0;h<t.length;h++){let p=t[h];if(p.patch&&p.patch.length>=3){let C=[...p.patch],M=s[h].belowY??r;if(m(()=>{if(l&&u)jo(e,l,u,C,p.y,o.tread);else{let k=C[0];for(let O=1;O+1<C.length;O++){let V=C[O],U=C[O+1];e.tri([k.x*_,p.y,k.y*_],[V.x*_,p.y,V.y*_],[U.x*_,p.y,U.y*_],c,o.tread)}}}),p.y>M+Ho){let k=0,O=0;for(let V of C)k+=V.x,O+=V.y;k/=C.length,O/=C.length,d(()=>{for(let V=0;V<C.length;V++){let U=C[V],N=C[(V+1)%C.length],A=N.x-U.x,v=N.y-U.y,w=Math.hypot(A,v);if(w<1e-6)continue;let P=v/w,T=-A/w;(U.x-k)*P+(U.y-O)*T<0&&(P=-P,T=-T);let L=[P,0,T],E=[U.x*_,p.y,U.y*_],R=[N.x*_,p.y,N.y*_],z=[U.x*_,M,U.y*_],I=[N.x*_,M,N.y*_];e.tri(E,R,I,L,o.riser),e.tri(E,I,z,L,o.riser)}})}continue}let f=Wo(t,h,s,n);if(!f)continue;let{pts:b,nrm:y,front:g,back:x}=f,S=s[h].belowY??r;for(let C=0;C+1<b.length;C++){let M=b[C],k=b[C+1],O=y[C],V=y[C+1];if(Math.hypot(k.x-M.x,k.y-M.y)<1e-6||O[0]===0&&O[1]===0||V[0]===0&&V[1]===0)continue;let U=[(M.x-O[0]*g)*_,p.y,(M.y-O[1]*g)*_],N=[(k.x-V[0]*g)*_,p.y,(k.y-V[1]*g)*_],A=[(M.x+O[0]*x)*_,p.y,(M.y+O[1]*x)*_],v=[(k.x+V[0]*x)*_,p.y,(k.y+V[1]*x)*_];if(m(()=>{l&&u?jo(e,l,u,[{x:M.x-O[0]*g,y:M.y-O[1]*g},{x:k.x-V[0]*g,y:k.y-V[1]*g},{x:k.x+V[0]*x,y:k.y+V[1]*x},{x:M.x+O[0]*x,y:M.y+O[1]*x}],p.y,o.tread):(e.tri(U,N,v,c,o.tread),e.tri(U,v,A,c,o.tread))}),p.y>S+Ho){let w=[U[0],S,U[2]],P=[N[0],S,N[2]],T=[-O[0],0,-O[1]];d(()=>{e.tri(U,N,P,T,o.riser),e.tri(U,P,w,T,o.riser)})}}}}function Jo(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function Xt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Dn=tt(require("polygon-clipping"),1);function Za(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function er(e,t){return e.filter(n=>n.type!=="shape"||Za(n,t))}function tr(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:er(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:er(e.objects,t),focal:n,baseHeightM:0,index:0}]}var $a={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function ct(e){return Jo(e)??$a}function nr(e,t){let n=zt(e.outline,ge),r=ct(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&Xt(r,ct(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=Dn.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,d])=>({x:u,y:d}));if(l.length>1){let u=l[0],d=l[l.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function or(e,t){if(!t.length)return e;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=t.map(i=>[n(i)]),o=[];for(let i of e){let a;try{a=Dn.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([l,u])=>({x:l,y:u}));if(c.length>1){let l=c[0],u=c[c.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var Ja=.05,rr=.05,es=.15,_n=25;function ir(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,l=[],u=new Set;for(let d=0;d<e.length;d+=1){let m=e[d];for(let h of m.objects){if(h.type==="table"&&u.add(h.id),h.type!=="section"||!h.outline||h.outline.length<3)continue;let p=zt(h.outline,ge);c.set(h.id,{section:h,unit:m,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:h.id,floorIndex:d,box:ct(p),section:h,unit:m,outline:p})}}for(let d=0;d<t.length;d++){let m=t[d];for(let h of l){if(n&&h.floorIndex!==n[d]||m.x<h.box.minX||m.x>h.box.maxX||m.y<h.box.minY||m.y>h.box.maxY||!Go({x:m.x,y:m.y},h.outline,h.section.holes))continue;o[d]=h.id;let p=c.get(h.id);p.hasSeats=!0;let f=m.focalPoint??h.unit.focal,b=Math.hypot(m.x-f.x,m.y-f.y);b<p.frontU&&(p.frontU=b),p.seatIndices.push(d);let y=m.rowId||`__seat-${d}`,g=p.rows.get(y);g?g.push({x:m.x,y:m.y}):p.rows.set(y,[{x:m.x,y:m.y}]);break}}for(let[d,m]of c){let h=wo(m.section,{floorBaseHeightM:m.unit.baseHeightM}),p=m.unit.baseHeightM,f=h.rake>0?Math.tan(h.rake*Math.PI/180):0,b=h.rake<=.01&&h.height<=p+.001,y=m.section.surfaceKind,g=y==="flat"?!0:y==="rakedRows"&&h.rake>.01?!1:b,x=m.hasSeats?Bo(d,t,m.seatIndices,m.unit.focal):{sectionId:d,rows:[],blockCount:0},C=x.rows.length<2?zo([...m.rows.values()].map(L=>({points:L})),m.unit.focal):null,M=1/0;if(C){if(m.hasSeats)for(let L of m.rows.values())for(let E of L){let R=C.depthAt(E.x,E.y);R<M&&(M=R)}if(!m.hasSeats||!Number.isFinite(M)){M=1/0;for(let L of m.section.outline){let E=C.depthAt(L.x,L.y);E<M&&(M=E)}}}let k=p+Ja,O=Math.max(k,h.height),V=L=>{let E=Math.max(0,L-M)*Ae,R=Math.min(E*f,_n);return Math.max(k,h.height+R)},U=L=>{let E=Math.max(0,L)*Ae,R=Math.min(E*f,_n);return Math.max(k,h.height+R)},N=g?[]:x.rows.map(L=>({pts:L.pts,y:U(L.blockDepth),depth:L.blockDepth,blockId:L.blockId,...u.has(L.id)?{patch:Xo(L.pts,ge)}:{}})),A=N.length?N[0].y:O,v=N.map(L=>{let E=L.patch&&L.patch.length>=3?L.patch:L.pts,R=0,z=0;for(let B of E)R+=B.x,z+=B.y;let I=E.length||1;R/=I,z/=I;let D=0;for(let B of E){let j=Math.hypot(B.x-R,B.y-z);j>D&&(D=j)}return{cx:R,cy:z,rad:D}}),w=g?()=>O:N.length>=2?(L,E)=>{let R=1/0,z=A;for(let I=0;I<N.length;I++){let D=v[I];if(Math.hypot(L-D.cx,E-D.cy)-D.rad>=R)continue;let B=N[I].patch,j=B&&B.length>=3?xt(B,L,E)?0:at(B,L,E):at(N[I].pts,L,E);j<R&&(R=j,z=N[I].y)}return z}:(L,E)=>C?V(C.depthAt(L,E)):O,P=[0,1,0],T=N.length>=2||g?()=>P:(L,E)=>{if(!C)return P;let R=C.depthAt(L,E);if(R<=M)return P;let z=(R-M)*Ae;if(z*f>=_n||h.height+z*f<=k)return P;let[I,D]=C.gradientAt(L,E);if(I===0&&D===0)return P;let B=1/Math.hypot(f,1);return[-I*f*B,B,-D*f*B]};if(!g)for(let L of x.rows){let E=U(L.blockDepth);for(let R of L.seatIndices)a[R]=E}for(let L of x.rows){let E=[];for(let B=1;B<L.pts.length;B++){let j=Math.hypot(L.pts[B].x-L.pts[B-1].x,L.pts[B].y-L.pts[B-1].y);j>1e-6&&E.push(j)}E.sort((B,j)=>B-j);let R=E.length?E[Math.floor(E.length/2)]:1/0,z=1/0,I=L.pts[Math.floor(L.pts.length/2)];if(I)for(let B of x.rows){if(B===L||B.blockId!==L.blockId)continue;let j=at(B.pts,I.x,I.y);j>1e-6&&j<z&&(z=j)}let D=Math.min(R,Math.max(z,R*.5));if(Number.isFinite(D)&&D>0)for(let B of L.seatIndices)s[B]=D}r.set(d,{sectionId:d,deckAt:w,normalAt:T,flat:g,bottomY:p,rowLevels:N,landingY:A})}for(let d=0;d<t.length;d++){let m=o[d],h=t[d];if(m){let f=a[d];i[d]=(f??r.get(m).deckAt(h.x,h.y))+es;continue}let p=h.eyeHeightM;i[d]=Number.isFinite(p)?Math.max(0,p-Bt):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var ae={top:1,wallBottom:.5,bottomCap:.4};function ke(e,t){if(!e)return t;let n=ye(ft(e,.4),.62);return pe(t,n,.72)}function ar(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){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,c=0,l=0,u=0;for(let[d,m]of a){let h=te(n.get(d));h&&(s+=h[0]*m,c+=h[1]*m,l+=h[2]*m,u+=m)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function sr(e,t){return te(e.color)??t.get(e.logicalSectionId??e.id)??null}var Gl=Math.PI*2;function cr(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var lr=tt(require("polygon-clipping"),1);function ts(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Wt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=ct(t),i=this.rings.filter((c,l)=>Xt(o,this.boxes[l])&&ts(n,this.levels[l])),a=[[r]];if(i.length)try{a=lr.default.difference([r],...i).map(l=>l.map(u=>u.map(([d,m])=>[d,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,d])=>({x:u,y:d}));if(l.length>1){let u=l[0],d=l[l.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function ns(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let d of e)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,c=t*Math.PI/180,l=Math.cos(c),u=Math.sin(c);return e.map(d=>{let m=d.x-a,h=d.y-s;return{x:a+m*l-h*u,y:s+m*u+h*l}})}function wt(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=St(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=Ht(n,r,e.width/2,e.height/2)}return t?ns(t,e.rotation):null}function Pt(e){let t=e.role??"",n={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}},r=t==="stage"&&cr(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var os=.08;function ur(e,t){let n=wt(e),r=Pt(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let u of n)i=Math.min(i,u.x),a=Math.min(a,u.y),s=Math.max(s,u.x),c=Math.max(c,u.y);let l=o;for(let u of t)s>u.minX&&i<u.maxX&&c>u.minY&&a<u.maxY&&l<=u.topOffsetM+1e-6&&(l=u.topOffsetM+os);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function Ge(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function dr(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function Ct(e,t,n){return[Ge(e[0],e[1],t),Ge(e[0],e[1],n),Ge(e[3],e[2],n),Ge(e[3],e[2],t)]}function mr(e,t,n){return[Ge(e[0],e[3],t),Ge(e[1],e[2],t),Ge(e[1],e[2],n),Ge(e[0],e[3],n)]}function Le(e,t,n,r,o,i){se(e,t,void 0,()=>n,r,o,i,ae)}var On=2.4,rs=.75,is=.15;function At(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=r/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,d])=>({x:t.x+u*a-d*s,y:t.y+u*s+d*a}))}function hr(e,t,n,r,o){let i=At(t);i&&se(e,i,void 0,()=>n+On,n,ke(r,o.boothTop),o.boothWall,ae)}function Bn(e){if(e.shape==="round"){let u=e.radius;return u?Ht(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,d])=>({x:o.x+u*a-d*s,y:o.y+u*s+d*a}))}function pr(e,t,n,r,o){let i=Bn(t);i&&se(e,i,void 0,()=>n+rs,n,ke(r,o.tableTop),o.tableWall,ae)}function fr(e,t,n,r,o,i,a){let s=wt(t);if(!s)return;let c=t.role==="stage",l=Pt(t),u=n+r;if(c&&a){let f=1/0,b=-1/0,y=1/0,g=-1/0;for(let x of s)x.x<f&&(f=x.x),x.x>b&&(b=x.x),x.y<y&&(y=x.y),x.y>g&&(g=x.y);a.push({cx:(f+b)/2*_,cz:(y+g)/2*_,y:u,halfX:Math.max((b-f)/2*_,.5),halfZ:Math.max((g-y)/2*_,.5)})}let d=te(t.fill),m=c&&d?pe(o.stageTop,ye(ft(d,.18),.9),.9):ke(d,c?o.stageTop:o.decorTop),h=t.role==="screen"?d:null,p=c?d?pe(o.stageWall,ye(d,.58),.82):o.stageWall:t.role==="screen"?h?pe(ye(h,1.42),[.24,.46,.82],.08):[.24,.46,.82]:ke(te(t.fill),o.decorWall);if(l.kind==="portal"&&s.length===4){let f=dr(s);Le(e,Ct(f,0,.16),u,n,m,p),Le(e,Ct(f,.84,1),u,n,m,p),Le(e,f,u,Math.max(n,u-.35),m,p);return}if(l.kind==="suite"&&s.length===4){let f=s.map((g,x)=>{let S=s[(x+1)%4],C=(g.x+S.x)/2,M=(g.y+S.y)/2;return Math.hypot(C-i.x,M-i.y)}),b=f.indexOf(Math.min(...f)),y=[0,1,2,3].map(g=>s[(b+g)%4]);Le(e,Ct(y,0,.08),u,n,m,p),Le(e,Ct(y,.92,1),u,n,m,p),Le(e,mr(y,.88,1),u,n,m,p),Le(e,y,u,Math.max(n,u-.18),m,p);return}Le(e,s,u,n,m,p)}function Nn(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=r/2,d=o/2;return[[-u,-d],[u,-d],[u,d],[-u,d]].map(([m,h])=>({x:i+m*c-h*l,y:a+m*l+h*c}))}function as(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.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=t.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 c=te(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>pe(s,c,1/(l+1)),a[0]):null}function br(e,t,n,r){if(t.layer==="foreground")return;let o=Nn(t);if(!o)return;let i=n+is,a=ke(as(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=pe(r.ground,a,s)),se(e,o,void 0,()=>i,n,a,pe(a,r.decorWall,.5),ae)}function yr(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=ke(r,o.gaTop);se(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ae)}var ss=Math.PI/180,$=96,cs=6,ls=60,us=150,gr=.2,ds=.35;function ms(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/ss;return n<0?n+360:n}function Kt(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function Qt(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%r+r)%r;else if(l<0||l>=r)continue;a+=e[l],s++}o[i]=a/s}return o}function xr(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let h of m.rows){for(let p of h.pts)o+=p.x,i+=p.y,a++;if(h.pts.length>=4){let p=Tn(h.pts);p&&Number.isFinite(p.cx)&&Number.isFinite(p.cy)&&r.push({x:p.cx,y:p.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=Kt(r.map(y=>y.x)),h=Kt(r.map(y=>y.y)),p=0;for(let y of n)for(let g of y.rows)for(let x of g.pts){let S=Math.hypot(x.x-s.x,x.y-s.y);S>p&&(p=S)}let f=0,b=p*.2;for(let y of n)for(let g of y.rows)for(let x of g.pts)Math.hypot(x.x-m,x.y-h)<b&&f++;Math.hypot(m-s.x,h-s.y)<=p&&f/a<.01&&(c={x:m,y:h})}let l=[];for(let m of n){let h={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let p of m.rows)for(let f of p.pts){let b=Math.hypot(f.x-c.x,f.y-c.y),y=Math.min($-1,Math.floor(ms(c,f)/(360/$)));h.samples.push({r:b,bin:y,levelM:p.levelM}),b<h.rMin&&(h.rMin=b),b>h.rMax&&(h.rMax=b)}h.samples.length&&l.push(h)}if(!l.length)return null;l.sort((m,h)=>m.rMin+m.rMax-(h.rMin+h.rMax));let u=[];for(let m of l){let h=!1;for(let p of u){let f=Math.min(m.rMax,p.rMax)-Math.max(m.rMin,p.rMin),b=Math.min(m.rMax-m.rMin,p.rMax-p.rMin);if(b>1e-9&&f>=ds*b){p.members.push(m),p.rMin=Math.min(p.rMin,m.rMin),p.rMax=Math.max(p.rMax,m.rMax),h=!0;break}}h||u.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let d=[];for(let m of u){let h=new Array($).fill(null);for(let v of m.members)for(let w of v.samples){let P=h[w.bin];P||(P={samples:[]},h[w.bin]=P),P.samples.push({r:w.r,levelM:w.levelM})}let p=h.map(v=>!!v);if(!p.filter(Boolean).length)continue;let b=[],y=[];for(let v of h){if(!v)continue;let w=1/0,P=-1/0;for(let T of v.samples)T.r<w&&(w=T.r),T.r>P&&(P=T.r);b.push(w),y.push(P)}let g=Kt(b),x=Kt(y);if(!(g>=gr*x)||!(x>0))continue;let S=[...b].sort((v,w)=>v-w);if(!(S[Math.floor(S.length*.1)]>=gr*x))continue;let M=h.map(v=>{if(!v)return null;let w=[...v.samples].sort((D,B)=>D.r-B.r),P=w[0].r,T=w[w.length-1].r,L=w[0].levelM,E=-1/0;for(let D of w)D.levelM>E&&(E=D.levelM);let R=[];for(let D of w){let B={r:D.r,l:D.levelM};for(;R.length&&Math.abs(R[R.length-1].r-B.r)<1e-9;){if(R[R.length-1].l<=B.l){B.skip=!0;break}R.pop()}if(!B.skip){for(;R.length>=2;){let j=R[R.length-2],G=R[R.length-1];if((G.r-j.r)*(B.l-j.l)-(G.l-j.l)*(B.r-j.r)<=0)R.pop();else break}R.push(B)}}let z=R.map(D=>D.r),I=R.map(D=>D.l);return{inner:P,outer:T,front:L,top:E,profile:{rs:z,ls:I}}}),k=p.slice();for(let v=0;v<$;v++){if(k[v])continue;let w=-1,P=-1,T=0;for(let F=1;F<=$;F++){let X=(v-F+$*2)%$;if(k[X]){w=X;break}}for(let F=1;F<=$;F++){let X=(v+F)%$;if(k[X]){P=X,T=F;break}}if(w<0||P<0)continue;let L=0;for(let F=1;F<=$;F++){let X=(v-F+$*2)%$;if(p[X]){L=F;break}}if(L-1+T>cs)continue;let R=M[w],z=M[P],I=L/(L+T),D=R.inner+(z.inner-R.inner)*I,B=R.outer+(z.outer-R.outer)*I,j=R.front+(z.front-R.front)*I,G=R.top+(z.top-R.top)*I;M[v]={inner:D,outer:B,front:j,top:G,profile:{rs:[D,B],ls:[j,G]}}}for(let v=0;v<$;v++)M[v]&&(k[v]=!0);let O=360/$,V=[],U=k.filter(Boolean).length,N=[];if(U===$)N.push({start:0,len:$});else{let v=0;for(;k[v];)v=(v+1)%$;let w=-1;for(let P=0;P<=$;P++){let T=(v+P)%$,L=P<$&&k[T];if(L&&w<0)w=T;else if(!L&&w>=0){let E=(T-w+$)%$||$;N.push({start:w,len:E}),w=-1}}}for(let v of N){if(v.len*O<ls&&v.len<$)continue;let w=v.len===$,P=new Float64Array(v.len),T=new Float64Array(v.len),L=new Float64Array(v.len),E=new Float64Array(v.len),R=[];for(let F=0;F<v.len;F++){let X=M[(v.start+F)%$];P[F]=X.inner,T[F]=X.outer,L[F]=X.front,E[F]=X.top,R.push(X.profile??{rs:[X.inner,X.outer],ls:[X.front,X.top]})}let z=Qt(P,w),I=Qt(T,w),D=Qt(L,w),B=Qt(E,w);for(let F=0;F<v.len;F++)z[F]>P[F]&&(z[F]=P[F]),I[F]<T[F]&&(I[F]=T[F]),z[F]>I[F]-1e-6&&(z[F]=Math.max(0,I[F]-1e-6)),B[F]<D[F]&&(B[F]=D[F]);let j={startBin:v.start,binCount:v.len,closed:w,innerR:z,outerR:I,frontLevelM:D,topLevelM:B,profiles:R},G=(F,X,K)=>{let J=R[F],Z=J.rs,q=J.ls;if(X<=Z[0]){q[0]>K&&(q[0]=K);return}if(X>=Z[Z.length-1]){q[q.length-1]>K&&(q[q.length-1]=K);return}for(let ne=0;ne+1<Z.length;ne++)if(X<=Z[ne+1]){q[ne]>K&&(q[ne]=K),q[ne+1]>K&&(q[ne+1]=K);return}};for(let F=0;F<v.len;F++){let X=h[(v.start+F)%$];if(X)for(let K of X.samples){G(F,K.r,K.levelM);let J=w?(F-1+v.len)%v.len:F-1,Z=w?(F+1)%v.len:F+1;J>=0&&G(J,K.r,K.levelM),Z<v.len&&G(Z,K.r,K.levelM)}}V.push(j)}V.reduce((v,w)=>v+w.binCount*O,0)<us||d.push({arcs:V,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:g,outerRMedian:x})}if(!d.length)return null;if(d.sort((m,h)=>m.innerRMedian-h.innerRMedian),t){let m=d[d.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:$,binStepDeg:360/$,rings:d}}function vr(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,l=u=>{let d=t.profiles[u],m=d.rs,h=d.ls;if(r<=m[0])return h[0];if(r>=m[m.length-1])return h[h.length-1];for(let p=0;p+1<m.length;p++)if(r<=m[p+1]){let f=m[p+1]-m[p],b=f>1e-9?(r-m[p])/f:0;return h[p]+(h[p+1]-h[p])*b}return h[h.length-1]};return l(a)*(1-c)+l(s)*c}var hs=.25,ps=1.2,fs=.6,bs=.45,ys=2.3,gs=Math.PI/180;function Ze(e,t,n){let r=n*gs;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function xs(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){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-t.centre.x,s.y-t.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var vs=24;function Ms(e,t,n,r,o,i,a,s){let c=n.binCount,l=vs,u=Ae,d=i+.02,m=[];for(let A=0;A<c;A++){let v=(n.startBin+A+.5)*t.binStepDeg,w=new Float64Array(l+1);for(let P=0;P<=l;P++){let T=r[A]+(o[A]-r[A])*P/l;w[P]=Math.max(d,vr(t,n,v,T)-hs)}m.push(w)}let h=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],p=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],f=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],b=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(A,v)=>{let w=(n.startBin+A+.5)*t.binStepDeg,P=r[A]+(o[A]-r[A])*v/l,T=Ze(t.centre,P,w);return[T.x*u,m[A][v],T.y*u]};{let A=Math.tan(12*Math.PI/180);for(let v=0;v<6;v++){let w=!1;for(let T=0;T<c;T++)for(let L=l-1;L>=0;L--)m[T][L]>m[T][L+1]&&(m[T][L]=m[T][L+1],w=!0);let P=n.closed?c:c-1;for(let T=0;T<P;T++){let L=(T+1)%c;for(let E=0;E<=l;E++){let R=m[L][E]-m[T][E];if(Math.abs(R)>1)continue;let z=r[T]+(o[T]-r[T])*E/l,I=r[L]+(o[L]-r[L])*E/l,D=Ze(t.centre,z,(n.startBin+T+.5)*t.binStepDeg),B=Ze(t.centre,I,(n.startBin+L+.5)*t.binStepDeg),j=A*Math.hypot(B.x-D.x,B.y-D.y)*u;R>j?(m[L][E]=m[T][E]+j,w=!0):-R>j&&(m[T][E]=m[L][E]+j,w=!0)}}if(!w)break}}let g=1,x=(A,v)=>{for(let w=0;w<=l;w+=4)if(Math.abs(m[A][w]-m[v][w])>g)return!0;return Math.abs(m[A][l]-m[v][l])>g},S=Math.tan(38*Math.PI/180),C=A=>(o[A]-r[A])/l*u,M=(A,v)=>m[A][v+1]-m[A][v]>S*Math.max(1e-6,C(A)),k=(A,v)=>{let w=n.closed?(A-1+c)%c:Math.max(0,A-1),P=n.closed?(A+1)%c:Math.min(c-1,A+1);Math.abs(m[w][v]-m[A][v])>g&&(w=A),Math.abs(m[P][v]-m[A][v])>g&&(P=A);let T=Math.max(0,v-1),L=Math.min(l,v+1);T<v&&M(A,T)&&(T=v),L>v&&M(A,v)&&(L=v);let E=y(w,v),R=y(P,v),z=y(A,T),I=y(A,L),D=R[0]-E[0],B=R[1]-E[1],j=R[2]-E[2],G=I[0]-z[0],F=I[1]-z[1],X=I[2]-z[2],K=B*X-j*F,J=j*G-D*X,Z=D*F-B*G,q=Math.hypot(K,J,Z);return q>1e-12?(K/=q,J/=q,Z/=q,J<0&&(K=-K,J=-J,Z=-Z),[K,J,Z]):[0,1,0]},O=(A,v)=>{let w=[A[0],i,A[2]],P=[v[0],i,v[2]],T=v[0]-A[0],L=v[2]-A[2],E=Math.hypot(T,L);if(!(E>1e-12))return;let R=[L/E,0,-T/E];e.tri(A,v,P,R,f,f,b),e.tri(A,P,w,R,f,b,b)},V=.05*Ne,U=A=>o[A]-r[A]<V,N=n.closed?c:c-1;for(let A=0;A<N;A++){let v=(A+1)%c;if(U(A)||U(v))continue;if(x(A,v)){let R=(n.startBin+A+1)*t.binStepDeg,z=(F,X)=>{let K=(r[A]+r[v])/2,J=(o[A]+o[v])/2,Z=K+(J-K)*X/l,q=Ze(t.centre,Z,R);return[q.x*u,m[F][X],q.y*u]};for(let F=0;F<l;F++){let X=y(A,F),K=y(A,F+1),J=z(A,F),Z=z(A,F+1),q=k(A,F),ne=k(A,F+1);e.triN(X,J,Z,q,q,ne,h),e.triN(X,Z,K,q,ne,ne,h);let je=y(v,F),Ye=y(v,F+1),ve=z(v,F),Fe=z(v,F+1),De=k(v,F),Me=k(v,F+1);e.triN(ve,je,Ye,De,De,Me,h),e.triN(ve,Ye,Fe,De,Me,Me,h);let be=z(A,F),ce=z(A,F+1),Je=z(v,F+1),Se=z(v,F),et=ce[0]-be[0],we=ce[2]-be[2],_e=Math.hypot(et,we);if(_e>1e-12){let It=[we/_e,0,-et/_e];e.tri(be,ce,Je,It,f),e.tri(be,Je,Se,It,f)}}let I=y(A,0),D=y(v,0),B=y(v,l),j=y(A,l),G=F=>[F[0],i,F[2]];e.tri(G(I),G(B),G(D),[0,-1,0],p),e.tri(G(I),G(j),G(B),[0,-1,0],p),O(I,D),O(j,B);continue}for(let R=0;R<l;R++){let z=k(A,R),I=k(v,R),D=k(v,R+1),B=k(A,R+1);if(M(A,R)||M(v,R)){let K=(ce,Je)=>{let Se=(n.startBin+ce+.5)*t.binStepDeg,et=r[ce]+(o[ce]-r[ce])*(R+.5)/l,we=Ze(t.centre,et,Se);return[we.x*u,Je,we.y*u]},J=y(A,R),Z=y(v,R),q=K(A,m[A][R]),ne=K(v,m[v][R]);e.triN(J,Z,ne,z,I,I,h),e.triN(J,ne,q,z,I,z,h);let je=y(v,R+1),Ye=y(A,R+1),ve=K(A,m[A][R+1]),Fe=K(v,m[v][R+1]);e.triN(ve,Fe,je,B,D,D,h),e.triN(ve,je,Ye,B,D,B,h);let De=ne[0]-q[0],Me=ne[2]-q[2],be=Math.hypot(De,Me);if(be>1e-12){let ce=[-Me/be,0,De/be];e.tri(q,ne,Fe,ce,f),e.tri(q,Fe,ve,ce,f)}continue}let j=y(A,R),G=y(v,R),F=y(v,R+1),X=y(A,R+1);e.triN(j,G,F,z,I,D,h),e.triN(j,F,X,z,D,B,h)}let w=y(A,0),P=y(v,0),T=y(v,l),L=y(A,l),E=R=>[R[0],i,R[2]];e.tri(E(w),E(T),E(P),[0,-1,0],p),e.tri(E(w),E(L),E(T),[0,-1,0],p),O(w,P),O(L,T)}if(!n.closed)for(let A of[0,c-1])for(let v=0;v<l;v++)O(y(A,v),y(A,v+1))}function Mr(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let d of u.arcs){let m=new Float64Array(d.binCount),h=new Float64Array(d.binCount);for(let f=0;f<d.binCount;f++){let b=(d.startBin+f)%t.binCount,y=Math.max(0,d.innerR[f]-ge);m[f]=Math.max(y,a[b]+.001),h[f]=Math.max(m[f]+.001,d.outerR[f]+ge)}let p=0;for(let f=0;f<d.binCount;f++){let b=d.topLevelM[f]-r;b>p&&(p=b)}p>=ps&&Ms(e,t,d,m,h,r,o,i);for(let f=0;f<d.binCount;f++){let b=(d.startBin+f)%t.binCount;h[f]>a[b]&&(a[b]=h[f])}}if(xs(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=fs*Ne,l=bs*Ne;for(let u of s.arcs){let d=[],m=[];for(let f=0;f<u.binCount;f++){let b=(u.startBin+f+.5)*t.binStepDeg,y=u.outerR[f]+ge+c;d.push(Ze(t.centre,y,b)),m.push(Ze(t.centre,y+l,b))}let h=-1/0;for(let f=0;f<u.binCount;f++)u.topLevelM[f]>h&&(h=u.topLevelM[f]);let p=()=>h+ys;u.closed?se(e,m,[d.slice().reverse()],p,r,o.shellTop,o.shellWall,i):se(e,[...m,...d.slice().reverse()],void 0,p,r,o.shellTop,o.shellWall,i)}}function Sr(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=ke(r,s.tierTop);if(!o)return;let u=b=>o.deckAt(b.x,b.y),d=nr(t,a),m=d[0]??t.outline;if(o.rowLevels.length>=2){let b=Yt(o.rowLevels),y=or(qo(o.rowLevels,n.focal,b),d),g=()=>[0,1,0];for(let S of y){let C=Math.max(c,S.topY-.02);for(let M of i.subtract(S.outline,C))se(e,M,S.holes,()=>C,c,l,s.tierWall,ae,void 0,g)}y.length||se(e,m,t.holes,()=>o.landingY,c,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 S of d.length?d:[m])$o(e,o.rowLevels,n.focal,o.landingY,x,S,b);return}let h=o.flat?1/0:rr,p=b=>o.normalAt(b.x,b.y),f=o.flat?o.landingY:void 0;for(let b of i.subtract(m,f))se(e,b,t.holes,u,c,l,s.tierWall,ae,h,p)}function Ss(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a],u=o.get(s);u||(u=new Map,o.set(s,u));let d=l.rowId||`__seat-${a}`,m=u.get(d);m||(m={pts:[],levelM:0,n:0},u.set(d,m)),m.pts.push({x:l.x,y:l.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function wr(e,t,n,r,o){let i=Ss(t,n,r);if(!i.length)return;let a=xr(i,t.focal);a&&(e.setMaterial(0),Mr(e,a,{bottomY:t.baseHeightM,colors:{bandTop:ye(o.tierTop,.8),bandWall:o.tierWall,shellTop:ye(o.tierWall,1.15),shellWall:o.tierWall},ao:ae,shapes:t.objects.filter(s=>s.type==="shape")}))}function Pr(e,t,n){return n<0?t>1?e.filter(r=>r.kind==="floor"):[...e]:e.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function Cr(e,t){let n=[...e].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(t-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var ws=1.15,Ps=3.25,Cs=4.5,As=.85,Rs=.5,Is=.26;function Ar(e,t,n){let r=Math.max(1e-6,t),o=e/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=ws&&a.add("zone"),o<=(i?Ps:Cs)&&(a.add("section"),a.add("ga")),o<=As&&(a.add("annotation"),a.add("booth")),o<=Rs&&a.add("row"),o<=Is&&a.add("seat"),a}function Ve(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],l=o[1]*i+o[5]*a+o[9]*s+o[13],u=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 m=c/d,h=l/d,p=u/d,f=m>=-1.05&&m<=1.05&&h>=-1.05&&h<=1.05&&p<=1;return{x:(m*.5+.5)*n,y:(1-(h*.5+.5))*r,depth:p,visible:f}}function Rr(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if(Gn(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var Es=6;function Gn(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+Es):n;return o<a&&i<r}function Ir(e,t,n){return e.length*t*.58+(n?14:0)}var Vn={row:8,seat:14};function Er(e,t,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-r/2)/o);return t*(1+1.5*i)}function zn(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let l of o)if(Gn(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(Gn(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var Ts=6,ks=2.2,Tr=.1,Ls=.3,Fs=1.8,Ds=.9,_s=.55,Os=6e3;function kr(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let u of n)for(let d of u.objects)d.type==="section"&&d.zone&&c.set(d.id,d.zone);let l=new Map;for(let u=0;u<r.length;u++){let d=r[u],m=o.seatOwner[u],h=d.zoneId??(m?c.get(m):void 0);if(!h)continue;let p=l.get(h);p||(p={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(h,p)),p.n++,d.x<p.minX&&(p.minX=d.x),d.y<p.minY&&(p.minY=d.y),d.x>p.maxX&&(p.maxX=d.x),d.y>p.maxY&&(p.maxY=d.y),p.sumY+=o.seatDeckY(u)}for(let u of a){let d=l.get(u.id),m=[];for(let[h,p]of c)p===u.id&&m.push(h);if(!d||d.n===0){s.push({id:u.id,label:u.label,color:te(u.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*_,1.5,(u.focalPoint??i).y*_]});continue}s.push({id:u.id,label:u.label,color:te(u.color),sectionIds:m,seatCount:d.n,center:[(d.minX+d.maxX)/2*_,d.sumY/d.n,(d.minY+d.maxY)/2*_],radius:.5*Math.hypot((d.maxX-d.minX)*_,(d.maxY-d.minY)*_)||1,focalWorld:[(u.focalPoint??i).x*_,1.5,(u.focalPoint??i).y*_]})}}return s}function Lr(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],d=[];for(let m of s)m.seatCount!==0&&l.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+Ts,m.center[2]],color:t.zones?.find(h=>h.id===m.id)?.color});{let m=new Map,h=new Map;for(let p=0;p<r.length;p++){let f=o.seatOwner[p];if(!f)continue;let b=m.get(f);b||(b={n:0,x:0,y:0,deck:0},m.set(f,b)),b.n++,b.x+=r[p].x,b.y+=r[p].y,b.deck+=o.seatDeckY(p);let y=h.get(f);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(f,y)),r[p].x<y.minX&&(y.minX=r[p].x),r[p].x>y.maxX&&(y.maxX=r[p].x),r[p].y<y.minY&&(y.minY=r[p].y),r[p].y>y.maxY&&(y.maxY=r[p].y)}for(let p of n)for(let f of p.objects){if(f.type!=="section")continue;let b=m.get(f.id);if(!b||b.n===0)continue;let y=h.get(f.id),g=[b.x/b.n*_,b.deck/b.n,b.y/b.n*_],x=f.displayLabel||f.label||f.id;u.push({id:f.id,floorIndex:p.index,label:x,seatCount:b.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*_),focalWorld:[p.focal.x*_,p.baseHeightM+1.5,p.focal.y*_]});let S=t.floors?.[p.index]?.name?.trim().toLocaleLowerCase();n.length>1&&S===x.trim().toLocaleLowerCase()||l.push({id:`section:${f.id}`,kind:"section",text:x,anchor:[g[0],g[1]+ks,g[2]],floorIndex:p.index})}}{for(let p of n)for(let f of p.objects){if(f.type!=="gaArea")continue;let b=gt(f.points);if(!b)continue;let y=f.displayLabel||f.label||f.id;l.push({id:`ga:${f.id}`,kind:"ga",text:f.capacity>0?`${y} \xB7 ${f.capacity.toLocaleString()}`:y,anchor:[b.x*_,p.baseHeightM+Fs,b.y*_],floorIndex:p.index})}let m=new Map;for(let p=0;p<r.length;p++){let f=r[p],b=Math.hypot(f.x-c.x,f.y-c.y),y=m.get(f.rowId);(!y||b>y.far)&&m.set(f.rowId,{seat:f,index:p,far:b})}for(let[p,f]of m){let b=f.seat.label?f.seat.label.lastIndexOf("-"):-1,y=b>0?f.seat.label.slice(0,b):p;y&&l.push({id:`row:${p}`,kind:"row",text:y,anchor:[f.seat.x*_,o.seatDeckY(f.index)+Ds,f.seat.y*_],floorIndex:a[f.index]})}let h=new Map;for(let p=0;p<r.length;p++){let f=r[p],b=f.label?f.label.lastIndexOf("-"):-1,y=h.get(f.rowId);y||(y={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:b>0?f.label.slice(0,b):f.rowId,sectionId:f.sectionId},h.set(f.rowId,y));let g=p*3,x=i.iPosition[g],S=i.iPosition[g+1],C=i.iPosition[g+2];y.n++,y.x+=x,y.y+=S,y.z+=C,y.minX=Math.min(y.minX,x),y.maxX=Math.max(y.maxX,x),y.minZ=Math.min(y.minZ,C),y.maxZ=Math.max(y.maxZ,C)}for(let[p,f]of h)d.push({id:p,label:f.label,sectionId:f.sectionId,seatCount:f.n,center:[f.x/f.n,f.y/f.n,f.z/f.n],radius:Math.max(.8,Math.hypot(f.maxX-f.minX,f.maxZ-f.minZ)*.5)});if(r.length<=Os)for(let p=0;p<r.length;p++){let f=r[p],b=f.displayLabel||f.label;b&&l.push({id:`seat:${f.id}`,kind:"seat",text:b,anchor:[f.x*_,o.seatDeckY(p)+_s,f.y*_],floorIndex:a[p]})}}for(let m of n)for(let h of m.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let p=wt(h),f=p?gt(p):null;if(!f||!h.label)continue;l.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[f.x*_,m.baseHeightM+Pt(h).heightM+Tr,f.y*_],color:h.fill,floorIndex:m.index})}else if(h.type==="text"){if(!h.text)continue;l.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*_,m.baseHeightM+Tr,h.position.y*_],color:h.color,rotation:h.rotation,floorIndex:m.index})}else if(h.type==="booth"){let p=At(h);if(!p)continue;let f=gt(p);if(!f)continue;l.push({id:`booth:${h.id}`,kind:"booth",text:h.displayLabel||h.label||h.id,anchor:[f.x*_,m.baseHeightM+On+Ls,f.y*_],floorIndex:m.index})}return{labels:l,sections:u,rows:d}}function Fr(e,t){if(t.length>1)for(let n of t)e.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 Dr(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let h=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),p=m*3,f=l[h];f.minX=Math.min(f.minX,i.position[p]),f.minY=Math.min(f.minY,i.position[p+1]),f.minZ=Math.min(f.minZ,i.position[p+2]),f.maxX=Math.max(f.maxX,i.position[p]),f.maxY=Math.max(f.maxY,i.position[p+1]),f.maxZ=Math.max(f.maxZ,i.position[p+2])}let u=new Map;for(let m=0;m<n.length;m++)for(let h of n[m].objects)h.type==="section"&&u.set(h.id,m);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 m=0;m<r.length;m++){let h=o.seatOwner[m],p=(h!==null?u.get(h):void 0)??a[m];if(p===void 0)continue;let f=d[p],b=r[m];f.n++,b.x<f.minX&&(f.minX=b.x),b.y<f.minY&&(f.minY=b.y),b.x>f.maxX&&(f.maxX=b.x),b.y>f.maxY&&(f.maxY=b.y);let y=o.seatDeckY(m);f.sumX+=b.x*_,f.sumDeck+=y,f.sumZ+=b.y*_,f.minDeck=Math.min(f.minDeck,y),f.maxDeck=Math.max(f.maxDeck,y+1.6),s[m]=p}for(let m=0;m<n.length;m++){let h=d[m],p=t.floors?.[m],f=l[m],b=Math.min(h.n?h.minX*_:n[m].focal.x*_-1,Number.isFinite(f.minX)?f.minX:1/0),y=Math.max(h.n?h.maxX*_:n[m].focal.x*_+1,Number.isFinite(f.maxX)?f.maxX:-1/0),g=Math.min(h.n?h.minY*_:n[m].focal.y*_-1,Number.isFinite(f.minZ)?f.minZ:1/0),x=Math.max(h.n?h.maxY*_:n[m].focal.y*_+1,Number.isFinite(f.maxZ)?f.maxZ:-1/0),S=Math.min(h.n?Math.min(n[m].baseHeightM,h.minDeck):n[m].baseHeightM,Number.isFinite(f.minY)?f.minY:1/0),C=Math.max(h.n?Math.max(h.maxDeck,S+.5):S+.5,Number.isFinite(f.maxY)?f.maxY:-1/0),M=[h.n?h.sumX/h.n:(b+y)/2,h.n?h.sumDeck/h.n:(S+C)/2,h.n?h.sumZ/h.n:(g+x)/2],k=Math.max(1,.5*Math.hypot(y-b,C-S,x-g));c.push({index:m,id:p?.id??`floor-${m}`,label:p?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:M,radius:k,box:{min:[b,S,g],max:[y,C,x]},focalWorld:[n[m].focal.x*_,n[m].baseHeightM+1.5,n[m].focal.y*_]})}}return c}function Hn(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)a(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)a(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)a(l.x,l.y);else if(c.type==="booth"){let l=At(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=Bn(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=Nn(c);if(l)for(let u of l)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function _r(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=St(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);se(e,s,void 0,()=>0,-.4,i.ground,i.ground,ae)}else{let a=t.reduce((h,p)=>p.baseHeightM<h.baseHeightM?p:h);e.setFloor(a.index);let s=n.filter((h,p)=>r[p]===a.index),c=Hn([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,l*.04)),d=St(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),m=a.baseHeightM-.03;se(e,d,void 0,()=>m,m-.22,i.ground,i.ground,ae)}}function Or(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,d=-1/0,m=(f,b,y)=>{a=Math.min(a,f),l=Math.max(l,f),s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,y),d=Math.max(d,y)};for(let f=0;f<e.position.length;f+=3)m(e.position[f],e.position[f+1],e.position[f+2]);for(let f=0;f<t.count;f++){let b=f*3,y=t.iPosition[b],g=t.iPosition[b+1],x=t.iPosition[b+2],S=Math.max(.35,t.iMaxRadius[f]??.35);m(y-S,g,x-S),m(y+S,g+1.6,x+S)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,d=o+i);let h=[(a+l)/2,(s+u)/2,(c+d)/2],p=Math.max(1,.5*Math.hypot(l-a,u-s,d-c));return{center:h,radius:p,minY:s,maxY:u}}function Br(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let S=0;S<e.count;S++){let C=S*3,M=e.iPosition[C],k=e.iPosition[C+2];M<a&&(a=M),M>c&&(c=M),k<s&&(s=k),k>l&&(l=k)}for(let S of t)a=Math.min(a,S.cx-S.halfX),c=Math.max(c,S.cx+S.halfX),s=Math.min(s,S.cz-S.halfZ),l=Math.max(l,S.cz+S.halfZ);let u=n.minX*_,d=n.maxX*_,m=n.minY*_,h=n.maxY*_,p=u,f=d,b=m,y=h;if(Number.isFinite(a)){let S=Math.max(2,.06*Math.hypot(c-a,l-s));p=Math.max(u,a-S),f=Math.min(d,c+S),b=Math.max(m,s-S),y=Math.min(h,l+S)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[p,g,b],max:[f,x,y]}}function lt(e){let{doc:t}=e,n=Fo(t.theme),r=n.structure,o=tr(t,e.eventConfigurationId??t.eventConfigurationId),i=e.seats,a=new Vt,s=new Map;for(let v of o)for(let w of v.objects)s.set(w.id,v.index),w.type==="section"&&s.set(w.logicalSectionId??w.id,v.index);let c=i.map(v=>s.get(v.sectionId??"")??s.get(v.rowId??"")??0),l=Hn(o,i);_r(a,o,i,c,l,r);let u=ar(t,i),d=new Map,m=new Map;for(let v of t.categories??[])d.set(v.key,v.color),v.seatGlyph&&m.set(v.key,v.seatGlyph);let h=[],p=ir(o,i,c),f=new Float32Array(i.length);for(let v=0;v<o.length;v++){let w=o[v];a.setFloor(v);let P=new Wt,T=[],L=w.objects.filter(E=>E.type==="section"&&!!E.outline&&E.outline.length>=3);for(let E of w.objects)E.type==="section"?Sr(a,E,w,sr(E,u),p.bySection.get(E.id),P,L,r):E.type==="shape"?(a.setMaterial(E.role==="screen"?1:0),fr(a,E,w.baseHeightM,ur(E,T),r,w.focal,h),a.setMaterial(0)):E.type==="gaArea"?yr(a,E,w.baseHeightM,te(d.get(E.categoryKey)),r):E.type==="booth"?hr(a,E,w.baseHeightM,te(d.get(E.categoryKey)),r):E.type==="table"?pr(a,E,w.baseHeightM,te(d.get(E.categoryKey)),r):E.type==="decorImage"&&br(a,E,w.baseHeightM,r);wr(a,w,i,p,r)}let b=o.length>1?{x:o.reduce((v,w)=>v+w.focal.x,0)/o.length,y:o.reduce((v,w)=>v+w.focal.y,0)/o.length}:t.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},y=Ro([a.build()]),g=Lo(i,e.initialState,p,f,d,m),x=kr({doc:t,units:o,seats:i,surfaces:p,focal:b}),{labels:S,sections:C,rows:M}=Lr({doc:t,units:o,seats:i,surfaces:p,seatData:g,hintedSeatFloor:c,zones:x,focal:b}),k=Dr({doc:t,units:o,seats:i,surfaces:p,solids:y,hintedSeatFloor:c,seatFloor:f});Fr(S,k),g.iYaw=To(g.iPosition,i.length,v=>i[v].rowId,v=>{let w=o[f[v]]?.focal??b;return[w.x*_,w.y*_]});let O=(l.minX+l.maxX)/2*_,V=(l.minY+l.maxY)/2*_,U=.5*Math.hypot((l.maxX-l.minX)*_,(l.maxY-l.minY)*_)||10,N=Or(y,g,{cx:O,cz:V,radius:U}),A=Br(g,h,l,N.minY,N.maxY,U);return{solids:y,seats:g,bounds:{center:[(A.min[0]+A.max[0])/2,(A.min[1]+A.max[1])/2,(A.min[2]+A.max[2])/2],radius:U,groundY:0,box:A},renderBounds:{center:N.center,radius:N.radius},stateColorLUT:Do(n,xe),theme:n,seatCount:i.length,focalWorld:[b.x*_,1.5,b.y*_],zones:x,stages:h,sections:C,rows:M,labels:S,floors:k}}var Bs=88,Ns=20,Nr={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}},qt=new Set(["row","seat"]),Gr={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Zt={row:{x:62,y:16},seat:{x:46,y:18}},zr=te,Un=e=>oo(e);function Hr(e,t){let n=Un(e),r=Un(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Vr(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*r+t[o-1]*(1-r))}function Gs(e,t=[.04,.06,.1]){let n=Un(t)<.42,r=n?"#f4f7fb":"#0b1220",o=zr(e),i=o&&Hr(o,t)>=4.5?e: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 $t=class{constructor(t,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),t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;let s=Ar(o,i,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let g of this.labels){if(!s.has(g.kind))continue;let x=Ve(t,g.anchor,n,r);if(!x.visible)continue;let S=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:x,focus:Er(x,S,n,r),halfWidth:Ir(g.text,Nr[g.kind].size,!qt.has(g.kind))/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let l=Cr(c.filter(g=>g.label.kind==="floor"),n),u=[...c.filter(g=>!qt.has(g.label.kind)&&g.label.kind!=="floor"),...l],d=Rr(u,Bs,Ns),m=zn(c.filter(g=>g.label.kind==="row"),Zt.row.x,Zt.row.y,Vn.row,d),h=zn(c.filter(g=>g.label.kind==="seat"),Zt.seat.x,Zt.seat.y,Vn.seat,[...d,...m]),p=[...d,...m,...h],f=new Set(p.map(g=>g.label.id));for(let{label:g,screen:x}of p){let C=this.nodeFor(g).style;C.display="",C.transform=`translate(-50%, -50%) translate(${x.x.toFixed(1)}px, ${x.y.toFixed(1)}px)`}let b=p.filter(({label:g})=>!qt.has(g.kind)).sort((g,x)=>Gr[x.label.kind]-Gr[g.label.kind]||g.screen.depth-x.screen.depth||g.focus-x.focus),y=[];for(let{label:g}of b){let x=this.nodes.get(g.id);if(!x||x.style.display==="none")continue;let S=x.getBoundingClientRect();y.some(M=>S.left<M.right+3&&S.right+3>M.left&&S.top<M.bottom+3&&S.bottom+3>M.top)?x.style.display="none":y.push(S)}for(let[g,x]of this.nodes)f.has(g)||(x.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let d=n.style;d.position="absolute",d.left="0",d.top="0",d.whiteSpace="nowrap",d.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",d.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=Nr[t.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=Gs(t.color??this.opts.ink,this.opts.backgroundRgb),s=!qt.has(t.kind);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=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],l=zr(r?"#ecf8ff":a.ink)??[1,1,1],u=r?Vr("rgba(10,28,45,.9)",c):s?Vr(a.backing,c):c;return n.dataset.qualityContrast=Hr(l,u).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var jr=1;var Vs=new Set(["floor","zone","section","ga","booth","annotation"]);function zs(e){return e.every(t=>Number.isFinite(t))}function Hs(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Ur(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function $e(e){return Math.round(e*1e4)/1e4}function Us(e){if(e)return{box:{x:$e(e.box.x),y:$e(e.box.y),width:$e(e.box.width),height:$e(e.box.height)},horizontalFillRatio:$e(e.horizontalFillRatio),verticalFillRatio:$e(e.verticalFillRatio),visibleAreaRatio:$e(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Re(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function Jt(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Vs.has(s.kind)),r=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,o=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)Hs(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[Re("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Re("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Re("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Re("viewport-empty","The 3D viewport must have visible dimensions",e.viewport.width>1&&e.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${e.viewport.width}\xD7${e.viewport.height}`}]),Re("camera-invalid","The capture camera must have a finite physical pose",zs(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Re("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!e.scene.authoredRelief||e.scene.renderedVerticalSpanM>.05&&e.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:e.scene.projectedReliefPx,minimum:2}]),Re("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Re("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Re("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Re("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:l})=>({id:s,kind:c,text:l})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:Us(e.framing)},metrics:{minimumHierarchyFontPx:Ur(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Ur(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var fe=require("ogl");var ze=require("ogl");var en=`
|
|
2
21
|
float chairWeight(float depth) {
|
|
3
22
|
return 1.0 - smoothstep(uChairFull, uChairNone, depth);
|
|
4
|
-
}`,
|
|
23
|
+
}`,Yr=`
|
|
5
24
|
float occupantWeight(float depth) {
|
|
6
|
-
float nearWeight = smoothstep(${
|
|
7
|
-
float farWeight = 1.0 - smoothstep(${
|
|
25
|
+
float nearWeight = smoothstep(${mo.toFixed(1)}, ${ho.toFixed(1)}, depth);
|
|
26
|
+
float farWeight = 1.0 - smoothstep(${lo.toFixed(1)}, ${uo.toFixed(1)}, depth);
|
|
8
27
|
return nearWeight * farWeight;
|
|
9
|
-
}`,
|
|
28
|
+
}`,Xr=`
|
|
10
29
|
float glyphEq(float glyph, float expected) {
|
|
11
30
|
return 1.0 - step(0.25, abs(glyph - expected));
|
|
12
31
|
}
|
|
@@ -55,7 +74,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
|
|
|
55
74
|
p.y += 0.16;
|
|
56
75
|
}
|
|
57
76
|
return p;
|
|
58
|
-
}`,
|
|
77
|
+
}`,js=`#version 300 es
|
|
59
78
|
precision highp float;
|
|
60
79
|
in vec3 position;
|
|
61
80
|
in vec3 normal;
|
|
@@ -91,7 +110,7 @@ void main() {
|
|
|
91
110
|
vNormalWorld = normalize(mat3(modelMatrix) * normal);
|
|
92
111
|
vColor = color;
|
|
93
112
|
gl_Position = projectionMatrix * mv;
|
|
94
|
-
}`,
|
|
113
|
+
}`,Ys=`#version 300 es
|
|
95
114
|
precision highp float;
|
|
96
115
|
in vec3 vColor;
|
|
97
116
|
in vec3 vNormalWorld;
|
|
@@ -158,7 +177,7 @@ void main() {
|
|
|
158
177
|
+ vec3(0.20, 0.10, 0.34) * focalHalo;
|
|
159
178
|
base = mix(base, display, poweredDisplay * verticalFace * 0.92);
|
|
160
179
|
fragColor = vec4(base, 1.0);
|
|
161
|
-
}`,
|
|
180
|
+
}`,Xs=`#version 300 es
|
|
162
181
|
precision highp float;
|
|
163
182
|
in vec2 position; // quad corner in [-1,1]
|
|
164
183
|
in vec3 iOffset; // per-instance world position
|
|
@@ -184,7 +203,7 @@ out float vDim;
|
|
|
184
203
|
out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
|
|
185
204
|
out float vPhysicalSeat;
|
|
186
205
|
out float vPixelRadius;
|
|
187
|
-
${
|
|
206
|
+
${en}
|
|
188
207
|
void main() {
|
|
189
208
|
vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
|
|
190
209
|
float depth = max(-mv.z, 0.001);
|
|
@@ -217,7 +236,7 @@ void main() {
|
|
|
217
236
|
vPhysicalSeat = iPhysicalSeat;
|
|
218
237
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
219
238
|
gl_Position = projectionMatrix * mv;
|
|
220
|
-
}`,
|
|
239
|
+
}`,Ws=`#version 300 es
|
|
221
240
|
precision highp float;
|
|
222
241
|
in vec2 vUv;
|
|
223
242
|
in vec3 vColor;
|
|
@@ -275,7 +294,7 @@ void main() {
|
|
|
275
294
|
alpha *= vDotWeight;
|
|
276
295
|
if (alpha <= 0.0) discard;
|
|
277
296
|
fragColor = vec4(c, alpha);
|
|
278
|
-
}`,
|
|
297
|
+
}`,Ks=`#version 300 es
|
|
279
298
|
precision highp float;
|
|
280
299
|
in vec3 position; // local: x/z in units of the seat radius, y in METRES
|
|
281
300
|
in vec3 normal;
|
|
@@ -306,9 +325,9 @@ out vec3 vRing;
|
|
|
306
325
|
out float vDim;
|
|
307
326
|
out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
|
|
308
327
|
out vec3 vOccupantTint;
|
|
309
|
-
${
|
|
310
|
-
${
|
|
311
|
-
${
|
|
328
|
+
${en}
|
|
329
|
+
${Yr}
|
|
330
|
+
${Xr}
|
|
312
331
|
void main() {
|
|
313
332
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
314
333
|
float viewDepth = -anchor.z;
|
|
@@ -394,7 +413,7 @@ void main() {
|
|
|
394
413
|
vRing = iRing;
|
|
395
414
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
396
415
|
gl_Position = projectionMatrix * mv;
|
|
397
|
-
}`,
|
|
416
|
+
}`,Qs=`#version 300 es
|
|
398
417
|
precision highp float;
|
|
399
418
|
in vec3 vColor;
|
|
400
419
|
in vec3 vNormalWorld;
|
|
@@ -449,14 +468,14 @@ void main() {
|
|
|
449
468
|
// which is what stops a block of them merging into one mass up close.
|
|
450
469
|
base += vec3(0.26, 0.31, 0.38) * fres * 0.55;
|
|
451
470
|
fragColor = vec4(base, 1.0);
|
|
452
|
-
}`,
|
|
471
|
+
}`,qs=`#version 300 es
|
|
453
472
|
precision highp float;
|
|
454
473
|
in vec2 position;
|
|
455
474
|
out vec2 vUv;
|
|
456
475
|
void main() {
|
|
457
476
|
vUv = position * 0.5 + 0.5;
|
|
458
477
|
gl_Position = vec4(position, 0.999, 1.0);
|
|
459
|
-
}`,
|
|
478
|
+
}`,Zs=`#version 300 es
|
|
460
479
|
precision highp float;
|
|
461
480
|
in vec2 vUv;
|
|
462
481
|
uniform vec3 uTop;
|
|
@@ -467,7 +486,7 @@ void main() {
|
|
|
467
486
|
vec2 c = vUv - 0.5;
|
|
468
487
|
float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
|
|
469
488
|
fragColor = vec4(col * vig, 1.0);
|
|
470
|
-
}
|
|
489
|
+
}`,$s=`#version 300 es
|
|
471
490
|
precision highp float;
|
|
472
491
|
in vec2 position;
|
|
473
492
|
in vec3 iOffset;
|
|
@@ -488,7 +507,7 @@ out float vPhysicalSeat;
|
|
|
488
507
|
out float vDotWeight;
|
|
489
508
|
out float vHidden;
|
|
490
509
|
flat out vec3 vPick;
|
|
491
|
-
${
|
|
510
|
+
${en}
|
|
492
511
|
void main() {
|
|
493
512
|
int id = gl_InstanceID + 1; // 0 reserved for no-hit
|
|
494
513
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -504,7 +523,7 @@ void main() {
|
|
|
504
523
|
vPhysicalSeat = iPhysicalSeat;
|
|
505
524
|
vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
506
525
|
gl_Position = projectionMatrix * mv;
|
|
507
|
-
}`,
|
|
526
|
+
}`,Js=`#version 300 es
|
|
508
527
|
precision highp float;
|
|
509
528
|
in vec2 vUv;
|
|
510
529
|
in float vPhysicalSeat;
|
|
@@ -518,7 +537,7 @@ void main() {
|
|
|
518
537
|
float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
|
|
519
538
|
if (d > 1.0) discard; // hit-mask matches chair/bay shape
|
|
520
539
|
fragColor = vec4(vPick, 1.0);
|
|
521
|
-
}`,
|
|
540
|
+
}`,ec=`#version 300 es
|
|
522
541
|
precision highp float;
|
|
523
542
|
in vec3 position;
|
|
524
543
|
in float part;
|
|
@@ -539,9 +558,9 @@ uniform float uBackBase;
|
|
|
539
558
|
uniform float uFocusFloor;
|
|
540
559
|
flat out vec3 vPick;
|
|
541
560
|
out float vHidden;
|
|
542
|
-
${
|
|
543
|
-
${
|
|
544
|
-
${
|
|
561
|
+
${en}
|
|
562
|
+
${Yr}
|
|
563
|
+
${Xr}
|
|
545
564
|
void main() {
|
|
546
565
|
int id = int(iPickIndex + 0.5); // already global index + 1
|
|
547
566
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -574,7 +593,7 @@ void main() {
|
|
|
574
593
|
float c = cos(iYaw), s = sin(iYaw);
|
|
575
594
|
vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
576
595
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
|
|
577
|
-
}`,
|
|
596
|
+
}`,tc=`#version 300 es
|
|
578
597
|
precision highp float;
|
|
579
598
|
flat in vec3 vPick;
|
|
580
599
|
in float vHidden;
|
|
@@ -582,7 +601,7 @@ out vec4 fragColor;
|
|
|
582
601
|
void main() {
|
|
583
602
|
if (vHidden > 0.5) discard;
|
|
584
603
|
fragColor = vec4(vPick, 1.0);
|
|
585
|
-
}`,
|
|
604
|
+
}`,nc=`#version 300 es
|
|
586
605
|
precision highp float;
|
|
587
606
|
in vec3 position;
|
|
588
607
|
in float floorIndex;
|
|
@@ -593,30 +612,11 @@ out float vHidden;
|
|
|
593
612
|
void main() {
|
|
594
613
|
vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
595
614
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
596
|
-
}`,
|
|
615
|
+
}`,oc=`#version 300 es
|
|
597
616
|
precision highp float;
|
|
598
617
|
in float vHidden;
|
|
599
618
|
out vec4 fragColor;
|
|
600
619
|
void main() {
|
|
601
620
|
if (vHidden > 0.5) discard;
|
|
602
621
|
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
603
|
-
}`;function zr(e){return new Ve.Program(e,{vertex:Hs,fragment:Us,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:ke},uSeatScale:{value:1},uMinPixels:{value:ot},uPixelToWorld:{value:.002},uChairFull:{value:bt},uChairNone:{value:rt},uFocusFloor:{value:-1}}})}function Hr(e){return new Ve.Program(e,{vertex:js,fragment:Ys,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:bt},uChairNone:{value:rt},uBackRake:{value:Pn},uBackBase:{value:zt},uFocusFloor:{value:-1}}})}function Ur(e){return new Ve.Program(e,{vertex:Xs,fragment:Ws,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function jr(e){return new Ve.Program(e,{vertex:Ds,fragment:_s,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function Yr(e){return new Ve.Program(e,{vertex:Os,fragment:Bs,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:ke},uSeatScale:{value:1},uMinPixels:{value:ot},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:bt},uChairNone:{value:rt}}})}function Xr(e){return new Ve.Program(e,{vertex:Ns,fragment:Gs,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:bt},uChairNone:{value:rt},uBackRake:{value:Pn},uBackBase:{value:zt},uFocusFloor:{value:-1}}})}function Wr(e,t,n){return new Ve.Program(e,{vertex:Vs,fragment:zs,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function Kr(e,t,n,r,o,i){for(let a=n;a<n+r;a++){let c=i&&t[a]===0?null:o[t[a]]??o[0];e[a*3]=c?c[0]:i[a*3],e[a*3+1]=c?c[1]:i[a*3+1],e[a*3+2]=c?c[2]:i[a*3+2]}}var Ks=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Qs=new Float32Array([-1,-1,3,-1,-1,3]);function Qr(e,t){let n=new pe.Transform,r=new pe.Transform,o=new pe.Geometry(e,{position:{size:2,data:Qs}}),i=Wr(e,t.theme.background.top,t.theme.background.bottom),a=new pe.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new pe.Geometry(e,{position:{size:3,data:t.solids.position},normal:{size:3,data:t.solids.normal},color:{size:3,data:t.solids.color},floorIndex:{size:1,data:t.solids.floor},materialIndex:{size:1,data:t.solids.material}}),c=jr(e),l=new pe.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let u=Yr(e),d=new Float32Array(t.seats.count*3),m=ge.map(R=>t.theme.seatStates[R]);Kr(d,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let h=new pe.Geometry(e,{position:{size:2,data:Ks},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:d,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),f=new pe.Mesh(e,{geometry:h,program:u});f.frustumCulled=!1,t.seats.count>0&&f.setParent(n);let p=h.attributes.iColor,b=wo(),y=Xr(e),g=Dt,x=new Float32Array(g*3),S=new Float32Array(g*3),C=new Float32Array(g),M=new Float32Array(g),k=new Float32Array(g),O=new Float32Array(g*3),V=new Float32Array(g),H=new Float32Array(g),N=new Float32Array(g),A=new Float32Array(g),v=new pe.Geometry(e,{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:S,instanced:1},iRadius:{size:1,data:C,instanced:1},iYaw:{size:1,data:M,instanced:1},iGlyph:{size:1,data:k,instanced:1},iRing:{size:3,data:O,instanced:1},iFloor:{size:1,data:V,instanced:1},iPhysicalSeat:{size:1,data:H,instanced:1},iSeed:{size:1,data:A,instanced:1},iPickIndex:{size:1,data:N,instanced:1}}),w=new pe.Mesh(e,{geometry:v,program:y});w.frustumCulled=!1;let P=0,T=new Int32Array(0),L=()=>{let R=t.seats;for(let z=0;z<P;z++){let I=T[z];A[z]=Co(R.iState[I],I);let B=R.iCategory&&R.iState[I]===0?null:m[R.iState[I]]??m[0];if(B)S[z*3]=B[0],S[z*3+1]=B[1],S[z*3+2]=B[2];else{let U=Jn([R.iCategory[I*3],R.iCategory[I*3+1],R.iCategory[I*3+2]]);S[z*3]=U[0],S[z*3+1]=U[1],S[z*3+2]=U[2]}}v.attributes.iColor.needsUpdate=!0,v.attributes.iSeed.needsUpdate=!0},E={main:n,background:r,seatProgram:u,solidProgram:c,chairProgram:y,seatGeometry:h,chairGeometry:v,solidGeometry:s,drawCalls:3,setNearSeats(R,z){let I=Math.min(z,g);if(T=R,P=I,I===0){w.parent&&w.setParent(null),v.instancedCount=0,E.drawCalls=3;return}let D=t.seats;for(let B=0;B<I;B++){let U=R[B];x[B*3]=D.iPosition[U*3],x[B*3+1]=D.iPosition[U*3+1],x[B*3+2]=D.iPosition[U*3+2],C[B]=D.iChairWidth[U],M[B]=D.iYaw[U],k[B]=D.iGlyph[U],O[B*3]=D.iRing[U*3],O[B*3+1]=D.iRing[U*3+1],O[B*3+2]=D.iRing[U*3+2],V[B]=D.iFloor[U],H[B]=D.iPhysicalSeat[U],N[B]=U+1}L(),v.attributes.iOffset.needsUpdate=!0,v.attributes.iRadius.needsUpdate=!0,v.attributes.iYaw.needsUpdate=!0,v.attributes.iGlyph.needsUpdate=!0,v.attributes.iRing.needsUpdate=!0,v.attributes.iFloor.needsUpdate=!0,v.attributes.iPhysicalSeat.needsUpdate=!0,v.attributes.iSeed.needsUpdate=!0,v.attributes.iPickIndex.needsUpdate=!0,v.instancedCount=I,w.parent||w.setParent(n),E.drawCalls=4},nearSeatCount(){return P},uploadSeatStateRuns(R){if(!R.length)return;P&&L();for(let I of R)Kr(d,t.seats.iState,I.start,I.length,m,t.seats.iCategory);let z=p.buffer;if(!z){p.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,z);for(let I of R){let D=d.subarray(I.start*3,(I.start+I.length)*3);e.bufferSubData(e.ARRAY_BUFFER,I.start*3*Float32Array.BYTES_PER_ELEMENT,D)}},dispose(){o.remove(),i.remove(),s.remove(),c.remove(),h.remove(),u.remove(),v.remove(),y.remove()}};return E}var Ce=require("ogl");function qs(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function qr(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let l=0;l<t;l++){let u=(c*t+l)*4,d=qs(e[u],e[u+1],e[u+2]);if(d<0||d>=i)continue;let m=l-r,h=c-o,f=m*m+h*h;f<s&&(s=f,a=d)}return a}function Zr(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,l))}}var Zs=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Jt=class{constructor(t,n,r,o,i){this.seatScene=new Ce.Transform;this.chairScene=new Ce.Transform;this.solidScene=new Ce.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=zr(this.gl),this.chairProg=Hr(this.gl),this.depthProg=Ur(this.gl);let a=new Ce.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Ce.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Ce.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of Zs)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new Ce.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-o),u=Math.max(0,r-o),d=Math.max(1,Math.min(s,n+o+1)-l),m=Math.max(1,Math.min(c,r+o+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(l,u,d,m);let[h,f,p]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(h,f,p,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(d*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,u,d,m,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),qr(b,d,m,n-l,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function $r(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,pt(r.state)):n.push(r);return n}function Jr(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:ge[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 ze=require("ogl");function $s(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function ei(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Js(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function ti(e){let t=Math.hypot(e[0],e[1],e[2]);return t>1e-6?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function Hn(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Un(e,t){return Math.max(0,Math.min(1,e+t))}function ni(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],l=e[i+1],u=e[Math.min(n-1,i+2)],d=a*a,m=d*a,h=[0,0,0];for(let f=0;f<3;f++)h[f]=.5*(2*c[f]+(-s[f]+l[f])*a+(2*s[f]-5*c[f]+4*l[f]-u[f])*d+(-s[f]+3*c[f]-3*l[f]+u[f])*m);return h}function jn(e,t,n,r,o){let i=ti($s(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=ei(ei(t,Js(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=ti(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,o),u=[r[0]+c[0]*l*1.3,r[1]+l*.75,r[2]+c[2]*l*1.3];return{waypoints:[e,u,a],finalPos:a}}function Yn(e,t,n=35,r=28){let o=Hn(t),i=ni(e,o),a=Hn(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function ii(e,t,n){let r=e.position.clone(),o=new ze.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new ze.Vec3(n[0],n[1],n[2]));let i=new ze.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var en=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new ze.Quat;this.endQuat=new ze.Quat;this.outQuat=new ze.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,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(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Yn(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,Un(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 t=this.resolveFn;this.resolveFn=null,t&&t()}};var ec=1.02,tc=1.5;function ai(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+ec;return{eye:[e[0],o,e[2]],focal:[t.x*_,n+tc,t.y*_]}}function nc(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function oc(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function tn(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:oc(t?.deviceMemory)}}function nn(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};return t.saveData?{...r,reason:"save-data"}:t.maxTextureSize!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&Math.max(e.sourceWidth,e.sourceHeight)>t.maxTextureSize?{...r,reason:"texture-limit"}:t.maxDecodedBytes!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&nc(e.sourceWidth,e.sourceHeight)>t.maxDecodedBytes?{...r,reason:"memory-limit"}:{...r,upgradeUrl:e.url,reason:"progressive"}}function si(){return new DOMException("Panorama image load aborted","AbortError")}function At(e,t){return new Promise((n,r)=>{if(t?.aborted){r(si());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=l=>{i||(i=!0,a(),l?r(l):n(o))},c=()=>{o.src="",s(si())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),o.src=e})}function on(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}function li(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":"AI-generated illustrative venue demo":e.coverage==="exact-seat"?"Exact seat photo":e.coverage==="row-representative"?"Representative row view":e.coverage==="section-representative"?"Representative section view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}var an=70,rc=35,ic=90;function Xn(e){return Math.max(rc,Math.min(ic,e))}var Ae=35;function ac(e,t,n){let r=(.5+e/360)*n;return t/2-r}function sc(e,t=an){return e*(180/t)}function ci(e,t,n){return(e-t)/2+rn(n,t)}function rn(e,t){let n=Ae/180*t;return Math.max(-n,Math.min(n,e))}function ui(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=nn(t,tn()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let u=document.createElement("div");Object.assign(u.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(u);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"}),c.appendChild(d),n.disclosure){let G=document.createElement("div");G.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(G.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)"}),c.appendChild(G)}let m=document.createElement("div");m.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(m.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"}),c.appendChild(m),e.appendChild(c),d.focus({preventScroll:!0});let h=0,f=0,p=0,b=0,y=an,g=()=>{let G=c.clientHeight||1,F=c.clientWidth||1,X=C.naturalWidth||F*2,K=C.naturalHeight||G,J=h>0?(F/2-p)/h:0,Z=f>0?b/f:0;f=sc(G,y),h=f*(X/K),u.style.backgroundSize=`${h}px ${f}px`,x?p=F/2-J*h:(p=ac(o,F,h),b=rn((t.initialPitchDeg??0)/180*f,f),x=!0),b=rn(Z*f,f),u.style.backgroundPosition=`${p}px ${ci(G,f,b)}px`},x=!1,S=()=>{let G=c.clientHeight||1;b=rn(b,f),u.style.backgroundPosition=`${p}px ${ci(G,f,b)}px`},C=new Image;C.onload=g,C.src=i.initialUrl;let M=()=>{};i.upgradeUrl&&(M=on(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(F=>!F||a.signal.aborted?null:At(F,a.signal).then(X=>({full:X,url:F}))).then(F=>{F&&(R||a.signal.aborted||(C=F.full,u.style.backgroundImage=`url("${F.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let k=!1,O=0,V=0,H=0,N=new Map,A=()=>{let[G,F]=[...N.values()];return G&&F?Math.hypot(G.x-F.x,G.y-F.y):0},v=G=>{let F=Xn(G);F!==y&&(y=F,g())},w=G=>{N.set(G.pointerId,{x:G.clientX,y:G.clientY}),k=N.size===1,O=G.clientX,V=G.clientY,N.size===2&&(H=A()),u.style.cursor="grabbing";try{u.setPointerCapture?.(G.pointerId)}catch{}},P=G=>{if(N.has(G.pointerId)){if(N.set(G.pointerId,{x:G.clientX,y:G.clientY}),N.size>=2){let F=A();H>0&&F>0&&v(y*(H/F)),H=F,k=!1;return}k&&(p+=G.clientX-O,b+=G.clientY-V,O=G.clientX,V=G.clientY,S())}},T=G=>{N.delete(G.pointerId),H=N.size===2?A():0;let F=N.values().next().value;k=N.size===1,F?(O=F.x,V=F.y):u.style.cursor="grab";try{u.releasePointerCapture?.(G.pointerId)}catch{}},L=G=>{G.preventDefault(),v(y+G.deltaY*.04)};u.addEventListener("pointerdown",w),u.addEventListener("pointermove",P),u.addEventListener("pointerup",T),u.addEventListener("pointercancel",T),u.addEventListener("wheel",L,{passive:!1});let E=!1,R=!1,z=0,I=()=>{u.removeEventListener("pointerdown",w),u.removeEventListener("pointermove",P),u.removeEventListener("pointerup",T),u.removeEventListener("pointercancel",T),u.removeEventListener("wheel",L),window.removeEventListener("keydown",U)},D=()=>{M(),a.abort(),n.signal?.removeEventListener("abort",s),z&&(window.clearTimeout(z),z=0),I(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},B=()=>{if(E)return;E=!0,c.style.opacity="0";let G=()=>{z=0,!R&&(D(),n.onClose?.())};z=window.setTimeout(G,r)},U=G=>{if(G.key==="Tab"){G.preventDefault(),d.focus({preventScroll:!0});return}if(G.key==="Escape"){G.stopPropagation(),B();return}if(G.key==="ArrowLeft"||G.key==="ArrowRight")p+=G.key==="ArrowLeft"?-32:32;else if(G.key==="ArrowUp"||G.key==="ArrowDown")b+=(G.key==="ArrowUp"?4:-4)*(f/180);else if(G.key==="+"||G.key==="="){v(y-5),G.preventDefault();return}else if(G.key==="-"){v(y+5),G.preventDefault();return}else return;G.preventDefault(),S()};return window.addEventListener("keydown",U),d.addEventListener("click",B),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:B,dispose(){E=!0,R=!0,D()}}}var He=require("ogl"),cc=64,lc=32,uc=500;function dc(e=cc,t=lc,n=uc){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<o;u++){let d=u/t,m=d*Math.PI,h=Math.sin(m),f=Math.cos(m);for(let p=0;p<r;p++){let b=p/e,y=(b-.5)*Math.PI*2,g=u*r+p;a[g*3]=n*h*Math.sin(y),a[g*3+1]=n*f,a[g*3+2]=-n*h*Math.cos(y),s[g*2]=b,s[g*2+1]=d}}let c=new Uint16Array(e*t*6),l=0;for(let u=0;u<t;u++)for(let d=0;d<e;d++){let m=u*r+d,h=m+r;c[l++]=m,c[l++]=h,c[l++]=m+1,c[l++]=m+1,c[l++]=h,c[l++]=h+1}return{position:a,uv:s,index:c}}function di(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}var mc=`#version 300 es
|
|
604
|
-
precision highp float;
|
|
605
|
-
in vec3 position;
|
|
606
|
-
in vec2 uv;
|
|
607
|
-
uniform mat4 modelViewMatrix;
|
|
608
|
-
uniform mat4 projectionMatrix;
|
|
609
|
-
out vec2 vUv;
|
|
610
|
-
void main() {
|
|
611
|
-
vUv = uv;
|
|
612
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
613
|
-
}`,hc=`#version 300 es
|
|
614
|
-
precision highp float;
|
|
615
|
-
in vec2 vUv;
|
|
616
|
-
uniform sampler2D uPano;
|
|
617
|
-
uniform float uOpacity;
|
|
618
|
-
out vec4 fragColor;
|
|
619
|
-
void main() {
|
|
620
|
-
vec3 rgb = texture(uPano, vUv).rgb;
|
|
621
|
-
fragColor = vec4(rgb, uOpacity);
|
|
622
|
-
}`;function mi(e,t){let{position:n,uv:r,index:o}=dc(),i=new He.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new He.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new He.Program(e,{vertex:mc,fragment:hc,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new He.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var hi=.15;async function fi(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Ae,Math.min(Ae,t?.initialPitchDeg??0)),s=an,c=!1,l=new AbortController,u=()=>l.abort();r.signal?.addEventListener("abort",u,{once:!0});let d=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let I=n.camera.position,D=n.focalWorld[0]-I.x,B=n.focalWorld[1]-I.y,U=n.focalWorld[2]-I.z,G=Math.hypot(D,U);G>.001&&(i=Math.atan2(D,-U)*180/Math.PI,a=Math.max(-Ae,Math.min(Ae,Math.atan2(B,G)*180/Math.PI)))}let h=null;if(t){let I=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),D=nn(t,tn(I)),B;try{let U=t.resolveUrl?await t.resolveUrl(D.initialUrl):D.initialUrl;if(!U)throw new Error("panorama_asset_unavailable");B=await At(U,l.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{h=mi(n.gl,B)}catch{return l.abort(),r.signal?.removeEventListener("abort",u),null}h.mesh.renderOrder=999,h.mesh.setParent(n.scene),D.upgradeUrl&&(d=on(()=>{(t.resolveUrl?t.resolveUrl(D.upgradeUrl):Promise.resolve(D.upgradeUrl)).then(G=>!G||l.signal.aborted?null:At(G,l.signal)).then(G=>{G&&(c||l.signal.aborted||(h?.setImage(G),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),b=()=>{let I=n.camera.position;h?.mesh.position.set(I.x,I.y,I.z);let[D,B,U]=di(i,a);n.camera.lookAt([I.x+D,I.y+B,I.z+U]),n.requestRender()};b();let y=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.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"}),y.appendChild(x),r.disclosure){let I=document.createElement("div");I.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(I.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)"}),y.appendChild(I)}let S=document.createElement("div");S.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(S.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"}),y.appendChild(S),e.appendChild(y),x.focus({preventScroll:!0});let C=!1,M=0,k=0,O=0,V=new Map,H=()=>{let[I,D]=[...V.values()];return I&&D?Math.hypot(I.x-D.x,I.y-D.y):0},N=I=>{let D=Xn(I);D!==s&&(s=D,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},A=I=>{I.target!==x&&(V.set(I.pointerId,{x:I.clientX,y:I.clientY}),C=V.size===1,M=I.clientX,k=I.clientY,V.size===2&&(O=H()),y.setPointerCapture?.(I.pointerId),y.style.cursor="grabbing")},v=I=>{if(V.has(I.pointerId)){if(V.set(I.pointerId,{x:I.clientX,y:I.clientY}),V.size>=2){let D=H();O>0&&D>0&&N(s*(O/D)),O=D,C=!1;return}C&&(i+=(I.clientX-M)*hi,a=Math.max(-Ae,Math.min(Ae,a+(I.clientY-k)*hi)),M=I.clientX,k=I.clientY,b())}},w=I=>{V.delete(I.pointerId),O=V.size===2?H():0;let D=V.values().next().value;C=V.size===1,D?(M=D.x,k=D.y):y.style.cursor="grab";try{y.releasePointerCapture?.(I.pointerId)}catch{}},P=I=>{I.preventDefault(),N(s+I.deltaY*.04)};y.addEventListener("pointerdown",A),y.addEventListener("pointermove",v),y.addEventListener("pointerup",w),y.addEventListener("pointercancel",w),y.addEventListener("wheel",P,{passive:!1});let T=I=>{if(!c){if(I.key==="Tab"){I.preventDefault(),x.focus({preventScroll:!0});return}if(I.key==="Escape"){I.stopPropagation(),z.close();return}if(I.key==="ArrowLeft"||I.key==="ArrowRight")i+=I.key==="ArrowLeft"?-4:4;else if(I.key==="ArrowUp"||I.key==="ArrowDown")a=Math.max(-Ae,Math.min(Ae,a+(I.key==="ArrowUp"?4:-4)));else if(I.key==="+"||I.key==="="){N(s-5),I.preventDefault();return}else if(I.key==="-"){N(s+5),I.preventDefault();return}else return;I.preventDefault(),b()}};window.addEventListener("keydown",T);let L=0,E=(I,D)=>{if(!h){D?.();return}let B=I===1?0:1,U=performance.now(),G=()=>{if(c)return;let F=o<=0?1:Math.min(1,(performance.now()-U)/o);h?.setOpacity(B+(I-B)*F),n.requestRender(),F<1?L=requestAnimationFrame(G):D?.()};L=requestAnimationFrame(G)};E(1);let R=()=>{c||(c=!0,d(),l.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(L),y.removeEventListener("pointerdown",A),y.removeEventListener("pointermove",v),y.removeEventListener("pointerup",w),y.removeEventListener("pointercancel",w),y.removeEventListener("wheel",P),window.removeEventListener("keydown",T),y.remove(),g?.isConnected&&g.focus({preventScroll:!0}),h?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},z={close(){if(c)return;let I=()=>{R(),r.onClose?.()};cancelAnimationFrame(L),E(0,I)},dispose:R};return x.addEventListener("click",()=>z.close()),z}function pi(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:d,isContextLost:m,isDisposed:h,flightGen:f,setPanorama:p,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:S,restorePanoramaLayer:C,getOverviewChip:M,labelOverlay:k,reducedMotion:O,removeArriveChip:V,showArriveChip:H}=e;return async(N,A,v)=>{b()?.abort();let w=new AbortController;y(w);let P=n.seats.idToIndex.get(N);if(P===void 0){i.syncFromCamera();return}let T=s.get(N)?.label??N,L=l(N,P),E=c(N);if(!E){w.abort(),b()===w&&y(null),i.syncFromCamera();return}x(!0),a.stop();let R;try{R=await E}catch{if(b()===w&&y(null),o.panoramaFailed(N,"source"),!h()&&v===f()){x(!1),i.resumeAfterFlight(L.focal),a.requestRender();let X=H(N,v,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(h()||v!==f()){w.abort(),b()===w&&y(null);return}V();let z=M(),I=()=>{w.abort(),b()===w&&y(null),p(null),g(!1),C(),z.style.display="",k.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(L.focal),a.requestRender();let X=H(N,f());requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())},D=R.generated===!0,B=li(R);S(),g(!D),z.style.display="none";let U=O()?0:A,G=u(),F=G&&!m()?await fi(t,D?null:R,{gl:d,scene:G.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:D?L.eye:void 0,focalWorld:L.focal},{fadeMs:U,seatLabel:T,disclosure:B,disclosurePrefix:D?"Live seat-eye view":"360\xB0 panorama",onClose:I,signal:w.signal}):null;if(h()||v!==f()){w.abort(),g(!1),b()===w&&y(null),F?.dispose(),z.style.display="",C();return}if(F)i.syncFromCamera(),k.setVisible(!1),x(!1),a.requestRender(),p(F);else if(D){C(),z.style.display="",x(!1),i.resumeAfterFlight(L.focal),a.requestRender(),p(null),g(!1),o.panoramaFailed(N,"mount");let X=H(N,f(),!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus()),b()===w&&y(null);return}else g(!1),o.panoramaFallback(N),p(ui(t,R,{fadeMs:U,seatLabel:T,disclosure:B,onClose:I,signal:w.signal}));o.panoramaOpened()}}var bi=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),sn=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,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(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=bi(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(bi()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:t})}panoramaFailed(t,n){this.emit("3d_panorama_failed",{seatId:t,phase:n})}panoramaFallback(t){this.emit("3d_panorama_fallback",{seatId:t})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function yi(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function gi(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{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,m,h=!1)=>{if(l(),e.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 p=o.get(d),b=p?.sectionId?n.sections.find(O=>O.id===p.sectionId):void 0,y=p?.label??d;f.setAttribute("aria-label",`Explore views near ${b?.label?`${b.label}, `:""}seat ${y}`);let g=document.createElement("span");g.textContent=["Live 3D seat view",b?.label,y].filter(Boolean).join(" \xB7 "),Object.assign(g.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(g);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(x);let S=p?.rowId?i.get(p.rowId):void 0,C=S?.indexOf(d)??-1,M=C>=0?[S?.[C-1],S?.[C+1]]:[void 0,void 0],k=(O,V,H,N=!1)=>{let A=document.createElement("button");A.type="button",A.textContent=O,A.setAttribute("aria-label",V),Object.assign(A.style,{minHeight:"44px",padding:N?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),N||(A.style.minWidth="44px"),N&&(A.dataset.panoramaTrigger=""),A.addEventListener("click",H),x.appendChild(A)};if(M[0]){let O=o.get(M[0])?.label??M[0];k("\u2039",`View previous seat ${O}`,()=>{e.flyToSeat(M[0])})}if(r.getSeatView){let O=r.seatViewActionLabel?.(d)??"Open 360\xB0 panorama";k(h?`\u21BB Retry ${O}`:`\u25C9 ${O}`,`${h?"Retry":O} from seat ${y}`,()=>{if(e.isDisposed()||m!==e.flightGen()){l();return}l(),e.openPanorama(d,400,m)},!0)}if(M[1]){let O=o.get(M[1])?.label??M[1];k("\u203A",`View next seat ${O}`,()=>{e.flyToSeat(M[1])})}return x.childElementCount?(t.appendChild(f),s=f,c(),f):null},remove:l,layout:c}}function xi(e){let{container:t,orbit:n,isNarrow:r}=e,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 c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.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 u=document.createElement("button");u.type="button",u.textContent="\u2212",u.setAttribute("aria-label","Zoom out of the 3D venue"),u.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 p of[c,l,u,d])p.className="sl-3d-icon-control",Object.assign(p.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,l),s.append(d,u);let m=p=>{n.setPrimaryDragMode(p);let b=p==="orbit";c.setAttribute("aria-pressed",String(b)),l.setAttribute("aria-pressed",String(!b)),c.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"};c.addEventListener("click",()=>m("orbit")),l.addEventListener("click",()=>m("pan")),u.addEventListener("click",()=>n.zoomBy(1.22)),d.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),t.appendChild(o);let h=()=>{let p=r();o.style.display=i?"none":"flex",o.style.right=p?"12px":"14px",o.style.bottom=p?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=p?"none":"flex",d.style.display=p?"none":"",u.style.display=p?"none":""};return h(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:p=>{i=p,n.setInteractionEnabled(!p),h()},seatViewLocked:()=>i,layout:h}}function vi(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:d,cancelFlight:m,focusSectionCamera:h,setSelection:f,ensureSeatView:p}=e,b=0,y=0,g=0,x=-1,S=!1,C=!1,M=N=>{e.seatViewLocked()||x===-1&&(x=N.pointerId,b=N.clientX,y=N.clientY,g=performance.now(),S=!1,C=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},k=N=>{N.pointerId===x&&Math.hypot(N.clientX-b,N.clientY-y)>u&&(S=!0)},O=(N,A,v,w,P)=>{let T=t.canvas.getBoundingClientRect(),L=t.canvas.clientWidth||T.width||1,E=t.canvas.clientHeight||T.height||1,R=N-T.left,z=A-T.top,I=w*w,D=-1,B=I,U=1/0;for(let G of o){if(v&&G.sectionId!==v)continue;let F=r.seats.idToIndex.get(G.id);if(F===void 0)continue;if(P){let te=Math.round(r.seats.iState[F]??0);if(te!==0&&te!==3)continue}let X=F*3,K=Ge(n.camera.projectionViewMatrix,[r.seats.iPosition[X],r.seats.iPosition[X+1]+.55,r.seats.iPosition[X+2]],L,E);if(!K.visible)continue;let J=K.x-R,Z=K.y-z,q=J*J+Z*Z;(q<B||Math.abs(q-B)<1&&K.depth<U)&&(D=F,B=q,U=K.depth)}return D},V=(N,A)=>{let v=e.gpu(),w=e.pick();if(!v||!w)return-1;w.syncFromSeatProgram(v.seatProgram);let P=t.canvas.getBoundingClientRect(),T=t.renderer.dpr,{x:L,y:E}=Zr(N,A,P,T,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),R=Math.max(2,Math.round(8*T));return w.pick(n.camera,L,E,R)};return{onDown:M,onMove:k,onUp:N=>{if(N.pointerId!==x)return;let A=!S&&performance.now()-g<d;if(x=-1,C){C=!1;return}let v=e.gpu(),w=e.pick();if(!A||!v||!w)return;let P=V(N.clientX,N.clientY);if(e.focusedSectionId()&&P>=0){let E=c[P],R=E?l.get(E):void 0;if(R&&R!==e.focusedSectionId()&&h(R))return}if(e.focusedSectionId()&&P<0&&(P=O(N.clientX,N.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&P<0){let E=O(N.clientX,N.clientY,null,72,!1),R=E>=0?c[E]:void 0,z=R?l.get(R):void 0;if(z&&z!==e.focusedSectionId()&&h(z))return}if(!e.focusedSectionId()){P<0&&(P=O(N.clientX,N.clientY,null,42,!1));let E=P>=0?c[P]:void 0,R=E?l.get(E):void 0;if(R&&h(R))return}if(P<0||P>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let T=c[P],L=ge[Math.round(r.seats.iState[P]??0)]??"available";if(L!=="available"&&L!=="selected"){i.onSeatInspect?.(T,L);return}if(e.selection().has(T)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null);return}f([T]),p(T),s.seatPicked(T,l.get(T)),i.onSeatPick?.(T)}}}var cn=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let h=0;h<this.count;h++){let f=t[h*3],p=t[h*3+2];f<n&&(n=f),f>o&&(o=f),p<r&&(r=p),p>i&&(i=p)}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 c=this.cols*this.rows,l=new Int32Array(c+1),u=h=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((t[h*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[h*3+2]-r)/this.cell)))*this.cols+f};for(let h=0;h<this.count;h++)l[u(h)+1]++;for(let h=0;h<c;h++)l[h+1]+=l[h];let d=new Int32Array(this.count),m=l.slice(0,c);for(let h=0;h<this.count;h++)d[m[u(h)]++]=h;this.cellStart=l,this.cellItems=d}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,l=Math.floor((t-this.minX)/this.cell),u=Math.floor((n-this.minZ)/this.cell),d=Math.ceil(r/this.cell)+1,m=this.iPosition,h=0;for(let f=0;f<=d&&h<s;f++){let p=u-f,b=u+f,y=l-f,g=l+f;for(let x=p;x<=b&&h<s;x++){if(x<0||x>=this.rows)continue;let S=x===p||x===b;for(let C=y;C<=g&&h<s;C++){if(!S&&C!==y&&C!==g){C=g-1;continue}if(C<0||C>=this.cols)continue;let M=x*this.cols+C;for(let k=i[M],O=i[M+1];k<O&&h<s;k++){let V=a[k],H=m[V*3]-t,N=m[V*3+2]-n;H*H+N*N<=c&&(o[h++]=V)}}}}return h}};var ln=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Dt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new cn(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){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)<xn)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>gn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,gn,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(t,n,r){let o=1-Math.exp(-t*9),i=1-Math.exp(-t*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 un=require("ogl");function Mi(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=e,d=0,m=-1,h=(C,M,k=28)=>{o.camera.position.set(C[0],C[1],C[2]),o.camera.lookAt(new un.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 p=()=>{f.textContent="\u2302"};p();let b=C=>{m=C;let M=e.gpu();M&&(M.seatProgram.uniforms.uFocusFloor.value=C,M.solidProgram.uniforms.uFocusFloor.value=C,M.chairProgram.uniforms.uFocusFloor.value=C),e.showSectionSeatLabels(null)},y=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),f.style.display="",c.setVisible(!0),e.setFrozen(!1);let C=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!C),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),C){let M=C.focalWorld[0]-C.center[0],k=C.focalWorld[2]-C.center[2],O=Math.hypot(M,k)>C.radius*.12?Math.atan2(M,k):l,V={center:C.center,radius:C.radius,box:C.box},H={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(V,!1,O,!1,H):o.frameSoft(V,O,!1,H)}else e.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,u):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,u);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{d++,e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=C=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let M=n.seats.idToIndex.get(C);if(M===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(C),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),f.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1),e.setSeatViewLocked(!1);let k=++d;e.removeArriveChip();let{eye:O,focal:V}=e.resolvedSeatViewPose(C,M),H=[o.camera.position.x,o.camera.position.y,o.camera.position.z],N=jn(H,O,V,n.bounds.center,n.bounds.radius),A=r.arriveAtSeatEye?O:N.finalPos,v=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,w=[N.waypoints[0],N.waypoints[1],A];if(c.setVisible(!1),e.reducedMotion())return h(A,V,v),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(C,k),Promise.resolve();let P=new un.Quat().copy(o.camera.quaternion),T=ii(o.camera,A,V);return s.requestRender(),i.start(w,P,T,2500,v).then(()=>{e.isDisposed()||k!==d||(a.cinematicPlayed(2500),o.resumeAfterFlight(V),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(C,k))})},S=C=>{let M=n.sections.find(H=>H.id===C);if(!M||M.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==M.floorIndex&&b(M.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(C);let k=M.focalWorld[0]-M.center[0],O=M.focalWorld[2]-M.center[2],V=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,V),r.onSectionFocusChange?.(C),s.requestRender(),!0};return f.addEventListener("click",y),{overviewChip:f,layoutOverviewChip:p,flightGen:()=>d,focusedFloor:()=>m,applyFloorFocus:b,placeCameraFinal:h,cancelFlight:g,focusOverview:y,flyToSeat:x,focusSectionCamera:S}}var fc={};function Si(e){let t=performance.now();return{model:ct(e),buildMs:performance.now()-t,source:"main"}}function wi(e){return typeof Worker>"u"?Promise.resolve(Si(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",fc.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(Si(e)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(e)})}var pc=Math.PI/180,bc=6,yc=500;function gc(e,t,n={}){let r=performance.now(),o=t.prepared?.model??ct(t),i=new sn(n.onAnalytics),a=new Array(o.seats.count);for(let[j,Y]of o.seats.idToIndex)a[Y]=j;let s=new Map(t.seats.map(j=>[j.id,j])),c=new Map;for(let j of t.seats){if(!j.rowId)continue;let Y=c.get(j.rowId);Y?Y.push(j.id):c.set(j.rowId,[j.id])}let l=new Map;for(let j of t.seats)l.set(j.id,j.sectionId);let u=t.doc.floors?.some(Y=>(Y.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&((Y.height??0)>0||(Y.rake??0)>0)),d=null,m=null,h=!1,f=!1,p=!1,b=new Map,y=null,g=null,x=null,S=new Map,C=null,M=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},k=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},O=!1,V=()=>O?me.focusedFloor():-1,H=()=>{d=Qr(w.gl,o),m=new Jt(w.renderer,d.seatGeometry,d.chairGeometry,d.solidGeometry,o.seats.count),w.setClearColor(o.theme.background.top),m.setRestoreClear(o.theme.background.top),d.seatProgram.uniforms.uSeatRadius.value=ke*o.theme.seatScale,d.seatProgram.uniforms.uFocusFloor.value=V(),d.solidProgram.uniforms.uFocusFloor.value=V(),d.chairProgram.uniforms.uFocusFloor.value=V(),A.forceRegather()},N=!1,A=new ln({model:o,orbit:()=>P,gpu:()=>d}),v=j=>A.setDetailEnabled(j),w=new kt(e,{onContextLost:()=>{p||i.contextLost(),h=!0,X.stop(),d=null,m=null},onContextRestored:()=>{H(),h=!1,p||i.contextRestored(),X.requestRender()}}),P=new Lt(w.gl,w.canvas,()=>X.requestRender(),()=>i.orbitEngaged());P.setAspect(w.aspect);let T=(t.doc.floors?.flatMap(j=>j.objects)??t.doc.objects).some(j=>j.type==="section"&&j.physical3dProvenance?.surfaceKind?.status==="inferred"),L=(()=>{if(T&&o.stages.length===0)return;let j=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(j,Y)>o.bounds.radius*.12?Math.atan2(j,Y):void 0})(),E=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,R=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;P.frame(o.bounds,!R&&n.skipInitialOverviewAnimation!==!0,L,n.portraitOverviewCrop===!0,E);let z=new en(P.camera),I=yi(e),D=new qt(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),B=o.labels,U=()=>gr(B,o.floors.length,V());D.setLabels(U());let G=null,F=j=>{if(G=j,D.setForcedDense(!!j),!j){D.setLabels(U());return}let Y=t.seats.filter(Q=>Q.sectionId===j),W=new Set(Y.map(Q=>Q.id)),ne=new Set(Y.map(Q=>Q.rowId)),ie=new Set(b.keys()),oe=new Set(Y.filter(Q=>ie.has(Q.id)).map(Q=>Q.id)),le=U().filter(Q=>Q.kind!=="row"&&Q.kind!=="seat"||(Q.kind==="row"?ne.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){D.setLabels(le);return}let ue=oe.size?Y.filter(Q=>oe.has(Q.id)):Y,Xe=new Set(ue.map(Q=>`seat:${Q.id}`)),Oe=ue.flatMap(Q=>{let he=o.seats.idToIndex.get(Q.id);if(he===void 0)return[];let Me=he*3;return[{id:`seat:${Q.id}`,kind:"seat",text:Q.displayLabel||Q.label,anchor:[o.seats.iPosition[Me],o.seats.iPosition[Me+1]+(ie.has(Q.id)?1.05:.55),o.seats.iPosition[Me+2]]}]});D.setLabels([...le.filter(Q=>!Xe.has(Q.id)),...Oe])};H();let X=new Ft(j=>{if(h||!d||f)return!1;let W=z.active?z.update(performance.now()):P.update(),ne=V()>=0?o.floors[V()]:null,ie=ne?.radius??o.bounds.radius,oe=so(P.currentDistance,ie),le=N?{center:[P.camera.position.x,P.camera.position.y,P.camera.position.z],radius:520}:o.renderBounds;P.updateClipping(le);let ue=ne?.center??o.renderBounds.center,Xe=ne?.radius??o.renderBounds.radius,Oe=(Se,ht)=>Math.hypot(P.camera.position.x-Se[0],P.camera.position.y-Se[1],P.camera.position.z-Se[2])<=ht*(A.detailVisible?1.8:1.55),Q=Oe(ue,Xe);if(!Q&&G){let Se=o.sections.find(ht=>ht.id===G);Se&&(Q=Oe(Se.center,Math.max(12,Se.radius*2)))}A.detailVisible=Q;let he=d.seatProgram.uniforms;he.uSeatScale.value=oe.scale,he.uSeatFade.value=oe.fade;let Me=!!ne&&co(ne.seatCount,w.canvas.clientWidth||1,w.canvas.clientHeight||1),Rt=lo(o.seats.count,ie,P.currentDistance,P.camera.fov,w.canvas.clientHeight||1),mt=A.detailVisible||Me||Rt?1:0,It=A.detailVisible||V()>=0||o.floors.length>1?1:0;return A.ease(j,mt,It),he.uSeatDetail.value=A.seatDetailMix,d.solidProgram.uniforms.uStructureDetail.value=A.structureDetailMix,he.uMinPixels.value=oe.minPixels,he.uPixelToWorld.value=2*Math.tan(P.camera.fov*pc/2)/Math.max(1,w.pixelHeight),A.update(A.detailVisible),w.renderer.render({scene:d.background,clear:!0}),w.renderer.render({scene:d.main,camera:P.camera,clear:!1}),D.update(P.camera.projectionViewMatrix,w.canvas.clientWidth||1,w.canvas.clientHeight||1,P.currentDistance,ie,[P.camera.position.x,P.camera.position.y,P.camera.position.z]),W||A.seatDetailMix!==mt||A.structureDetailMix!==It}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>mn.resize()):null;K?.observe(e);let J=j=>{let Y=ie=>{let oe=o.seats.idToIndex.get(ie);return oe===void 0?void 0:o.seats.iState[oe]},{updates:W,next:ne}=Jr(b,j,Y);if(b=ne,D.setSelectedSeatIds(b.keys()),G&&F(G),W.length){let ie=An(o.seats,W);d&&d.uploadSeatStateRuns(ie),X.requestRender()}},Z=()=>C!==null?C:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=8,te=j=>{if(!n.getSeatView)return null;let Y=S.get(j);if(!Y)for(Y=Promise.resolve(n.getSeatView(j)),S.set(j,Y),Y.catch(()=>{S.get(j)===Y&&S.delete(j)});S.size>q;){let W=S.keys().next().value;if(W===void 0)break;S.delete(W)}return Y},Ue=(j,Y)=>{let W=s.get(j),ne=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),ie=t.doc.floors?.[ne],oe=o.floors[ne],le=ie?.focalPoint??t.doc.focalPoint,ue=oe?{x:oe.focalWorld[0]/_,y:oe.focalWorld[2]/_}:le,Xe=W?.focalPoint?{x:W.focalPoint.x+ue.x-le.x,y:W.focalPoint.y+ue.y-le.y}:ue,Oe=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return ai(Oe,Xe,ie?.baseHeightM??0,W?.eyeHeightM)},je=()=>(e.clientWidth||w.canvas.clientWidth)<=520,Re,Ie=gi({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:je,isDisposed:()=>p,flightGen:()=>me.flightGen(),flyToSeat:j=>Kn(j),openPanorama:(j,Y,W)=>Re(j,Y,W)}),Ee=Ie.show,xe=Ie.remove,ve=Ie.layout,ae=xi({container:e,orbit:P,isNarrow:je}),Je=ae.element,De=ae.setNavigationMode,Te=ae.setSeatViewLocked,Ye=ae.layout,dt=ae.utilityControls,me=Mi({container:e,model:o,opts:n,orbit:P,cinematic:z,analytics:i,loop:X,labelOverlay:D,stageAzimuth:L,overviewFraming:E,gpu:()=>d,isDisposed:()=>p,panorama:()=>y,setPanorama:j=>{y=j},setPanoramaSphereVisible:j=>{N=j},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:j=>{g=j},setFrozen:j=>{f=j},restorePanoramaLayer:k,reducedMotion:Z,resolvedSeatViewPose:Ue,showSectionSeatLabels:F,setNearFieldDetailEnabled:v,setSeatViewLocked:Te,setNavigationMode:De,showArriveChip:Ee,removeArriveChip:xe});O=!0;let dn=me.overviewChip,Pi=me.layoutOverviewChip,Ci=me.applyFloorFocus,Ai=me.focusOverview,Wn=me.cancelFlight,Kn=me.flyToSeat,Qn=me.focusSectionCamera;dt.appendChild(dn),Re=pi({container:e,model:o,opts:n,analytics:i,orbit:P,loop:X,seatsById:s,ensureSeatView:te,resolvedSeatViewPose:Ue,gpu:()=>d,gl:w.gl,isContextLost:()=>h,isDisposed:()=>p,flightGen:()=>me.flightGen(),setPanorama:j=>{y=j},getLoadAbort:()=>g,setLoadAbort:j=>{g=j},setPanoramaSphereVisible:j=>{N=j},setFrozen:j=>{f=j},raisePanoramaLayer:M,restorePanoramaLayer:k,getOverviewChip:()=>dn,labelOverlay:D,reducedMotion:Z,removeArriveChip:xe,showArriveChip:Ee});let _e=vi({glctx:w,orbit:P,model:o,seats:t.seats,opts:n,cinematic:z,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:bc,tapMs:yc,gpu:()=>d,pick:()=>m,seatViewLocked:()=>ae.seatViewLocked(),focusedSectionId:()=>G,selection:()=>b,cancelFlight:Wn,focusSectionCamera:Qn,setSelection:J,ensureSeatView:te});w.canvas.addEventListener("pointerdown",_e.onDown),w.canvas.addEventListener("pointermove",_e.onMove),w.canvas.addEventListener("pointerup",_e.onUp),w.canvas.addEventListener("pointercancel",_e.onUp),X.requestRender();let mn={setAvailability(j){let Y=$r(b,j),W=An(o.seats,Y);W.length&&d&&d.uploadSeatStateRuns(W),X.requestRender()},setSelection:J,flyToSeat:Kn,focusOverview:Ai,resize(){let{width:j,height:Y}=w.resize();P.setAspect(j/Math.max(1,Y)),ve(),Ye(),Pi(),X.requestRender()},stats(){return{...X.stats(),drawCalls:d?d.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let j=X.stats(),Y=w.canvas.clientWidth||1,W=w.canvas.clientHeight||1,ne=o.bounds.center,ie=Ge(P.camera.projectionViewMatrix,[ne[0],o.bounds.box.min[1],ne[2]],Y,W),oe=Ge(P.camera.projectionViewMatrix,[ne[0],o.bounds.box.max[1],ne[2]],Y,W),le=o.bounds.box,ue=[le.min[0],le.max[0]].flatMap(Q=>[le.min[1],le.max[1]].flatMap(he=>[le.min[2],le.max[2]].map(Me=>Ge(P.camera.projectionViewMatrix,[Q,he,Me],Y,W)))).filter(Q=>Number.isFinite(Q.x)&&Number.isFinite(Q.y)&&Number.isFinite(Q.depth)),Xe=ue.length?(()=>{let Q=Math.min(...ue.map(We=>We.x)),he=Math.max(...ue.map(We=>We.x)),Me=Math.min(...ue.map(We=>We.y)),Rt=Math.max(...ue.map(We=>We.y)),mt=Math.max(0,Q),It=Math.min(Y,he),Se=Math.max(0,Me),ht=Math.min(W,Rt),Et=Math.max(0,It-mt),hn=Math.max(0,ht-Se);return{box:{x:mt,y:Se,width:Et,height:hn},horizontalFillRatio:Et/Y,verticalFillRatio:hn/W,visibleAreaRatio:Et*hn/(Y*W),clippedEdges:[...Me<0?["top"]:[],...he>Y?["right"]:[],...Rt>W?["bottom"]:[],...Q<0?["left"]:[]]}})():void 0,Oe=String(w.gl.getParameter(w.gl.VERSION)??"");return{viewport:{width:Y,height:W},context:{webgl2:/webgl\s*2/i.test(Oe),lost:h},frame:{rendered:j.rendered,idle:j.idle},camera:{position:[P.camera.position.x,P.camera.position.y,P.camera.position.z],distance:P.currentDistance,verticalFovDeg:P.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:u,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:ie.visible&&oe.visible?Math.abs(ie.y-oe.y):0},labels:D.qualityEvidence(),framing:Xe}},getQualityReport(){return Zt(mn.getQualityEvidence())},loseContextForTest(){w.simulateContextLossCycle()},floors(){return o.floors},focusFloor(j){if(j!==null&&!o.floors.some(W=>W.index===j))return!1;let Y=j??-1;if(v(j!==null),Te(!1),Ci(Y),De("orbit"),j===null)z.cancel(),Z()?P.frame(o.bounds,!1,L,n.portraitOverviewCrop===!0,E):P.frameSoft(o.bounds,L,n.portraitOverviewCrop===!0,E);else{let W=o.floors[j];if(W.seatCount>0){z.cancel();let ne=W.focalWorld[0]-W.center[0],ie=W.focalWorld[2]-W.center[2],oe=Math.hypot(ne,ie)>W.radius*.12?Math.atan2(ne,ie):L;P.frame({center:W.center,radius:W.radius,box:W.box},!1,oe,!1,{polarDeg:58,margin:1.12})}}return X.requestRender(),!0},zones(){return o.zones},focusZone(j){let Y=o.zones.find(oe=>oe.id===j);if(!Y||Y.seatCount===0)return!1;v(!1),Te(!1),z.cancel(),De("orbit"),F(null),n.onSectionFocusChange?.(null);let W=Y.focalWorld[0]-Y.center[0],ne=Y.focalWorld[2]-Y.center[2],ie=Math.hypot(W,ne)>Y.radius*.12?Math.atan2(W,ne):void 0;return P.frame({center:Y.center,radius:Y.radius*1.25},!1,ie),X.requestRender(),!0},sections(){return o.sections},focusSection(j){return Qn(j)},rows(j){return j?o.rows.filter(Y=>Y.sectionId===j):o.rows},seatsInRow(j){return t.seats.filter(Y=>Y.rowId===j).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(j){let Y=o.rows.find(W=>W.id===j);return!Y||Y.seatCount===0?!1:(v(!0),Te(!1),z.cancel(),De("pan"),Y.sectionId&&(F(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),P.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),X.requestRender(),!0)},setReducedMotionForTest(j){C=j},dispose(){p=!0,xe(),dn.remove(),Je.remove(),Wn(),X.stop(),D.dispose(),K?.disconnect(),y&&(y.dispose(),y=null),k(),I(),w.canvas.removeEventListener("pointerdown",_e.onDown),w.canvas.removeEventListener("pointermove",_e.onMove),w.canvas.removeEventListener("pointerup",_e.onUp),w.canvas.removeEventListener("pointercancel",_e.onUp),P.dispose(),m&&m.dispose(),d&&d.dispose(),d=null,m=null,w.dispose()}};return i.opened(o.seatCount,u,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),mn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});
|
|
622
|
+
}`;function Wr(e){return new ze.Program(e,{vertex:$s,fragment:Js,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Te},uSeatScale:{value:1},uMinPixels:{value:rt},uPixelToWorld:{value:.002},uChairFull:{value:yt},uChairNone:{value:it},uFocusFloor:{value:-1}}})}function Kr(e){return new ze.Program(e,{vertex:ec,fragment:tc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:yt},uChairNone:{value:it},uBackRake:{value:An},uBackBase:{value:Ut},uFocusFloor:{value:-1}}})}function Qr(e){return new ze.Program(e,{vertex:nc,fragment:oc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function qr(e){return new ze.Program(e,{vertex:js,fragment:Ys,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function Zr(e){return new ze.Program(e,{vertex:Xs,fragment:Ws,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Te},uSeatScale:{value:1},uMinPixels:{value:rt},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:yt},uChairNone:{value:it}}})}function $r(e){return new ze.Program(e,{vertex:Ks,fragment:Qs,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:yt},uChairNone:{value:it},uBackRake:{value:An},uBackBase:{value:Ut},uFocusFloor:{value:-1}}})}function Jr(e,t,n){return new ze.Program(e,{vertex:qs,fragment:Zs,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function ei(e,t,n,r,o,i){for(let a=n;a<n+r;a++){let c=i&&t[a]===0?null:o[t[a]]??o[0];e[a*3]=c?c[0]:i[a*3],e[a*3+1]=c?c[1]:i[a*3+1],e[a*3+2]=c?c[2]:i[a*3+2]}}var rc=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),ic=new Float32Array([-1,-1,3,-1,-1,3]);function ti(e,t){let n=new fe.Transform,r=new fe.Transform,o=new fe.Geometry(e,{position:{size:2,data:ic}}),i=Jr(e,t.theme.background.top,t.theme.background.bottom),a=new fe.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new fe.Geometry(e,{position:{size:3,data:t.solids.position},normal:{size:3,data:t.solids.normal},color:{size:3,data:t.solids.color},floorIndex:{size:1,data:t.solids.floor},materialIndex:{size:1,data:t.solids.material}}),c=qr(e),l=new fe.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let u=Zr(e),d=new Float32Array(t.seats.count*3),m=xe.map(R=>t.theme.seatStates[R]);ei(d,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let h=new fe.Geometry(e,{position:{size:2,data:rc},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:d,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),p=new fe.Mesh(e,{geometry:h,program:u});p.frustumCulled=!1,t.seats.count>0&&p.setParent(n);let f=h.attributes.iColor,b=Eo(),y=$r(e),g=Ot,x=new Float32Array(g*3),S=new Float32Array(g*3),C=new Float32Array(g),M=new Float32Array(g),k=new Float32Array(g),O=new Float32Array(g*3),V=new Float32Array(g),U=new Float32Array(g),N=new Float32Array(g),A=new Float32Array(g),v=new fe.Geometry(e,{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:S,instanced:1},iRadius:{size:1,data:C,instanced:1},iYaw:{size:1,data:M,instanced:1},iGlyph:{size:1,data:k,instanced:1},iRing:{size:3,data:O,instanced:1},iFloor:{size:1,data:V,instanced:1},iPhysicalSeat:{size:1,data:U,instanced:1},iSeed:{size:1,data:A,instanced:1},iPickIndex:{size:1,data:N,instanced:1}}),w=new fe.Mesh(e,{geometry:v,program:y});w.frustumCulled=!1;let P=0,T=new Int32Array(0),L=()=>{let R=t.seats;for(let z=0;z<P;z++){let I=T[z];A[z]=ko(R.iState[I],I);let B=R.iCategory&&R.iState[I]===0?null:m[R.iState[I]]??m[0];if(B)S[z*3]=B[0],S[z*3+1]=B[1],S[z*3+2]=B[2];else{let j=io([R.iCategory[I*3],R.iCategory[I*3+1],R.iCategory[I*3+2]]);S[z*3]=j[0],S[z*3+1]=j[1],S[z*3+2]=j[2]}}v.attributes.iColor.needsUpdate=!0,v.attributes.iSeed.needsUpdate=!0},E={main:n,background:r,seatProgram:u,solidProgram:c,chairProgram:y,seatGeometry:h,chairGeometry:v,solidGeometry:s,drawCalls:3,setNearSeats(R,z){let I=Math.min(z,g);if(T=R,P=I,I===0){w.parent&&w.setParent(null),v.instancedCount=0,E.drawCalls=3;return}let D=t.seats;for(let B=0;B<I;B++){let j=R[B];x[B*3]=D.iPosition[j*3],x[B*3+1]=D.iPosition[j*3+1],x[B*3+2]=D.iPosition[j*3+2],C[B]=D.iChairWidth[j],M[B]=D.iYaw[j],k[B]=D.iGlyph[j],O[B*3]=D.iRing[j*3],O[B*3+1]=D.iRing[j*3+1],O[B*3+2]=D.iRing[j*3+2],V[B]=D.iFloor[j],U[B]=D.iPhysicalSeat[j],N[B]=j+1}L(),v.attributes.iOffset.needsUpdate=!0,v.attributes.iRadius.needsUpdate=!0,v.attributes.iYaw.needsUpdate=!0,v.attributes.iGlyph.needsUpdate=!0,v.attributes.iRing.needsUpdate=!0,v.attributes.iFloor.needsUpdate=!0,v.attributes.iPhysicalSeat.needsUpdate=!0,v.attributes.iSeed.needsUpdate=!0,v.attributes.iPickIndex.needsUpdate=!0,v.instancedCount=I,w.parent||w.setParent(n),E.drawCalls=4},nearSeatCount(){return P},uploadSeatStateRuns(R){if(!R.length)return;P&&L();for(let I of R)ei(d,t.seats.iState,I.start,I.length,m,t.seats.iCategory);let z=f.buffer;if(!z){f.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,z);for(let I of R){let D=d.subarray(I.start*3,(I.start+I.length)*3);e.bufferSubData(e.ARRAY_BUFFER,I.start*3*Float32Array.BYTES_PER_ELEMENT,D)}},dispose(){o.remove(),i.remove(),s.remove(),c.remove(),h.remove(),u.remove(),v.remove(),y.remove()}};return E}var Ie=require("ogl");function ac(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function ni(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let l=0;l<t;l++){let u=(c*t+l)*4,d=ac(e[u],e[u+1],e[u+2]);if(d<0||d>=i)continue;let m=l-r,h=c-o,p=m*m+h*h;p<s&&(s=p,a=d)}return a}function oi(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,l))}}var sc=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],tn=class{constructor(t,n,r,o,i){this.seatScene=new Ie.Transform;this.chairScene=new Ie.Transform;this.solidScene=new Ie.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=Wr(this.gl),this.chairProg=Kr(this.gl),this.depthProg=Qr(this.gl);let a=new Ie.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Ie.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Ie.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of sc)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new Ie.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-o),u=Math.max(0,r-o),d=Math.max(1,Math.min(s,n+o+1)-l),m=Math.max(1,Math.min(c,r+o+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(l,u,d,m);let[h,p,f]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(h,p,f,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(d*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,u,d,m,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),ni(b,d,m,n-l,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function ri(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,bt(r.state)):n.push(r);return n}function ii(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:xe[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 cc(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function ai(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function lc(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function si(e){let t=Math.hypot(e[0],e[1],e[2]);return t>1e-6?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function jn(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Yn(e,t){return Math.max(0,Math.min(1,e+t))}function ci(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],l=e[i+1],u=e[Math.min(n-1,i+2)],d=a*a,m=d*a,h=[0,0,0];for(let p=0;p<3;p++)h[p]=.5*(2*c[p]+(-s[p]+l[p])*a+(2*s[p]-5*c[p]+4*l[p]-u[p])*d+(-s[p]+3*c[p]-3*l[p]+u[p])*m);return h}function Xn(e,t,n,r,o){let i=si(cc(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=ai(ai(t,lc(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=si(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,o),u=[r[0]+c[0]*l*1.3,r[1]+l*.75,r[2]+c[2]*l*1.3];return{waypoints:[e,u,a],finalPos:a}}function Wn(e,t,n=35,r=28){let o=jn(t),i=ci(e,o),a=jn(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function di(e,t,n){let r=e.position.clone(),o=new He.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new He.Vec3(n[0],n[1],n[2]));let i=new He.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var nn=class{constructor(t){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=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,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(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Wn(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,Yn(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 t=this.resolveFn;this.resolveFn=null,t&&t()}};var uc=1.02,dc=1.5;function mi(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+uc;return{eye:[e[0],o,e[2]],focal:[t.x*_,n+dc,t.y*_]}}var Zn=null;function Ci(){return Zn??=Promise.resolve().then(()=>(Pi(),wi)).catch(e=>{throw Zn=null,e}),Zn}var Ai=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),ln=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,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(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=Ai(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(Ai()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:t})}panoramaFailed(t,n){this.emit("3d_panorama_failed",{seatId:t,phase:n})}panoramaFallback(t){this.emit("3d_panorama_fallback",{seatId:t})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function Ri(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function Ii(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{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,m,h=!1)=>{if(l(),e.isDisposed())return null;let p=document.createElement("div");p.setAttribute("role","group"),Object.assign(p.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let f=o.get(d),b=f?.sectionId?n.sections.find(O=>O.id===f.sectionId):void 0,y=f?.label??d;p.setAttribute("aria-label",`Explore views near ${b?.label?`${b.label}, `:""}seat ${y}`);let g=document.createElement("span");g.textContent=["Live 3D seat view",b?.label,y].filter(Boolean).join(" \xB7 "),Object.assign(g.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)"}),p.appendChild(g);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),p.appendChild(x);let S=f?.rowId?i.get(f.rowId):void 0,C=S?.indexOf(d)??-1,M=C>=0?[S?.[C-1],S?.[C+1]]:[void 0,void 0],k=(O,V,U,N=!1)=>{let A=document.createElement("button");A.type="button",A.textContent=O,A.setAttribute("aria-label",V),Object.assign(A.style,{minHeight:"44px",padding:N?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),N||(A.style.minWidth="44px"),N&&(A.dataset.panoramaTrigger=""),A.addEventListener("click",U),x.appendChild(A)};if(M[0]){let O=o.get(M[0])?.label??M[0];k("\u2039",`View previous seat ${O}`,()=>{e.flyToSeat(M[0])})}if(r.getSeatView){let O=r.seatViewActionLabel?.(d)??"Open 360\xB0 panorama";k(h?`\u21BB Retry ${O}`:`\u25C9 ${O}`,`${h?"Retry":O} from seat ${y}`,()=>{if(e.isDisposed()||m!==e.flightGen()){l();return}l(),e.openPanorama(d,400,m)},!0)}if(M[1]){let O=o.get(M[1])?.label??M[1];k("\u203A",`View next seat ${O}`,()=>{e.flyToSeat(M[1])})}return x.childElementCount?(t.appendChild(p),s=p,c(),p):null},remove:l,layout:c}}function Ei(e){let{container:t,orbit:n,isNarrow:r}=e,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 c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.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 u=document.createElement("button");u.type="button",u.textContent="\u2212",u.setAttribute("aria-label","Zoom out of the 3D venue"),u.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 f of[c,l,u,d])f.className="sl-3d-icon-control",Object.assign(f.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,l),s.append(d,u);let m=f=>{n.setPrimaryDragMode(f);let b=f==="orbit";c.setAttribute("aria-pressed",String(b)),l.setAttribute("aria-pressed",String(!b)),c.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"};c.addEventListener("click",()=>m("orbit")),l.addEventListener("click",()=>m("pan")),u.addEventListener("click",()=>n.zoomBy(1.22)),d.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),t.appendChild(o);let h=()=>{let f=r();o.style.display=i?"none":"flex",o.style.right=f?"12px":"14px",o.style.bottom=f?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=f?"none":"flex",d.style.display=f?"none":"",u.style.display=f?"none":""};return h(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:f=>{i=f,n.setInteractionEnabled(!f),h()},seatViewLocked:()=>i,layout:h}}function Ti(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:d,cancelFlight:m,focusSectionCamera:h,setSelection:p,ensureSeatView:f}=e,b=0,y=0,g=0,x=-1,S=!1,C=!1,M=N=>{e.seatViewLocked()||x===-1&&(x=N.pointerId,b=N.clientX,y=N.clientY,g=performance.now(),S=!1,C=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},k=N=>{N.pointerId===x&&Math.hypot(N.clientX-b,N.clientY-y)>u&&(S=!0)},O=(N,A,v,w,P)=>{let T=t.canvas.getBoundingClientRect(),L=t.canvas.clientWidth||T.width||1,E=t.canvas.clientHeight||T.height||1,R=N-T.left,z=A-T.top,I=w*w,D=-1,B=I,j=1/0;for(let G of o){if(v&&G.sectionId!==v)continue;let F=r.seats.idToIndex.get(G.id);if(F===void 0)continue;if(P){let ne=Math.round(r.seats.iState[F]??0);if(ne!==0&&ne!==3)continue}let X=F*3,K=Ve(n.camera.projectionViewMatrix,[r.seats.iPosition[X],r.seats.iPosition[X+1]+.55,r.seats.iPosition[X+2]],L,E);if(!K.visible)continue;let J=K.x-R,Z=K.y-z,q=J*J+Z*Z;(q<B||Math.abs(q-B)<1&&K.depth<j)&&(D=F,B=q,j=K.depth)}return D},V=(N,A)=>{let v=e.gpu(),w=e.pick();if(!v||!w)return-1;w.syncFromSeatProgram(v.seatProgram);let P=t.canvas.getBoundingClientRect(),T=t.renderer.dpr,{x:L,y:E}=oi(N,A,P,T,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),R=Math.max(2,Math.round(8*T));return w.pick(n.camera,L,E,R)};return{onDown:M,onMove:k,onUp:N=>{if(N.pointerId!==x)return;let A=!S&&performance.now()-g<d;if(x=-1,C){C=!1;return}let v=e.gpu(),w=e.pick();if(!A||!v||!w)return;let P=V(N.clientX,N.clientY);if(e.focusedSectionId()&&P>=0){let E=c[P],R=E?l.get(E):void 0;if(R&&R!==e.focusedSectionId()&&h(R))return}if(e.focusedSectionId()&&P<0&&(P=O(N.clientX,N.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&P<0){let E=O(N.clientX,N.clientY,null,72,!1),R=E>=0?c[E]:void 0,z=R?l.get(R):void 0;if(z&&z!==e.focusedSectionId()&&h(z))return}if(!e.focusedSectionId()){P<0&&(P=O(N.clientX,N.clientY,null,42,!1));let E=P>=0?c[P]:void 0,R=E?l.get(E):void 0;if(R&&h(R))return}if(P<0||P>=c.length){e.selection().size&&(p([]),i.onViewTargetChange?.(null));return}let T=c[P],L=xe[Math.round(r.seats.iState[P]??0)]??"available";if(L!=="available"&&L!=="selected"){i.onSeatInspect?.(T,L);return}if(e.selection().has(T)&&e.selection().size===1){p([]),i.onViewTargetChange?.(null);return}p([T]),f(T),s.seatPicked(T,l.get(T)),i.onSeatPick?.(T)}}}var un=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let h=0;h<this.count;h++){let p=t[h*3],f=t[h*3+2];p<n&&(n=p),p>o&&(o=p),f<r&&(r=f),f>i&&(i=f)}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 c=this.cols*this.rows,l=new Int32Array(c+1),u=h=>{let p=Math.min(this.cols-1,Math.max(0,Math.floor((t[h*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[h*3+2]-r)/this.cell)))*this.cols+p};for(let h=0;h<this.count;h++)l[u(h)+1]++;for(let h=0;h<c;h++)l[h+1]+=l[h];let d=new Int32Array(this.count),m=l.slice(0,c);for(let h=0;h<this.count;h++)d[m[u(h)]++]=h;this.cellStart=l,this.cellItems=d}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,l=Math.floor((t-this.minX)/this.cell),u=Math.floor((n-this.minZ)/this.cell),d=Math.ceil(r/this.cell)+1,m=this.iPosition,h=0;for(let p=0;p<=d&&h<s;p++){let f=u-p,b=u+p,y=l-p,g=l+p;for(let x=f;x<=b&&h<s;x++){if(x<0||x>=this.rows)continue;let S=x===f||x===b;for(let C=y;C<=g&&h<s;C++){if(!S&&C!==y&&C!==g){C=g-1;continue}if(C<0||C>=this.cols)continue;let M=x*this.cols+C;for(let k=i[M],O=i[M+1];k<O&&h<s;k++){let V=a[k],U=m[V*3]-t,N=m[V*3+2]-n;U*U+N*N<=c&&(o[h++]=V)}}}}return h}};var dn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Ot);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new un(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){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)<Mn)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>vn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,vn,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(t,n,r){let o=1-Math.exp(-t*9),i=1-Math.exp(-t*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 mn=require("ogl");function ki(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=e,d=0,m=-1,h=(C,M,k=28)=>{o.camera.position.set(C[0],C[1],C[2]),o.camera.lookAt(new mn.Vec3(M[0],M[1],M[2])),o.camera.fov=k,o.camera.updateProjectionMatrix()},p=document.createElement("button");p.className="sl-3d-overview-control sl-3d-icon-control",p.type="button",p.textContent="\u2302",p.setAttribute("aria-label","Fit the active level or whole venue in view"),p.dataset.tooltip="Fit view",Object.assign(p.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let f=()=>{p.textContent="\u2302"};f();let b=C=>{m=C;let M=e.gpu();M&&(M.seatProgram.uniforms.uFocusFloor.value=C,M.solidProgram.uniforms.uFocusFloor.value=C,M.chairProgram.uniforms.uFocusFloor.value=C),e.showSectionSeatLabels(null)},y=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),p.style.display="",c.setVisible(!0),e.setFrozen(!1);let C=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!C),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),C){let M=C.focalWorld[0]-C.center[0],k=C.focalWorld[2]-C.center[2],O=Math.hypot(M,k)>C.radius*.12?Math.atan2(M,k):l,V={center:C.center,radius:C.radius,box:C.box},U={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(V,!1,O,!1,U):o.frameSoft(V,O,!1,U)}else e.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,u):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,u);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{d++,e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=C=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let M=n.seats.idToIndex.get(C);if(M===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(C),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),p.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1),e.setSeatViewLocked(!1);let k=++d;e.removeArriveChip();let{eye:O,focal:V}=e.resolvedSeatViewPose(C,M),U=[o.camera.position.x,o.camera.position.y,o.camera.position.z],N=Xn(U,O,V,n.bounds.center,n.bounds.radius),A=r.arriveAtSeatEye?O:N.finalPos,v=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,w=[N.waypoints[0],N.waypoints[1],A];if(c.setVisible(!1),e.reducedMotion())return h(A,V,v),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(C,k),Promise.resolve();let P=new mn.Quat().copy(o.camera.quaternion),T=di(o.camera,A,V);return s.requestRender(),i.start(w,P,T,2500,v).then(()=>{e.isDisposed()||k!==d||(a.cinematicPlayed(2500),o.resumeAfterFlight(V),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(C,k))})},S=C=>{let M=n.sections.find(U=>U.id===C);if(!M||M.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==M.floorIndex&&b(M.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(C);let k=M.focalWorld[0]-M.center[0],O=M.focalWorld[2]-M.center[2],V=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,V),r.onSectionFocusChange?.(C),s.requestRender(),!0};return p.addEventListener("click",y),{overviewChip:p,layoutOverviewChip:f,flightGen:()=>d,focusedFloor:()=>m,applyFloorFocus:b,placeCameraFinal:h,cancelFlight:g,focusOverview:y,flyToSeat:x,focusSectionCamera:S}}var Cc={};function Li(e){let t=performance.now();return{model:lt(e),buildMs:performance.now()-t,source:"main"}}function Fi(e){return typeof Worker>"u"?Promise.resolve(Li(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",Cc.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(Li(e)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(e)})}var Ac=Math.PI/180,Rc=6,Ic=500;function Ec(e,t,n={}){let r=performance.now(),o=t.prepared?.model??lt(t),i=new ln(n.onAnalytics),a=new Array(o.seats.count);for(let[H,Y]of o.seats.idToIndex)a[Y]=H;let s=new Map(t.seats.map(H=>[H.id,H])),c=new Map;for(let H of t.seats){if(!H.rowId)continue;let Y=c.get(H.rowId);Y?Y.push(H.id):c.set(H.rowId,[H.id])}let l=new Map;for(let H of t.seats)l.set(H.id,H.sectionId);let u=t.doc.floors?.some(Y=>(Y.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&((Y.height??0)>0||(Y.rake??0)>0)),d=null,m=null,h=!1,p=!1,f=!1,b=new Map,y=null,g=null,x=null,S=new Map,C=null,M=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},k=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},O=!1,V=()=>O?me.focusedFloor():-1,U=()=>{d=ti(w.gl,o),m=new tn(w.renderer,d.seatGeometry,d.chairGeometry,d.solidGeometry,o.seats.count),w.setClearColor(o.theme.background.top),m.setRestoreClear(o.theme.background.top),d.seatProgram.uniforms.uSeatRadius.value=Te*o.theme.seatScale,d.seatProgram.uniforms.uFocusFloor.value=V(),d.solidProgram.uniforms.uFocusFloor.value=V(),d.chairProgram.uniforms.uFocusFloor.value=V(),A.forceRegather()},N=!1,A=new dn({model:o,orbit:()=>P,gpu:()=>d}),v=H=>A.setDetailEnabled(H),w=new Ft(e,{onContextLost:()=>{f||i.contextLost(),h=!0,X.stop(),d=null,m=null},onContextRestored:()=>{U(),h=!1,f||i.contextRestored(),X.requestRender()}}),P=new Dt(w.gl,w.canvas,()=>X.requestRender(),()=>i.orbitEngaged());P.setAspect(w.aspect);let T=(t.doc.floors?.flatMap(H=>H.objects)??t.doc.objects).some(H=>H.type==="section"&&H.physical3dProvenance?.surfaceKind?.status==="inferred"),L=(()=>{if(T&&o.stages.length===0)return;let H=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(H,Y)>o.bounds.radius*.12?Math.atan2(H,Y):void 0})(),E=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,R=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;P.frame(o.bounds,!R&&n.skipInitialOverviewAnimation!==!0,L,n.portraitOverviewCrop===!0,E);let z=new nn(P.camera),I=Ri(e),D=new $t(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),B=o.labels,j=()=>Pr(B,o.floors.length,V());D.setLabels(j());let G=null,F=H=>{if(G=H,D.setForcedDense(!!H),!H){D.setLabels(j());return}let Y=t.seats.filter(Q=>Q.sectionId===H),W=new Set(Y.map(Q=>Q.id)),ee=new Set(Y.map(Q=>Q.rowId)),oe=new Set(b.keys()),re=new Set(Y.filter(Q=>oe.has(Q.id)).map(Q=>Q.id)),le=j().filter(Q=>Q.kind!=="row"&&Q.kind!=="seat"||(Q.kind==="row"?ee.has(Q.id.slice(4)):W.has(Q.id.slice(5))&&(re.size===0||re.has(Q.id.slice(5)))));if(o.seatCount<=6e3&&re.size===0){D.setLabels(le);return}let ue=re.size?Y.filter(Q=>re.has(Q.id)):Y,Xe=new Set(ue.map(Q=>`seat:${Q.id}`)),Be=ue.flatMap(Q=>{let he=o.seats.idToIndex.get(Q.id);if(he===void 0)return[];let Pe=he*3;return[{id:`seat:${Q.id}`,kind:"seat",text:Q.displayLabel||Q.label,anchor:[o.seats.iPosition[Pe],o.seats.iPosition[Pe+1]+(oe.has(Q.id)?1.05:.55),o.seats.iPosition[Pe+2]]}]});D.setLabels([...le.filter(Q=>!Xe.has(Q.id)),...Be])};U();let X=new _t(H=>{if(h||!d||p)return!1;let W=z.active?z.update(performance.now()):P.update(),ee=V()>=0?o.floors[V()]:null,oe=ee?.radius??o.bounds.radius,re=po(P.currentDistance,oe),le=N?{center:[P.camera.position.x,P.camera.position.y,P.camera.position.z],radius:520}:o.renderBounds;P.updateClipping(le);let ue=ee?.center??o.renderBounds.center,Xe=ee?.radius??o.renderBounds.radius,Be=(Ce,ht)=>Math.hypot(P.camera.position.x-Ce[0],P.camera.position.y-Ce[1],P.camera.position.z-Ce[2])<=ht*(A.detailVisible?1.8:1.55),Q=Be(ue,Xe);if(!Q&&G){let Ce=o.sections.find(ht=>ht.id===G);Ce&&(Q=Be(Ce.center,Math.max(12,Ce.radius*2)))}A.detailVisible=Q;let he=d.seatProgram.uniforms;he.uSeatScale.value=re.scale,he.uSeatFade.value=re.fade;let Pe=!!ee&&fo(ee.seatCount,w.canvas.clientWidth||1,w.canvas.clientHeight||1),Et=bo(o.seats.count,oe,P.currentDistance,P.camera.fov,w.canvas.clientHeight||1),mt=A.detailVisible||Pe||Et?1:0,Tt=A.detailVisible||V()>=0||o.floors.length>1?1:0;return A.ease(H,mt,Tt),he.uSeatDetail.value=A.seatDetailMix,d.solidProgram.uniforms.uStructureDetail.value=A.structureDetailMix,he.uMinPixels.value=re.minPixels,he.uPixelToWorld.value=2*Math.tan(P.camera.fov*Ac/2)/Math.max(1,w.pixelHeight),A.update(A.detailVisible),w.renderer.render({scene:d.background,clear:!0}),w.renderer.render({scene:d.main,camera:P.camera,clear:!1}),D.update(P.camera.projectionViewMatrix,w.canvas.clientWidth||1,w.canvas.clientHeight||1,P.currentDistance,oe,[P.camera.position.x,P.camera.position.y,P.camera.position.z]),W||A.seatDetailMix!==mt||A.structureDetailMix!==Tt}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>pn.resize()):null;K?.observe(e);let J=H=>{let Y=oe=>{let re=o.seats.idToIndex.get(oe);return re===void 0?void 0:o.seats.iState[re]},{updates:W,next:ee}=ii(b,H,Y);if(b=ee,D.setSelectedSeatIds(b.keys()),G&&F(G),W.length){let oe=In(o.seats,W);d&&d.uploadSeatStateRuns(oe),X.requestRender()}},Z=()=>C!==null?C:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=8,ne=H=>{if(!n.getSeatView)return null;let Y=S.get(H);if(!Y)for(Y=Promise.resolve(n.getSeatView(H)),S.set(H,Y),Y.catch(()=>{S.get(H)===Y&&S.delete(H)});S.size>q;){let W=S.keys().next().value;if(W===void 0)break;S.delete(W)}return Y},je=(H,Y)=>{let W=s.get(H),ee=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),oe=t.doc.floors?.[ee],re=o.floors[ee],le=oe?.focalPoint??t.doc.focalPoint,ue=re?{x:re.focalWorld[0]/_,y:re.focalWorld[2]/_}:le,Xe=W?.focalPoint?{x:W.focalPoint.x+ue.x-le.x,y:W.focalPoint.y+ue.y-le.y}:ue,Be=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return mi(Be,Xe,oe?.baseHeightM??0,W?.eyeHeightM)},Ye=()=>(e.clientWidth||w.canvas.clientWidth)<=520,ve=null,Fe=null,De=async(H,Y,W)=>{if(!n.getSeatView||f||W!==me.flightGen())return;let ee;try{ee=await Ci()}catch{if(i.panoramaFailed(H,"mount"),!f&&W===me.flightGen()){let oe=be(H,W,!0);requestAnimationFrame(()=>oe?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(f||W!==me.flightGen()||!ve))return Fe??=ee.createOpenPanorama(ve),Fe(H,Y,W)},Me=Ii({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:Ye,isDisposed:()=>f,flightGen:()=>me.flightGen(),flyToSeat:H=>Jn(H),openPanorama:(H,Y,W)=>De(H,Y,W)}),be=Me.show,ce=Me.remove,Je=Me.layout,Se=Ei({container:e,orbit:P,isNarrow:Ye}),et=Se.element,we=Se.setNavigationMode,_e=Se.setSeatViewLocked,It=Se.layout,Di=Se.utilityControls,me=ki({container:e,model:o,opts:n,orbit:P,cinematic:z,analytics:i,loop:X,labelOverlay:D,stageAzimuth:L,overviewFraming:E,gpu:()=>d,isDisposed:()=>f,panorama:()=>y,setPanorama:H=>{y=H},setPanoramaSphereVisible:H=>{N=H},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:H=>{g=H},setFrozen:H=>{p=H},restorePanoramaLayer:k,reducedMotion:Z,resolvedSeatViewPose:je,showSectionSeatLabels:F,setNearFieldDetailEnabled:v,setSeatViewLocked:_e,setNavigationMode:we,showArriveChip:be,removeArriveChip:ce});O=!0;let hn=me.overviewChip,_i=me.layoutOverviewChip,Oi=me.applyFloorFocus,Bi=me.focusOverview,$n=me.cancelFlight,Jn=me.flyToSeat,eo=me.focusSectionCamera;Di.appendChild(hn),ve={container:e,model:o,opts:n,analytics:i,orbit:P,loop:X,seatsById:s,ensureSeatView:ne,resolvedSeatViewPose:je,gpu:()=>d,gl:w.gl,isContextLost:()=>h,isDisposed:()=>f,flightGen:()=>me.flightGen(),setPanorama:H=>{y=H},getLoadAbort:()=>g,setLoadAbort:H=>{g=H},setPanoramaSphereVisible:H=>{N=H},setFrozen:H=>{p=H},raisePanoramaLayer:M,restorePanoramaLayer:k,getOverviewChip:()=>hn,labelOverlay:D,reducedMotion:Z,removeArriveChip:ce,showArriveChip:be};let Oe=Ti({glctx:w,orbit:P,model:o,seats:t.seats,opts:n,cinematic:z,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:Rc,tapMs:Ic,gpu:()=>d,pick:()=>m,seatViewLocked:()=>Se.seatViewLocked(),focusedSectionId:()=>G,selection:()=>b,cancelFlight:$n,focusSectionCamera:eo,setSelection:J,ensureSeatView:ne});w.canvas.addEventListener("pointerdown",Oe.onDown),w.canvas.addEventListener("pointermove",Oe.onMove),w.canvas.addEventListener("pointerup",Oe.onUp),w.canvas.addEventListener("pointercancel",Oe.onUp),X.requestRender();let pn={setAvailability(H){let Y=ri(b,H),W=In(o.seats,Y);W.length&&d&&d.uploadSeatStateRuns(W),X.requestRender()},setSelection:J,flyToSeat:Jn,focusOverview:Bi,resize(){let{width:H,height:Y}=w.resize();P.setAspect(H/Math.max(1,Y)),Je(),It(),_i(),X.requestRender()},stats(){return{...X.stats(),drawCalls:d?d.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let H=X.stats(),Y=w.canvas.clientWidth||1,W=w.canvas.clientHeight||1,ee=o.bounds.center,oe=Ve(P.camera.projectionViewMatrix,[ee[0],o.bounds.box.min[1],ee[2]],Y,W),re=Ve(P.camera.projectionViewMatrix,[ee[0],o.bounds.box.max[1],ee[2]],Y,W),le=o.bounds.box,ue=[le.min[0],le.max[0]].flatMap(Q=>[le.min[1],le.max[1]].flatMap(he=>[le.min[2],le.max[2]].map(Pe=>Ve(P.camera.projectionViewMatrix,[Q,he,Pe],Y,W)))).filter(Q=>Number.isFinite(Q.x)&&Number.isFinite(Q.y)&&Number.isFinite(Q.depth)),Xe=ue.length?(()=>{let Q=Math.min(...ue.map(We=>We.x)),he=Math.max(...ue.map(We=>We.x)),Pe=Math.min(...ue.map(We=>We.y)),Et=Math.max(...ue.map(We=>We.y)),mt=Math.max(0,Q),Tt=Math.min(Y,he),Ce=Math.max(0,Pe),ht=Math.min(W,Et),kt=Math.max(0,Tt-mt),fn=Math.max(0,ht-Ce);return{box:{x:mt,y:Ce,width:kt,height:fn},horizontalFillRatio:kt/Y,verticalFillRatio:fn/W,visibleAreaRatio:kt*fn/(Y*W),clippedEdges:[...Pe<0?["top"]:[],...he>Y?["right"]:[],...Et>W?["bottom"]:[],...Q<0?["left"]:[]]}})():void 0,Be=String(w.gl.getParameter(w.gl.VERSION)??"");return{viewport:{width:Y,height:W},context:{webgl2:/webgl\s*2/i.test(Be),lost:h},frame:{rendered:H.rendered,idle:H.idle},camera:{position:[P.camera.position.x,P.camera.position.y,P.camera.position.z],distance:P.currentDistance,verticalFovDeg:P.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:u,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:oe.visible&&re.visible?Math.abs(oe.y-re.y):0},labels:D.qualityEvidence(),framing:Xe}},getQualityReport(){return Jt(pn.getQualityEvidence())},loseContextForTest(){w.simulateContextLossCycle()},floors(){return o.floors},focusFloor(H){if(H!==null&&!o.floors.some(W=>W.index===H))return!1;let Y=H??-1;if(v(H!==null),_e(!1),Oi(Y),we("orbit"),H===null)z.cancel(),Z()?P.frame(o.bounds,!1,L,n.portraitOverviewCrop===!0,E):P.frameSoft(o.bounds,L,n.portraitOverviewCrop===!0,E);else{let W=o.floors[H];if(W.seatCount>0){z.cancel();let ee=W.focalWorld[0]-W.center[0],oe=W.focalWorld[2]-W.center[2],re=Math.hypot(ee,oe)>W.radius*.12?Math.atan2(ee,oe):L;P.frame({center:W.center,radius:W.radius,box:W.box},!1,re,!1,{polarDeg:58,margin:1.12})}}return X.requestRender(),!0},zones(){return o.zones},focusZone(H){let Y=o.zones.find(re=>re.id===H);if(!Y||Y.seatCount===0)return!1;v(!1),_e(!1),z.cancel(),we("orbit"),F(null),n.onSectionFocusChange?.(null);let W=Y.focalWorld[0]-Y.center[0],ee=Y.focalWorld[2]-Y.center[2],oe=Math.hypot(W,ee)>Y.radius*.12?Math.atan2(W,ee):void 0;return P.frame({center:Y.center,radius:Y.radius*1.25},!1,oe),X.requestRender(),!0},sections(){return o.sections},focusSection(H){return eo(H)},rows(H){return H?o.rows.filter(Y=>Y.sectionId===H):o.rows},seatsInRow(H){return t.seats.filter(Y=>Y.rowId===H).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(H){let Y=o.rows.find(W=>W.id===H);return!Y||Y.seatCount===0?!1:(v(!0),_e(!1),z.cancel(),we("pan"),Y.sectionId&&(F(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),P.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),X.requestRender(),!0)},setReducedMotionForTest(H){C=H},dispose(){f=!0,ce(),hn.remove(),et.remove(),$n(),X.stop(),D.dispose(),K?.disconnect(),y&&(y.dispose(),y=null),k(),I(),w.canvas.removeEventListener("pointerdown",Oe.onDown),w.canvas.removeEventListener("pointermove",Oe.onMove),w.canvas.removeEventListener("pointerup",Oe.onUp),w.canvas.removeEventListener("pointercancel",Oe.onUp),P.dispose(),m&&m.dispose(),d&&d.dispose(),d=null,m=null,w.dispose()}};return i.opened(o.seatCount,u,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),pn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});
|