@seatlayer/core 0.58.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ar-H46G25IW.js +1 -0
- package/dist/be-X2N4CNF6.js +1 -0
- package/dist/bg-WAFRHN4U.js +1 -0
- package/dist/ca-KJY6UBX2.js +1 -0
- package/dist/{categoryInventory-BwarniiK.d.ts → categoryInventory-B-0p5PBr.d.ts} +1 -1
- package/dist/{categoryInventory-D3qPwfKz.d.cts → categoryInventory-DjFHXtp6.d.cts} +1 -1
- package/dist/{chunk-4BVXDBFE.js → chunk-ATFAQDPR.js} +1 -1
- package/dist/chunk-CNCFI5RT.js +1 -0
- package/dist/chunk-FOYQOIWG.js +1 -0
- package/dist/{chunk-66HGMU7D.js → chunk-IZTHA3X2.js} +1 -1
- package/dist/{chunk-N4CBOQFB.js → chunk-P2NJ6UO6.js} +1 -1
- package/dist/chunk-T2LWVOQ3.js +1 -0
- package/dist/{chunk-6XJN4REG.js → chunk-VI3IZS2B.js} +1 -1
- package/dist/{chunk-IRFG5DVH.js → chunk-VOJMGPDK.js} +1 -1
- package/dist/{chunk-PMU3VPNK.js → chunk-XU73MULJ.js} +1 -1
- package/dist/core/cdnAsset.cjs +1 -0
- package/dist/core/cdnAsset.d.cts +35 -0
- package/dist/core/cdnAsset.d.ts +35 -0
- package/dist/core/cdnAsset.js +1 -0
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.d.cts +5 -5
- package/dist/core/chart-ops/index.d.ts +5 -5
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.d.cts +4 -4
- package/dist/core/inventory/index.d.ts +4 -4
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.cjs +1 -1
- package/dist/core/layout/index.d.cts +4 -4
- package/dist/core/layout/index.d.ts +4 -4
- package/dist/core/layout/index.js +1 -1
- package/dist/core/quality/index.d.cts +3 -3
- package/dist/core/quality/index.d.ts +3 -3
- package/dist/core/render-assets/index.d.cts +1 -1
- package/dist/core/render-assets/index.d.ts +1 -1
- package/dist/core/seatConfidence.d.cts +1 -1
- package/dist/core/seatConfidence.d.ts +1 -1
- package/dist/core/sections/index.cjs +1 -1
- package/dist/core/sections/index.d.cts +5 -5
- package/dist/core/sections/index.d.ts +5 -5
- package/dist/core/sections/index.js +1 -1
- package/dist/cs-6DGE2CXL.js +1 -0
- package/dist/cy-IN3H2JGF.js +1 -0
- package/dist/da-CW77LCG4.js +1 -0
- package/dist/{de-JS2HQ675.js → de-BTL7PM4X.js} +1 -1
- package/dist/el-TWE62U4P.js +1 -0
- package/dist/es-EJCQGGF7.js +1 -0
- package/dist/et-UQ6VFRG2.js +1 -0
- package/dist/fa-A5636YDV.js +1 -0
- package/dist/fi-6YNSAFLB.js +1 -0
- package/dist/fr-TGUAIAOM.js +1 -0
- package/dist/he-PAFZSFIR.js +1 -0
- package/dist/hr-SIQR4W7D.js +1 -0
- package/dist/hu-YBOAMZ2D.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +125 -41
- package/dist/index.d.ts +125 -41
- package/dist/index.js +1 -1
- package/dist/it-KCSKVAKE.js +1 -0
- package/dist/ja-4454OUK5.js +1 -0
- package/dist/ku-JPB5LQ72.js +1 -0
- package/dist/{labeling-BmCzW50y.d.ts → labeling-BPCTQfDG.d.ts} +1 -1
- package/dist/{labeling-VfJBEOn0.d.cts → labeling-iVwhgoip.d.cts} +1 -1
- package/dist/{layout-ClQkmixY.d.ts → layout-D-R46h1m.d.ts} +40 -4
- package/dist/{layout-Dlv5bIf2.d.cts → layout-Vk2ZGdMS.d.cts} +40 -4
- package/dist/localeLoaders-KUIWB7O3.js +1 -0
- package/dist/lt-54TNW6YF.js +1 -0
- package/dist/lv-TJ75JL4U.js +1 -0
- package/dist/nl-B67UFSMM.js +1 -0
- package/dist/no-6JQSRSCX.js +1 -0
- package/dist/pl-MKZX6GFZ.js +1 -0
- package/dist/pt-F2GLS7QA.js +1 -0
- package/dist/{renderedQuality-B3jgdgPO.d.ts → renderedQuality-CsXNQCCH.d.ts} +1 -1
- package/dist/{renderedQuality-bDkUOyBL.d.cts → renderedQuality-h9RvUWMo.d.cts} +1 -1
- package/dist/{renderer-B_g-W_QB.d.ts → renderer-Bo9JzqMA.d.ts} +46 -8
- package/dist/{renderer-DySMcKAR.d.cts → renderer-QnB3a1yh.d.cts} +46 -8
- package/dist/ro-2WKWAK7S.js +1 -0
- package/dist/ru-I7I76LMP.js +1 -0
- package/dist/{sections-DIzgtDjF.d.ts → sections-9_Ka3i-z.d.ts} +1 -1
- package/dist/{sections-Dna1nZgR.d.cts → sections-Dmjtj1BQ.d.cts} +1 -1
- package/dist/{segmentedRowModel-COXw4GCh.d.ts → segmentedRowModel-CO6Jogaa.d.ts} +1 -1
- package/dist/{segmentedRowModel-BNXEUeHp.d.cts → segmentedRowModel-s157HmRp.d.cts} +1 -1
- package/dist/sk-6ERFVKXJ.js +1 -0
- package/dist/sl-AVE6GE3D.js +1 -0
- package/dist/sr-D5KFFJNW.js +1 -0
- package/dist/sv-JJ7HXVOK.js +1 -0
- package/dist/{ticketRestrictions-CzchbX_o.d.cts → ticketRestrictions-DetdPbsL.d.cts} +2 -2
- package/dist/{ticketRestrictions-DaYOCpEw.d.ts → ticketRestrictions-EJTEWPGN.d.ts} +2 -2
- package/dist/tr-KKJMU4QY.js +1 -0
- package/dist/{types-DTSG6_Hq.d.cts → types-Db9rXT14.d.cts} +155 -1
- package/dist/{types-DTSG6_Hq.d.ts → types-Db9rXT14.d.ts} +155 -1
- package/dist/uk-KX5ZFXAR.js +1 -0
- package/dist/view3d/crossfade/panorama.d.cts +1 -1
- package/dist/view3d/crossfade/panorama.d.ts +1 -1
- package/dist/view3d/index.cjs +21 -21
- package/dist/view3d/index.d.cts +2 -2
- package/dist/view3d/index.d.ts +2 -2
- package/dist/view3d/index.js +23 -23
- package/dist/zh-Hans-TTCOG4UW.js +1 -0
- package/dist/zh-Hant-37V5VMCE.js +1 -0
- package/package.json +19 -2
- package/dist/chunk-GHJUDU3U.js +0 -1
- package/dist/es-XJUREIJL.js +0 -1
- package/dist/fr-CAT46QLZ.js +0 -1
package/dist/view3d/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";var gi=Object.create;var Tt=Object.defineProperty;var xi=Object.getOwnPropertyDescriptor;var vi=Object.getOwnPropertyNames;var Mi=Object.getPrototypeOf,Si=Object.prototype.hasOwnProperty;var wi=(e,t)=>{for(var n in t)Tt(e,n,{get:t[n],enumerable:!0})},Yn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of vi(t))!Si.call(e,o)&&o!==n&&Tt(e,o,{get:()=>t[o],enumerable:!(r=xi(t,o))||r.enumerable});return e};var et=(e,t,n)=>(n=e!=null?gi(Mi(e)):{},Yn(t||!e||!e.__esModule?Tt(n,"default",{value:e,enumerable:!0}):n,e)),Pi=e=>Yn(Tt({},"__esModule",{value:!0}),e);var lc={};wi(lc,{VENUE3D_QUALITY_REPORT_VERSION:()=>Tr,buildSceneModel:()=>ct,inspectVenue3DQualityEvidence:()=>qt,mountVenue3D:()=>cc,prepareVenue3D:()=>pi});module.exports=Pi(lc);var $n=require("ogl");var Ci=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ai(e){let t=Ci.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=Ai(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function mn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Ri(e){return .2126*mn(e[0])+.7152*mn(e[1])+.0722*mn(e[2])}function Wn(e){return Ri([e[0]*255,e[1]*255,e[2]*255])}function Ii(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 pt(e,t){let n=Ii(e);return pe(e,[n,n,n],t)}var ge=["available","held","sold","selected","dimmed"];function ht(e){let t=ge.indexOf(e);return t<0?0:t}var Kn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function qn(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 fn={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 Ei(){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 Dt=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 $n.Renderer({canvas:this.canvas,dpr:Ei(),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,pn=15*de,hn=80*de,tt=.12,Zn=35,Qn=1.25,Ft=class{constructor(t,n,r,o){this.fovY=Zn;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:Zn,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(pn,Math.min(hn,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(pn,Math.min(hn,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??Qn)),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??Qn))}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 f=-m,p=u,h=Math.hypot(f,p);f/=h,p/=h;let b=-p*d,y=p*u-f*m,g=f*d,x=Math.tan(r),P=Math.tan(n),R=1;for(let S=0;S<8;S++){let D=(S&1?c.max[0]:c.min[0])-t.center[0],B=(S&2?c.max[1]:c.min[1])-t.center[1],V=(S&4?c.max[2]:c.min[2])-t.center[2],H=D*u+B*d+V*m,O=Math.abs(D*f+V*p),M=Math.abs(D*b+B*y+V*g);R=Math.max(R,O/x-H,M/P-H)}return Math.min(s,Math.max(R,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(pn,Math.min(hn,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 kt=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,Ti=1.15,bt=6,rt=10,Jn=6,eo=9.5,to=.9,no=2.2,bn=30,yn=4,Lt=8192;var gc=rt+yn;function oo(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*(Ti-ot)}}function ro(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function io(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 Di=[{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"}],vc=new Map(Di.map(e=>[e.key,e]));var Fi={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 ao(e){let t=e?.[0];return t&&Fi[t]||"#3b82f6"}var ki=[{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"}],Mc=new Map(ki.map(e=>[e.key,e]));var Li=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Sc=new Set(Li);var we=.02291666666666667,Be=1/we,_i=58,Oi=_i*we;var Bi=3,so=0,gn=120,Ni=0,Vi=45,zi=7,_t=1.2;function xn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Gi(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=zi?e:Bi}function co(e,t={}){let n=xn(t.floorBaseHeightM,so,gn,0),r=Math.min(gn,n+Gi(e.elevation)*Oi),o=e.height===void 0?r:xn(e.height,so,gn,r),i=xn(e.rake,Ni,Vi,0);return{height:o,rake:i}}var uo=et(require("earcut"),1),mo=et(require("polygon-clipping"),1);var Rc=Math.PI/180;function vn(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?vn(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 L=we,Hi=.002;function Ui(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<Hi}var $e=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 $e;this.nor=new $e;this.col=new $e;this.flr=new $e;this.mat=new $e;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){Ui(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 ji(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 Xi(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,uo.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Mn(e){return qe(e)<0?[...e].reverse():e}var Yi=3;function Wi(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(f,p,h,b)=>Math.abs(r({x:(f.x+p.x)/2,y:(f.y+p.y)/2})-(h+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=(f,p,h)=>{let b=Math.abs(r({x:(f+c)/2,y:(p+l)/2})-(h+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 Wi(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},f={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};vt(e,t,m,p,o,i,a-1,s),vt(e,m,n,f,o,i,a-1,s),vt(e,p,f,r,o,i,a-1,s),vt(e,m,f,p,o,i,a-1,s);return}let c=[t.x*L,o(t),t.y*L],l=[n.x*L,o(n),n.y*L],u=[r.x*L,o(r),r.y*L];if(s){e.triN(c,l,u,s(t),s(n),s(r),i);return}let d=ji(c,l,u);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),e.tri(c,l,u,d,i)}var Ki=8;function lo(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),Ki)}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 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=Ot(lo(Ot(Mn(t),Bt),r,c),Bt),d=n?.map(S=>Ot(lo(Ot(Mn(S),Bt),r,c),Bt)).filter(S=>S.length>=3&&Math.abs(qe(S))>=1e-4),{pts:m,tris:f}=Xi(u,d),p=[i[0]*s.top,i[1]*s.top,i[2]*s.top],h=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<Yi;g++){let S=0;for(let D=0;D<f.length;D+=3){let B=xt(m[f[D]],m[f[D+1]],m[f[D+2]],r,g);B>S&&(S=B)}if(S<=c)break}for(let S=0;S<f.length;S+=3){let D=m[f[S]],B=m[f[S+1]],V=m[f[S+2]];vt(e,D,B,V,r,p,g,l);let H=[D.x*L,o,D.y*L],O=[B.x*L,o,B.y*L],M=[V.x*L,o,V.y*L];e.tri(H,M,O,[0,-1,0],h)}let x=S=>{if(g<=0)return S;let D=1<<g,B=[];for(let V=0;V<S.length;V++){let H=S[V],O=S[(V+1)%S.length];for(let M=0;M<D;M++){let v=M/D;B.push({x:H.x+(O.x-H.x)*v,y:H.y+(O.y-H.y)*v})}}return B},P=vn(u),R=[{ring:x(u),flip:!1}];if(d)for(let S of d)S.length>=3&&R.push({ring:x(S),flip:!0});for(let{ring:S,flip:D}of R)for(let B=0;B<S.length;B++){let V=S[B],H=S[(B+1)%S.length],O=(H.x-V.x)*L,v=(H.y-V.y)*L,A=-O,w=Math.hypot(v,A)||1;v/=w,A/=w;let _=(V.x+H.x)/2-P.x,C=(V.y+H.y)/2-P.y,F=v*_+A*C;D&&(F=-F),F<0&&(v=-v,A=-A);let I=[v,0,A],z=[V.x*L,r(V),V.y*L],E=[H.x*L,r(H),H.y*L],k=[V.x*L,o,V.y*L],G=[H.x*L,o,H.y*L];e.tri(z,E,G,I,b,b,y),e.tri(z,G,k,I,b,y,y)}}function fo(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 Vt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Mn(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,f=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(f<1e-9){p();continue}d/=f,m/=f;let h=d*l.x+m*l.y,b=1/Math.max(h,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=mo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let d of s){let m=Math.abs(qe(d[0].map(([f,p])=>({x:f,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 zt(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 le={pedestal:0,pad:1,back:2,body:3,head:4},qi=.44,$i=.15,Zi=.3,Qi=.24;function po(e){return e===void 0||!Number.isFinite(e)||e<=0?Qi:Math.min(Zi,Math.max($i,e*qi))}var Sn=.21,Ji=.05,wn=.45,Gt=wn+Ji,ea=[{part:le.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:le.pad,min:[-1,.36,-.95],max:[1,wn,1]},{part:le.back,min:[-1,Gt,-1],max:[1,.92,-.72]}],ta=[{part:le.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:le.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:le.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:le.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:le.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],na=[{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 ho(){let e=[],t=[],n=[],r=[],o=(w,_,C)=>{let F=n.length,[I,z,E]=w,k=[z[0]-I[0],z[1]-I[1],z[2]-I[2]],G=[E[0]-I[0],E[1]-I[1],E[2]-I[2]],X=k[1]*G[2]-k[2]*G[1],N=k[2]*G[0]-k[0]*G[2],T=k[0]*G[1]-k[1]*G[0],Y=Math.hypot(X,N,T);Y>1e-9?(X/=Y,N/=Y,T/=Y):[X,N,T]=_,X*_[0]+N*_[1]+T*_[2]<0&&(X=-X,N=-N,T=-T);for(let K of w)e.push(...K),t.push(X,N,T),n.push(C);r.push(F,F+1,F+2,F,F+2,F+3)},i=w=>{for(let _ of na){let C=_.c.map(F=>F.map((I,z)=>I?w.max[z]:w.min[z]));o(C,_.n,w.part)}};for(let w of ea)i(w);for(let w of ta)i(w);let a=wn,s=1.08,c=.47,l=.69,u=-.55,d=.08,m=-.48,f=.01,p=[-c,a,u],h=[c,a,u],b=[-c,a,d],y=[c,a,d],g=[-l,s,m],x=[l,s,m],P=[-l,s,f],R=[l,s,f];o([h,x,R,y],[1,0,0],le.body),o([b,P,g,p],[-1,0,0],le.body),o([P,R,x,g],[0,1,0],le.body),o([p,h,y,b],[0,-1,0],le.body),o([y,R,P,b],[0,0,1],le.body),o([p,g,x,h],[0,0,-1],le.body);let S=10,D=8,B=[0,1.205,-.23],V=[.42,.115,.38],H=n.length;for(let w=0;w<=D;w++){let _=Math.PI*w/D,C=Math.cos(_),F=Math.sin(_);for(let I=0;I<=S;I++){let z=Math.PI*2*I/S,E=F*Math.cos(z),k=F*Math.sin(z);e.push(B[0]+V[0]*E,B[1]+V[1]*C,B[2]+V[2]*k);let G=E/V[0],X=C/V[1],N=k/V[2],T=Math.hypot(G,X,N)||1;G/=T,X/=T,N/=T,t.push(G,X,N),n.push(le.head)}}for(let w=0;w<D;w++)for(let _=0;_<S;_++){let C=H+w*(S+1)+_,F=C+S+1;r.push(C,F,C+1,C+1,F,F+1)}let O=new Float32Array(e),M=new Float32Array(t),v=new Float32Array(n),A=new Uint16Array(r);return{position:O,normal:M,part:v,index:A,vertexCount:n.length,indexCount:r.length}}function bo(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[f,p]=r(m),h=f-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),P=a(g)-a(y),R=Math.hypot(x,P);if(R>1e-6){let S=-P/R,D=x/R;S*h+D*b<0&&(S=-S,D=-D),h=S,b=D}}o[m]=h===0&&b===0?0:Math.atan2(h,b)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var De=.22;function yo(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 oa=.42;function ra(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,f=(p,h)=>{let b=Math.min(u-1,Math.max(0,Math.floor((p-r)/l)));return Math.min(d-1,Math.max(0,Math.floor((h-o)/l)))*u+b};for(let p=0;p<t;p++){let h=f(e[p].x,e[p].y),b=m.get(h);b?b.push(p):m.set(h,[p])}for(let p=0;p<t;p++){let h=e[p],b=Math.min(u-1,Math.max(0,Math.floor((h.x-r)/l))),y=Math.min(d-1,Math.max(0,Math.floor((h.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let P=y-x;P<=y+x;P++)if(!(P<0||P>=d))for(let R=b-x;R<=b+x;R++){if(R<0||R>=u||x>1&&Math.abs(P-y)<x&&Math.abs(R-b)<x)continue;let S=m.get(P*u+R);if(S)for(let D of S){if(D===p)continue;let B=Math.hypot(e[D].x-h.x,e[D].y-h.y);B<g&&(g=B)}}if(Number.isFinite(g)&&g<=x*l)break}n[p]=g}return n}function ia(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-_t):0}function go(e,t,n,r,o){let i=e.length,a=new Float32Array(i*3),s=new Float32Array(i),c=new Float32Array(i*3),l=new Float32Array(i),u=new Float32Array(i),d=new Float32Array(i),m=new Float32Array(i*3),f=new Map,p=ra(e);for(let h=0;h<i;h++){let b=e[h],g=(n?.seatPitchU(h)??p[h])*L;l[h]=Number.isFinite(g)?Math.max(.06,Math.min(De,g*oa)):De,u[h]=po(Number.isFinite(g)?g:void 0),d[h]=b.wheelchairSpaceType==="no-seat"?0:1,a[h*3]=b.x*L,a[h*3+1]=n?n.seatDeckY(h):ia(b),a[h*3+2]=b.y*L,s[h]=ht(t?t(b):"available");let x=ee(o?.get(b.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[h*3]=x[0],c[h*3+1]=x[1],c[h*3+2]=x[2],b.accessibility?.length){let P=ee(ao(b.accessibility));P&&(m[h*3]=P[0],m[h*3+1]=P[1],m[h*3+2]=P[2])}f.set(b.id,h)}return{count:i,iPosition:a,iState:s,iCategory:c,iMaxRadius:l,iRing:m,idToIndex:f,iChairWidth:u,iPhysicalSeat:d,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var aa=64;function Pn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=ht(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 sa=.15,ca=.9,la=1.76,ua=.7,da=1.6;function ma(){return{background:{top:[...Ke.top],bottom:[...Ke.bottom]},structure:fn,seatStates:{...Kn},seatScale:1}}function xo(e){let t=ma();if(!e)return t;let n=ee(e.background);if(n){t.background={top:be(n,ca),bottom:be(n,la)};let i={};for(let[a,s]of Object.entries(fn))i[a]=pe(s,n,sa);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(da,Math.max(ua,o))),t}function vo(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Mo(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 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 So(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Cn(e,t){let n=1/0;for(let r of Mo(e)){let o=it(t,r.x,r.y);o<n&&(n=o)}for(let r of Mo(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 An(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,P=g.y-r;o+=x*x,a+=P*P,i+=x*P,s+=x*x*x,c+=P*P*P,l+=x*P*P,u+=P*x*x}let d=o*a-i*i;if(Math.abs(d)<1e-9)return null;let m=(s+l)/2,f=(c+u)/2,p=(m*a-f*i)/d,h=(f*o-m*i)/d,b=p+n,y=h+r;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var ha=.15;function ba(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,P=0;for(let R of g.pts)x+=R.x,P+=R.y;return{x:x/g.pts.length,y:P/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,P=g.y-r;o+=x*x,i+=x*P,a+=P*P}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 f=1/0,p=-1/0,h=[];for(let g of e){let x=1/0,P=-1/0;for(let R of g.pts){let S=R.x*u+R.y*d;S<x&&(x=S),S>P&&(P=S),S<f&&(f=S),S>p&&(p=S)}h.push(P-x)}let b=p-f;return b>1e-9?(h.sort((g,x)=>g-x),h[Math.min(h.length-1,Math.floor(h.length*.9))]/b<=ya?{x:u,y:d}:null):null}var ya=.35;function wo(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 P of g.pts)x+=Math.hypot(P.x-r.x,P.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||So(a[b],a[g])>=y)continue;let x=Cn(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++)So(a[b],a[y])>l||Cn(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 P of u[x])i[P].blockId===-1&&(i[P].blockId=y,g.push(P))}}let m=new Map;for(let b of i){let y=m.get(b.blockId)??[];y.push(b),m.set(b.blockId,y)}let f=[];for(let b of i){if(b.pts.length<4)continue;let y=An(b.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||f.push({x:y.cx,y:y.cy}))}let p=f.length>=2?(()=>{let b=f.map(x=>x.x).sort((x,P)=>x-P),y=f.map(x=>x.y).sort((x,P)=>x-P),g=Math.floor(f.length/2);return{cx:b[g],cy:y[g]}})():null;if(p){let b=S=>Math.hypot(S.x-p.cx,S.y-p.cy),y=1/0,g=-1/0,x=[];for(let S of i){let D=1/0,B=-1/0;for(let V of S.pts){let H=b(V);H<D&&(D=H),H>B&&(B=H)}x.push(B-D),D<y&&(y=D),B>g&&(g=B)}let P=g-y;x.sort((S,D)=>S-D);let R=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(P>1e-9&&R/P<=ha){let S=i.map(w=>{let _=0;for(let C of w.pts)_+=b(C);return{row:w,radius:_/w.pts.length}}),D=S[0],B=S[0];for(let w of S)w.radius<D.radius&&(D=w),w.radius>B.radius&&(B=w);if(D.row.focalDistance>B.row.focalDistance)for(let w of S)w.radius=-w.radius;let H=1/0;for(let w of S)w.radius<H&&(H=w.radius);S.sort((w,_)=>w.radius-_.radius);let O=-1,M=-1/0,v=P/Math.max(1,S.length)*.5,A=[];for(let w of S)w.radius-M>v&&(O++,M=w.radius),w.row.ordinal=O,w.row.blockDepth=w.radius-H,A.push(w.row);return{sectionId:e,rows:A,blockCount:d}}}let h=[];for(let[,b]of m){let y=ba(b);if(y){let g=P=>{let R=0;for(let S of P.pts)R+=S.x*y.x+S.y*y.y;return R/P.pts.length};b.sort((P,R)=>g(P)-g(R)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let x=0;for(let P=0;P<b.length;P++)P>0&&(x+=Cn(b[P-1].pts,b[P].pts)),b[P].ordinal=P,b[P].blockDepth=x,h.push(b[P])}else{let g=1/0;for(let x of b)x.focalDistance<g&&(g=x.focalDistance);b.sort((x,P)=>x.focalDistance-P.focalDistance);for(let x=0;x<b.length;x++)b[x].ordinal=x,b[x].blockDepth=Math.max(0,b[x].focalDistance-g),h.push(b[x])}}return{sectionId:e,rows:h,blockCount:d}}var Xc=Math.PI/180;function Po(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 ga(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 Co(e,t,n){return Po(e,t)&&!(n??[]).some(r=>Po(e,r)||ga(e,r))}function xa(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 f of e)n+=f.x,r+=f.y,o+=Math.hypot(f.x-t.x,f.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let f of e){let p=Math.hypot(f.x-n,f.y-r);p>s&&(s=p,a=f)}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((f,p)=>(f.x-n)*c+(f.y-r)*l-((p.x-n)*c+(p.y-r)*l)),m=0;for(let f of d){let p=Math.hypot(f.x-n,f.y-r);p>m&&(m=p)}return{pts:d,cx:n,cy:r,radius:m,depth:o}}function Ao(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 Ma(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 f=0;f<Ht;f++)if(m<r[f]){for(let p=Ht-1;p>f;p--)r[p]=r[p-1],o[p]=o[p-1];r[f]=m,o[f]=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=Ao(e[u],t,n);for(let m=0;m<3;m++)if(d<i[m]){for(let f=2;f>m;f--)i[f]=i[f-1],a[f]=a[f-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 Sa(e){let t=(r,o)=>Ma(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=Ao(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 Ro(e,t){let n=[];for(let r of e){let o=va(r.points,t);o&&n.push(o)}return n.length<2?xa(t):(n.sort((r,o)=>r.depth-o.depth),Sa(n))}var En=et(require("polygon-clipping"),1);var Do=et(require("earcut"),1);var wa=.58,Io=.01,ye=De*1.5*Be,Pa=.5,Ca=.6;function Aa(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 Ra(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 Eo=Math.PI/12;function Ia(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 Fo(e,t){if(!e.length||!(t>0))return[];let n=Ia(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/Eo)),f=t/Math.cos(d/m/2);for(let p=0;p<=m;p++){let h=c+d*p/m;u.push({x:s.x+Math.cos(h)*f,y:s.y+Math.sin(h)*f})}};if(n.length<3){let s=0,c=0;for(let f of n)s+=f.x,c+=f.y;s/=n.length||1,c/=n.length||1;let l=0;for(let f of n)l=Math.max(l,Math.hypot(f.x-s,f.y-c));let u=[],d=Math.max(3,Math.ceil(Math.PI*2/Eo)),m=(l+t)/Math.cos(Math.PI/d);for(let f=0;f<d;f++){let p=f/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 Bo(a)}function Ea(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 f=t[m],p=Math.hypot(u.x-f.cx,u.y-f.cy)-f.rad;if(p>=d&&p>=s)continue;let h=Ea(e[m].pts,u.x,u.y);h<d&&(d=h),e[m].depth<e[o].depth&&h<s&&(s=h,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 ko(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,f=Math.hypot(d,m)||1;d/=f,m/=f;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=Ra(i,Math.max(c*Ca,ye));return{pts:l,nrm:Aa(l,r),front:Math.max(n[t].pitch*wa,ye),back:Math.max(n[t].pitch*Pa,ye)}}var at=1.5,Lo=.3;function Rn(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],f=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);f>s&&(s=f,c=d)}if(s<=t||c<0)return[n,r];let l=Rn(e.slice(0,c+1),t),u=Rn(e.slice(c),t);return[...l.slice(0,-1),...u]}function _o(e,t){if(e.length<4)return e;let n=Rn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Oo(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=>ko(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],f=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=f.pts.length-1;g>=0;g--)p.push(d(f,g));for(let g=l.length-1;g>=0;g--)p.push(u(l[g],0));let h=Bo(p),b=1/0;for(let g of s)e[g].y<b&&(b=e[g].y);if(!Number.isFinite(b))continue;if(h.length>=3&&Math.abs(qe(h))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return gt(h,x.x,x.y)})){i.push({outline:_o(h,Lo),holes:[],topY:b});continue}for(let g of Ta(l))i.push({outline:g,holes:[],topY:b})}return i}function Ta(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=En.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(_o(i,Lo))}return r}catch{return[]}}function Bo(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 In=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 To(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],f=r[d+1];e.tri([u.x*L,o,u.y*L],[m.x*L,o,m.y*L],[f.x*L,o,f.y*L],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=En.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 f=(0,Do.default)(d,void 0,2);for(let p=0;p<f.length;p+=3){let h=m[f[p]],b=m[f[p+1]],y=m[f[p+2]];e.tri([h[0]*L,o,h[1]*L],[b[0]*L,o,b[1]*L],[y[0]*L,o,y[1]*L],c,i)}}}function No(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(f=>[f.x,f.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new In([[...i]]):null,d=f=>{e.setMaterial(2),f(),e.setMaterial(0)},m=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let p=t[f];if(p.patch&&p.patch.length>=3){let R=[...p.patch],S=s[f].belowY??r;if(m(()=>{if(l&&u)To(e,l,u,R,p.y,o.tread);else{let D=R[0];for(let B=1;B+1<R.length;B++){let V=R[B],H=R[B+1];e.tri([D.x*L,p.y,D.y*L],[V.x*L,p.y,V.y*L],[H.x*L,p.y,H.y*L],c,o.tread)}}}),p.y>S+Io){let D=0,B=0;for(let V of R)D+=V.x,B+=V.y;D/=R.length,B/=R.length,d(()=>{for(let V=0;V<R.length;V++){let H=R[V],O=R[(V+1)%R.length],M=O.x-H.x,v=O.y-H.y,A=Math.hypot(M,v);if(A<1e-6)continue;let w=v/A,_=-M/A;(H.x-D)*w+(H.y-B)*_<0&&(w=-w,_=-_);let C=[w,0,_],F=[H.x*L,p.y,H.y*L],I=[O.x*L,p.y,O.y*L],z=[H.x*L,S,H.y*L],E=[O.x*L,S,O.y*L];e.tri(F,I,E,C,o.riser),e.tri(F,E,z,C,o.riser)}})}continue}let h=ko(t,f,s,n);if(!h)continue;let{pts:b,nrm:y,front:g,back:x}=h,P=s[f].belowY??r;for(let R=0;R+1<b.length;R++){let S=b[R],D=b[R+1],B=y[R],V=y[R+1];if(Math.hypot(D.x-S.x,D.y-S.y)<1e-6||B[0]===0&&B[1]===0||V[0]===0&&V[1]===0)continue;let H=[(S.x-B[0]*g)*L,p.y,(S.y-B[1]*g)*L],O=[(D.x-V[0]*g)*L,p.y,(D.y-V[1]*g)*L],M=[(S.x+B[0]*x)*L,p.y,(S.y+B[1]*x)*L],v=[(D.x+V[0]*x)*L,p.y,(D.y+V[1]*x)*L];if(m(()=>{l&&u?To(e,l,u,[{x:S.x-B[0]*g,y:S.y-B[1]*g},{x:D.x-V[0]*g,y:D.y-V[1]*g},{x:D.x+V[0]*x,y:D.y+V[1]*x},{x:S.x+B[0]*x,y:S.y+B[1]*x}],p.y,o.tread):(e.tri(H,O,v,c,o.tread),e.tri(H,v,M,c,o.tread))}),p.y>P+Io){let A=[H[0],P,H[2]],w=[O[0],P,O[2]],_=[-B[0],0,-B[1]];d(()=>{e.tri(H,O,w,_,o.riser),e.tri(H,w,A,_,o.riser)})}}}}function Vo(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 Tn=et(require("polygon-clipping"),1);function Da(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function zo(e,t){return e.filter(n=>n.type!=="shape"||Da(n,t))}function Go(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:zo(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:zo(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Fa={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function st(e){return Vo(e)??Fa}function Ho(e,t){let n=Vt(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=Tn.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 Uo(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=Tn.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 ka=.05,jo=.05,La=.15,Dn=25;function Xo(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 f of m.objects){if(f.type==="table"&&u.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let p=Vt(f.outline,ye);c.set(f.id,{section:f,unit:m,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:f.id,floorIndex:d,box:st(p),section:f,unit:m,outline:p})}}for(let d=0;d<t.length;d++){let m=t[d];for(let f of l){if(n&&f.floorIndex!==n[d]||m.x<f.box.minX||m.x>f.box.maxX||m.y<f.box.minY||m.y>f.box.maxY||!Co({x:m.x,y:m.y},f.outline,f.section.holes))continue;o[d]=f.id;let p=c.get(f.id);p.hasSeats=!0;let h=m.focalPoint??f.unit.focal,b=Math.hypot(m.x-h.x,m.y-h.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 f=co(m.section,{floorBaseHeightM:m.unit.baseHeightM}),p=m.unit.baseHeightM,h=f.rake>0?Math.tan(f.rake*Math.PI/180):0,b=f.rake<=.01&&f.height<=p+.001,y=m.section.surfaceKind,g=y==="flat"?!0:y==="rakedRows"&&f.rake>.01?!1:b,x=m.hasSeats?wo(d,t,m.seatIndices,m.unit.focal):{sectionId:d,rows:[],blockCount:0},R=x.rows.length<2?Ro([...m.rows.values()].map(C=>({points:C})),m.unit.focal):null,S=1/0;if(R){if(m.hasSeats)for(let C of m.rows.values())for(let F of C){let I=R.depthAt(F.x,F.y);I<S&&(S=I)}if(!m.hasSeats||!Number.isFinite(S)){S=1/0;for(let C of m.section.outline){let F=R.depthAt(C.x,C.y);F<S&&(S=F)}}}let D=p+ka,B=Math.max(D,f.height),V=C=>{let F=Math.max(0,C-S)*we,I=Math.min(F*h,Dn);return Math.max(D,f.height+I)},H=C=>{let F=Math.max(0,C)*we,I=Math.min(F*h,Dn);return Math.max(D,f.height+I)},O=g?[]:x.rows.map(C=>({pts:C.pts,y:H(C.blockDepth),depth:C.blockDepth,blockId:C.blockId,...u.has(C.id)?{patch:Fo(C.pts,ye)}:{}})),M=O.length?O[0].y:B,v=O.map(C=>{let F=C.patch&&C.patch.length>=3?C.patch:C.pts,I=0,z=0;for(let G of F)I+=G.x,z+=G.y;let E=F.length||1;I/=E,z/=E;let k=0;for(let G of F){let X=Math.hypot(G.x-I,G.y-z);X>k&&(k=X)}return{cx:I,cy:z,rad:k}}),A=g?()=>B:O.length>=2?(C,F)=>{let I=1/0,z=M;for(let E=0;E<O.length;E++){let k=v[E];if(Math.hypot(C-k.cx,F-k.cy)-k.rad>=I)continue;let G=O[E].patch,X=G&&G.length>=3?gt(G,C,F)?0:it(G,C,F):it(O[E].pts,C,F);X<I&&(I=X,z=O[E].y)}return z}:(C,F)=>R?V(R.depthAt(C,F)):B,w=[0,1,0],_=O.length>=2||g?()=>w:(C,F)=>{if(!R)return w;let I=R.depthAt(C,F);if(I<=S)return w;let z=(I-S)*we;if(z*h>=Dn||f.height+z*h<=D)return w;let[E,k]=R.gradientAt(C,F);if(E===0&&k===0)return w;let G=1/Math.hypot(h,1);return[-E*h*G,G,-k*h*G]};if(!g)for(let C of x.rows){let F=H(C.blockDepth);for(let I of C.seatIndices)a[I]=F}for(let C of x.rows){let F=[];for(let G=1;G<C.pts.length;G++){let X=Math.hypot(C.pts[G].x-C.pts[G-1].x,C.pts[G].y-C.pts[G-1].y);X>1e-6&&F.push(X)}F.sort((G,X)=>G-X);let I=F.length?F[Math.floor(F.length/2)]:1/0,z=1/0,E=C.pts[Math.floor(C.pts.length/2)];if(E)for(let G of x.rows){if(G===C||G.blockId!==C.blockId)continue;let X=it(G.pts,E.x,E.y);X>1e-6&&X<z&&(z=X)}let k=Math.min(I,Math.max(z,I*.5));if(Number.isFinite(k)&&k>0)for(let G of C.seatIndices)s[G]=k}r.set(d,{sectionId:d,deckAt:A,normalAt:_,flat:g,bottomY:p,rowLevels:O,landingY:M})}for(let d=0;d<t.length;d++){let m=o[d],f=t[d];if(m){let h=a[d];i[d]=(h??r.get(m).deckAt(f.x,f.y))+La;continue}let p=f.eyeHeightM;i[d]=Number.isFinite(p)?Math.max(0,p-_t):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var ae={top:1,wallBottom:.5,bottomCap:.4};function Fe(e,t){if(!e)return t;let n=be(pt(e,.4),.62);return pe(t,n,.72)}function Yo(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 f=ee(n.get(d));f&&(s+=f[0]*m,c+=f[1]*m,l+=f[2]*m,u+=m)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function Wo(e,t){return ee(e.color)??t.get(e.logicalSectionId??e.id)??null}var Ko=et(require("polygon-clipping"),1);function _a(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Xt=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])&&_a(n,this.levels[l])),a=[[r]];if(i.length)try{a=Ko.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 Oa(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,f=d.y-s;return{x:a+m*l-f*u,y:s+m*u+f*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=zt(n,r,e.width/2,e.height/2)}return t?Oa(t,e.rotation):null}function wt(e){let t=e.role??"",r={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}}[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Ba=.08;function qo(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+Ba);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 $o(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 Zo(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 ke(e,t,n,r,o,i){se(e,t,void 0,()=>n,r,o,i,ae)}var Fn=2.4,Na=.75,Va=.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 Qo(e,t,n,r,o){let i=Ct(t);i&&se(e,i,void 0,()=>n+Fn,n,Fe(r,o.boothTop),o.boothWall,ae)}function kn(e){if(e.shape==="round"){let u=e.radius;return u?zt(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 Jo(e,t,n,r,o){let i=kn(t);i&&se(e,i,void 0,()=>n+Na,n,Fe(r,o.tableTop),o.tableWall,ae)}function er(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 h=1/0,b=-1/0,y=1/0,g=-1/0;for(let x of s)x.x<h&&(h=x.x),x.x>b&&(b=x.x),x.y<y&&(y=x.y),x.y>g&&(g=x.y);a.push({cx:(h+b)/2*L,cz:(y+g)/2*L,y:u,halfX:Math.max((b-h)/2*L,.5),halfZ:Math.max((g-y)/2*L,.5)})}let d=ee(t.fill),m=c&&d?pe(o.stageTop,be(pt(d,.18),.9),.9):Fe(d,c?o.stageTop:o.decorTop),f=t.role==="screen"?d:null,p=c?d?pe(o.stageWall,be(d,.58),.82):o.stageWall:t.role==="screen"?f?pe(be(f,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Fe(ee(t.fill),o.decorWall);if(l.kind==="portal"&&s.length===4){let h=$o(s);ke(e,Pt(h,0,.16),u,n,m,p),ke(e,Pt(h,.84,1),u,n,m,p),ke(e,h,u,Math.max(n,u-.35),m,p);return}if(l.kind==="suite"&&s.length===4){let h=s.map((g,x)=>{let P=s[(x+1)%4],R=(g.x+P.x)/2,S=(g.y+P.y)/2;return Math.hypot(R-i.x,S-i.y)}),b=h.indexOf(Math.min(...h)),y=[0,1,2,3].map(g=>s[(b+g)%4]);ke(e,Pt(y,0,.08),u,n,m,p),ke(e,Pt(y,.92,1),u,n,m,p),ke(e,Zo(y,.88,1),u,n,m,p),ke(e,y,u,Math.max(n,u-.18),m,p);return}ke(e,s,u,n,m,p)}function Ln(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,f])=>({x:i+m*c-f*l,y:a+m*l+f*c}))}function za(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)=>pe(s,c,1/(l+1)),a[0]):null}function tr(e,t,n,r){if(t.layer==="foreground")return;let o=Ln(t);if(!o)return;let i=n+Va,a=Fe(za(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 nr(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Fe(r,o.gaTop);se(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ae)}var Ga=Math.PI/180,Q=96,Ha=6,Ua=60,ja=150,or=.2,Xa=.35;function Ya(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Ga;return n<0?n+360:n}function Yt(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 rr(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 f of m.rows){for(let p of f.pts)o+=p.x,i+=p.y,a++;if(f.pts.length>=4){let p=An(f.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=Yt(r.map(y=>y.x)),f=Yt(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 P=Math.hypot(x.x-s.x,x.y-s.y);P>p&&(p=P)}let h=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-f)<b&&h++;Math.hypot(m-s.x,f-s.y)<=p&&h/a<.01&&(c={x:m,y:f})}let l=[];for(let m of n){let f={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let p of m.rows)for(let h of p.pts){let b=Math.hypot(h.x-c.x,h.y-c.y),y=Math.min(Q-1,Math.floor(Ya(c,h)/(360/Q)));f.samples.push({r:b,bin:y,levelM:p.levelM}),b<f.rMin&&(f.rMin=b),b>f.rMax&&(f.rMax=b)}f.samples.length&&l.push(f)}if(!l.length)return null;l.sort((m,f)=>m.rMin+m.rMax-(f.rMin+f.rMax));let u=[];for(let m of l){let f=!1;for(let p of u){let h=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&&h>=Xa*b){p.members.push(m),p.rMin=Math.min(p.rMin,m.rMin),p.rMax=Math.max(p.rMax,m.rMax),f=!0;break}}f||u.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let d=[];for(let m of u){let f=new Array(Q).fill(null);for(let v of m.members)for(let A of v.samples){let w=f[A.bin];w||(w={samples:[]},f[A.bin]=w),w.samples.push({r:A.r,levelM:A.levelM})}let p=f.map(v=>!!v);if(!p.filter(Boolean).length)continue;let b=[],y=[];for(let v of f){if(!v)continue;let A=1/0,w=-1/0;for(let _ of v.samples)_.r<A&&(A=_.r),_.r>w&&(w=_.r);b.push(A),y.push(w)}let g=Yt(b),x=Yt(y);if(!(g>=or*x)||!(x>0))continue;let P=[...b].sort((v,A)=>v-A);if(!(P[Math.floor(P.length*.1)]>=or*x))continue;let S=f.map(v=>{if(!v)return null;let A=[...v.samples].sort((k,G)=>k.r-G.r),w=A[0].r,_=A[A.length-1].r,C=A[0].levelM,F=-1/0;for(let k of A)k.levelM>F&&(F=k.levelM);let I=[];for(let k of A){let G={r:k.r,l:k.levelM};for(;I.length&&Math.abs(I[I.length-1].r-G.r)<1e-9;){if(I[I.length-1].l<=G.l){G.skip=!0;break}I.pop()}if(!G.skip){for(;I.length>=2;){let X=I[I.length-2],N=I[I.length-1];if((N.r-X.r)*(G.l-X.l)-(N.l-X.l)*(G.r-X.r)<=0)I.pop();else break}I.push(G)}}let z=I.map(k=>k.r),E=I.map(k=>k.l);return{inner:w,outer:_,front:C,top:F,profile:{rs:z,ls:E}}}),D=p.slice();for(let v=0;v<Q;v++){if(D[v])continue;let A=-1,w=-1,_=0;for(let T=1;T<=Q;T++){let Y=(v-T+Q*2)%Q;if(D[Y]){A=Y;break}}for(let T=1;T<=Q;T++){let Y=(v+T)%Q;if(D[Y]){w=Y,_=T;break}}if(A<0||w<0)continue;let C=0;for(let T=1;T<=Q;T++){let Y=(v-T+Q*2)%Q;if(p[Y]){C=T;break}}if(C-1+_>Ha)continue;let I=S[A],z=S[w],E=C/(C+_),k=I.inner+(z.inner-I.inner)*E,G=I.outer+(z.outer-I.outer)*E,X=I.front+(z.front-I.front)*E,N=I.top+(z.top-I.top)*E;S[v]={inner:k,outer:G,front:X,top:N,profile:{rs:[k,G],ls:[X,N]}}}for(let v=0;v<Q;v++)S[v]&&(D[v]=!0);let B=360/Q,V=[],H=D.filter(Boolean).length,O=[];if(H===Q)O.push({start:0,len:Q});else{let v=0;for(;D[v];)v=(v+1)%Q;let A=-1;for(let w=0;w<=Q;w++){let _=(v+w)%Q,C=w<Q&&D[_];if(C&&A<0)A=_;else if(!C&&A>=0){let F=(_-A+Q)%Q||Q;O.push({start:A,len:F}),A=-1}}}for(let v of O){if(v.len*B<Ua&&v.len<Q)continue;let A=v.len===Q,w=new Float64Array(v.len),_=new Float64Array(v.len),C=new Float64Array(v.len),F=new Float64Array(v.len),I=[];for(let T=0;T<v.len;T++){let Y=S[(v.start+T)%Q];w[T]=Y.inner,_[T]=Y.outer,C[T]=Y.front,F[T]=Y.top,I.push(Y.profile??{rs:[Y.inner,Y.outer],ls:[Y.front,Y.top]})}let z=Wt(w,A),E=Wt(_,A),k=Wt(C,A),G=Wt(F,A);for(let T=0;T<v.len;T++)z[T]>w[T]&&(z[T]=w[T]),E[T]<_[T]&&(E[T]=_[T]),z[T]>E[T]-1e-6&&(z[T]=Math.max(0,E[T]-1e-6)),G[T]<k[T]&&(G[T]=k[T]);let X={startBin:v.start,binCount:v.len,closed:A,innerR:z,outerR:E,frontLevelM:k,topLevelM:G,profiles:I},N=(T,Y,K)=>{let J=I[T],Z=J.rs,$=J.ls;if(Y<=Z[0]){$[0]>K&&($[0]=K);return}if(Y>=Z[Z.length-1]){$[$.length-1]>K&&($[$.length-1]=K);return}for(let te=0;te+1<Z.length;te++)if(Y<=Z[te+1]){$[te]>K&&($[te]=K),$[te+1]>K&&($[te+1]=K);return}};for(let T=0;T<v.len;T++){let Y=f[(v.start+T)%Q];if(Y)for(let K of Y.samples){N(T,K.r,K.levelM);let J=A?(T-1+v.len)%v.len:T-1,Z=A?(T+1)%v.len:T+1;J>=0&&N(J,K.r,K.levelM),Z<v.len&&N(Z,K.r,K.levelM)}}V.push(X)}V.reduce((v,A)=>v+A.binCount*B,0)<ja||d.push({arcs:V,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:g,outerRMedian:x})}if(!d.length)return null;if(d.sort((m,f)=>m.innerRMedian-f.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:Q,binStepDeg:360/Q,rings:d}}function ir(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,f=d.ls;if(r<=m[0])return f[0];if(r>=m[m.length-1])return f[f.length-1];for(let p=0;p+1<m.length;p++)if(r<=m[p+1]){let h=m[p+1]-m[p],b=h>1e-9?(r-m[p])/h:0;return f[p]+(f[p+1]-f[p])*b}return f[f.length-1]};return l(a)*(1-c)+l(s)*c}var Wa=.25,Ka=1.2,qa=.6,$a=.45,Za=2.3,Qa=Math.PI/180;function Ze(e,t,n){let r=n*Qa;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function Ja(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 es=24;function ts(e,t,n,r,o,i,a,s){let c=n.binCount,l=es,u=we,d=i+.02,m=[];for(let M=0;M<c;M++){let v=(n.startBin+M+.5)*t.binStepDeg,A=new Float64Array(l+1);for(let w=0;w<=l;w++){let _=r[M]+(o[M]-r[M])*w/l;A[w]=Math.max(d,ir(t,n,v,_)-Wa)}m.push(A)}let f=[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],h=[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=(M,v)=>{let A=(n.startBin+M+.5)*t.binStepDeg,w=r[M]+(o[M]-r[M])*v/l,_=Ze(t.centre,w,A);return[_.x*u,m[M][v],_.y*u]};{let M=Math.tan(12*Math.PI/180);for(let v=0;v<6;v++){let A=!1;for(let _=0;_<c;_++)for(let C=l-1;C>=0;C--)m[_][C]>m[_][C+1]&&(m[_][C]=m[_][C+1],A=!0);let w=n.closed?c:c-1;for(let _=0;_<w;_++){let C=(_+1)%c;for(let F=0;F<=l;F++){let I=m[C][F]-m[_][F];if(Math.abs(I)>1)continue;let z=r[_]+(o[_]-r[_])*F/l,E=r[C]+(o[C]-r[C])*F/l,k=Ze(t.centre,z,(n.startBin+_+.5)*t.binStepDeg),G=Ze(t.centre,E,(n.startBin+C+.5)*t.binStepDeg),X=M*Math.hypot(G.x-k.x,G.y-k.y)*u;I>X?(m[C][F]=m[_][F]+X,A=!0):-I>X&&(m[_][F]=m[C][F]+X,A=!0)}}if(!A)break}}let g=1,x=(M,v)=>{for(let A=0;A<=l;A+=4)if(Math.abs(m[M][A]-m[v][A])>g)return!0;return Math.abs(m[M][l]-m[v][l])>g},P=Math.tan(38*Math.PI/180),R=M=>(o[M]-r[M])/l*u,S=(M,v)=>m[M][v+1]-m[M][v]>P*Math.max(1e-6,R(M)),D=(M,v)=>{let A=n.closed?(M-1+c)%c:Math.max(0,M-1),w=n.closed?(M+1)%c:Math.min(c-1,M+1);Math.abs(m[A][v]-m[M][v])>g&&(A=M),Math.abs(m[w][v]-m[M][v])>g&&(w=M);let _=Math.max(0,v-1),C=Math.min(l,v+1);_<v&&S(M,_)&&(_=v),C>v&&S(M,v)&&(C=v);let F=y(A,v),I=y(w,v),z=y(M,_),E=y(M,C),k=I[0]-F[0],G=I[1]-F[1],X=I[2]-F[2],N=E[0]-z[0],T=E[1]-z[1],Y=E[2]-z[2],K=G*Y-X*T,J=X*N-k*Y,Z=k*T-G*N,$=Math.hypot(K,J,Z);return $>1e-12?(K/=$,J/=$,Z/=$,J<0&&(K=-K,J=-J,Z=-Z),[K,J,Z]):[0,1,0]},B=(M,v)=>{let A=[M[0],i,M[2]],w=[v[0],i,v[2]],_=v[0]-M[0],C=v[2]-M[2],F=Math.hypot(_,C);if(!(F>1e-12))return;let I=[C/F,0,-_/F];e.tri(M,v,w,I,h,h,b),e.tri(M,w,A,I,h,b,b)},V=.05*Be,H=M=>o[M]-r[M]<V,O=n.closed?c:c-1;for(let M=0;M<O;M++){let v=(M+1)%c;if(H(M)||H(v))continue;if(x(M,v)){let I=(n.startBin+M+1)*t.binStepDeg,z=(T,Y)=>{let K=(r[M]+r[v])/2,J=(o[M]+o[v])/2,Z=K+(J-K)*Y/l,$=Ze(t.centre,Z,I);return[$.x*u,m[T][Y],$.y*u]};for(let T=0;T<l;T++){let Y=y(M,T),K=y(M,T+1),J=z(M,T),Z=z(M,T+1),$=D(M,T),te=D(M,T+1);e.triN(Y,J,Z,$,$,te,f),e.triN(Y,Z,K,$,te,te,f);let Ue=y(v,T),je=y(v,T+1),Re=z(v,T),Ie=z(v,T+1),Ee=D(v,T),xe=D(v,T+1);e.triN(Re,Ue,je,Ee,Ee,xe,f),e.triN(Re,je,Ie,Ee,xe,xe,f);let ve=z(M,T),ie=z(M,T+1),Je=z(v,T+1),Le=z(v,T),Te=ie[0]-ve[0],Xe=ie[2]-ve[2],dt=Math.hypot(Te,Xe);if(dt>1e-12){let me=[Xe/dt,0,-Te/dt];e.tri(ve,ie,Je,me,h),e.tri(ve,Je,Le,me,h)}}let E=y(M,0),k=y(v,0),G=y(v,l),X=y(M,l),N=T=>[T[0],i,T[2]];e.tri(N(E),N(G),N(k),[0,-1,0],p),e.tri(N(E),N(X),N(G),[0,-1,0],p),B(E,k),B(X,G);continue}for(let I=0;I<l;I++){let z=D(M,I),E=D(v,I),k=D(v,I+1),G=D(M,I+1);if(S(M,I)||S(v,I)){let K=(ie,Je)=>{let Le=(n.startBin+ie+.5)*t.binStepDeg,Te=r[ie]+(o[ie]-r[ie])*(I+.5)/l,Xe=Ze(t.centre,Te,Le);return[Xe.x*u,Je,Xe.y*u]},J=y(M,I),Z=y(v,I),$=K(M,m[M][I]),te=K(v,m[v][I]);e.triN(J,Z,te,z,E,E,f),e.triN(J,te,$,z,E,z,f);let Ue=y(v,I+1),je=y(M,I+1),Re=K(M,m[M][I+1]),Ie=K(v,m[v][I+1]);e.triN(Re,Ie,Ue,G,k,k,f),e.triN(Re,Ue,je,G,k,G,f);let Ee=te[0]-$[0],xe=te[2]-$[2],ve=Math.hypot(Ee,xe);if(ve>1e-12){let ie=[-xe/ve,0,Ee/ve];e.tri($,te,Ie,ie,h),e.tri($,Ie,Re,ie,h)}continue}let X=y(M,I),N=y(v,I),T=y(v,I+1),Y=y(M,I+1);e.triN(X,N,T,z,E,k,f),e.triN(X,T,Y,z,k,G,f)}let A=y(M,0),w=y(v,0),_=y(v,l),C=y(M,l),F=I=>[I[0],i,I[2]];e.tri(F(A),F(_),F(w),[0,-1,0],p),e.tri(F(A),F(C),F(_),[0,-1,0],p),B(A,w),B(C,_)}if(!n.closed)for(let M of[0,c-1])for(let v=0;v<l;v++)B(y(M,v),y(M,v+1))}function ar(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),f=new Float64Array(d.binCount);for(let h=0;h<d.binCount;h++){let b=(d.startBin+h)%t.binCount,y=Math.max(0,d.innerR[h]-ye);m[h]=Math.max(y,a[b]+.001),f[h]=Math.max(m[h]+.001,d.outerR[h]+ye)}let p=0;for(let h=0;h<d.binCount;h++){let b=d.topLevelM[h]-r;b>p&&(p=b)}p>=Ka&&ts(e,t,d,m,f,r,o,i);for(let h=0;h<d.binCount;h++){let b=(d.startBin+h)%t.binCount;f[h]>a[b]&&(a[b]=f[h])}}if(Ja(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=qa*Be,l=$a*Be;for(let u of s.arcs){let d=[],m=[];for(let h=0;h<u.binCount;h++){let b=(u.startBin+h+.5)*t.binStepDeg,y=u.outerR[h]+ye+c;d.push(Ze(t.centre,y,b)),m.push(Ze(t.centre,y+l,b))}let f=-1/0;for(let h=0;h<u.binCount;h++)u.topLevelM[h]>f&&(f=u.topLevelM[h]);let p=()=>f+Za;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=Fe(r,s.tierTop);if(!o)return;let u=b=>o.deckAt(b.x,b.y),d=Ho(t,a),m=d[0]??t.outline;if(o.rowLevels.length>=2){let b=Ut(o.rowLevels),y=Uo(Oo(o.rowLevels,n.focal,b),d),g=()=>[0,1,0];for(let P of y){let R=Math.max(c,P.topY-.02);for(let S of i.subtract(P.outline,R))se(e,S,P.holes,()=>R,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 P of d.length?d:[m])No(e,o.rowLevels,n.focal,o.landingY,x,P,b);return}let f=o.flat?1/0:jo,p=b=>o.normalAt(b.x,b.y),h=o.flat?o.landingY:void 0;for(let b of i.subtract(m,h))se(e,b,t.holes,u,c,l,s.tierWall,ae,f,p)}function ns(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 cr(e,t,n,r,o){let i=ns(t,n,r);if(!i.length)return;let a=rr(i,t.focal);a&&(e.setMaterial(0),ar(e,a,{bottomY:t.baseHeightM,colors:{bandTop:be(o.tierTop,.8),bandWall:o.tierWall,shellTop:be(o.tierWall,1.15),shellWall:o.tierWall},ao:ae,shapes:t.objects.filter(s=>s.type==="shape")}))}function lr(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 ur(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 os=1.15,rs=3.25,is=4.5,as=.85,ss=.5,cs=.26;function dr(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>=os&&a.add("zone"),o<=(i?rs:is)&&(a.add("section"),a.add("ga")),o<=as&&(a.add("annotation"),a.add("booth")),o<=ss&&a.add("row"),o<=cs&&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,f=l/d,p=u/d,h=m>=-1.05&&m<=1.05&&f>=-1.05&&f<=1.05&&p<=1;return{x:(m*.5+.5)*n,y:(1-(f*.5+.5))*r,depth:p,visible:h}}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){let c=Math.abs(i.screen.x-s.screen.x),l=Math.abs(i.screen.y-s.screen.y);if(c<t&&l<n){a=!0;break}}a||r.push(i)}return r}var fr={row:8,seat:14};function pr(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 hr(e,t,n,r){let o=[...e].sort((a,s)=>(s.priority??0)-(a.priority??0)||a.focus-s.focus),i=[];for(let a of o){if(i.length>=r)break;let s=!1;for(let c of i)if(Math.abs(a.screen.x-c.screen.x)<t&&Math.abs(a.screen.y-c.screen.y)<n){s=!0;break}s||i.push(a)}return i}var ls=6,us=2.2,br=.1,ds=.3,ms=1.8,fs=.9,ps=.55,hs=6e3;function yr(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],f=d.zoneId??(m?c.get(m):void 0);if(!f)continue;let p=l.get(f);p||(p={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(f,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[f,p]of c)p===u.id&&m.push(f);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*L,1.5,(u.focalPoint??i).y*L]});continue}s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:m,seatCount:d.n,center:[(d.minX+d.maxX)/2*L,d.sumY/d.n,(d.minY+d.maxY)/2*L],radius:.5*Math.hypot((d.maxX-d.minX)*L,(d.maxY-d.minY)*L)||1,focalWorld:[(u.focalPoint??i).x*L,1.5,(u.focalPoint??i).y*L]})}}return s}function gr(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]+ls,m.center[2]],color:t.zones?.find(f=>f.id===m.id)?.color});{let m=new Map,f=new Map;for(let p=0;p<r.length;p++){let h=o.seatOwner[p];if(!h)continue;let b=m.get(h);b||(b={n:0,x:0,y:0,deck:0},m.set(h,b)),b.n++,b.x+=r[p].x,b.y+=r[p].y,b.deck+=o.seatDeckY(p);let y=f.get(h);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},f.set(h,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 h of p.objects){if(h.type!=="section")continue;let b=m.get(h.id);if(!b||b.n===0)continue;let y=f.get(h.id),g=[b.x/b.n*L,b.deck/b.n,b.y/b.n*L],x=h.displayLabel||h.label||h.id;u.push({id:h.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*L),focalWorld:[p.focal.x*L,p.baseHeightM+1.5,p.focal.y*L]});let P=t.floors?.[p.index]?.name?.trim().toLocaleLowerCase();n.length>1&&P===x.trim().toLocaleLowerCase()||l.push({id:`section:${h.id}`,kind:"section",text:x,anchor:[g[0],g[1]+us,g[2]],floorIndex:p.index})}}{for(let p of n)for(let h of p.objects){if(h.type!=="gaArea")continue;let b=yt(h.points);if(!b)continue;let y=h.displayLabel||h.label||h.id;l.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${y} \xB7 ${h.capacity.toLocaleString()}`:y,anchor:[b.x*L,p.baseHeightM+ms,b.y*L],floorIndex:p.index})}let m=new Map;for(let p=0;p<r.length;p++){let h=r[p],b=Math.hypot(h.x-c.x,h.y-c.y),y=m.get(h.rowId);(!y||b>y.far)&&m.set(h.rowId,{seat:h,index:p,far:b})}for(let[p,h]of m){let b=h.seat.label?h.seat.label.lastIndexOf("-"):-1,y=b>0?h.seat.label.slice(0,b):p;y&&l.push({id:`row:${p}`,kind:"row",text:y,anchor:[h.seat.x*L,o.seatDeckY(h.index)+fs,h.seat.y*L],floorIndex:a[h.index]})}let f=new Map;for(let p=0;p<r.length;p++){let h=r[p],b=h.label?h.label.lastIndexOf("-"):-1,y=f.get(h.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?h.label.slice(0,b):h.rowId,sectionId:h.sectionId},f.set(h.rowId,y));let g=p*3,x=i.iPosition[g],P=i.iPosition[g+1],R=i.iPosition[g+2];y.n++,y.x+=x,y.y+=P,y.z+=R,y.minX=Math.min(y.minX,x),y.maxX=Math.max(y.maxX,x),y.minZ=Math.min(y.minZ,R),y.maxZ=Math.max(y.maxZ,R)}for(let[p,h]of f)d.push({id:p,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=hs)for(let p=0;p<r.length;p++){let h=r[p],b=h.displayLabel||h.label;b&&l.push({id:`seat:${h.id}`,kind:"seat",text:b,anchor:[h.x*L,o.seatDeckY(p)+ps,h.y*L],floorIndex:a[p]})}}for(let m of n)for(let f of m.objects)if(f.type==="shape"&&f.role&&["entrance","exit","screen","suite","obstruction"].includes(f.role)){let p=St(f),h=p?yt(p):null;if(!h||!f.label)continue;l.push({id:`architecture:${f.id}`,kind:"annotation",text:f.label,anchor:[h.x*L,m.baseHeightM+wt(f).heightM+br,h.y*L],color:f.fill,floorIndex:m.index})}else if(f.type==="text"){if(!f.text)continue;l.push({id:`text:${f.id}`,kind:"annotation",text:f.text,anchor:[f.position.x*L,m.baseHeightM+br,f.position.y*L],color:f.color,rotation:f.rotation,floorIndex:m.index})}else if(f.type==="booth"){let p=Ct(f);if(!p)continue;let h=yt(p);if(!h)continue;l.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[h.x*L,m.baseHeightM+Fn+ds,h.y*L],floorIndex:m.index})}return{labels:l,sections:u,rows:d}}function xr(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 vr(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 f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),p=m*3,h=l[f];h.minX=Math.min(h.minX,i.position[p]),h.minY=Math.min(h.minY,i.position[p+1]),h.minZ=Math.min(h.minZ,i.position[p+2]),h.maxX=Math.max(h.maxX,i.position[p]),h.maxY=Math.max(h.maxY,i.position[p+1]),h.maxZ=Math.max(h.maxZ,i.position[p+2])}let u=new Map;for(let m=0;m<n.length;m++)for(let f of n[m].objects)f.type==="section"&&u.set(f.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 f=o.seatOwner[m],p=(f!==null?u.get(f):void 0)??a[m];if(p===void 0)continue;let h=d[p],b=r[m];h.n++,b.x<h.minX&&(h.minX=b.x),b.y<h.minY&&(h.minY=b.y),b.x>h.maxX&&(h.maxX=b.x),b.y>h.maxY&&(h.maxY=b.y);let y=o.seatDeckY(m);h.sumX+=b.x*L,h.sumDeck+=y,h.sumZ+=b.y*L,h.minDeck=Math.min(h.minDeck,y),h.maxDeck=Math.max(h.maxDeck,y+1.6),s[m]=p}for(let m=0;m<n.length;m++){let f=d[m],p=t.floors?.[m],h=l[m],b=Math.min(f.n?f.minX*L:n[m].focal.x*L-1,Number.isFinite(h.minX)?h.minX:1/0),y=Math.max(f.n?f.maxX*L:n[m].focal.x*L+1,Number.isFinite(h.maxX)?h.maxX:-1/0),g=Math.min(f.n?f.minY*L:n[m].focal.y*L-1,Number.isFinite(h.minZ)?h.minZ:1/0),x=Math.max(f.n?f.maxY*L:n[m].focal.y*L+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),P=Math.min(f.n?Math.min(n[m].baseHeightM,f.minDeck):n[m].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),R=Math.max(f.n?Math.max(f.maxDeck,P+.5):P+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[f.n?f.sumX/f.n:(b+y)/2,f.n?f.sumDeck/f.n:(P+R)/2,f.n?f.sumZ/f.n:(g+x)/2],D=Math.max(1,.5*Math.hypot(y-b,R-P,x-g));c.push({index:m,id:p?.id??`floor-${m}`,label:p?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:f.n,center:S,radius:D,box:{min:[b,P,g],max:[y,R,x]},focalWorld:[n[m].focal.x*L,n[m].baseHeightM+1.5,n[m].focal.y*L]})}}return c}function _n(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=kn(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=Ln(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 Mr(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);se(e,s,void 0,()=>0,-.4,i.ground,i.ground,ae)}else{let a=t.reduce((f,p)=>p.baseHeightM<f.baseHeightM?p:f);e.setFloor(a.index);let s=n.filter((f,p)=>r[p]===a.index),c=_n([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;se(e,d,void 0,()=>m,m-.22,i.ground,i.ground,ae)}}function Sr(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=(h,b,y)=>{a=Math.min(a,h),l=Math.max(l,h),s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,y),d=Math.max(d,y)};for(let h=0;h<e.position.length;h+=3)m(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let b=h*3,y=t.iPosition[b],g=t.iPosition[b+1],x=t.iPosition[b+2],P=Math.max(.35,t.iMaxRadius[h]??.35);m(y-P,g,x-P),m(y+P,g+1.6,x+P)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,d=o+i);let f=[(a+l)/2,(s+u)/2,(c+d)/2],p=Math.max(1,.5*Math.hypot(l-a,u-s,d-c));return{center:f,radius:p,minY:s,maxY:u}}function wr(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let P=0;P<e.count;P++){let R=P*3,S=e.iPosition[R],D=e.iPosition[R+2];S<a&&(a=S),S>c&&(c=S),D<s&&(s=D),D>l&&(l=D)}for(let P of t)a=Math.min(a,P.cx-P.halfX),c=Math.max(c,P.cx+P.halfX),s=Math.min(s,P.cz-P.halfZ),l=Math.max(l,P.cz+P.halfZ);let u=n.minX*L,d=n.maxX*L,m=n.minY*L,f=n.maxY*L,p=u,h=d,b=m,y=f;if(Number.isFinite(a)){let P=Math.max(2,.06*Math.hypot(c-a,l-s));p=Math.max(u,a-P),h=Math.min(d,c+P),b=Math.max(m,s-P),y=Math.min(f,l+P)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[p,g,b],max:[h,x,y]}}function ct(e){let{doc:t}=e,n=xo(t.theme),r=n.structure,o=Go(t,e.eventConfigurationId??t.eventConfigurationId),i=e.seats,a=new Nt,s=new Map;for(let M of o)for(let v of M.objects)s.set(v.id,M.index),v.type==="section"&&s.set(v.logicalSectionId??v.id,M.index);let c=i.map(M=>s.get(M.sectionId??"")??s.get(M.rowId??"")??0),l=_n(o,i);Mr(a,o,i,c,l,r);let u=Yo(t,i),d=new Map;for(let M of t.categories??[])d.set(M.key,M.color);let m=[],f=Xo(o,i,c),p=new Float32Array(i.length);for(let M=0;M<o.length;M++){let v=o[M];a.setFloor(M);let A=new Xt,w=[],_=v.objects.filter(C=>C.type==="section"&&!!C.outline&&C.outline.length>=3);for(let C of v.objects)C.type==="section"?sr(a,C,v,Wo(C,u),f.bySection.get(C.id),A,_,r):C.type==="shape"?(a.setMaterial(C.role==="screen"?1:0),er(a,C,v.baseHeightM,qo(C,w),r,v.focal,m),a.setMaterial(0)):C.type==="gaArea"?nr(a,C,v.baseHeightM,ee(d.get(C.categoryKey)),r):C.type==="booth"?Qo(a,C,v.baseHeightM,ee(d.get(C.categoryKey)),r):C.type==="table"?Jo(a,C,v.baseHeightM,ee(d.get(C.categoryKey)),r):C.type==="decorImage"&&tr(a,C,v.baseHeightM,r);cr(a,v,i,f,r)}let h=o.length>1?{x:o.reduce((M,v)=>M+v.focal.x,0)/o.length,y:o.reduce((M,v)=>M+v.focal.y,0)/o.length}:t.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},b=fo([a.build()]),y=go(i,e.initialState,f,p,d),g=yr({doc:t,units:o,seats:i,surfaces:f,focal:h}),{labels:x,sections:P,rows:R}=gr({doc:t,units:o,seats:i,surfaces:f,seatData:y,hintedSeatFloor:c,zones:g,focal:h}),S=vr({doc:t,units:o,seats:i,surfaces:f,solids:b,hintedSeatFloor:c,seatFloor:p});xr(x,S),y.iYaw=bo(y.iPosition,i.length,M=>i[M].rowId,M=>{let v=o[p[M]]?.focal??h;return[v.x*L,v.y*L]});let D=(l.minX+l.maxX)/2*L,B=(l.minY+l.maxY)/2*L,V=.5*Math.hypot((l.maxX-l.minX)*L,(l.maxY-l.minY)*L)||10,H=Sr(b,y,{cx:D,cz:B,radius:V}),O=wr(y,m,l,H.minY,H.maxY,V);return{solids:b,seats:y,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:V,groundY:0,box:O},renderBounds:{center:H.center,radius:H.radius},stateColorLUT:vo(n,ge),theme:n,seatCount:i.length,focalWorld:[h.x*L,1.5,h.y*L],zones:g,stages:m,sections:P,rows:R,labels:x,floors:S}}var bs=88,ys=20,gs={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}},On=new Set(["row","seat"]),Pr={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Cr={row:{x:62,y:16},seat:{x:46,y:18}},Rr=ee,Bn=e=>Wn(e);function Ir(e,t){let n=Bn(e),r=Bn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Ar(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 xs(e,t=[.04,.06,.1]){let n=Bn(t)<.42,r=n?"#f4f7fb":"#0b1220",o=Rr(e),i=o&&Ir(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 Kt=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=dr(o,i,{hasZoneLabels:this.labels.some(h=>h.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let h of this.labels){if(!s.has(h.kind))continue;let b=Ve(t,h.anchor,n,r);if(!b.visible)continue;let y=a?Math.hypot(h.anchor[0]-a[0],h.anchor[1]-a[1],h.anchor[2]-a[2]):1;c.push({label:h,screen:b,focus:pr(b,y,n,r),...this.selectedSeatLabelIds.has(h.id)?{priority:1}:{}})}let l=ur(c.filter(h=>h.label.kind==="floor"),n),u=[...c.filter(h=>!On.has(h.label.kind)&&h.label.kind!=="floor"),...l],d=[...mr(u,bs,ys),...["row","seat"].flatMap(h=>hr(c.filter(b=>b.label.kind===h),Cr[h].x,Cr[h].y,fr[h]))],m=new Set(d.map(h=>h.label.id));for(let{label:h,screen:b}of d){let g=this.nodeFor(h).style;g.display="",g.transform=`translate(-50%, -50%) translate(${b.x.toFixed(1)}px, ${b.y.toFixed(1)}px)`}let f=d.filter(({label:h})=>!On.has(h.kind)).sort((h,b)=>Pr[b.label.kind]-Pr[h.label.kind]||h.screen.depth-b.screen.depth||h.focus-b.focus),p=[];for(let{label:h}of f){let b=this.nodes.get(h.id);if(!b||b.style.display==="none")continue;let y=b.getBoundingClientRect();p.some(x=>y.left<x.right+3&&y.right+3>x.left&&y.top<x.bottom+3&&y.bottom+3>x.top)?b.style.display="none":p.push(y)}for(let[h,b]of this.nodes)m.has(h)||(b.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=gs[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=xs(t.color??this.opts.ink,this.opts.backgroundRgb),s=!On.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=Rr(r?"#ecf8ff":a.ink)??[1,1,1],u=r?Ar("rgba(10,28,45,.9)",c):s?Ar(a.backing,c):c;return n.dataset.qualityContrast=Ir(l,u).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Tr=1;var vs=new Set(["floor","zone","section","ga","booth","annotation"]);function Ms(e){return e.every(t=>Number.isFinite(t))}function Ss(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 Er(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Qe(e){return Math.round(e*1e4)/1e4}function ws(e){if(e)return{box:{x:Qe(e.box.x),y:Qe(e.box.y),width:Qe(e.box.width),height:Qe(e.box.height)},horizontalFillRatio:Qe(e.horizontalFillRatio),verticalFillRatio:Qe(e.verticalFillRatio),visibleAreaRatio:Qe(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 qt(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)Ss(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",Ms(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:ws(e.framing)},metrics:{minimumHierarchyFontPx:Er(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Er(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var he=require("ogl");var ze=require("ogl");var $t=`
|
|
1
|
+
"use strict";var xi=Object.create;var Tt=Object.defineProperty;var vi=Object.getOwnPropertyDescriptor;var Mi=Object.getOwnPropertyNames;var Si=Object.getPrototypeOf,wi=Object.prototype.hasOwnProperty;var Pi=(e,t)=>{for(var n in t)Tt(e,n,{get:t[n],enumerable:!0})},Yn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Mi(t))!wi.call(e,o)&&o!==n&&Tt(e,o,{get:()=>t[o],enumerable:!(r=vi(t,o))||r.enumerable});return e};var et=(e,t,n)=>(n=e!=null?xi(Si(e)):{},Yn(t||!e||!e.__esModule?Tt(n,"default",{value:e,enumerable:!0}):n,e)),Ci=e=>Yn(Tt({},"__esModule",{value:!0}),e);var uc={};Pi(uc,{VENUE3D_QUALITY_REPORT_VERSION:()=>kr,buildSceneModel:()=>ct,inspectVenue3DQualityEvidence:()=>qt,mountVenue3D:()=>lc,prepareVenue3D:()=>pi});module.exports=Ci(uc);var $n=require("ogl");var Ai=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ri(e){let t=Ai.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=Ri(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function mn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Ii(e){return .2126*mn(e[0])+.7152*mn(e[1])+.0722*mn(e[2])}function Wn(e){return Ii([e[0]*255,e[1]*255,e[2]*255])}function Ei(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function he(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 ht(e,t){let n=Ei(e);return he(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 Kn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function qn(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 fn={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 Ti(){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 $n.Renderer({canvas:this.canvas,dpr:Ti(),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,hn=15*de,pn=80*de,tt=.12,Zn=35,Qn=1.25,Ft=class{constructor(t,n,r,o){this.fovY=Zn;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:Zn,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(hn,Math.min(pn,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(hn,Math.min(pn,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??Qn)),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??Qn))}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 f=-m,h=u,p=Math.hypot(f,h);f/=p,h/=p;let b=-h*d,y=h*u-f*m,g=f*d,x=Math.tan(r),w=Math.tan(n),R=1;for(let S=0;S<8;S++){let D=(S&1?c.max[0]:c.min[0])-t.center[0],B=(S&2?c.max[1]:c.min[1])-t.center[1],N=(S&4?c.max[2]:c.min[2])-t.center[2],H=D*u+B*d+N*m,O=Math.abs(D*f+N*h),M=Math.abs(D*b+B*y+N*g);R=Math.max(R,O/x-H,M/w-H)}return Math.min(s,Math.max(R,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(hn,Math.min(pn,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 Dt=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,ki=1.15,bt=6,rt=10,Jn=6,eo=9.5,to=.9,no=2.2,bn=30,yn=4,Lt=8192;var xc=rt+yn;function oo(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*(ki-ot)}}function ro(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function io(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 Fi=[{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"}],Mc=new Map(Fi.map(e=>[e.key,e]));var Di={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 ao(e){let t=e?.[0];return t&&Di[t]||"#3b82f6"}var Li=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],Sc=new Map(Li.map(e=>[e.key,e]));var _i=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],wc=new Set(_i);var we=.02291666666666667,Be=1/we,Oi=58,Bi=Oi*we;var Ni=3,so=0,gn=120,Vi=0,zi=45,Gi=7,_t=1.2;function xn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Hi(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Gi?e:Ni}function co(e,t={}){let n=xn(t.floorBaseHeightM,so,gn,0),r=Math.min(gn,n+Hi(e.elevation)*Bi),o=e.height===void 0?r:xn(e.height,so,gn,r),i=xn(e.rake,Vi,zi,0);return{height:o,rake:i}}var uo=et(require("earcut"),1),mo=et(require("polygon-clipping"),1);var Ic=Math.PI/180;function vn(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?vn(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,Ui=.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<Ui}var $e=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 $e;this.nor=new $e;this.col=new $e;this.flr=new $e;this.mat=new $e;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 Xi(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 Yi(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,uo.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Mn(e){return qe(e)<0?[...e].reverse():e}var Wi=3;function Ki(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(f,h,p,b)=>Math.abs(r({x:(f.x+h.x)/2,y:(f.y+h.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=(f,h,p)=>{let b=Math.abs(r({x:(f+c)/2,y:(h+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 Ki(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},f={x:(n.x+r.x)/2,y:(n.y+r.y)/2},h={x:(r.x+t.x)/2,y:(r.y+t.y)/2};vt(e,t,m,h,o,i,a-1,s),vt(e,m,n,f,o,i,a-1,s),vt(e,h,f,r,o,i,a-1,s),vt(e,m,f,h,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=Xi(c,l,u);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),e.tri(c,l,u,d,i)}var qi=8;function lo(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),qi)}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 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=Ot(lo(Ot(Mn(t),Bt),r,c),Bt),d=n?.map(S=>Ot(lo(Ot(Mn(S),Bt),r,c),Bt)).filter(S=>S.length>=3&&Math.abs(qe(S))>=1e-4),{pts:m,tris:f}=Yi(u,d),h=[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<Wi;g++){let S=0;for(let D=0;D<f.length;D+=3){let B=xt(m[f[D]],m[f[D+1]],m[f[D+2]],r,g);B>S&&(S=B)}if(S<=c)break}for(let S=0;S<f.length;S+=3){let D=m[f[S]],B=m[f[S+1]],N=m[f[S+2]];vt(e,D,B,N,r,h,g,l);let H=[D.x*_,o,D.y*_],O=[B.x*_,o,B.y*_],M=[N.x*_,o,N.y*_];e.tri(H,M,O,[0,-1,0],p)}let x=S=>{if(g<=0)return S;let D=1<<g,B=[];for(let N=0;N<S.length;N++){let H=S[N],O=S[(N+1)%S.length];for(let M=0;M<D;M++){let v=M/D;B.push({x:H.x+(O.x-H.x)*v,y:H.y+(O.y-H.y)*v})}}return B},w=vn(u),R=[{ring:x(u),flip:!1}];if(d)for(let S of d)S.length>=3&&R.push({ring:x(S),flip:!0});for(let{ring:S,flip:D}of R)for(let B=0;B<S.length;B++){let N=S[B],H=S[(B+1)%S.length],O=(H.x-N.x)*_,v=(H.y-N.y)*_,A=-O,C=Math.hypot(v,A)||1;v/=C,A/=C;let T=(N.x+H.x)/2-w.x,P=(N.y+H.y)/2-w.y,F=v*T+A*P;D&&(F=-F),F<0&&(v=-v,A=-A);let I=[v,0,A],z=[N.x*_,r(N),N.y*_],E=[H.x*_,r(H),H.y*_],L=[N.x*_,o,N.y*_],G=[H.x*_,o,H.y*_];e.tri(z,E,G,I,b,b,y),e.tri(z,G,L,I,b,y,y)}}function fo(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 Vt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Mn(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,f=Math.hypot(d,m),h=()=>{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(f<1e-9){h();continue}d/=f,m/=f;let p=d*l.x+m*l.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){h();continue}a.push([c.x+d*t*b,c.y+m*t*b])}if(a.length<3)return e;try{let s=mo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let d of s){let m=Math.abs(qe(d[0].map(([f,h])=>({x:f,y:h}))));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 zt(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 le={pedestal:0,pad:1,back:2,body:3,head:4},$i=.44,Zi=.15,Qi=.3,Ji=.24;function ho(e){return e===void 0||!Number.isFinite(e)||e<=0?Ji:Math.min(Qi,Math.max(Zi,e*$i))}var Sn=.21,ea=.05,wn=.45,Gt=wn+ea,ta=[{part:le.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:le.pad,min:[-1,.36,-.95],max:[1,wn,1]},{part:le.back,min:[-1,Gt,-1],max:[1,.92,-.72]}],na=[{part:le.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:le.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:le.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:le.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:le.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],oa=[{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 po(){let e=[],t=[],n=[],r=[],o=(C,T,P)=>{let F=n.length,[I,z,E]=C,L=[z[0]-I[0],z[1]-I[1],z[2]-I[2]],G=[E[0]-I[0],E[1]-I[1],E[2]-I[2]],X=L[1]*G[2]-L[2]*G[1],V=L[2]*G[0]-L[0]*G[2],k=L[0]*G[1]-L[1]*G[0],Y=Math.hypot(X,V,k);Y>1e-9?(X/=Y,V/=Y,k/=Y):[X,V,k]=T,X*T[0]+V*T[1]+k*T[2]<0&&(X=-X,V=-V,k=-k);for(let K of C)e.push(...K),t.push(X,V,k),n.push(P);r.push(F,F+1,F+2,F,F+2,F+3)},i=C=>{for(let T of oa){let P=T.c.map(F=>F.map((I,z)=>I?C.max[z]:C.min[z]));o(P,T.n,C.part)}};for(let C of ta)i(C);for(let C of na)i(C);let a=wn,s=1.08,c=.47,l=.69,u=-.55,d=.08,m=-.48,f=.01,h=[-c,a,u],p=[c,a,u],b=[-c,a,d],y=[c,a,d],g=[-l,s,m],x=[l,s,m],w=[-l,s,f],R=[l,s,f];o([p,x,R,y],[1,0,0],le.body),o([b,w,g,h],[-1,0,0],le.body),o([w,R,x,g],[0,1,0],le.body),o([h,p,y,b],[0,-1,0],le.body),o([y,R,w,b],[0,0,1],le.body),o([h,g,x,p],[0,0,-1],le.body);let S=10,D=8,B=[0,1.205,-.23],N=[.42,.115,.38],H=n.length;for(let C=0;C<=D;C++){let T=Math.PI*C/D,P=Math.cos(T),F=Math.sin(T);for(let I=0;I<=S;I++){let z=Math.PI*2*I/S,E=F*Math.cos(z),L=F*Math.sin(z);e.push(B[0]+N[0]*E,B[1]+N[1]*P,B[2]+N[2]*L);let G=E/N[0],X=P/N[1],V=L/N[2],k=Math.hypot(G,X,V)||1;G/=k,X/=k,V/=k,t.push(G,X,V),n.push(le.head)}}for(let C=0;C<D;C++)for(let T=0;T<S;T++){let P=H+C*(S+1)+T,F=P+S+1;r.push(P,F,P+1,P+1,F,F+1)}let O=new Float32Array(e),M=new Float32Array(t),v=new Float32Array(n),A=new Uint16Array(r);return{position:O,normal:M,part:v,index:A,vertexCount:n.length,indexCount:r.length}}function bo(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[f,h]=r(m),p=f-i(m),b=h-a(m);if(d>=2){let y=Math.max(l,m-1),g=Math.min(u-1,m+1),x=i(g)-i(y),w=a(g)-a(y),R=Math.hypot(x,w);if(R>1e-6){let S=-w/R,D=x/R;S*p+D*b<0&&(S=-S,D=-D),p=S,b=D}}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 yo(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 ra=.42;function ia(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 h of e)h.x<r&&(r=h.x),h.y<o&&(o=h.y),h.x>i&&(i=h.x),h.y>a&&(a=h.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,f=(h,p)=>{let b=Math.min(u-1,Math.max(0,Math.floor((h-r)/l)));return Math.min(d-1,Math.max(0,Math.floor((p-o)/l)))*u+b};for(let h=0;h<t;h++){let p=f(e[h].x,e[h].y),b=m.get(p);b?b.push(h):m.set(p,[h])}for(let h=0;h<t;h++){let p=e[h],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 w=y-x;w<=y+x;w++)if(!(w<0||w>=d))for(let R=b-x;R<=b+x;R++){if(R<0||R>=u||x>1&&Math.abs(w-y)<x&&Math.abs(R-b)<x)continue;let S=m.get(w*u+R);if(S)for(let D of S){if(D===h)continue;let B=Math.hypot(e[D].x-p.x,e[D].y-p.y);B<g&&(g=B)}}if(Number.isFinite(g)&&g<=x*l)break}n[h]=g}return n}function aa(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-_t):0}function go(e,t,n,r,o){let i=e.length,a=new Float32Array(i*3),s=new Float32Array(i),c=new Float32Array(i*3),l=new Float32Array(i),u=new Float32Array(i),d=new Float32Array(i),m=new Float32Array(i*3),f=new Map,h=ia(e);for(let p=0;p<i;p++){let b=e[p],g=(n?.seatPitchU(p)??h[p])*_;l[p]=Number.isFinite(g)?Math.max(.06,Math.min(ke,g*ra)):ke,u[p]=ho(Number.isFinite(g)?g:void 0),d[p]=b.wheelchairSpaceType==="no-seat"?0:1,a[p*3]=b.x*_,a[p*3+1]=n?n.seatDeckY(p):aa(b),a[p*3+2]=b.y*_,s[p]=pt(t?t(b):"available");let x=ee(o?.get(b.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[p*3]=x[0],c[p*3+1]=x[1],c[p*3+2]=x[2],b.accessibility?.length){let w=ee(ao(b.accessibility));w&&(m[p*3]=w[0],m[p*3+1]=w[1],m[p*3+2]=w[2])}f.set(b.id,p)}return{count:i,iPosition:a,iState:s,iCategory:c,iMaxRadius:l,iRing:m,idToIndex:f,iChairWidth:u,iPhysicalSeat:d,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var sa=64;function Pn(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+sa){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 ca=.15,la=.9,ua=1.76,da=.7,ma=1.6;function fa(){return{background:{top:[...Ke.top],bottom:[...Ke.bottom]},structure:fn,seatStates:{...Kn},seatScale:1}}function xo(e){let t=fa();if(!e)return t;let n=ee(e.background);if(n){t.background={top:be(n,la),bottom:be(n,ua)};let i={};for(let[a,s]of Object.entries(fn))i[a]=he(s,n,ca);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(da,o))),t}function vo(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Mo(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 ha(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 So(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Cn(e,t){let n=1/0;for(let r of Mo(e)){let o=it(t,r.x,r.y);o<n&&(n=o)}for(let r of Mo(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 An(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,w=g.y-r;o+=x*x,a+=w*w,i+=x*w,s+=x*x*x,c+=w*w*w,l+=x*w*w,u+=w*x*x}let d=o*a-i*i;if(Math.abs(d)<1e-9)return null;let m=(s+l)/2,f=(c+u)/2,h=(m*a-f*i)/d,p=(f*o-m*i)/d,b=h+n,y=p+r;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var ba=.15;function ya(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,w=0;for(let R of g.pts)x+=R.x,w+=R.y;return{x:x/g.pts.length,y:w/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,w=g.y-r;o+=x*x,i+=x*w,a+=w*w}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 f=1/0,h=-1/0,p=[];for(let g of e){let x=1/0,w=-1/0;for(let R of g.pts){let S=R.x*u+R.y*d;S<x&&(x=S),S>w&&(w=S),S<f&&(f=S),S>h&&(h=S)}p.push(w-x)}let b=h-f;return b>1e-9?(p.sort((g,x)=>g-x),p[Math.min(p.length-1,Math.floor(p.length*.9))]/b<=ga?{x:u,y:d}:null):null}var ga=.35;function wo(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 w of g.pts)x+=Math.hypot(w.x-r.x,w.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=>ha(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||So(a[b],a[g])>=y)continue;let x=Cn(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++)So(a[b],a[y])>l||Cn(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 w of u[x])i[w].blockId===-1&&(i[w].blockId=y,g.push(w))}}let m=new Map;for(let b of i){let y=m.get(b.blockId)??[];y.push(b),m.set(b.blockId,y)}let f=[];for(let b of i){if(b.pts.length<4)continue;let y=An(b.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||f.push({x:y.cx,y:y.cy}))}let h=f.length>=2?(()=>{let b=f.map(x=>x.x).sort((x,w)=>x-w),y=f.map(x=>x.y).sort((x,w)=>x-w),g=Math.floor(f.length/2);return{cx:b[g],cy:y[g]}})():null;if(h){let b=S=>Math.hypot(S.x-h.cx,S.y-h.cy),y=1/0,g=-1/0,x=[];for(let S of i){let D=1/0,B=-1/0;for(let N of S.pts){let H=b(N);H<D&&(D=H),H>B&&(B=H)}x.push(B-D),D<y&&(y=D),B>g&&(g=B)}let w=g-y;x.sort((S,D)=>S-D);let R=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(w>1e-9&&R/w<=ba){let S=i.map(T=>{let P=0;for(let F of T.pts)P+=b(F);return{row:T,radius:P/T.pts.length}}),D=0,B=0;for(let T of S)D+=T.radius,B+=T.row.focalDistance;D/=S.length,B/=S.length;let N=0;for(let T of S)N+=(T.radius-D)*(T.row.focalDistance-B);if(N<0)for(let T of S)T.radius=-T.radius;let O=1/0;for(let T of S)T.radius<O&&(O=T.radius);S.sort((T,P)=>T.radius-P.radius);let M=-1,v=-1/0,A=w/Math.max(1,S.length)*.5,C=[];for(let T of S)T.radius-v>A&&(M++,v=T.radius),T.row.ordinal=M,T.row.blockDepth=T.radius-O,C.push(T.row);return{sectionId:e,rows:C,blockCount:d}}}let p=[];for(let[,b]of m){let y=ya(b);if(y){let g=w=>{let R=0;for(let S of w.pts)R+=S.x*y.x+S.y*y.y;return R/w.pts.length};b.sort((w,R)=>g(w)-g(R)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let x=0;for(let w=0;w<b.length;w++)w>0&&(x+=Cn(b[w-1].pts,b[w].pts)),b[w].ordinal=w,b[w].blockDepth=x,p.push(b[w])}else{let g=1/0;for(let x of b)x.focalDistance<g&&(g=x.focalDistance);b.sort((x,w)=>x.focalDistance-w.focalDistance);for(let x=0;x<b.length;x++)b[x].ordinal=x,b[x].blockDepth=Math.max(0,b[x].focalDistance-g),p.push(b[x])}}return{sectionId:e,rows:p,blockCount:d}}var Yc=Math.PI/180;function Po(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 xa(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 Co(e,t,n){return Po(e,t)&&!(n??[]).some(r=>Po(e,r)||xa(e,r))}function va(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 Ma(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let f of e)n+=f.x,r+=f.y,o+=Math.hypot(f.x-t.x,f.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let f of e){let h=Math.hypot(f.x-n,f.y-r);h>s&&(s=h,a=f)}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((f,h)=>(f.x-n)*c+(f.y-r)*l-((h.x-n)*c+(h.y-r)*l)),m=0;for(let f of d){let h=Math.hypot(f.x-n,f.y-r);h>m&&(m=h)}return{pts:d,cx:n,cy:r,radius:m,depth:o}}function Ao(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 Sa(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 f=0;f<Ht;f++)if(m<r[f]){for(let h=Ht-1;h>f;h--)r[h]=r[h-1],o[h]=o[h-1];r[f]=m,o[f]=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=Ao(e[u],t,n);for(let m=0;m<3;m++)if(d<i[m]){for(let f=2;f>m;f--)i[f]=i[f-1],a[f]=a[f-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 wa(e){let t=(r,o)=>Sa(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=Ao(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 Ro(e,t){let n=[];for(let r of e){let o=Ma(r.points,t);o&&n.push(o)}return n.length<2?va(t):(n.sort((r,o)=>r.depth-o.depth),wa(n))}var En=et(require("polygon-clipping"),1);var ko=et(require("earcut"),1);var Pa=.58,Io=.01,ye=ke*1.5*Be,Ca=.5,Aa=.6;function Ra(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 Ia(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 Eo=Math.PI/12;function Ea(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 Fo(e,t){if(!e.length||!(t>0))return[];let n=Ea(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/Eo)),f=t/Math.cos(d/m/2);for(let h=0;h<=m;h++){let p=c+d*h/m;u.push({x:s.x+Math.cos(p)*f,y:s.y+Math.sin(p)*f})}};if(n.length<3){let s=0,c=0;for(let f of n)s+=f.x,c+=f.y;s/=n.length||1,c/=n.length||1;let l=0;for(let f of n)l=Math.max(l,Math.hypot(f.x-s,f.y-c));let u=[],d=Math.max(3,Math.ceil(Math.PI*2/Eo)),m=(l+t)/Math.cos(Math.PI/d);for(let f=0;f<d;f++){let h=f/d*Math.PI*2;u.push({x:s+Math.cos(h)*m,y:c+Math.sin(h)*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 Bo(a)}function Ta(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 f=t[m],h=Math.hypot(u.x-f.cx,u.y-f.cy)-f.rad;if(h>=d&&h>=s)continue;let p=Ta(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 Do(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,f=Math.hypot(d,m)||1;d/=f,m/=f;let h=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+m*h,y:u.y-d*h},{x:u.x-m*h,y:u.y+d*h}]})():[];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=Ia(i,Math.max(c*Aa,ye));return{pts:l,nrm:Ra(l,r),front:Math.max(n[t].pitch*Pa,ye),back:Math.max(n[t].pitch*Ca,ye)}}var at=1.5,Lo=.3;function Rn(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],f=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);f>s&&(s=f,c=d)}if(s<=t||c<0)return[n,r];let l=Rn(e.slice(0,c+1),t),u=Rn(e.slice(c),t);return[...l.slice(0,-1),...u]}function _o(e,t){if(e.length<4)return e;let n=Rn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Oo(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=>Do(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],f=l[l.length-1],h=[];for(let g=0;g<m.pts.length;g++)h.push(u(m,g));for(let g of l)h.push(d(g,g.pts.length-1));for(let g=f.pts.length-1;g>=0;g--)h.push(d(f,g));for(let g=l.length-1;g>=0;g--)h.push(u(l[g],0));let p=Bo(h),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:_o(p,Lo),holes:[],topY:b});continue}for(let g of ka(l))i.push({outline:g,holes:[],topY:b})}return i}function ka(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=En.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(_o(i,Lo))}return r}catch{return[]}}function Bo(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 In=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 To(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],f=r[d+1];e.tri([u.x*_,o,u.y*_],[m.x*_,o,m.y*_],[f.x*_,o,f.y*_],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=En.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 h=0;h<u.length-1;h++)d.push(u[h][0],u[h][1]),m.push([u[h][0],u[h][1]]);if(m.length<3)continue;let f=(0,ko.default)(d,void 0,2);for(let h=0;h<f.length;h+=3){let p=m[f[h]],b=m[f[h+1]],y=m[f[h+2]];e.tri([p[0]*_,o,p[1]*_],[b[0]*_,o,b[1]*_],[y[0]*_,o,y[1]*_],c,i)}}}function No(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(f=>[f.x,f.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new In([[...i]]):null,d=f=>{e.setMaterial(2),f(),e.setMaterial(0)},m=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let h=t[f];if(h.patch&&h.patch.length>=3){let R=[...h.patch],S=s[f].belowY??r;if(m(()=>{if(l&&u)To(e,l,u,R,h.y,o.tread);else{let D=R[0];for(let B=1;B+1<R.length;B++){let N=R[B],H=R[B+1];e.tri([D.x*_,h.y,D.y*_],[N.x*_,h.y,N.y*_],[H.x*_,h.y,H.y*_],c,o.tread)}}}),h.y>S+Io){let D=0,B=0;for(let N of R)D+=N.x,B+=N.y;D/=R.length,B/=R.length,d(()=>{for(let N=0;N<R.length;N++){let H=R[N],O=R[(N+1)%R.length],M=O.x-H.x,v=O.y-H.y,A=Math.hypot(M,v);if(A<1e-6)continue;let C=v/A,T=-M/A;(H.x-D)*C+(H.y-B)*T<0&&(C=-C,T=-T);let P=[C,0,T],F=[H.x*_,h.y,H.y*_],I=[O.x*_,h.y,O.y*_],z=[H.x*_,S,H.y*_],E=[O.x*_,S,O.y*_];e.tri(F,I,E,P,o.riser),e.tri(F,E,z,P,o.riser)}})}continue}let p=Do(t,f,s,n);if(!p)continue;let{pts:b,nrm:y,front:g,back:x}=p,w=s[f].belowY??r;for(let R=0;R+1<b.length;R++){let S=b[R],D=b[R+1],B=y[R],N=y[R+1];if(Math.hypot(D.x-S.x,D.y-S.y)<1e-6||B[0]===0&&B[1]===0||N[0]===0&&N[1]===0)continue;let H=[(S.x-B[0]*g)*_,h.y,(S.y-B[1]*g)*_],O=[(D.x-N[0]*g)*_,h.y,(D.y-N[1]*g)*_],M=[(S.x+B[0]*x)*_,h.y,(S.y+B[1]*x)*_],v=[(D.x+N[0]*x)*_,h.y,(D.y+N[1]*x)*_];if(m(()=>{l&&u?To(e,l,u,[{x:S.x-B[0]*g,y:S.y-B[1]*g},{x:D.x-N[0]*g,y:D.y-N[1]*g},{x:D.x+N[0]*x,y:D.y+N[1]*x},{x:S.x+B[0]*x,y:S.y+B[1]*x}],h.y,o.tread):(e.tri(H,O,v,c,o.tread),e.tri(H,v,M,c,o.tread))}),h.y>w+Io){let A=[H[0],w,H[2]],C=[O[0],w,O[2]],T=[-B[0],0,-B[1]];d(()=>{e.tri(H,O,C,T,o.riser),e.tri(H,C,A,T,o.riser)})}}}}function Vo(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 Tn=et(require("polygon-clipping"),1);function Fa(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function zo(e,t){return e.filter(n=>n.type!=="shape"||Fa(n,t))}function Go(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:zo(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:zo(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Da={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function st(e){return Vo(e)??Da}function Ho(e,t){let n=Vt(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=Tn.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 Uo(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=Tn.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 La=.05,jo=.05,_a=.15,kn=25;function Xo(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 f of m.objects){if(f.type==="table"&&u.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let h=Vt(f.outline,ye);c.set(f.id,{section:f,unit:m,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:f.id,floorIndex:d,box:st(h),section:f,unit:m,outline:h})}}for(let d=0;d<t.length;d++){let m=t[d];for(let f of l){if(n&&f.floorIndex!==n[d]||m.x<f.box.minX||m.x>f.box.maxX||m.y<f.box.minY||m.y>f.box.maxY||!Co({x:m.x,y:m.y},f.outline,f.section.holes))continue;o[d]=f.id;let h=c.get(f.id);h.hasSeats=!0;let p=m.focalPoint??f.unit.focal,b=Math.hypot(m.x-p.x,m.y-p.y);b<h.frontU&&(h.frontU=b),h.seatIndices.push(d);let y=m.rowId||`__seat-${d}`,g=h.rows.get(y);g?g.push({x:m.x,y:m.y}):h.rows.set(y,[{x:m.x,y:m.y}]);break}}for(let[d,m]of c){let f=co(m.section,{floorBaseHeightM:m.unit.baseHeightM}),h=m.unit.baseHeightM,p=f.rake>0?Math.tan(f.rake*Math.PI/180):0,b=f.rake<=.01&&f.height<=h+.001,y=m.section.surfaceKind,g=y==="flat"?!0:y==="rakedRows"&&f.rake>.01?!1:b,x=m.hasSeats?wo(d,t,m.seatIndices,m.unit.focal):{sectionId:d,rows:[],blockCount:0},R=x.rows.length<2?Ro([...m.rows.values()].map(P=>({points:P})),m.unit.focal):null,S=1/0;if(R){if(m.hasSeats)for(let P of m.rows.values())for(let F of P){let I=R.depthAt(F.x,F.y);I<S&&(S=I)}if(!m.hasSeats||!Number.isFinite(S)){S=1/0;for(let P of m.section.outline){let F=R.depthAt(P.x,P.y);F<S&&(S=F)}}}let D=h+La,B=Math.max(D,f.height),N=P=>{let F=Math.max(0,P-S)*we,I=Math.min(F*p,kn);return Math.max(D,f.height+I)},H=P=>{let F=Math.max(0,P)*we,I=Math.min(F*p,kn);return Math.max(D,f.height+I)},O=g?[]:x.rows.map(P=>({pts:P.pts,y:H(P.blockDepth),depth:P.blockDepth,blockId:P.blockId,...u.has(P.id)?{patch:Fo(P.pts,ye)}:{}})),M=O.length?O[0].y:B,v=O.map(P=>{let F=P.patch&&P.patch.length>=3?P.patch:P.pts,I=0,z=0;for(let G of F)I+=G.x,z+=G.y;let E=F.length||1;I/=E,z/=E;let L=0;for(let G of F){let X=Math.hypot(G.x-I,G.y-z);X>L&&(L=X)}return{cx:I,cy:z,rad:L}}),A=g?()=>B:O.length>=2?(P,F)=>{let I=1/0,z=M;for(let E=0;E<O.length;E++){let L=v[E];if(Math.hypot(P-L.cx,F-L.cy)-L.rad>=I)continue;let G=O[E].patch,X=G&&G.length>=3?gt(G,P,F)?0:it(G,P,F):it(O[E].pts,P,F);X<I&&(I=X,z=O[E].y)}return z}:(P,F)=>R?N(R.depthAt(P,F)):B,C=[0,1,0],T=O.length>=2||g?()=>C:(P,F)=>{if(!R)return C;let I=R.depthAt(P,F);if(I<=S)return C;let z=(I-S)*we;if(z*p>=kn||f.height+z*p<=D)return C;let[E,L]=R.gradientAt(P,F);if(E===0&&L===0)return C;let G=1/Math.hypot(p,1);return[-E*p*G,G,-L*p*G]};if(!g)for(let P of x.rows){let F=H(P.blockDepth);for(let I of P.seatIndices)a[I]=F}for(let P of x.rows){let F=[];for(let G=1;G<P.pts.length;G++){let X=Math.hypot(P.pts[G].x-P.pts[G-1].x,P.pts[G].y-P.pts[G-1].y);X>1e-6&&F.push(X)}F.sort((G,X)=>G-X);let I=F.length?F[Math.floor(F.length/2)]:1/0,z=1/0,E=P.pts[Math.floor(P.pts.length/2)];if(E)for(let G of x.rows){if(G===P||G.blockId!==P.blockId)continue;let X=it(G.pts,E.x,E.y);X>1e-6&&X<z&&(z=X)}let L=Math.min(I,Math.max(z,I*.5));if(Number.isFinite(L)&&L>0)for(let G of P.seatIndices)s[G]=L}r.set(d,{sectionId:d,deckAt:A,normalAt:T,flat:g,bottomY:h,rowLevels:O,landingY:M})}for(let d=0;d<t.length;d++){let m=o[d],f=t[d];if(m){let p=a[d];i[d]=(p??r.get(m).deckAt(f.x,f.y))+_a;continue}let h=f.eyeHeightM;i[d]=Number.isFinite(h)?Math.max(0,h-_t):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var ae={top:1,wallBottom:.5,bottomCap:.4};function Fe(e,t){if(!e)return t;let n=be(ht(e,.4),.62);return he(t,n,.72)}function Yo(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 f=ee(n.get(d));f&&(s+=f[0]*m,c+=f[1]*m,l+=f[2]*m,u+=m)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function Wo(e,t){return ee(e.color)??t.get(e.logicalSectionId??e.id)??null}var yl=Math.PI*2;function Ko(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var qo=et(require("polygon-clipping"),1);function Oa(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Xt=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])&&Oa(n,this.levels[l])),a=[[r]];if(i.length)try{a=qo.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 Ba(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,f=d.y-s;return{x:a+m*l-f*u,y:s+m*u+f*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=zt(n,r,e.width/2,e.height/2)}return t?Ba(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"&&Ko(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Na=.08;function $o(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+Na);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 Zo(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 Qo(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 De(e,t,n,r,o,i){se(e,t,void 0,()=>n,r,o,i,ae)}var Fn=2.4,Va=.75,za=.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 Jo(e,t,n,r,o){let i=Ct(t);i&&se(e,i,void 0,()=>n+Fn,n,Fe(r,o.boothTop),o.boothWall,ae)}function Dn(e){if(e.shape==="round"){let u=e.radius;return u?zt(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 er(e,t,n,r,o){let i=Dn(t);i&&se(e,i,void 0,()=>n+Va,n,Fe(r,o.tableTop),o.tableWall,ae)}function tr(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?he(o.stageTop,be(ht(d,.18),.9),.9):Fe(d,c?o.stageTop:o.decorTop),f=t.role==="screen"?d:null,h=c?d?he(o.stageWall,be(d,.58),.82):o.stageWall:t.role==="screen"?f?he(be(f,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Fe(ee(t.fill),o.decorWall);if(l.kind==="portal"&&s.length===4){let p=Zo(s);De(e,Pt(p,0,.16),u,n,m,h),De(e,Pt(p,.84,1),u,n,m,h),De(e,p,u,Math.max(n,u-.35),m,h);return}if(l.kind==="suite"&&s.length===4){let p=s.map((g,x)=>{let w=s[(x+1)%4],R=(g.x+w.x)/2,S=(g.y+w.y)/2;return Math.hypot(R-i.x,S-i.y)}),b=p.indexOf(Math.min(...p)),y=[0,1,2,3].map(g=>s[(b+g)%4]);De(e,Pt(y,0,.08),u,n,m,h),De(e,Pt(y,.92,1),u,n,m,h),De(e,Qo(y,.88,1),u,n,m,h),De(e,y,u,Math.max(n,u-.18),m,h);return}De(e,s,u,n,m,h)}function Ln(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,f])=>({x:i+m*c-f*l,y:a+m*l+f*c}))}function Ga(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)=>he(s,c,1/(l+1)),a[0]):null}function nr(e,t,n,r){if(t.layer==="foreground")return;let o=Ln(t);if(!o)return;let i=n+za,a=Fe(Ga(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=he(r.ground,a,s)),se(e,o,void 0,()=>i,n,a,he(a,r.decorWall,.5),ae)}function or(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Fe(r,o.gaTop);se(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ae)}var Ha=Math.PI/180,Q=96,Ua=6,ja=60,Xa=150,rr=.2,Ya=.35;function Wa(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Ha;return n<0?n+360:n}function Yt(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 ir(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 f of m.rows){for(let h of f.pts)o+=h.x,i+=h.y,a++;if(f.pts.length>=4){let h=An(f.pts);h&&Number.isFinite(h.cx)&&Number.isFinite(h.cy)&&r.push({x:h.cx,y:h.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=Yt(r.map(y=>y.x)),f=Yt(r.map(y=>y.y)),h=0;for(let y of n)for(let g of y.rows)for(let x of g.pts){let w=Math.hypot(x.x-s.x,x.y-s.y);w>h&&(h=w)}let p=0,b=h*.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-f)<b&&p++;Math.hypot(m-s.x,f-s.y)<=h&&p/a<.01&&(c={x:m,y:f})}let l=[];for(let m of n){let f={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let h of m.rows)for(let p of h.pts){let b=Math.hypot(p.x-c.x,p.y-c.y),y=Math.min(Q-1,Math.floor(Wa(c,p)/(360/Q)));f.samples.push({r:b,bin:y,levelM:h.levelM}),b<f.rMin&&(f.rMin=b),b>f.rMax&&(f.rMax=b)}f.samples.length&&l.push(f)}if(!l.length)return null;l.sort((m,f)=>m.rMin+m.rMax-(f.rMin+f.rMax));let u=[];for(let m of l){let f=!1;for(let h of u){let p=Math.min(m.rMax,h.rMax)-Math.max(m.rMin,h.rMin),b=Math.min(m.rMax-m.rMin,h.rMax-h.rMin);if(b>1e-9&&p>=Ya*b){h.members.push(m),h.rMin=Math.min(h.rMin,m.rMin),h.rMax=Math.max(h.rMax,m.rMax),f=!0;break}}f||u.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let d=[];for(let m of u){let f=new Array(Q).fill(null);for(let v of m.members)for(let A of v.samples){let C=f[A.bin];C||(C={samples:[]},f[A.bin]=C),C.samples.push({r:A.r,levelM:A.levelM})}let h=f.map(v=>!!v);if(!h.filter(Boolean).length)continue;let b=[],y=[];for(let v of f){if(!v)continue;let A=1/0,C=-1/0;for(let T of v.samples)T.r<A&&(A=T.r),T.r>C&&(C=T.r);b.push(A),y.push(C)}let g=Yt(b),x=Yt(y);if(!(g>=rr*x)||!(x>0))continue;let w=[...b].sort((v,A)=>v-A);if(!(w[Math.floor(w.length*.1)]>=rr*x))continue;let S=f.map(v=>{if(!v)return null;let A=[...v.samples].sort((L,G)=>L.r-G.r),C=A[0].r,T=A[A.length-1].r,P=A[0].levelM,F=-1/0;for(let L of A)L.levelM>F&&(F=L.levelM);let I=[];for(let L of A){let G={r:L.r,l:L.levelM};for(;I.length&&Math.abs(I[I.length-1].r-G.r)<1e-9;){if(I[I.length-1].l<=G.l){G.skip=!0;break}I.pop()}if(!G.skip){for(;I.length>=2;){let X=I[I.length-2],V=I[I.length-1];if((V.r-X.r)*(G.l-X.l)-(V.l-X.l)*(G.r-X.r)<=0)I.pop();else break}I.push(G)}}let z=I.map(L=>L.r),E=I.map(L=>L.l);return{inner:C,outer:T,front:P,top:F,profile:{rs:z,ls:E}}}),D=h.slice();for(let v=0;v<Q;v++){if(D[v])continue;let A=-1,C=-1,T=0;for(let k=1;k<=Q;k++){let Y=(v-k+Q*2)%Q;if(D[Y]){A=Y;break}}for(let k=1;k<=Q;k++){let Y=(v+k)%Q;if(D[Y]){C=Y,T=k;break}}if(A<0||C<0)continue;let P=0;for(let k=1;k<=Q;k++){let Y=(v-k+Q*2)%Q;if(h[Y]){P=k;break}}if(P-1+T>Ua)continue;let I=S[A],z=S[C],E=P/(P+T),L=I.inner+(z.inner-I.inner)*E,G=I.outer+(z.outer-I.outer)*E,X=I.front+(z.front-I.front)*E,V=I.top+(z.top-I.top)*E;S[v]={inner:L,outer:G,front:X,top:V,profile:{rs:[L,G],ls:[X,V]}}}for(let v=0;v<Q;v++)S[v]&&(D[v]=!0);let B=360/Q,N=[],H=D.filter(Boolean).length,O=[];if(H===Q)O.push({start:0,len:Q});else{let v=0;for(;D[v];)v=(v+1)%Q;let A=-1;for(let C=0;C<=Q;C++){let T=(v+C)%Q,P=C<Q&&D[T];if(P&&A<0)A=T;else if(!P&&A>=0){let F=(T-A+Q)%Q||Q;O.push({start:A,len:F}),A=-1}}}for(let v of O){if(v.len*B<ja&&v.len<Q)continue;let A=v.len===Q,C=new Float64Array(v.len),T=new Float64Array(v.len),P=new Float64Array(v.len),F=new Float64Array(v.len),I=[];for(let k=0;k<v.len;k++){let Y=S[(v.start+k)%Q];C[k]=Y.inner,T[k]=Y.outer,P[k]=Y.front,F[k]=Y.top,I.push(Y.profile??{rs:[Y.inner,Y.outer],ls:[Y.front,Y.top]})}let z=Wt(C,A),E=Wt(T,A),L=Wt(P,A),G=Wt(F,A);for(let k=0;k<v.len;k++)z[k]>C[k]&&(z[k]=C[k]),E[k]<T[k]&&(E[k]=T[k]),z[k]>E[k]-1e-6&&(z[k]=Math.max(0,E[k]-1e-6)),G[k]<L[k]&&(G[k]=L[k]);let X={startBin:v.start,binCount:v.len,closed:A,innerR:z,outerR:E,frontLevelM:L,topLevelM:G,profiles:I},V=(k,Y,K)=>{let J=I[k],Z=J.rs,$=J.ls;if(Y<=Z[0]){$[0]>K&&($[0]=K);return}if(Y>=Z[Z.length-1]){$[$.length-1]>K&&($[$.length-1]=K);return}for(let te=0;te+1<Z.length;te++)if(Y<=Z[te+1]){$[te]>K&&($[te]=K),$[te+1]>K&&($[te+1]=K);return}};for(let k=0;k<v.len;k++){let Y=f[(v.start+k)%Q];if(Y)for(let K of Y.samples){V(k,K.r,K.levelM);let J=A?(k-1+v.len)%v.len:k-1,Z=A?(k+1)%v.len:k+1;J>=0&&V(J,K.r,K.levelM),Z<v.len&&V(Z,K.r,K.levelM)}}N.push(X)}N.reduce((v,A)=>v+A.binCount*B,0)<Xa||d.push({arcs:N,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:g,outerRMedian:x})}if(!d.length)return null;if(d.sort((m,f)=>m.innerRMedian-f.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:Q,binStepDeg:360/Q,rings:d}}function ar(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,f=d.ls;if(r<=m[0])return f[0];if(r>=m[m.length-1])return f[f.length-1];for(let h=0;h+1<m.length;h++)if(r<=m[h+1]){let p=m[h+1]-m[h],b=p>1e-9?(r-m[h])/p:0;return f[h]+(f[h+1]-f[h])*b}return f[f.length-1]};return l(a)*(1-c)+l(s)*c}var Ka=.25,qa=1.2,$a=.6,Za=.45,Qa=2.3,Ja=Math.PI/180;function Ze(e,t,n){let r=n*Ja;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function es(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 ts=24;function ns(e,t,n,r,o,i,a,s){let c=n.binCount,l=ts,u=we,d=i+.02,m=[];for(let M=0;M<c;M++){let v=(n.startBin+M+.5)*t.binStepDeg,A=new Float64Array(l+1);for(let C=0;C<=l;C++){let T=r[M]+(o[M]-r[M])*C/l;A[C]=Math.max(d,ar(t,n,v,T)-Ka)}m.push(A)}let f=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],h=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],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=(M,v)=>{let A=(n.startBin+M+.5)*t.binStepDeg,C=r[M]+(o[M]-r[M])*v/l,T=Ze(t.centre,C,A);return[T.x*u,m[M][v],T.y*u]};{let M=Math.tan(12*Math.PI/180);for(let v=0;v<6;v++){let A=!1;for(let T=0;T<c;T++)for(let P=l-1;P>=0;P--)m[T][P]>m[T][P+1]&&(m[T][P]=m[T][P+1],A=!0);let C=n.closed?c:c-1;for(let T=0;T<C;T++){let P=(T+1)%c;for(let F=0;F<=l;F++){let I=m[P][F]-m[T][F];if(Math.abs(I)>1)continue;let z=r[T]+(o[T]-r[T])*F/l,E=r[P]+(o[P]-r[P])*F/l,L=Ze(t.centre,z,(n.startBin+T+.5)*t.binStepDeg),G=Ze(t.centre,E,(n.startBin+P+.5)*t.binStepDeg),X=M*Math.hypot(G.x-L.x,G.y-L.y)*u;I>X?(m[P][F]=m[T][F]+X,A=!0):-I>X&&(m[T][F]=m[P][F]+X,A=!0)}}if(!A)break}}let g=1,x=(M,v)=>{for(let A=0;A<=l;A+=4)if(Math.abs(m[M][A]-m[v][A])>g)return!0;return Math.abs(m[M][l]-m[v][l])>g},w=Math.tan(38*Math.PI/180),R=M=>(o[M]-r[M])/l*u,S=(M,v)=>m[M][v+1]-m[M][v]>w*Math.max(1e-6,R(M)),D=(M,v)=>{let A=n.closed?(M-1+c)%c:Math.max(0,M-1),C=n.closed?(M+1)%c:Math.min(c-1,M+1);Math.abs(m[A][v]-m[M][v])>g&&(A=M),Math.abs(m[C][v]-m[M][v])>g&&(C=M);let T=Math.max(0,v-1),P=Math.min(l,v+1);T<v&&S(M,T)&&(T=v),P>v&&S(M,v)&&(P=v);let F=y(A,v),I=y(C,v),z=y(M,T),E=y(M,P),L=I[0]-F[0],G=I[1]-F[1],X=I[2]-F[2],V=E[0]-z[0],k=E[1]-z[1],Y=E[2]-z[2],K=G*Y-X*k,J=X*V-L*Y,Z=L*k-G*V,$=Math.hypot(K,J,Z);return $>1e-12?(K/=$,J/=$,Z/=$,J<0&&(K=-K,J=-J,Z=-Z),[K,J,Z]):[0,1,0]},B=(M,v)=>{let A=[M[0],i,M[2]],C=[v[0],i,v[2]],T=v[0]-M[0],P=v[2]-M[2],F=Math.hypot(T,P);if(!(F>1e-12))return;let I=[P/F,0,-T/F];e.tri(M,v,C,I,p,p,b),e.tri(M,C,A,I,p,b,b)},N=.05*Be,H=M=>o[M]-r[M]<N,O=n.closed?c:c-1;for(let M=0;M<O;M++){let v=(M+1)%c;if(H(M)||H(v))continue;if(x(M,v)){let I=(n.startBin+M+1)*t.binStepDeg,z=(k,Y)=>{let K=(r[M]+r[v])/2,J=(o[M]+o[v])/2,Z=K+(J-K)*Y/l,$=Ze(t.centre,Z,I);return[$.x*u,m[k][Y],$.y*u]};for(let k=0;k<l;k++){let Y=y(M,k),K=y(M,k+1),J=z(M,k),Z=z(M,k+1),$=D(M,k),te=D(M,k+1);e.triN(Y,J,Z,$,$,te,f),e.triN(Y,Z,K,$,te,te,f);let Ue=y(v,k),je=y(v,k+1),Re=z(v,k),Ie=z(v,k+1),Ee=D(v,k),xe=D(v,k+1);e.triN(Re,Ue,je,Ee,Ee,xe,f),e.triN(Re,je,Ie,Ee,xe,xe,f);let ve=z(M,k),ie=z(M,k+1),Je=z(v,k+1),Le=z(v,k),Te=ie[0]-ve[0],Xe=ie[2]-ve[2],dt=Math.hypot(Te,Xe);if(dt>1e-12){let me=[Xe/dt,0,-Te/dt];e.tri(ve,ie,Je,me,p),e.tri(ve,Je,Le,me,p)}}let E=y(M,0),L=y(v,0),G=y(v,l),X=y(M,l),V=k=>[k[0],i,k[2]];e.tri(V(E),V(G),V(L),[0,-1,0],h),e.tri(V(E),V(X),V(G),[0,-1,0],h),B(E,L),B(X,G);continue}for(let I=0;I<l;I++){let z=D(M,I),E=D(v,I),L=D(v,I+1),G=D(M,I+1);if(S(M,I)||S(v,I)){let K=(ie,Je)=>{let Le=(n.startBin+ie+.5)*t.binStepDeg,Te=r[ie]+(o[ie]-r[ie])*(I+.5)/l,Xe=Ze(t.centre,Te,Le);return[Xe.x*u,Je,Xe.y*u]},J=y(M,I),Z=y(v,I),$=K(M,m[M][I]),te=K(v,m[v][I]);e.triN(J,Z,te,z,E,E,f),e.triN(J,te,$,z,E,z,f);let Ue=y(v,I+1),je=y(M,I+1),Re=K(M,m[M][I+1]),Ie=K(v,m[v][I+1]);e.triN(Re,Ie,Ue,G,L,L,f),e.triN(Re,Ue,je,G,L,G,f);let Ee=te[0]-$[0],xe=te[2]-$[2],ve=Math.hypot(Ee,xe);if(ve>1e-12){let ie=[-xe/ve,0,Ee/ve];e.tri($,te,Ie,ie,p),e.tri($,Ie,Re,ie,p)}continue}let X=y(M,I),V=y(v,I),k=y(v,I+1),Y=y(M,I+1);e.triN(X,V,k,z,E,L,f),e.triN(X,k,Y,z,L,G,f)}let A=y(M,0),C=y(v,0),T=y(v,l),P=y(M,l),F=I=>[I[0],i,I[2]];e.tri(F(A),F(T),F(C),[0,-1,0],h),e.tri(F(A),F(P),F(T),[0,-1,0],h),B(A,C),B(P,T)}if(!n.closed)for(let M of[0,c-1])for(let v=0;v<l;v++)B(y(M,v),y(M,v+1))}function sr(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),f=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),f[p]=Math.max(m[p]+.001,d.outerR[p]+ye)}let h=0;for(let p=0;p<d.binCount;p++){let b=d.topLevelM[p]-r;b>h&&(h=b)}h>=qa&&ns(e,t,d,m,f,r,o,i);for(let p=0;p<d.binCount;p++){let b=(d.startBin+p)%t.binCount;f[p]>a[b]&&(a[b]=f[p])}}if(es(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=$a*Be,l=Za*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 f=-1/0;for(let p=0;p<u.binCount;p++)u.topLevelM[p]>f&&(f=u.topLevelM[p]);let h=()=>f+Qa;u.closed?se(e,m,[d.slice().reverse()],h,r,o.shellTop,o.shellWall,i):se(e,[...m,...d.slice().reverse()],void 0,h,r,o.shellTop,o.shellWall,i)}}function cr(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=Fe(r,s.tierTop);if(!o)return;let u=b=>o.deckAt(b.x,b.y),d=Ho(t,a),m=d[0]??t.outline;if(o.rowLevels.length>=2){let b=Ut(o.rowLevels),y=Uo(Oo(o.rowLevels,n.focal,b),d),g=()=>[0,1,0];for(let w of y){let R=Math.max(c,w.topY-.02);for(let S of i.subtract(w.outline,R))se(e,S,w.holes,()=>R,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 w of d.length?d:[m])No(e,o.rowLevels,n.focal,o.landingY,x,w,b);return}let f=o.flat?1/0:jo,h=b=>o.normalAt(b.x,b.y),p=o.flat?o.landingY:void 0;for(let b of i.subtract(m,p))se(e,b,t.holes,u,c,l,s.tierWall,ae,f,h)}function os(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 lr(e,t,n,r,o){let i=os(t,n,r);if(!i.length)return;let a=ir(i,t.focal);a&&(e.setMaterial(0),sr(e,a,{bottomY:t.baseHeightM,colors:{bandTop:be(o.tierTop,.8),bandWall:o.tierWall,shellTop:be(o.tierWall,1.15),shellWall:o.tierWall},ao:ae,shapes:t.objects.filter(s=>s.type==="shape")}))}function ur(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 dr(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 rs=1.15,is=3.25,as=4.5,ss=.85,cs=.5,ls=.26;function mr(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>=rs&&a.add("zone"),o<=(i?is:as)&&(a.add("section"),a.add("ga")),o<=ss&&(a.add("annotation"),a.add("booth")),o<=cs&&a.add("row"),o<=ls&&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,f=l/d,h=u/d,p=m>=-1.05&&m<=1.05&&f>=-1.05&&f<=1.05&&h<=1;return{x:(m*.5+.5)*n,y:(1-(f*.5+.5))*r,depth:h,visible:p}}function fr(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){let c=Math.abs(i.screen.x-s.screen.x),l=Math.abs(i.screen.y-s.screen.y);if(c<t&&l<n){a=!0;break}}a||r.push(i)}return r}var hr={row:8,seat:14};function pr(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 br(e,t,n,r){let o=[...e].sort((a,s)=>(s.priority??0)-(a.priority??0)||a.focus-s.focus),i=[];for(let a of o){if(i.length>=r)break;let s=!1;for(let c of i)if(Math.abs(a.screen.x-c.screen.x)<t&&Math.abs(a.screen.y-c.screen.y)<n){s=!0;break}s||i.push(a)}return i}var us=6,ds=2.2,yr=.1,ms=.3,fs=1.8,hs=.9,ps=.55,bs=6e3;function gr(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],f=d.zoneId??(m?c.get(m):void 0);if(!f)continue;let h=l.get(f);h||(h={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(f,h)),h.n++,d.x<h.minX&&(h.minX=d.x),d.y<h.minY&&(h.minY=d.y),d.x>h.maxX&&(h.maxX=d.x),d.y>h.maxY&&(h.maxY=d.y),h.sumY+=o.seatDeckY(u)}for(let u of a){let d=l.get(u.id),m=[];for(let[f,h]of c)h===u.id&&m.push(f);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 xr(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]+us,m.center[2]],color:t.zones?.find(f=>f.id===m.id)?.color});{let m=new Map,f=new Map;for(let h=0;h<r.length;h++){let p=o.seatOwner[h];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[h].x,b.y+=r[h].y,b.deck+=o.seatDeckY(h);let y=f.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},f.set(p,y)),r[h].x<y.minX&&(y.minX=r[h].x),r[h].x>y.maxX&&(y.maxX=r[h].x),r[h].y<y.minY&&(y.minY=r[h].y),r[h].y>y.maxY&&(y.maxY=r[h].y)}for(let h of n)for(let p of h.objects){if(p.type!=="section")continue;let b=m.get(p.id);if(!b||b.n===0)continue;let y=f.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:h.index,label:x,seatCount:b.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*_),focalWorld:[h.focal.x*_,h.baseHeightM+1.5,h.focal.y*_]});let w=t.floors?.[h.index]?.name?.trim().toLocaleLowerCase();n.length>1&&w===x.trim().toLocaleLowerCase()||l.push({id:`section:${p.id}`,kind:"section",text:x,anchor:[g[0],g[1]+ds,g[2]],floorIndex:h.index})}}{for(let h of n)for(let p of h.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*_,h.baseHeightM+fs,b.y*_],floorIndex:h.index})}let m=new Map;for(let h=0;h<r.length;h++){let p=r[h],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:h,far:b})}for(let[h,p]of m){let b=p.seat.label?p.seat.label.lastIndexOf("-"):-1,y=b>0?p.seat.label.slice(0,b):h;y&&l.push({id:`row:${h}`,kind:"row",text:y,anchor:[p.seat.x*_,o.seatDeckY(p.index)+hs,p.seat.y*_],floorIndex:a[p.index]})}let f=new Map;for(let h=0;h<r.length;h++){let p=r[h],b=p.label?p.label.lastIndexOf("-"):-1,y=f.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},f.set(p.rowId,y));let g=h*3,x=i.iPosition[g],w=i.iPosition[g+1],R=i.iPosition[g+2];y.n++,y.x+=x,y.y+=w,y.z+=R,y.minX=Math.min(y.minX,x),y.maxX=Math.max(y.maxX,x),y.minZ=Math.min(y.minZ,R),y.maxZ=Math.max(y.maxZ,R)}for(let[h,p]of f)d.push({id:h,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<=bs)for(let h=0;h<r.length;h++){let p=r[h],b=p.displayLabel||p.label;b&&l.push({id:`seat:${p.id}`,kind:"seat",text:b,anchor:[p.x*_,o.seatDeckY(h)+ps,p.y*_],floorIndex:a[h]})}}for(let m of n)for(let f of m.objects)if(f.type==="shape"&&f.role&&["entrance","exit","screen","suite","obstruction"].includes(f.role)){let h=St(f),p=h?yt(h):null;if(!p||!f.label)continue;l.push({id:`architecture:${f.id}`,kind:"annotation",text:f.label,anchor:[p.x*_,m.baseHeightM+wt(f).heightM+yr,p.y*_],color:f.fill,floorIndex:m.index})}else if(f.type==="text"){if(!f.text)continue;l.push({id:`text:${f.id}`,kind:"annotation",text:f.text,anchor:[f.position.x*_,m.baseHeightM+yr,f.position.y*_],color:f.color,rotation:f.rotation,floorIndex:m.index})}else if(f.type==="booth"){let h=Ct(f);if(!h)continue;let p=yt(h);if(!p)continue;l.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[p.x*_,m.baseHeightM+Fn+ms,p.y*_],floorIndex:m.index})}return{labels:l,sections:u,rows:d}}function vr(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 Mr(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 f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),h=m*3,p=l[f];p.minX=Math.min(p.minX,i.position[h]),p.minY=Math.min(p.minY,i.position[h+1]),p.minZ=Math.min(p.minZ,i.position[h+2]),p.maxX=Math.max(p.maxX,i.position[h]),p.maxY=Math.max(p.maxY,i.position[h+1]),p.maxZ=Math.max(p.maxZ,i.position[h+2])}let u=new Map;for(let m=0;m<n.length;m++)for(let f of n[m].objects)f.type==="section"&&u.set(f.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 f=o.seatOwner[m],h=(f!==null?u.get(f):void 0)??a[m];if(h===void 0)continue;let p=d[h],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]=h}for(let m=0;m<n.length;m++){let f=d[m],h=t.floors?.[m],p=l[m],b=Math.min(f.n?f.minX*_:n[m].focal.x*_-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(f.n?f.maxX*_:n[m].focal.x*_+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(f.n?f.minY*_:n[m].focal.y*_-1,Number.isFinite(p.minZ)?p.minZ:1/0),x=Math.max(f.n?f.maxY*_:n[m].focal.y*_+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),w=Math.min(f.n?Math.min(n[m].baseHeightM,f.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),R=Math.max(f.n?Math.max(f.maxDeck,w+.5):w+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),S=[f.n?f.sumX/f.n:(b+y)/2,f.n?f.sumDeck/f.n:(w+R)/2,f.n?f.sumZ/f.n:(g+x)/2],D=Math.max(1,.5*Math.hypot(y-b,R-w,x-g));c.push({index:m,id:h?.id??`floor-${m}`,label:h?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:f.n,center:S,radius:D,box:{min:[b,w,g],max:[y,R,x]},focalWorld:[n[m].focal.x*_,n[m].baseHeightM+1.5,n[m].focal.y*_]})}}return c}function _n(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=Dn(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=Ln(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 Sr(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);se(e,s,void 0,()=>0,-.4,i.ground,i.ground,ae)}else{let a=t.reduce((f,h)=>h.baseHeightM<f.baseHeightM?h:f);e.setFloor(a.index);let s=n.filter((f,h)=>r[h]===a.index),c=_n([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;se(e,d,void 0,()=>m,m-.22,i.ground,i.ground,ae)}}function wr(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],w=Math.max(.35,t.iMaxRadius[p]??.35);m(y-w,g,x-w),m(y+w,g+1.6,x+w)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,d=o+i);let f=[(a+l)/2,(s+u)/2,(c+d)/2],h=Math.max(1,.5*Math.hypot(l-a,u-s,d-c));return{center:f,radius:h,minY:s,maxY:u}}function Pr(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let w=0;w<e.count;w++){let R=w*3,S=e.iPosition[R],D=e.iPosition[R+2];S<a&&(a=S),S>c&&(c=S),D<s&&(s=D),D>l&&(l=D)}for(let w of t)a=Math.min(a,w.cx-w.halfX),c=Math.max(c,w.cx+w.halfX),s=Math.min(s,w.cz-w.halfZ),l=Math.max(l,w.cz+w.halfZ);let u=n.minX*_,d=n.maxX*_,m=n.minY*_,f=n.maxY*_,h=u,p=d,b=m,y=f;if(Number.isFinite(a)){let w=Math.max(2,.06*Math.hypot(c-a,l-s));h=Math.max(u,a-w),p=Math.min(d,c+w),b=Math.max(m,s-w),y=Math.min(f,l+w)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[h,g,b],max:[p,x,y]}}function ct(e){let{doc:t}=e,n=xo(t.theme),r=n.structure,o=Go(t,e.eventConfigurationId??t.eventConfigurationId),i=e.seats,a=new Nt,s=new Map;for(let M of o)for(let v of M.objects)s.set(v.id,M.index),v.type==="section"&&s.set(v.logicalSectionId??v.id,M.index);let c=i.map(M=>s.get(M.sectionId??"")??s.get(M.rowId??"")??0),l=_n(o,i);Sr(a,o,i,c,l,r);let u=Yo(t,i),d=new Map;for(let M of t.categories??[])d.set(M.key,M.color);let m=[],f=Xo(o,i,c),h=new Float32Array(i.length);for(let M=0;M<o.length;M++){let v=o[M];a.setFloor(M);let A=new Xt,C=[],T=v.objects.filter(P=>P.type==="section"&&!!P.outline&&P.outline.length>=3);for(let P of v.objects)P.type==="section"?cr(a,P,v,Wo(P,u),f.bySection.get(P.id),A,T,r):P.type==="shape"?(a.setMaterial(P.role==="screen"?1:0),tr(a,P,v.baseHeightM,$o(P,C),r,v.focal,m),a.setMaterial(0)):P.type==="gaArea"?or(a,P,v.baseHeightM,ee(d.get(P.categoryKey)),r):P.type==="booth"?Jo(a,P,v.baseHeightM,ee(d.get(P.categoryKey)),r):P.type==="table"?er(a,P,v.baseHeightM,ee(d.get(P.categoryKey)),r):P.type==="decorImage"&&nr(a,P,v.baseHeightM,r);lr(a,v,i,f,r)}let p=o.length>1?{x:o.reduce((M,v)=>M+v.focal.x,0)/o.length,y:o.reduce((M,v)=>M+v.focal.y,0)/o.length}:t.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},b=fo([a.build()]),y=go(i,e.initialState,f,h,d),g=gr({doc:t,units:o,seats:i,surfaces:f,focal:p}),{labels:x,sections:w,rows:R}=xr({doc:t,units:o,seats:i,surfaces:f,seatData:y,hintedSeatFloor:c,zones:g,focal:p}),S=Mr({doc:t,units:o,seats:i,surfaces:f,solids:b,hintedSeatFloor:c,seatFloor:h});vr(x,S),y.iYaw=bo(y.iPosition,i.length,M=>i[M].rowId,M=>{let v=o[h[M]]?.focal??p;return[v.x*_,v.y*_]});let D=(l.minX+l.maxX)/2*_,B=(l.minY+l.maxY)/2*_,N=.5*Math.hypot((l.maxX-l.minX)*_,(l.maxY-l.minY)*_)||10,H=wr(b,y,{cx:D,cz:B,radius:N}),O=Pr(y,m,l,H.minY,H.maxY,N);return{solids:b,seats:y,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:N,groundY:0,box:O},renderBounds:{center:H.center,radius:H.radius},stateColorLUT:vo(n,ge),theme:n,seatCount:i.length,focalWorld:[p.x*_,1.5,p.y*_],zones:g,stages:m,sections:w,rows:R,labels:x,floors:S}}var ys=88,gs=20,xs={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}},On=new Set(["row","seat"]),Cr={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Ar={row:{x:62,y:16},seat:{x:46,y:18}},Ir=ee,Bn=e=>Wn(e);function Er(e,t){let n=Bn(e),r=Bn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Rr(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 vs(e,t=[.04,.06,.1]){let n=Bn(t)<.42,r=n?"#f4f7fb":"#0b1220",o=Ir(e),i=o&&Er(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 Kt=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=mr(o,i,{hasZoneLabels:this.labels.some(p=>p.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let p of this.labels){if(!s.has(p.kind))continue;let b=Ve(t,p.anchor,n,r);if(!b.visible)continue;let y=a?Math.hypot(p.anchor[0]-a[0],p.anchor[1]-a[1],p.anchor[2]-a[2]):1;c.push({label:p,screen:b,focus:pr(b,y,n,r),...this.selectedSeatLabelIds.has(p.id)?{priority:1}:{}})}let l=dr(c.filter(p=>p.label.kind==="floor"),n),u=[...c.filter(p=>!On.has(p.label.kind)&&p.label.kind!=="floor"),...l],d=[...fr(u,ys,gs),...["row","seat"].flatMap(p=>br(c.filter(b=>b.label.kind===p),Ar[p].x,Ar[p].y,hr[p]))],m=new Set(d.map(p=>p.label.id));for(let{label:p,screen:b}of d){let g=this.nodeFor(p).style;g.display="",g.transform=`translate(-50%, -50%) translate(${b.x.toFixed(1)}px, ${b.y.toFixed(1)}px)`}let f=d.filter(({label:p})=>!On.has(p.kind)).sort((p,b)=>Cr[b.label.kind]-Cr[p.label.kind]||p.screen.depth-b.screen.depth||p.focus-b.focus),h=[];for(let{label:p}of f){let b=this.nodes.get(p.id);if(!b||b.style.display==="none")continue;let y=b.getBoundingClientRect();h.some(x=>y.left<x.right+3&&y.right+3>x.left&&y.top<x.bottom+3&&y.bottom+3>x.top)?b.style.display="none":h.push(y)}for(let[p,b]of this.nodes)m.has(p)||(b.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=xs[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=vs(t.color??this.opts.ink,this.opts.backgroundRgb),s=!On.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=Ir(r?"#ecf8ff":a.ink)??[1,1,1],u=r?Rr("rgba(10,28,45,.9)",c):s?Rr(a.backing,c):c;return n.dataset.qualityContrast=Er(l,u).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var kr=1;var Ms=new Set(["floor","zone","section","ga","booth","annotation"]);function Ss(e){return e.every(t=>Number.isFinite(t))}function ws(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 Tr(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Qe(e){return Math.round(e*1e4)/1e4}function Ps(e){if(e)return{box:{x:Qe(e.box.x),y:Qe(e.box.y),width:Qe(e.box.width),height:Qe(e.box.height)},horizontalFillRatio:Qe(e.horizontalFillRatio),verticalFillRatio:Qe(e.verticalFillRatio),visibleAreaRatio:Qe(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 qt(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Ms.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)ws(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",Ss(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:Ps(e.framing)},metrics:{minimumHierarchyFontPx:Tr(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Tr(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var pe=require("ogl");var ze=require("ogl");var $t=`
|
|
2
2
|
float chairWeight(float depth) {
|
|
3
3
|
return 1.0 - smoothstep(uChairFull, uChairNone, depth);
|
|
4
|
-
}`,
|
|
4
|
+
}`,Fr=`
|
|
5
5
|
float occupantWeight(float depth) {
|
|
6
6
|
float nearWeight = smoothstep(${to.toFixed(1)}, ${no.toFixed(1)}, depth);
|
|
7
7
|
float farWeight = 1.0 - smoothstep(${Jn.toFixed(1)}, ${eo.toFixed(1)}, depth);
|
|
8
8
|
return nearWeight * farWeight;
|
|
9
|
-
}`,
|
|
9
|
+
}`,Cs=`#version 300 es
|
|
10
10
|
precision highp float;
|
|
11
11
|
in vec3 position;
|
|
12
12
|
in vec3 normal;
|
|
@@ -42,7 +42,7 @@ void main() {
|
|
|
42
42
|
vNormalWorld = normalize(mat3(modelMatrix) * normal);
|
|
43
43
|
vColor = color;
|
|
44
44
|
gl_Position = projectionMatrix * mv;
|
|
45
|
-
}`,
|
|
45
|
+
}`,As=`#version 300 es
|
|
46
46
|
precision highp float;
|
|
47
47
|
in vec3 vColor;
|
|
48
48
|
in vec3 vNormalWorld;
|
|
@@ -109,7 +109,7 @@ void main() {
|
|
|
109
109
|
+ vec3(0.20, 0.10, 0.34) * focalHalo;
|
|
110
110
|
base = mix(base, display, poweredDisplay * verticalFace * 0.92);
|
|
111
111
|
fragColor = vec4(base, 1.0);
|
|
112
|
-
}`,
|
|
112
|
+
}`,Rs=`#version 300 es
|
|
113
113
|
precision highp float;
|
|
114
114
|
in vec2 position; // quad corner in [-1,1]
|
|
115
115
|
in vec3 iOffset; // per-instance world position
|
|
@@ -168,7 +168,7 @@ void main() {
|
|
|
168
168
|
vPhysicalSeat = iPhysicalSeat;
|
|
169
169
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
170
170
|
gl_Position = projectionMatrix * mv;
|
|
171
|
-
}`,
|
|
171
|
+
}`,Is=`#version 300 es
|
|
172
172
|
precision highp float;
|
|
173
173
|
in vec2 vUv;
|
|
174
174
|
in vec3 vColor;
|
|
@@ -226,7 +226,7 @@ void main() {
|
|
|
226
226
|
alpha *= vDotWeight;
|
|
227
227
|
if (alpha <= 0.0) discard;
|
|
228
228
|
fragColor = vec4(c, alpha);
|
|
229
|
-
}`,
|
|
229
|
+
}`,Es=`#version 300 es
|
|
230
230
|
precision highp float;
|
|
231
231
|
in vec3 position; // local: x/z in units of the seat radius, y in METRES
|
|
232
232
|
in vec3 normal;
|
|
@@ -257,7 +257,7 @@ out float vDim;
|
|
|
257
257
|
out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
|
|
258
258
|
out vec3 vOccupantTint;
|
|
259
259
|
${$t}
|
|
260
|
-
${
|
|
260
|
+
${Fr}
|
|
261
261
|
void main() {
|
|
262
262
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
263
263
|
float viewDepth = -anchor.z;
|
|
@@ -340,7 +340,7 @@ void main() {
|
|
|
340
340
|
vRing = iRing;
|
|
341
341
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
342
342
|
gl_Position = projectionMatrix * mv;
|
|
343
|
-
}`,
|
|
343
|
+
}`,Ts=`#version 300 es
|
|
344
344
|
precision highp float;
|
|
345
345
|
in vec3 vColor;
|
|
346
346
|
in vec3 vNormalWorld;
|
|
@@ -390,14 +390,14 @@ void main() {
|
|
|
390
390
|
// which is what stops a block of them merging into one mass up close.
|
|
391
391
|
base += vec3(0.26, 0.31, 0.38) * fres * 0.55;
|
|
392
392
|
fragColor = vec4(base, 1.0);
|
|
393
|
-
}`,
|
|
393
|
+
}`,ks=`#version 300 es
|
|
394
394
|
precision highp float;
|
|
395
395
|
in vec2 position;
|
|
396
396
|
out vec2 vUv;
|
|
397
397
|
void main() {
|
|
398
398
|
vUv = position * 0.5 + 0.5;
|
|
399
399
|
gl_Position = vec4(position, 0.999, 1.0);
|
|
400
|
-
}`,
|
|
400
|
+
}`,Fs=`#version 300 es
|
|
401
401
|
precision highp float;
|
|
402
402
|
in vec2 vUv;
|
|
403
403
|
uniform vec3 uTop;
|
|
@@ -408,7 +408,7 @@ void main() {
|
|
|
408
408
|
vec2 c = vUv - 0.5;
|
|
409
409
|
float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
|
|
410
410
|
fragColor = vec4(col * vig, 1.0);
|
|
411
|
-
}`,
|
|
411
|
+
}`,Ds=`#version 300 es
|
|
412
412
|
precision highp float;
|
|
413
413
|
in vec2 position;
|
|
414
414
|
in vec3 iOffset;
|
|
@@ -445,7 +445,7 @@ void main() {
|
|
|
445
445
|
vPhysicalSeat = iPhysicalSeat;
|
|
446
446
|
vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
447
447
|
gl_Position = projectionMatrix * mv;
|
|
448
|
-
}`,
|
|
448
|
+
}`,Ls=`#version 300 es
|
|
449
449
|
precision highp float;
|
|
450
450
|
in vec2 vUv;
|
|
451
451
|
in float vPhysicalSeat;
|
|
@@ -459,7 +459,7 @@ void main() {
|
|
|
459
459
|
float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
|
|
460
460
|
if (d > 1.0) discard; // hit-mask matches chair/bay shape
|
|
461
461
|
fragColor = vec4(vPick, 1.0);
|
|
462
|
-
}`,
|
|
462
|
+
}`,_s=`#version 300 es
|
|
463
463
|
precision highp float;
|
|
464
464
|
in vec3 position;
|
|
465
465
|
in float part;
|
|
@@ -480,7 +480,7 @@ uniform float uFocusFloor;
|
|
|
480
480
|
flat out vec3 vPick;
|
|
481
481
|
out float vHidden;
|
|
482
482
|
${$t}
|
|
483
|
-
${
|
|
483
|
+
${Fr}
|
|
484
484
|
void main() {
|
|
485
485
|
int id = int(iPickIndex + 0.5); // already global index + 1
|
|
486
486
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -510,7 +510,7 @@ void main() {
|
|
|
510
510
|
float c = cos(iYaw), s = sin(iYaw);
|
|
511
511
|
vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
512
512
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
|
|
513
|
-
}`,
|
|
513
|
+
}`,Os=`#version 300 es
|
|
514
514
|
precision highp float;
|
|
515
515
|
flat in vec3 vPick;
|
|
516
516
|
in float vHidden;
|
|
@@ -518,7 +518,7 @@ out vec4 fragColor;
|
|
|
518
518
|
void main() {
|
|
519
519
|
if (vHidden > 0.5) discard;
|
|
520
520
|
fragColor = vec4(vPick, 1.0);
|
|
521
|
-
}`,
|
|
521
|
+
}`,Bs=`#version 300 es
|
|
522
522
|
precision highp float;
|
|
523
523
|
in vec3 position;
|
|
524
524
|
in float floorIndex;
|
|
@@ -529,14 +529,14 @@ out float vHidden;
|
|
|
529
529
|
void main() {
|
|
530
530
|
vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
531
531
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
532
|
-
}`,
|
|
532
|
+
}`,Ns=`#version 300 es
|
|
533
533
|
precision highp float;
|
|
534
534
|
in float vHidden;
|
|
535
535
|
out vec4 fragColor;
|
|
536
536
|
void main() {
|
|
537
537
|
if (vHidden > 0.5) discard;
|
|
538
538
|
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
539
|
-
}`;function Fr(e){return new ze.Program(e,{vertex:Fs,fragment:ks,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:De},uSeatScale:{value:1},uMinPixels:{value:ot},uPixelToWorld:{value:.002},uChairFull:{value:bt},uChairNone:{value:rt},uFocusFloor:{value:-1}}})}function kr(e){return new ze.Program(e,{vertex:Ls,fragment:_s,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:bt},uChairNone:{value:rt},uBackRake:{value:Sn},uBackBase:{value:Gt},uFocusFloor:{value:-1}}})}function Lr(e){return new ze.Program(e,{vertex:Os,fragment:Bs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function _r(e){return new ze.Program(e,{vertex:Ps,fragment:Cs,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function Or(e){return new ze.Program(e,{vertex:As,fragment:Rs,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:De},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 Br(e){return new ze.Program(e,{vertex:Is,fragment:Es,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:Sn},uBackBase:{value:Gt},uFocusFloor:{value:-1}}})}function Nr(e,t,n){return new ze.Program(e,{vertex:Ts,fragment:Ds,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function Vr(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 Ns=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Vs=new Float32Array([-1,-1,3,-1,-1,3]);function zr(e,t){let n=new he.Transform,r=new he.Transform,o=new he.Geometry(e,{position:{size:2,data:Vs}}),i=Nr(e,t.theme.background.top,t.theme.background.bottom),a=new he.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new he.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=_r(e),l=new he.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let u=Or(e),d=new Float32Array(t.seats.count*3),m=ge.map(F=>t.theme.seatStates[F]);Vr(d,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let f=new he.Geometry(e,{position:{size:2,data:Ns},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 he.Mesh(e,{geometry:f,program:u});p.frustumCulled=!1,t.seats.count>0&&p.setParent(n);let h=f.attributes.iColor,b=ho(),y=Br(e),g=Lt,x=new Float32Array(g*3),P=new Float32Array(g*3),R=new Float32Array(g),S=new Float32Array(g),D=new Float32Array(g*3),B=new Float32Array(g),V=new Float32Array(g),H=new Float32Array(g),O=new Float32Array(g),M=new he.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:P,instanced:1},iRadius:{size:1,data:R,instanced:1},iYaw:{size:1,data:S,instanced:1},iRing:{size:3,data:D,instanced:1},iFloor:{size:1,data:B,instanced:1},iPhysicalSeat:{size:1,data:V,instanced:1},iSeed:{size:1,data:O,instanced:1},iPickIndex:{size:1,data:H,instanced:1}}),v=new he.Mesh(e,{geometry:M,program:y});v.frustumCulled=!1;let A=0,w=new Int32Array(0),_=()=>{let F=t.seats;for(let I=0;I<A;I++){let z=w[I];O[I]=yo(F.iState[z],z);let k=F.iCategory&&F.iState[z]===0?null:m[F.iState[z]]??m[0];if(k)P[I*3]=k[0],P[I*3+1]=k[1],P[I*3+2]=k[2];else{let G=qn([F.iCategory[z*3],F.iCategory[z*3+1],F.iCategory[z*3+2]]);P[I*3]=G[0],P[I*3+1]=G[1],P[I*3+2]=G[2]}}M.attributes.iColor.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0},C={main:n,background:r,seatProgram:u,solidProgram:c,chairProgram:y,seatGeometry:f,chairGeometry:M,solidGeometry:s,drawCalls:3,setNearSeats(F,I){let z=Math.min(I,g);if(w=F,A=z,z===0){v.parent&&v.setParent(null),M.instancedCount=0,C.drawCalls=3;return}let E=t.seats;for(let k=0;k<z;k++){let G=F[k];x[k*3]=E.iPosition[G*3],x[k*3+1]=E.iPosition[G*3+1],x[k*3+2]=E.iPosition[G*3+2],R[k]=E.iChairWidth[G],S[k]=E.iYaw[G],D[k*3]=E.iRing[G*3],D[k*3+1]=E.iRing[G*3+1],D[k*3+2]=E.iRing[G*3+2],B[k]=E.iFloor[G],V[k]=E.iPhysicalSeat[G],H[k]=G+1}_(),M.attributes.iOffset.needsUpdate=!0,M.attributes.iRadius.needsUpdate=!0,M.attributes.iYaw.needsUpdate=!0,M.attributes.iRing.needsUpdate=!0,M.attributes.iFloor.needsUpdate=!0,M.attributes.iPhysicalSeat.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0,M.attributes.iPickIndex.needsUpdate=!0,M.instancedCount=z,v.parent||v.setParent(n),C.drawCalls=4},nearSeatCount(){return A},uploadSeatStateRuns(F){if(!F.length)return;A&&_();for(let z of F)Vr(d,t.seats.iState,z.start,z.length,m,t.seats.iCategory);let I=h.buffer;if(!I){h.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,I);for(let z of F){let E=d.subarray(z.start*3,(z.start+z.length)*3);e.bufferSubData(e.ARRAY_BUFFER,z.start*3*Float32Array.BYTES_PER_ELEMENT,E)}},dispose(){o.remove(),i.remove(),s.remove(),c.remove(),f.remove(),u.remove(),M.remove(),y.remove()}};return C}var Ce=require("ogl");function zs(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function Gr(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=zs(e[u],e[u+1],e[u+2]);if(d<0||d>=i)continue;let m=l-r,f=c-o,p=m*m+f*f;p<s&&(s=p,a=d)}return a}function Hr(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 Gs=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Zt=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=Fr(this.gl),this.chairProg=kr(this.gl),this.depthProg=Lr(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 Gs)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[f,p,h]=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(f,p,h,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(),Gr(b,d,m,n-l,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Ur(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,ht(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 Ge=require("ogl");function Hs(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Xr(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Us(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Yr(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 Nn(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Vn(e,t){return Math.max(0,Math.min(1,e+t))}function Wr(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,f=[0,0,0];for(let p=0;p<3;p++)f[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 f}function zn(e,t,n,r,o){let i=Yr(Hs(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Xr(Xr(t,Us(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=Yr(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 Gn(e,t,n=35,r=28){let o=Nn(t),i=Wr(e,o),a=Nn(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function $r(e,t,n){let r=e.position.clone(),o=new Ge.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new Ge.Vec3(n[0],n[1],n[2]));let i=new Ge.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var Qt=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new Ge.Quat;this.endQuat=new Ge.Quat;this.outQuat=new Ge.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}=Gn(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,Vn(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 js=1.02,Xs=1.5;function Zr(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+js;return{eye:[e[0],o,e[2]],focal:[t.x*L,n+Xs,t.y*L]}}function Ys(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Ws(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function Jt(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Ws(t?.deviceMemory)}}function en(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&&Ys(e.sourceWidth,e.sourceHeight)>t.maxDecodedBytes?{...r,reason:"memory-limit"}:{...r,upgradeUrl:e.url,reason:"progressive"}}function Qr(){return new DOMException("Panorama image load aborted","AbortError")}function At(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Qr());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(Qr())};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 tn(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 ei(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 on=70,Ks=35,qs=90;function Hn(e){return Math.max(Ks,Math.min(qs,e))}var Ae=35;function $s(e,t,n){let r=(.5+e/360)*n;return t/2-r}function Zs(e,t=on){return e*(180/t)}function Jr(e,t,n){return(e-t)/2+nn(n,t)}function nn(e,t){let n=Ae/180*t;return Math.max(-n,Math.min(n,e))}function ti(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=en(t,Jt()),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 N=document.createElement("div");N.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(N.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(N)}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 f=0,p=0,h=0,b=0,y=on,g=()=>{let N=c.clientHeight||1,T=c.clientWidth||1,Y=R.naturalWidth||T*2,K=R.naturalHeight||N,J=f>0?(T/2-h)/f:0,Z=p>0?b/p:0;p=Zs(N,y),f=p*(Y/K),u.style.backgroundSize=`${f}px ${p}px`,x?h=T/2-J*f:(h=$s(o,T,f),b=nn((t.initialPitchDeg??0)/180*p,p),x=!0),b=nn(Z*p,p),u.style.backgroundPosition=`${h}px ${Jr(N,p,b)}px`},x=!1,P=()=>{let N=c.clientHeight||1;b=nn(b,p),u.style.backgroundPosition=`${h}px ${Jr(N,p,b)}px`},R=new Image;R.onload=g,R.src=i.initialUrl;let S=()=>{};i.upgradeUrl&&(S=tn(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(T=>!T||a.signal.aborted?null:At(T,a.signal).then(Y=>({full:Y,url:T}))).then(T=>{T&&(I||a.signal.aborted||(R=T.full,u.style.backgroundImage=`url("${T.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let D=!1,B=0,V=0,H=0,O=new Map,M=()=>{let[N,T]=[...O.values()];return N&&T?Math.hypot(N.x-T.x,N.y-T.y):0},v=N=>{let T=Hn(N);T!==y&&(y=T,g())},A=N=>{O.set(N.pointerId,{x:N.clientX,y:N.clientY}),D=O.size===1,B=N.clientX,V=N.clientY,O.size===2&&(H=M()),u.style.cursor="grabbing";try{u.setPointerCapture?.(N.pointerId)}catch{}},w=N=>{if(O.has(N.pointerId)){if(O.set(N.pointerId,{x:N.clientX,y:N.clientY}),O.size>=2){let T=M();H>0&&T>0&&v(y*(H/T)),H=T,D=!1;return}D&&(h+=N.clientX-B,b+=N.clientY-V,B=N.clientX,V=N.clientY,P())}},_=N=>{O.delete(N.pointerId),H=O.size===2?M():0;let T=O.values().next().value;D=O.size===1,T?(B=T.x,V=T.y):u.style.cursor="grab";try{u.releasePointerCapture?.(N.pointerId)}catch{}},C=N=>{N.preventDefault(),v(y+N.deltaY*.04)};u.addEventListener("pointerdown",A),u.addEventListener("pointermove",w),u.addEventListener("pointerup",_),u.addEventListener("pointercancel",_),u.addEventListener("wheel",C,{passive:!1});let F=!1,I=!1,z=0,E=()=>{u.removeEventListener("pointerdown",A),u.removeEventListener("pointermove",w),u.removeEventListener("pointerup",_),u.removeEventListener("pointercancel",_),u.removeEventListener("wheel",C),window.removeEventListener("keydown",X)},k=()=>{S(),a.abort(),n.signal?.removeEventListener("abort",s),z&&(window.clearTimeout(z),z=0),E(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},G=()=>{if(F)return;F=!0,c.style.opacity="0";let N=()=>{z=0,!I&&(k(),n.onClose?.())};z=window.setTimeout(N,r)},X=N=>{if(N.key==="Tab"){N.preventDefault(),d.focus({preventScroll:!0});return}if(N.key==="Escape"){N.stopPropagation(),G();return}if(N.key==="ArrowLeft"||N.key==="ArrowRight")h+=N.key==="ArrowLeft"?-32:32;else if(N.key==="ArrowUp"||N.key==="ArrowDown")b+=(N.key==="ArrowUp"?4:-4)*(p/180);else if(N.key==="+"||N.key==="="){v(y-5),N.preventDefault();return}else if(N.key==="-"){v(y+5),N.preventDefault();return}else return;N.preventDefault(),P()};return window.addEventListener("keydown",X),d.addEventListener("click",G),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:G,dispose(){F=!0,I=!0,k()}}}var He=require("ogl"),Qs=64,Js=32,ec=500;function tc(e=Qs,t=Js,n=ec){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,f=Math.sin(m),p=Math.cos(m);for(let h=0;h<r;h++){let b=h/e,y=(b-.5)*Math.PI*2,g=u*r+h;a[g*3]=n*f*Math.sin(y),a[g*3+1]=n*p,a[g*3+2]=-n*f*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,f=m+r;c[l++]=m,c[l++]=f,c[l++]=m+1,c[l++]=m+1,c[l++]=f,c[l++]=f+1}return{position:a,uv:s,index:c}}function ni(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 nc=`#version 300 es
|
|
539
|
+
}`;function Dr(e){return new ze.Program(e,{vertex:Ds,fragment:Ls,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 Lr(e){return new ze.Program(e,{vertex:_s,fragment:Os,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:bt},uChairNone:{value:rt},uBackRake:{value:Sn},uBackBase:{value:Gt},uFocusFloor:{value:-1}}})}function _r(e){return new ze.Program(e,{vertex:Bs,fragment:Ns,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function Or(e){return new ze.Program(e,{vertex:Cs,fragment:As,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function Br(e){return new ze.Program(e,{vertex:Rs,fragment:Is,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 Nr(e){return new ze.Program(e,{vertex:Es,fragment:Ts,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:Sn},uBackBase:{value:Gt},uFocusFloor:{value:-1}}})}function Vr(e,t,n){return new ze.Program(e,{vertex:ks,fragment:Fs,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function zr(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 Vs=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),zs=new Float32Array([-1,-1,3,-1,-1,3]);function Gr(e,t){let n=new pe.Transform,r=new pe.Transform,o=new pe.Geometry(e,{position:{size:2,data:zs}}),i=Vr(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=Or(e),l=new pe.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let u=Br(e),d=new Float32Array(t.seats.count*3),m=ge.map(F=>t.theme.seatStates[F]);zr(d,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let f=new pe.Geometry(e,{position:{size:2,data:Vs},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}}),h=new pe.Mesh(e,{geometry:f,program:u});h.frustumCulled=!1,t.seats.count>0&&h.setParent(n);let p=f.attributes.iColor,b=po(),y=Nr(e),g=Lt,x=new Float32Array(g*3),w=new Float32Array(g*3),R=new Float32Array(g),S=new Float32Array(g),D=new Float32Array(g*3),B=new Float32Array(g),N=new Float32Array(g),H=new Float32Array(g),O=new Float32Array(g),M=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:w,instanced:1},iRadius:{size:1,data:R,instanced:1},iYaw:{size:1,data:S,instanced:1},iRing:{size:3,data:D,instanced:1},iFloor:{size:1,data:B,instanced:1},iPhysicalSeat:{size:1,data:N,instanced:1},iSeed:{size:1,data:O,instanced:1},iPickIndex:{size:1,data:H,instanced:1}}),v=new pe.Mesh(e,{geometry:M,program:y});v.frustumCulled=!1;let A=0,C=new Int32Array(0),T=()=>{let F=t.seats;for(let I=0;I<A;I++){let z=C[I];O[I]=yo(F.iState[z],z);let L=F.iCategory&&F.iState[z]===0?null:m[F.iState[z]]??m[0];if(L)w[I*3]=L[0],w[I*3+1]=L[1],w[I*3+2]=L[2];else{let G=qn([F.iCategory[z*3],F.iCategory[z*3+1],F.iCategory[z*3+2]]);w[I*3]=G[0],w[I*3+1]=G[1],w[I*3+2]=G[2]}}M.attributes.iColor.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0},P={main:n,background:r,seatProgram:u,solidProgram:c,chairProgram:y,seatGeometry:f,chairGeometry:M,solidGeometry:s,drawCalls:3,setNearSeats(F,I){let z=Math.min(I,g);if(C=F,A=z,z===0){v.parent&&v.setParent(null),M.instancedCount=0,P.drawCalls=3;return}let E=t.seats;for(let L=0;L<z;L++){let G=F[L];x[L*3]=E.iPosition[G*3],x[L*3+1]=E.iPosition[G*3+1],x[L*3+2]=E.iPosition[G*3+2],R[L]=E.iChairWidth[G],S[L]=E.iYaw[G],D[L*3]=E.iRing[G*3],D[L*3+1]=E.iRing[G*3+1],D[L*3+2]=E.iRing[G*3+2],B[L]=E.iFloor[G],N[L]=E.iPhysicalSeat[G],H[L]=G+1}T(),M.attributes.iOffset.needsUpdate=!0,M.attributes.iRadius.needsUpdate=!0,M.attributes.iYaw.needsUpdate=!0,M.attributes.iRing.needsUpdate=!0,M.attributes.iFloor.needsUpdate=!0,M.attributes.iPhysicalSeat.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0,M.attributes.iPickIndex.needsUpdate=!0,M.instancedCount=z,v.parent||v.setParent(n),P.drawCalls=4},nearSeatCount(){return A},uploadSeatStateRuns(F){if(!F.length)return;A&&T();for(let z of F)zr(d,t.seats.iState,z.start,z.length,m,t.seats.iCategory);let I=p.buffer;if(!I){p.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,I);for(let z of F){let E=d.subarray(z.start*3,(z.start+z.length)*3);e.bufferSubData(e.ARRAY_BUFFER,z.start*3*Float32Array.BYTES_PER_ELEMENT,E)}},dispose(){o.remove(),i.remove(),s.remove(),c.remove(),f.remove(),u.remove(),M.remove(),y.remove()}};return P}var Ce=require("ogl");function Gs(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function Hr(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=Gs(e[u],e[u+1],e[u+2]);if(d<0||d>=i)continue;let m=l-r,f=c-o,h=m*m+f*f;h<s&&(s=h,a=d)}return a}function Ur(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 Hs=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Zt=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=Dr(this.gl),this.chairProg=Lr(this.gl),this.depthProg=_r(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 Hs)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[f,h,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(f,h,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(),Hr(b,d,m,n-l,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function jr(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 Xr(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 Ge=require("ogl");function Us(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Yr(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 Wr(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 Nn(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Vn(e,t){return Math.max(0,Math.min(1,e+t))}function Kr(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,f=[0,0,0];for(let h=0;h<3;h++)f[h]=.5*(2*c[h]+(-s[h]+l[h])*a+(2*s[h]-5*c[h]+4*l[h]-u[h])*d+(-s[h]+3*c[h]-3*l[h]+u[h])*m);return f}function zn(e,t,n,r,o){let i=Wr(Us(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Yr(Yr(t,js(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=Wr(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 Gn(e,t,n=35,r=28){let o=Nn(t),i=Kr(e,o),a=Nn(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Zr(e,t,n){let r=e.position.clone(),o=new Ge.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new Ge.Vec3(n[0],n[1],n[2]));let i=new Ge.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var Qt=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new Ge.Quat;this.endQuat=new Ge.Quat;this.outQuat=new Ge.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}=Gn(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,Vn(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 Xs=1.02,Ys=1.5;function Qr(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+Xs;return{eye:[e[0],o,e[2]],focal:[t.x*_,n+Ys,t.y*_]}}function Ws(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Ks(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function Jt(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Ks(t?.deviceMemory)}}function en(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&&Ws(e.sourceWidth,e.sourceHeight)>t.maxDecodedBytes?{...r,reason:"memory-limit"}:{...r,upgradeUrl:e.url,reason:"progressive"}}function Jr(){return new DOMException("Panorama image load aborted","AbortError")}function At(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Jr());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(Jr())};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 tn(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 ti(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 on=70,qs=35,$s=90;function Hn(e){return Math.max(qs,Math.min($s,e))}var Ae=35;function Zs(e,t,n){let r=(.5+e/360)*n;return t/2-r}function Qs(e,t=on){return e*(180/t)}function ei(e,t,n){return(e-t)/2+nn(n,t)}function nn(e,t){let n=Ae/180*t;return Math.max(-n,Math.min(n,e))}function ni(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=en(t,Jt()),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 V=document.createElement("div");V.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(V.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(V)}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 f=0,h=0,p=0,b=0,y=on,g=()=>{let V=c.clientHeight||1,k=c.clientWidth||1,Y=R.naturalWidth||k*2,K=R.naturalHeight||V,J=f>0?(k/2-p)/f:0,Z=h>0?b/h:0;h=Qs(V,y),f=h*(Y/K),u.style.backgroundSize=`${f}px ${h}px`,x?p=k/2-J*f:(p=Zs(o,k,f),b=nn((t.initialPitchDeg??0)/180*h,h),x=!0),b=nn(Z*h,h),u.style.backgroundPosition=`${p}px ${ei(V,h,b)}px`},x=!1,w=()=>{let V=c.clientHeight||1;b=nn(b,h),u.style.backgroundPosition=`${p}px ${ei(V,h,b)}px`},R=new Image;R.onload=g,R.src=i.initialUrl;let S=()=>{};i.upgradeUrl&&(S=tn(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(k=>!k||a.signal.aborted?null:At(k,a.signal).then(Y=>({full:Y,url:k}))).then(k=>{k&&(I||a.signal.aborted||(R=k.full,u.style.backgroundImage=`url("${k.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let D=!1,B=0,N=0,H=0,O=new Map,M=()=>{let[V,k]=[...O.values()];return V&&k?Math.hypot(V.x-k.x,V.y-k.y):0},v=V=>{let k=Hn(V);k!==y&&(y=k,g())},A=V=>{O.set(V.pointerId,{x:V.clientX,y:V.clientY}),D=O.size===1,B=V.clientX,N=V.clientY,O.size===2&&(H=M()),u.style.cursor="grabbing";try{u.setPointerCapture?.(V.pointerId)}catch{}},C=V=>{if(O.has(V.pointerId)){if(O.set(V.pointerId,{x:V.clientX,y:V.clientY}),O.size>=2){let k=M();H>0&&k>0&&v(y*(H/k)),H=k,D=!1;return}D&&(p+=V.clientX-B,b+=V.clientY-N,B=V.clientX,N=V.clientY,w())}},T=V=>{O.delete(V.pointerId),H=O.size===2?M():0;let k=O.values().next().value;D=O.size===1,k?(B=k.x,N=k.y):u.style.cursor="grab";try{u.releasePointerCapture?.(V.pointerId)}catch{}},P=V=>{V.preventDefault(),v(y+V.deltaY*.04)};u.addEventListener("pointerdown",A),u.addEventListener("pointermove",C),u.addEventListener("pointerup",T),u.addEventListener("pointercancel",T),u.addEventListener("wheel",P,{passive:!1});let F=!1,I=!1,z=0,E=()=>{u.removeEventListener("pointerdown",A),u.removeEventListener("pointermove",C),u.removeEventListener("pointerup",T),u.removeEventListener("pointercancel",T),u.removeEventListener("wheel",P),window.removeEventListener("keydown",X)},L=()=>{S(),a.abort(),n.signal?.removeEventListener("abort",s),z&&(window.clearTimeout(z),z=0),E(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},G=()=>{if(F)return;F=!0,c.style.opacity="0";let V=()=>{z=0,!I&&(L(),n.onClose?.())};z=window.setTimeout(V,r)},X=V=>{if(V.key==="Tab"){V.preventDefault(),d.focus({preventScroll:!0});return}if(V.key==="Escape"){V.stopPropagation(),G();return}if(V.key==="ArrowLeft"||V.key==="ArrowRight")p+=V.key==="ArrowLeft"?-32:32;else if(V.key==="ArrowUp"||V.key==="ArrowDown")b+=(V.key==="ArrowUp"?4:-4)*(h/180);else if(V.key==="+"||V.key==="="){v(y-5),V.preventDefault();return}else if(V.key==="-"){v(y+5),V.preventDefault();return}else return;V.preventDefault(),w()};return window.addEventListener("keydown",X),d.addEventListener("click",G),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:G,dispose(){F=!0,I=!0,L()}}}var He=require("ogl"),Js=64,ec=32,tc=500;function nc(e=Js,t=ec,n=tc){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,f=Math.sin(m),h=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*f*Math.sin(y),a[g*3+1]=n*h,a[g*3+2]=-n*f*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,f=m+r;c[l++]=m,c[l++]=f,c[l++]=m+1,c[l++]=m+1,c[l++]=f,c[l++]=f+1}return{position:a,uv:s,index:c}}function oi(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 oc=`#version 300 es
|
|
540
540
|
precision highp float;
|
|
541
541
|
in vec3 position;
|
|
542
542
|
in vec2 uv;
|
|
@@ -546,7 +546,7 @@ out vec2 vUv;
|
|
|
546
546
|
void main() {
|
|
547
547
|
vUv = uv;
|
|
548
548
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
549
|
-
}`,
|
|
549
|
+
}`,rc=`#version 300 es
|
|
550
550
|
precision highp float;
|
|
551
551
|
in vec2 vUv;
|
|
552
552
|
uniform sampler2D uPano;
|
|
@@ -555,4 +555,4 @@ out vec4 fragColor;
|
|
|
555
555
|
void main() {
|
|
556
556
|
vec3 rgb = texture(uPano, vUv).rgb;
|
|
557
557
|
fragColor = vec4(rgb, uOpacity);
|
|
558
|
-
}`;function oi(e,t){let{position:n,uv:r,index:o}=tc(),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:nc,fragment:oc,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 ri=.15;async function ii(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Ae,Math.min(Ae,t?.initialPitchDeg??0)),s=on,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 E=n.camera.position,k=n.focalWorld[0]-E.x,G=n.focalWorld[1]-E.y,X=n.focalWorld[2]-E.z,N=Math.hypot(k,X);N>.001&&(i=Math.atan2(k,-X)*180/Math.PI,a=Math.max(-Ae,Math.min(Ae,Math.atan2(G,N)*180/Math.PI)))}let f=null;if(t){let E=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),k=en(t,Jt(E)),G;try{let X=t.resolveUrl?await t.resolveUrl(k.initialUrl):k.initialUrl;if(!X)throw new Error("panorama_asset_unavailable");G=await At(X,l.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{f=oi(n.gl,G)}catch{return l.abort(),r.signal?.removeEventListener("abort",u),null}f.mesh.renderOrder=999,f.mesh.setParent(n.scene),k.upgradeUrl&&(d=tn(()=>{(t.resolveUrl?t.resolveUrl(k.upgradeUrl):Promise.resolve(k.upgradeUrl)).then(N=>!N||l.signal.aborted?null:At(N,l.signal)).then(N=>{N&&(c||l.signal.aborted||(f?.setImage(N),n.requestRender()))}).catch(()=>{})}))}let p=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),b=()=>{let E=n.camera.position;f?.mesh.position.set(E.x,E.y,E.z);let[k,G,X]=ni(i,a);n.camera.lookAt([E.x+k,E.y+G,E.z+X]),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 E=document.createElement("div");E.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(E.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(E)}let P=document.createElement("div");P.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(P.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),y.appendChild(P),e.appendChild(y),x.focus({preventScroll:!0});let R=!1,S=0,D=0,B=0,V=new Map,H=()=>{let[E,k]=[...V.values()];return E&&k?Math.hypot(E.x-k.x,E.y-k.y):0},O=E=>{let k=Hn(E);k!==s&&(s=k,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},M=E=>{E.target!==x&&(V.set(E.pointerId,{x:E.clientX,y:E.clientY}),R=V.size===1,S=E.clientX,D=E.clientY,V.size===2&&(B=H()),y.setPointerCapture?.(E.pointerId),y.style.cursor="grabbing")},v=E=>{if(V.has(E.pointerId)){if(V.set(E.pointerId,{x:E.clientX,y:E.clientY}),V.size>=2){let k=H();B>0&&k>0&&O(s*(B/k)),B=k,R=!1;return}R&&(i+=(E.clientX-S)*ri,a=Math.max(-Ae,Math.min(Ae,a+(E.clientY-D)*ri)),S=E.clientX,D=E.clientY,b())}},A=E=>{V.delete(E.pointerId),B=V.size===2?H():0;let k=V.values().next().value;R=V.size===1,k?(S=k.x,D=k.y):y.style.cursor="grab";try{y.releasePointerCapture?.(E.pointerId)}catch{}},w=E=>{E.preventDefault(),O(s+E.deltaY*.04)};y.addEventListener("pointerdown",M),y.addEventListener("pointermove",v),y.addEventListener("pointerup",A),y.addEventListener("pointercancel",A),y.addEventListener("wheel",w,{passive:!1});let _=E=>{if(!c){if(E.key==="Tab"){E.preventDefault(),x.focus({preventScroll:!0});return}if(E.key==="Escape"){E.stopPropagation(),z.close();return}if(E.key==="ArrowLeft"||E.key==="ArrowRight")i+=E.key==="ArrowLeft"?-4:4;else if(E.key==="ArrowUp"||E.key==="ArrowDown")a=Math.max(-Ae,Math.min(Ae,a+(E.key==="ArrowUp"?4:-4)));else if(E.key==="+"||E.key==="="){O(s-5),E.preventDefault();return}else if(E.key==="-"){O(s+5),E.preventDefault();return}else return;E.preventDefault(),b()}};window.addEventListener("keydown",_);let C=0,F=(E,k)=>{if(!f){k?.();return}let G=E===1?0:1,X=performance.now(),N=()=>{if(c)return;let T=o<=0?1:Math.min(1,(performance.now()-X)/o);f?.setOpacity(G+(E-G)*T),n.requestRender(),T<1?C=requestAnimationFrame(N):k?.()};C=requestAnimationFrame(N)};F(1);let I=()=>{c||(c=!0,d(),l.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(C),y.removeEventListener("pointerdown",M),y.removeEventListener("pointermove",v),y.removeEventListener("pointerup",A),y.removeEventListener("pointercancel",A),y.removeEventListener("wheel",w),window.removeEventListener("keydown",_),y.remove(),g?.isConnected&&g.focus({preventScroll:!0}),f?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:p,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},z={close(){if(c)return;let E=()=>{I(),r.onClose?.()};cancelAnimationFrame(C),F(0,E)},dispose:I};return x.addEventListener("click",()=>z.close()),z}function ai(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:f,flightGen:p,setPanorama:h,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:P,restorePanoramaLayer:R,getOverviewChip:S,labelOverlay:D,reducedMotion:B,removeArriveChip:V,showArriveChip:H}=e;return async(O,M,v)=>{b()?.abort();let A=new AbortController;y(A);let w=n.seats.idToIndex.get(O);if(w===void 0){i.syncFromCamera();return}let _=s.get(O)?.label??O,C=l(O,w),F=c(O);if(!F){A.abort(),b()===A&&y(null),i.syncFromCamera();return}x(!0),a.stop();let I;try{I=await F}catch{if(b()===A&&y(null),o.panoramaFailed(O,"source"),!f()&&v===p()){x(!1),i.resumeAfterFlight(C.focal),a.requestRender();let Y=H(O,v,!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())}return}if(f()||v!==p()){A.abort(),b()===A&&y(null);return}V();let z=S(),E=()=>{A.abort(),b()===A&&y(null),h(null),g(!1),R(),z.style.display="",D.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(C.focal),a.requestRender();let Y=H(O,p());requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())},k=I.generated===!0,G=ei(I);P(),g(!k),z.style.display="none";let X=B()?0:M,N=u(),T=N&&!m()?await ii(t,k?null:I,{gl:d,scene:N.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:k?C.eye:void 0,focalWorld:C.focal},{fadeMs:X,seatLabel:_,disclosure:G,disclosurePrefix:k?"Live seat-eye view":"360\xB0 panorama",onClose:E,signal:A.signal}):null;if(f()||v!==p()){A.abort(),g(!1),b()===A&&y(null),T?.dispose(),z.style.display="",R();return}if(T)i.syncFromCamera(),D.setVisible(!1),x(!1),a.requestRender(),h(T);else if(k){R(),z.style.display="",x(!1),i.resumeAfterFlight(C.focal),a.requestRender(),h(null),g(!1),o.panoramaFailed(O,"mount");let Y=H(O,p(),!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus()),b()===A&&y(null);return}else g(!1),o.panoramaFallback(O),h(ti(t,I,{fadeMs:X,seatLabel:_,disclosure:G,onClose:E,signal:A.signal}));o.panoramaOpened()}}var si=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),rn=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=si(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(si()-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 ci(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function li(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,f=!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 h=o.get(d),b=h?.sectionId?n.sections.find(B=>B.id===h.sectionId):void 0,y=h?.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 P=h?.rowId?i.get(h.rowId):void 0,R=P?.indexOf(d)??-1,S=R>=0?[P?.[R-1],P?.[R+1]]:[void 0,void 0],D=(B,V,H,O=!1)=>{let M=document.createElement("button");M.type="button",M.textContent=B,M.setAttribute("aria-label",V),Object.assign(M.style,{minHeight:"44px",padding:O?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),O||(M.style.minWidth="44px"),O&&(M.dataset.panoramaTrigger=""),M.addEventListener("click",H),x.appendChild(M)};if(S[0]){let B=o.get(S[0])?.label??S[0];D("\u2039",`View previous seat ${B}`,()=>{e.flyToSeat(S[0])})}if(r.getSeatView){let B=r.seatViewActionLabel?.(d)??"Open 360\xB0 panorama";D(f?`\u21BB Retry ${B}`:`\u25C9 ${B}`,`${f?"Retry":B} from seat ${y}`,()=>{if(e.isDisposed()||m!==e.flightGen()){l();return}l(),e.openPanorama(d,400,m)},!0)}if(S[1]){let B=o.get(S[1])?.label??S[1];D("\u203A",`View next seat ${B}`,()=>{e.flyToSeat(S[1])})}return x.childElementCount?(t.appendChild(p),s=p,c(),p):null},remove:l,layout:c}}function ui(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 h of[c,l,u,d])h.className="sl-3d-icon-control",Object.assign(h.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,l),s.append(d,u);let m=h=>{n.setPrimaryDragMode(h);let b=h==="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 f=()=>{let h=r();o.style.display=i?"none":"flex",o.style.right=h?"12px":"14px",o.style.bottom=h?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=h?"none":"flex",d.style.display=h?"none":"",u.style.display=h?"none":""};return f(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:h=>{i=h,n.setInteractionEnabled(!h),f()},seatViewLocked:()=>i,layout:f}}function di(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:f,setSelection:p,ensureSeatView:h}=e,b=0,y=0,g=0,x=-1,P=!1,R=!1,S=O=>{e.seatViewLocked()||x===-1&&(x=O.pointerId,b=O.clientX,y=O.clientY,g=performance.now(),P=!1,R=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},D=O=>{O.pointerId===x&&Math.hypot(O.clientX-b,O.clientY-y)>u&&(P=!0)},B=(O,M,v,A,w)=>{let _=t.canvas.getBoundingClientRect(),C=t.canvas.clientWidth||_.width||1,F=t.canvas.clientHeight||_.height||1,I=O-_.left,z=M-_.top,E=A*A,k=-1,G=E,X=1/0;for(let N of o){if(v&&N.sectionId!==v)continue;let T=r.seats.idToIndex.get(N.id);if(T===void 0)continue;if(w){let te=Math.round(r.seats.iState[T]??0);if(te!==0&&te!==3)continue}let Y=T*3,K=Ve(n.camera.projectionViewMatrix,[r.seats.iPosition[Y],r.seats.iPosition[Y+1]+.55,r.seats.iPosition[Y+2]],C,F);if(!K.visible)continue;let J=K.x-I,Z=K.y-z,$=J*J+Z*Z;($<G||Math.abs($-G)<1&&K.depth<X)&&(k=T,G=$,X=K.depth)}return k},V=(O,M)=>{let v=e.gpu(),A=e.pick();if(!v||!A)return-1;A.syncFromSeatProgram(v.seatProgram);let w=t.canvas.getBoundingClientRect(),_=t.renderer.dpr,{x:C,y:F}=Hr(O,M,w,_,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),I=Math.max(2,Math.round(8*_));return A.pick(n.camera,C,F,I)};return{onDown:S,onMove:D,onUp:O=>{if(O.pointerId!==x)return;let M=!P&&performance.now()-g<d;if(x=-1,R){R=!1;return}let v=e.gpu(),A=e.pick();if(!M||!v||!A)return;let w=V(O.clientX,O.clientY);if(e.focusedSectionId()&&w>=0){let F=c[w],I=F?l.get(F):void 0;if(I&&I!==e.focusedSectionId()&&f(I))return}if(e.focusedSectionId()&&w<0&&(w=B(O.clientX,O.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&w<0){let F=B(O.clientX,O.clientY,null,72,!1),I=F>=0?c[F]:void 0,z=I?l.get(I):void 0;if(z&&z!==e.focusedSectionId()&&f(z))return}if(!e.focusedSectionId()){w<0&&(w=B(O.clientX,O.clientY,null,42,!1));let F=w>=0?c[w]:void 0,I=F?l.get(F):void 0;if(I&&f(I))return}if(w<0||w>=c.length){e.selection().size&&(p([]),i.onViewTargetChange?.(null));return}let _=c[w],C=ge[Math.round(r.seats.iState[w]??0)]??"available";if(C!=="available"&&C!=="selected"){i.onSeatInspect?.(_,C);return}if(e.selection().has(_)&&e.selection().size===1){p([]),i.onViewTargetChange?.(null);return}p([_]),h(_),s.seatPicked(_,l.get(_)),i.onSeatPick?.(_)}}}var an=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 f=0;f<this.count;f++){let p=t[f*3],h=t[f*3+2];p<n&&(n=p),p>o&&(o=p),h<r&&(r=h),h>i&&(i=h)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,l=new Int32Array(c+1),u=f=>{let p=Math.min(this.cols-1,Math.max(0,Math.floor((t[f*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[f*3+2]-r)/this.cell)))*this.cols+p};for(let f=0;f<this.count;f++)l[u(f)+1]++;for(let f=0;f<c;f++)l[f+1]+=l[f];let d=new Int32Array(this.count),m=l.slice(0,c);for(let f=0;f<this.count;f++)d[m[u(f)]++]=f;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,f=0;for(let p=0;p<=d&&f<s;p++){let h=u-p,b=u+p,y=l-p,g=l+p;for(let x=h;x<=b&&f<s;x++){if(x<0||x>=this.rows)continue;let P=x===h||x===b;for(let R=y;R<=g&&f<s;R++){if(!P&&R!==y&&R!==g){R=g-1;continue}if(R<0||R>=this.cols)continue;let S=x*this.cols+R;for(let D=i[S],B=i[S+1];D<B&&f<s;D++){let V=a[D],H=m[V*3]-t,O=m[V*3+2]-n;H*H+O*O<=c&&(o[f++]=V)}}}}return f}};var sn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Lt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new an(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)<yn)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>bn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,bn,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 cn=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,f=(R,S,D=28)=>{o.camera.position.set(R[0],R[1],R[2]),o.camera.lookAt(new cn.Vec3(S[0],S[1],S[2])),o.camera.fov=D,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 h=()=>{p.textContent="\u2302"};h();let b=R=>{m=R;let S=e.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=R,S.solidProgram.uniforms.uFocusFloor.value=R,S.chairProgram.uniforms.uFocusFloor.value=R),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 R=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!R),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),R){let S=R.focalWorld[0]-R.center[0],D=R.focalWorld[2]-R.center[2],B=Math.hypot(S,D)>R.radius*.12?Math.atan2(S,D):l,V={center:R.center,radius:R.radius,box:R.box},H={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(V,!1,B,!1,H):o.frameSoft(V,B,!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=R=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let S=n.seats.idToIndex.get(R);if(S===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(R),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 D=++d;e.removeArriveChip();let{eye:B,focal:V}=e.resolvedSeatViewPose(R,S),H=[o.camera.position.x,o.camera.position.y,o.camera.position.z],O=zn(H,B,V,n.bounds.center,n.bounds.radius),M=r.arriveAtSeatEye?B:O.finalPos,v=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,A=[O.waypoints[0],O.waypoints[1],M];if(c.setVisible(!1),e.reducedMotion())return f(M,V,v),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(R,D),Promise.resolve();let w=new cn.Quat().copy(o.camera.quaternion),_=$r(o.camera,M,V);return s.requestRender(),i.start(A,w,_,2500,v).then(()=>{e.isDisposed()||D!==d||(a.cinematicPlayed(2500),o.resumeAfterFlight(V),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(R,D))})},P=R=>{let S=n.sections.find(H=>H.id===R);if(!S||S.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==S.floorIndex&&b(S.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(R);let D=S.focalWorld[0]-S.center[0],B=S.focalWorld[2]-S.center[2],V=Math.hypot(D,B)>S.radius*.12?Math.atan2(D,B):void 0;return o.frame({center:S.center,radius:Math.max(5,S.radius*.5)},!1,V),r.onSectionFocusChange?.(R),s.requestRender(),!0};return p.addEventListener("click",y),{overviewChip:p,layoutOverviewChip:h,flightGen:()=>d,focusedFloor:()=>m,applyFloorFocus:b,placeCameraFinal:f,cancelFlight:g,focusOverview:y,flyToSeat:x,focusSectionCamera:P}}var rc={};function fi(e){let t=performance.now();return{model:ct(e),buildMs:performance.now()-t,source:"main"}}function pi(e){return typeof Worker>"u"?Promise.resolve(fi(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",rc.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(fi(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 ic=Math.PI/180,ac=6,sc=500;function cc(e,t,n={}){let r=performance.now(),o=t.prepared?.model??ct(t),i=new rn(n.onAnalytics),a=new Array(o.seats.count);for(let[U,j]of o.seats.idToIndex)a[j]=U;let s=new Map(t.seats.map(U=>[U.id,U])),c=new Map;for(let U of t.seats){if(!U.rowId)continue;let j=c.get(U.rowId);j?j.push(U.id):c.set(U.rowId,[U.id])}let l=new Map;for(let U of t.seats)l.set(U.id,U.sectionId);let u=t.doc.floors?.some(j=>(j.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(j=>j.objects)??t.doc.objects).some(j=>j.type==="section"&&((j.height??0)>0||(j.rake??0)>0)),d=null,m=null,f=!1,p=!1,h=!1,b=new Map,y=null,g=null,x=null,P=new Map,R=null,S=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},D=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},B=!1,V=()=>B?me.focusedFloor():-1,H=()=>{d=zr(A.gl,o),m=new Zt(A.renderer,d.seatGeometry,d.chairGeometry,d.solidGeometry,o.seats.count),A.setClearColor(o.theme.background.top),m.setRestoreClear(o.theme.background.top),d.seatProgram.uniforms.uSeatRadius.value=De*o.theme.seatScale,d.seatProgram.uniforms.uFocusFloor.value=V(),d.solidProgram.uniforms.uFocusFloor.value=V(),d.chairProgram.uniforms.uFocusFloor.value=V(),M.forceRegather()},O=!1,M=new sn({model:o,orbit:()=>w,gpu:()=>d}),v=U=>M.setDetailEnabled(U),A=new Dt(e,{onContextLost:()=>{h||i.contextLost(),f=!0,Y.stop(),d=null,m=null},onContextRestored:()=>{H(),f=!1,h||i.contextRestored(),Y.requestRender()}}),w=new Ft(A.gl,A.canvas,()=>Y.requestRender(),()=>i.orbitEngaged());w.setAspect(A.aspect);let _=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),C=(()=>{if(_&&o.stages.length===0)return;let U=o.focalWorld[0]-o.bounds.center[0],j=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(U,j)>o.bounds.radius*.12?Math.atan2(U,j):void 0})(),F=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;w.frame(o.bounds,!I&&n.skipInitialOverviewAnimation!==!0,C,n.portraitOverviewCrop===!0,F);let z=new Qt(w.camera),E=ci(e),k=new Kt(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),G=o.labels,X=()=>lr(G,o.floors.length,V());k.setLabels(X());let N=null,T=U=>{if(N=U,k.setForcedDense(!!U),!U){k.setLabels(X());return}let j=t.seats.filter(q=>q.sectionId===U),W=new Set(j.map(q=>q.id)),ne=new Set(j.map(q=>q.rowId)),re=new Set(b.keys()),oe=new Set(j.filter(q=>re.has(q.id)).map(q=>q.id)),ce=X().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){k.setLabels(ce);return}let ue=oe.size?j.filter(q=>oe.has(q.id)):j,Ye=new Set(ue.map(q=>`seat:${q.id}`)),Oe=ue.flatMap(q=>{let fe=o.seats.idToIndex.get(q.id);if(fe===void 0)return[];let Me=fe*3;return[{id:`seat:${q.id}`,kind:"seat",text:q.displayLabel||q.label,anchor:[o.seats.iPosition[Me],o.seats.iPosition[Me+1]+(re.has(q.id)?1.05:.55),o.seats.iPosition[Me+2]]}]});k.setLabels([...ce.filter(q=>!Ye.has(q.id)),...Oe])};H();let Y=new kt(U=>{if(f||!d||p)return!1;let W=z.active?z.update(performance.now()):w.update(),ne=V()>=0?o.floors[V()]:null,re=ne?.radius??o.bounds.radius,oe=oo(w.currentDistance,re),ce=O?{center:[w.camera.position.x,w.camera.position.y,w.camera.position.z],radius:520}:o.renderBounds;w.updateClipping(ce);let ue=ne?.center??o.renderBounds.center,Ye=ne?.radius??o.renderBounds.radius,Oe=(Se,ft)=>Math.hypot(w.camera.position.x-Se[0],w.camera.position.y-Se[1],w.camera.position.z-Se[2])<=ft*(M.detailVisible?1.8:1.55),q=Oe(ue,Ye);if(!q&&N){let Se=o.sections.find(ft=>ft.id===N);Se&&(q=Oe(Se.center,Math.max(12,Se.radius*2)))}M.detailVisible=q;let fe=d.seatProgram.uniforms;fe.uSeatScale.value=oe.scale,fe.uSeatFade.value=oe.fade;let Me=!!ne&&ro(ne.seatCount,A.canvas.clientWidth||1,A.canvas.clientHeight||1),Rt=io(o.seats.count,re,w.currentDistance,w.camera.fov,A.canvas.clientHeight||1),mt=M.detailVisible||Me||Rt?1:0,It=M.detailVisible||V()>=0||o.floors.length>1?1:0;return M.ease(U,mt,It),fe.uSeatDetail.value=M.seatDetailMix,d.solidProgram.uniforms.uStructureDetail.value=M.structureDetailMix,fe.uMinPixels.value=oe.minPixels,fe.uPixelToWorld.value=2*Math.tan(w.camera.fov*ic/2)/Math.max(1,A.pixelHeight),M.update(M.detailVisible),A.renderer.render({scene:d.background,clear:!0}),A.renderer.render({scene:d.main,camera:w.camera,clear:!1}),k.update(w.camera.projectionViewMatrix,A.canvas.clientWidth||1,A.canvas.clientHeight||1,w.currentDistance,re,[w.camera.position.x,w.camera.position.y,w.camera.position.z]),W||M.seatDetailMix!==mt||M.structureDetailMix!==It}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>un.resize()):null;K?.observe(e);let J=U=>{let j=re=>{let oe=o.seats.idToIndex.get(re);return oe===void 0?void 0:o.seats.iState[oe]},{updates:W,next:ne}=jr(b,U,j);if(b=ne,k.setSelectedSeatIds(b.keys()),N&&T(N),W.length){let re=Pn(o.seats,W);d&&d.uploadSeatStateRuns(re),Y.requestRender()}},Z=()=>R!==null?R:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=8,te=U=>{if(!n.getSeatView)return null;let j=P.get(U);if(!j)for(j=Promise.resolve(n.getSeatView(U)),P.set(U,j),j.catch(()=>{P.get(U)===j&&P.delete(U)});P.size>$;){let W=P.keys().next().value;if(W===void 0)break;P.delete(W)}return j},Ue=(U,j)=>{let W=s.get(U),ne=Math.max(0,Math.round(o.seats.iFloor[j]??0)),re=t.doc.floors?.[ne],oe=o.floors[ne],ce=re?.focalPoint??t.doc.focalPoint,ue=oe?{x:oe.focalWorld[0]/L,y:oe.focalWorld[2]/L}:ce,Ye=W?.focalPoint?{x:W.focalPoint.x+ue.x-ce.x,y:W.focalPoint.y+ue.y-ce.y}:ue,Oe=[o.seats.iPosition[j*3],o.seats.iPosition[j*3+1],o.seats.iPosition[j*3+2]];return Zr(Oe,Ye,re?.baseHeightM??0,W?.eyeHeightM)},je=()=>(e.clientWidth||A.canvas.clientWidth)<=520,Re,Ie=li({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:je,isDisposed:()=>h,flightGen:()=>me.flightGen(),flyToSeat:U=>jn(U),openPanorama:(U,j,W)=>Re(U,j,W)}),Ee=Ie.show,xe=Ie.remove,ve=Ie.layout,ie=ui({container:e,orbit:w,isNarrow:je}),Je=ie.element,Le=ie.setNavigationMode,Te=ie.setSeatViewLocked,Xe=ie.layout,dt=ie.utilityControls,me=mi({container:e,model:o,opts:n,orbit:w,cinematic:z,analytics:i,loop:Y,labelOverlay:k,stageAzimuth:C,overviewFraming:F,gpu:()=>d,isDisposed:()=>h,panorama:()=>y,setPanorama:U=>{y=U},setPanoramaSphereVisible:U=>{O=U},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:U=>{g=U},setFrozen:U=>{p=U},restorePanoramaLayer:D,reducedMotion:Z,resolvedSeatViewPose:Ue,showSectionSeatLabels:T,setNearFieldDetailEnabled:v,setSeatViewLocked:Te,setNavigationMode:Le,showArriveChip:Ee,removeArriveChip:xe});B=!0;let ln=me.overviewChip,hi=me.layoutOverviewChip,bi=me.applyFloorFocus,yi=me.focusOverview,Un=me.cancelFlight,jn=me.flyToSeat,Xn=me.focusSectionCamera;dt.appendChild(ln),Re=ai({container:e,model:o,opts:n,analytics:i,orbit:w,loop:Y,seatsById:s,ensureSeatView:te,resolvedSeatViewPose:Ue,gpu:()=>d,gl:A.gl,isContextLost:()=>f,isDisposed:()=>h,flightGen:()=>me.flightGen(),setPanorama:U=>{y=U},getLoadAbort:()=>g,setLoadAbort:U=>{g=U},setPanoramaSphereVisible:U=>{O=U},setFrozen:U=>{p=U},raisePanoramaLayer:S,restorePanoramaLayer:D,getOverviewChip:()=>ln,labelOverlay:k,reducedMotion:Z,removeArriveChip:xe,showArriveChip:Ee});let _e=di({glctx:A,orbit:w,model:o,seats:t.seats,opts:n,cinematic:z,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:ac,tapMs:sc,gpu:()=>d,pick:()=>m,seatViewLocked:()=>ie.seatViewLocked(),focusedSectionId:()=>N,selection:()=>b,cancelFlight:Un,focusSectionCamera:Xn,setSelection:J,ensureSeatView:te});A.canvas.addEventListener("pointerdown",_e.onDown),A.canvas.addEventListener("pointermove",_e.onMove),A.canvas.addEventListener("pointerup",_e.onUp),A.canvas.addEventListener("pointercancel",_e.onUp),Y.requestRender();let un={setAvailability(U){let j=Ur(b,U),W=Pn(o.seats,j);W.length&&d&&d.uploadSeatStateRuns(W),Y.requestRender()},setSelection:J,flyToSeat:jn,focusOverview:yi,resize(){let{width:U,height:j}=A.resize();w.setAspect(U/Math.max(1,j)),ve(),Xe(),hi(),Y.requestRender()},stats(){return{...Y.stats(),drawCalls:d?d.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let U=Y.stats(),j=A.canvas.clientWidth||1,W=A.canvas.clientHeight||1,ne=o.bounds.center,re=Ve(w.camera.projectionViewMatrix,[ne[0],o.bounds.box.min[1],ne[2]],j,W),oe=Ve(w.camera.projectionViewMatrix,[ne[0],o.bounds.box.max[1],ne[2]],j,W),ce=o.bounds.box,ue=[ce.min[0],ce.max[0]].flatMap(q=>[ce.min[1],ce.max[1]].flatMap(fe=>[ce.min[2],ce.max[2]].map(Me=>Ve(w.camera.projectionViewMatrix,[q,fe,Me],j,W)))).filter(q=>Number.isFinite(q.x)&&Number.isFinite(q.y)&&Number.isFinite(q.depth)),Ye=ue.length?(()=>{let q=Math.min(...ue.map(We=>We.x)),fe=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(j,fe),Se=Math.max(0,Me),ft=Math.min(W,Rt),Et=Math.max(0,It-mt),dn=Math.max(0,ft-Se);return{box:{x:mt,y:Se,width:Et,height:dn},horizontalFillRatio:Et/j,verticalFillRatio:dn/W,visibleAreaRatio:Et*dn/(j*W),clippedEdges:[...Me<0?["top"]:[],...fe>j?["right"]:[],...Rt>W?["bottom"]:[],...q<0?["left"]:[]]}})():void 0,Oe=String(A.gl.getParameter(A.gl.VERSION)??"");return{viewport:{width:j,height:W},context:{webgl2:/webgl\s*2/i.test(Oe),lost:f},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[w.camera.position.x,w.camera.position.y,w.camera.position.z],distance:w.currentDistance,verticalFovDeg:w.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:u,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:re.visible&&oe.visible?Math.abs(re.y-oe.y):0},labels:k.qualityEvidence(),framing:Ye}},getQualityReport(){return qt(un.getQualityEvidence())},loseContextForTest(){A.simulateContextLossCycle()},floors(){return o.floors},focusFloor(U){if(U!==null&&!o.floors.some(W=>W.index===U))return!1;let j=U??-1;if(v(U!==null),Te(!1),bi(j),Le("orbit"),U===null)z.cancel(),Z()?w.frame(o.bounds,!1,C,n.portraitOverviewCrop===!0,F):w.frameSoft(o.bounds,C,n.portraitOverviewCrop===!0,F);else{let W=o.floors[U];if(W.seatCount>0){z.cancel();let ne=W.focalWorld[0]-W.center[0],re=W.focalWorld[2]-W.center[2],oe=Math.hypot(ne,re)>W.radius*.12?Math.atan2(ne,re):C;w.frame({center:W.center,radius:W.radius,box:W.box},!1,oe,!1,{polarDeg:58,margin:1.12})}}return Y.requestRender(),!0},zones(){return o.zones},focusZone(U){let j=o.zones.find(oe=>oe.id===U);if(!j||j.seatCount===0)return!1;v(!1),Te(!1),z.cancel(),Le("orbit"),T(null),n.onSectionFocusChange?.(null);let W=j.focalWorld[0]-j.center[0],ne=j.focalWorld[2]-j.center[2],re=Math.hypot(W,ne)>j.radius*.12?Math.atan2(W,ne):void 0;return w.frame({center:j.center,radius:j.radius*1.25},!1,re),Y.requestRender(),!0},sections(){return o.sections},focusSection(U){return Xn(U)},rows(U){return U?o.rows.filter(j=>j.sectionId===U):o.rows},seatsInRow(U){return t.seats.filter(j=>j.rowId===U).map(j=>({id:j.id,label:j.displayLabel||j.label}))},focusRow(U){let j=o.rows.find(W=>W.id===U);return!j||j.seatCount===0?!1:(v(!0),Te(!1),z.cancel(),Le("pan"),j.sectionId&&(T(j.sectionId),n.onSectionFocusChange?.(j.sectionId)),w.frame({center:j.center,radius:Math.max(2.5,j.radius*.65)}),Y.requestRender(),!0)},setReducedMotionForTest(U){R=U},dispose(){h=!0,xe(),ln.remove(),Je.remove(),Un(),Y.stop(),k.dispose(),K?.disconnect(),y&&(y.dispose(),y=null),D(),E(),A.canvas.removeEventListener("pointerdown",_e.onDown),A.canvas.removeEventListener("pointermove",_e.onMove),A.canvas.removeEventListener("pointerup",_e.onUp),A.canvas.removeEventListener("pointercancel",_e.onUp),w.dispose(),m&&m.dispose(),d&&d.dispose(),d=null,m=null,A.dispose()}};return i.opened(o.seatCount,u,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),un}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});
|
|
558
|
+
}`;function ri(e,t){let{position:n,uv:r,index:o}=nc(),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:oc,fragment:rc,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 ii=.15;async function ai(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Ae,Math.min(Ae,t?.initialPitchDeg??0)),s=on,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 E=n.camera.position,L=n.focalWorld[0]-E.x,G=n.focalWorld[1]-E.y,X=n.focalWorld[2]-E.z,V=Math.hypot(L,X);V>.001&&(i=Math.atan2(L,-X)*180/Math.PI,a=Math.max(-Ae,Math.min(Ae,Math.atan2(G,V)*180/Math.PI)))}let f=null;if(t){let E=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),L=en(t,Jt(E)),G;try{let X=t.resolveUrl?await t.resolveUrl(L.initialUrl):L.initialUrl;if(!X)throw new Error("panorama_asset_unavailable");G=await At(X,l.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{f=ri(n.gl,G)}catch{return l.abort(),r.signal?.removeEventListener("abort",u),null}f.mesh.renderOrder=999,f.mesh.setParent(n.scene),L.upgradeUrl&&(d=tn(()=>{(t.resolveUrl?t.resolveUrl(L.upgradeUrl):Promise.resolve(L.upgradeUrl)).then(V=>!V||l.signal.aborted?null:At(V,l.signal)).then(V=>{V&&(c||l.signal.aborted||(f?.setImage(V),n.requestRender()))}).catch(()=>{})}))}let h=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),b=()=>{let E=n.camera.position;f?.mesh.position.set(E.x,E.y,E.z);let[L,G,X]=oi(i,a);n.camera.lookAt([E.x+L,E.y+G,E.z+X]),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 E=document.createElement("div");E.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(E.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(E)}let w=document.createElement("div");w.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(w.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),y.appendChild(w),e.appendChild(y),x.focus({preventScroll:!0});let R=!1,S=0,D=0,B=0,N=new Map,H=()=>{let[E,L]=[...N.values()];return E&&L?Math.hypot(E.x-L.x,E.y-L.y):0},O=E=>{let L=Hn(E);L!==s&&(s=L,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},M=E=>{E.target!==x&&(N.set(E.pointerId,{x:E.clientX,y:E.clientY}),R=N.size===1,S=E.clientX,D=E.clientY,N.size===2&&(B=H()),y.setPointerCapture?.(E.pointerId),y.style.cursor="grabbing")},v=E=>{if(N.has(E.pointerId)){if(N.set(E.pointerId,{x:E.clientX,y:E.clientY}),N.size>=2){let L=H();B>0&&L>0&&O(s*(B/L)),B=L,R=!1;return}R&&(i+=(E.clientX-S)*ii,a=Math.max(-Ae,Math.min(Ae,a+(E.clientY-D)*ii)),S=E.clientX,D=E.clientY,b())}},A=E=>{N.delete(E.pointerId),B=N.size===2?H():0;let L=N.values().next().value;R=N.size===1,L?(S=L.x,D=L.y):y.style.cursor="grab";try{y.releasePointerCapture?.(E.pointerId)}catch{}},C=E=>{E.preventDefault(),O(s+E.deltaY*.04)};y.addEventListener("pointerdown",M),y.addEventListener("pointermove",v),y.addEventListener("pointerup",A),y.addEventListener("pointercancel",A),y.addEventListener("wheel",C,{passive:!1});let T=E=>{if(!c){if(E.key==="Tab"){E.preventDefault(),x.focus({preventScroll:!0});return}if(E.key==="Escape"){E.stopPropagation(),z.close();return}if(E.key==="ArrowLeft"||E.key==="ArrowRight")i+=E.key==="ArrowLeft"?-4:4;else if(E.key==="ArrowUp"||E.key==="ArrowDown")a=Math.max(-Ae,Math.min(Ae,a+(E.key==="ArrowUp"?4:-4)));else if(E.key==="+"||E.key==="="){O(s-5),E.preventDefault();return}else if(E.key==="-"){O(s+5),E.preventDefault();return}else return;E.preventDefault(),b()}};window.addEventListener("keydown",T);let P=0,F=(E,L)=>{if(!f){L?.();return}let G=E===1?0:1,X=performance.now(),V=()=>{if(c)return;let k=o<=0?1:Math.min(1,(performance.now()-X)/o);f?.setOpacity(G+(E-G)*k),n.requestRender(),k<1?P=requestAnimationFrame(V):L?.()};P=requestAnimationFrame(V)};F(1);let I=()=>{c||(c=!0,d(),l.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(P),y.removeEventListener("pointerdown",M),y.removeEventListener("pointermove",v),y.removeEventListener("pointerup",A),y.removeEventListener("pointercancel",A),y.removeEventListener("wheel",C),window.removeEventListener("keydown",T),y.remove(),g?.isConnected&&g.focus({preventScroll:!0}),f?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:h,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},z={close(){if(c)return;let E=()=>{I(),r.onClose?.()};cancelAnimationFrame(P),F(0,E)},dispose:I};return x.addEventListener("click",()=>z.close()),z}function si(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:f,flightGen:h,setPanorama:p,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:w,restorePanoramaLayer:R,getOverviewChip:S,labelOverlay:D,reducedMotion:B,removeArriveChip:N,showArriveChip:H}=e;return async(O,M,v)=>{b()?.abort();let A=new AbortController;y(A);let C=n.seats.idToIndex.get(O);if(C===void 0){i.syncFromCamera();return}let T=s.get(O)?.label??O,P=l(O,C),F=c(O);if(!F){A.abort(),b()===A&&y(null),i.syncFromCamera();return}x(!0),a.stop();let I;try{I=await F}catch{if(b()===A&&y(null),o.panoramaFailed(O,"source"),!f()&&v===h()){x(!1),i.resumeAfterFlight(P.focal),a.requestRender();let Y=H(O,v,!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())}return}if(f()||v!==h()){A.abort(),b()===A&&y(null);return}N();let z=S(),E=()=>{A.abort(),b()===A&&y(null),p(null),g(!1),R(),z.style.display="",D.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(P.focal),a.requestRender();let Y=H(O,h());requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())},L=I.generated===!0,G=ti(I);w(),g(!L),z.style.display="none";let X=B()?0:M,V=u(),k=V&&!m()?await ai(t,L?null:I,{gl:d,scene:V.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:L?P.eye:void 0,focalWorld:P.focal},{fadeMs:X,seatLabel:T,disclosure:G,disclosurePrefix:L?"Live seat-eye view":"360\xB0 panorama",onClose:E,signal:A.signal}):null;if(f()||v!==h()){A.abort(),g(!1),b()===A&&y(null),k?.dispose(),z.style.display="",R();return}if(k)i.syncFromCamera(),D.setVisible(!1),x(!1),a.requestRender(),p(k);else if(L){R(),z.style.display="",x(!1),i.resumeAfterFlight(P.focal),a.requestRender(),p(null),g(!1),o.panoramaFailed(O,"mount");let Y=H(O,h(),!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus()),b()===A&&y(null);return}else g(!1),o.panoramaFallback(O),p(ni(t,I,{fadeMs:X,seatLabel:T,disclosure:G,onClose:E,signal:A.signal}));o.panoramaOpened()}}var ci=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),rn=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=ci(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(ci()-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 li(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function ui(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,f=!1)=>{if(l(),e.isDisposed())return null;let h=document.createElement("div");h.setAttribute("role","group"),Object.assign(h.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.get(d),b=p?.sectionId?n.sections.find(B=>B.id===p.sectionId):void 0,y=p?.label??d;h.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)"}),h.appendChild(g);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),h.appendChild(x);let w=p?.rowId?i.get(p.rowId):void 0,R=w?.indexOf(d)??-1,S=R>=0?[w?.[R-1],w?.[R+1]]:[void 0,void 0],D=(B,N,H,O=!1)=>{let M=document.createElement("button");M.type="button",M.textContent=B,M.setAttribute("aria-label",N),Object.assign(M.style,{minHeight:"44px",padding:O?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),O||(M.style.minWidth="44px"),O&&(M.dataset.panoramaTrigger=""),M.addEventListener("click",H),x.appendChild(M)};if(S[0]){let B=o.get(S[0])?.label??S[0];D("\u2039",`View previous seat ${B}`,()=>{e.flyToSeat(S[0])})}if(r.getSeatView){let B=r.seatViewActionLabel?.(d)??"Open 360\xB0 panorama";D(f?`\u21BB Retry ${B}`:`\u25C9 ${B}`,`${f?"Retry":B} from seat ${y}`,()=>{if(e.isDisposed()||m!==e.flightGen()){l();return}l(),e.openPanorama(d,400,m)},!0)}if(S[1]){let B=o.get(S[1])?.label??S[1];D("\u203A",`View next seat ${B}`,()=>{e.flyToSeat(S[1])})}return x.childElementCount?(t.appendChild(h),s=h,c(),h):null},remove:l,layout:c}}function di(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 f=()=>{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 f(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:p=>{i=p,n.setInteractionEnabled(!p),f()},seatViewLocked:()=>i,layout:f}}function mi(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:f,setSelection:h,ensureSeatView:p}=e,b=0,y=0,g=0,x=-1,w=!1,R=!1,S=O=>{e.seatViewLocked()||x===-1&&(x=O.pointerId,b=O.clientX,y=O.clientY,g=performance.now(),w=!1,R=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},D=O=>{O.pointerId===x&&Math.hypot(O.clientX-b,O.clientY-y)>u&&(w=!0)},B=(O,M,v,A,C)=>{let T=t.canvas.getBoundingClientRect(),P=t.canvas.clientWidth||T.width||1,F=t.canvas.clientHeight||T.height||1,I=O-T.left,z=M-T.top,E=A*A,L=-1,G=E,X=1/0;for(let V of o){if(v&&V.sectionId!==v)continue;let k=r.seats.idToIndex.get(V.id);if(k===void 0)continue;if(C){let te=Math.round(r.seats.iState[k]??0);if(te!==0&&te!==3)continue}let Y=k*3,K=Ve(n.camera.projectionViewMatrix,[r.seats.iPosition[Y],r.seats.iPosition[Y+1]+.55,r.seats.iPosition[Y+2]],P,F);if(!K.visible)continue;let J=K.x-I,Z=K.y-z,$=J*J+Z*Z;($<G||Math.abs($-G)<1&&K.depth<X)&&(L=k,G=$,X=K.depth)}return L},N=(O,M)=>{let v=e.gpu(),A=e.pick();if(!v||!A)return-1;A.syncFromSeatProgram(v.seatProgram);let C=t.canvas.getBoundingClientRect(),T=t.renderer.dpr,{x:P,y:F}=Ur(O,M,C,T,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),I=Math.max(2,Math.round(8*T));return A.pick(n.camera,P,F,I)};return{onDown:S,onMove:D,onUp:O=>{if(O.pointerId!==x)return;let M=!w&&performance.now()-g<d;if(x=-1,R){R=!1;return}let v=e.gpu(),A=e.pick();if(!M||!v||!A)return;let C=N(O.clientX,O.clientY);if(e.focusedSectionId()&&C>=0){let F=c[C],I=F?l.get(F):void 0;if(I&&I!==e.focusedSectionId()&&f(I))return}if(e.focusedSectionId()&&C<0&&(C=B(O.clientX,O.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&C<0){let F=B(O.clientX,O.clientY,null,72,!1),I=F>=0?c[F]:void 0,z=I?l.get(I):void 0;if(z&&z!==e.focusedSectionId()&&f(z))return}if(!e.focusedSectionId()){C<0&&(C=B(O.clientX,O.clientY,null,42,!1));let F=C>=0?c[C]:void 0,I=F?l.get(F):void 0;if(I&&f(I))return}if(C<0||C>=c.length){e.selection().size&&(h([]),i.onViewTargetChange?.(null));return}let T=c[C],P=ge[Math.round(r.seats.iState[C]??0)]??"available";if(P!=="available"&&P!=="selected"){i.onSeatInspect?.(T,P);return}if(e.selection().has(T)&&e.selection().size===1){h([]),i.onViewTargetChange?.(null);return}h([T]),p(T),s.seatPicked(T,l.get(T)),i.onSeatPick?.(T)}}}var an=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 f=0;f<this.count;f++){let h=t[f*3],p=t[f*3+2];h<n&&(n=h),h>o&&(o=h),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=f=>{let h=Math.min(this.cols-1,Math.max(0,Math.floor((t[f*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[f*3+2]-r)/this.cell)))*this.cols+h};for(let f=0;f<this.count;f++)l[u(f)+1]++;for(let f=0;f<c;f++)l[f+1]+=l[f];let d=new Int32Array(this.count),m=l.slice(0,c);for(let f=0;f<this.count;f++)d[m[u(f)]++]=f;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,f=0;for(let h=0;h<=d&&f<s;h++){let p=u-h,b=u+h,y=l-h,g=l+h;for(let x=p;x<=b&&f<s;x++){if(x<0||x>=this.rows)continue;let w=x===p||x===b;for(let R=y;R<=g&&f<s;R++){if(!w&&R!==y&&R!==g){R=g-1;continue}if(R<0||R>=this.cols)continue;let S=x*this.cols+R;for(let D=i[S],B=i[S+1];D<B&&f<s;D++){let N=a[D],H=m[N*3]-t,O=m[N*3+2]-n;H*H+O*O<=c&&(o[f++]=N)}}}}return f}};var sn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Lt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new an(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)<yn)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>bn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,bn,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 cn=require("ogl");function fi(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,f=(R,S,D=28)=>{o.camera.position.set(R[0],R[1],R[2]),o.camera.lookAt(new cn.Vec3(S[0],S[1],S[2])),o.camera.fov=D,o.camera.updateProjectionMatrix()},h=document.createElement("button");h.className="sl-3d-overview-control sl-3d-icon-control",h.type="button",h.textContent="\u2302",h.setAttribute("aria-label","Fit the active level or whole venue in view"),h.dataset.tooltip="Fit view",Object.assign(h.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=()=>{h.textContent="\u2302"};p();let b=R=>{m=R;let S=e.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=R,S.solidProgram.uniforms.uFocusFloor.value=R,S.chairProgram.uniforms.uFocusFloor.value=R),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(),h.style.display="",c.setVisible(!0),e.setFrozen(!1);let R=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!R),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),R){let S=R.focalWorld[0]-R.center[0],D=R.focalWorld[2]-R.center[2],B=Math.hypot(S,D)>R.radius*.12?Math.atan2(S,D):l,N={center:R.center,radius:R.radius,box:R.box},H={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(N,!1,B,!1,H):o.frameSoft(N,B,!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=R=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let S=n.seats.idToIndex.get(R);if(S===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(R),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),h.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1),e.setSeatViewLocked(!1);let D=++d;e.removeArriveChip();let{eye:B,focal:N}=e.resolvedSeatViewPose(R,S),H=[o.camera.position.x,o.camera.position.y,o.camera.position.z],O=zn(H,B,N,n.bounds.center,n.bounds.radius),M=r.arriveAtSeatEye?B:O.finalPos,v=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,A=[O.waypoints[0],O.waypoints[1],M];if(c.setVisible(!1),e.reducedMotion())return f(M,N,v),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(R,D),Promise.resolve();let C=new cn.Quat().copy(o.camera.quaternion),T=Zr(o.camera,M,N);return s.requestRender(),i.start(A,C,T,2500,v).then(()=>{e.isDisposed()||D!==d||(a.cinematicPlayed(2500),o.resumeAfterFlight(N),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(R,D))})},w=R=>{let S=n.sections.find(H=>H.id===R);if(!S||S.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==S.floorIndex&&b(S.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(R);let D=S.focalWorld[0]-S.center[0],B=S.focalWorld[2]-S.center[2],N=Math.hypot(D,B)>S.radius*.12?Math.atan2(D,B):void 0;return o.frame({center:S.center,radius:Math.max(5,S.radius*.5)},!1,N),r.onSectionFocusChange?.(R),s.requestRender(),!0};return h.addEventListener("click",y),{overviewChip:h,layoutOverviewChip:p,flightGen:()=>d,focusedFloor:()=>m,applyFloorFocus:b,placeCameraFinal:f,cancelFlight:g,focusOverview:y,flyToSeat:x,focusSectionCamera:w}}var ic={};function hi(e){let t=performance.now();return{model:ct(e),buildMs:performance.now()-t,source:"main"}}function pi(e){return typeof Worker>"u"?Promise.resolve(hi(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",ic.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(hi(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,sc=6,cc=500;function lc(e,t,n={}){let r=performance.now(),o=t.prepared?.model??ct(t),i=new rn(n.onAnalytics),a=new Array(o.seats.count);for(let[U,j]of o.seats.idToIndex)a[j]=U;let s=new Map(t.seats.map(U=>[U.id,U])),c=new Map;for(let U of t.seats){if(!U.rowId)continue;let j=c.get(U.rowId);j?j.push(U.id):c.set(U.rowId,[U.id])}let l=new Map;for(let U of t.seats)l.set(U.id,U.sectionId);let u=t.doc.floors?.some(j=>(j.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(j=>j.objects)??t.doc.objects).some(j=>j.type==="section"&&((j.height??0)>0||(j.rake??0)>0)),d=null,m=null,f=!1,h=!1,p=!1,b=new Map,y=null,g=null,x=null,w=new Map,R=null,S=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},D=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},B=!1,N=()=>B?me.focusedFloor():-1,H=()=>{d=Gr(A.gl,o),m=new Zt(A.renderer,d.seatGeometry,d.chairGeometry,d.solidGeometry,o.seats.count),A.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=N(),d.solidProgram.uniforms.uFocusFloor.value=N(),d.chairProgram.uniforms.uFocusFloor.value=N(),M.forceRegather()},O=!1,M=new sn({model:o,orbit:()=>C,gpu:()=>d}),v=U=>M.setDetailEnabled(U),A=new kt(e,{onContextLost:()=>{p||i.contextLost(),f=!0,Y.stop(),d=null,m=null},onContextRestored:()=>{H(),f=!1,p||i.contextRestored(),Y.requestRender()}}),C=new Ft(A.gl,A.canvas,()=>Y.requestRender(),()=>i.orbitEngaged());C.setAspect(A.aspect);let T=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),P=(()=>{if(T&&o.stages.length===0)return;let U=o.focalWorld[0]-o.bounds.center[0],j=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(U,j)>o.bounds.radius*.12?Math.atan2(U,j):void 0})(),F=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;C.frame(o.bounds,!I&&n.skipInitialOverviewAnimation!==!0,P,n.portraitOverviewCrop===!0,F);let z=new Qt(C.camera),E=li(e),L=new Kt(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),G=o.labels,X=()=>ur(G,o.floors.length,N());L.setLabels(X());let V=null,k=U=>{if(V=U,L.setForcedDense(!!U),!U){L.setLabels(X());return}let j=t.seats.filter(q=>q.sectionId===U),W=new Set(j.map(q=>q.id)),ne=new Set(j.map(q=>q.rowId)),re=new Set(b.keys()),oe=new Set(j.filter(q=>re.has(q.id)).map(q=>q.id)),ce=X().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){L.setLabels(ce);return}let ue=oe.size?j.filter(q=>oe.has(q.id)):j,Ye=new Set(ue.map(q=>`seat:${q.id}`)),Oe=ue.flatMap(q=>{let fe=o.seats.idToIndex.get(q.id);if(fe===void 0)return[];let Me=fe*3;return[{id:`seat:${q.id}`,kind:"seat",text:q.displayLabel||q.label,anchor:[o.seats.iPosition[Me],o.seats.iPosition[Me+1]+(re.has(q.id)?1.05:.55),o.seats.iPosition[Me+2]]}]});L.setLabels([...ce.filter(q=>!Ye.has(q.id)),...Oe])};H();let Y=new Dt(U=>{if(f||!d||h)return!1;let W=z.active?z.update(performance.now()):C.update(),ne=N()>=0?o.floors[N()]:null,re=ne?.radius??o.bounds.radius,oe=oo(C.currentDistance,re),ce=O?{center:[C.camera.position.x,C.camera.position.y,C.camera.position.z],radius:520}:o.renderBounds;C.updateClipping(ce);let ue=ne?.center??o.renderBounds.center,Ye=ne?.radius??o.renderBounds.radius,Oe=(Se,ft)=>Math.hypot(C.camera.position.x-Se[0],C.camera.position.y-Se[1],C.camera.position.z-Se[2])<=ft*(M.detailVisible?1.8:1.55),q=Oe(ue,Ye);if(!q&&V){let Se=o.sections.find(ft=>ft.id===V);Se&&(q=Oe(Se.center,Math.max(12,Se.radius*2)))}M.detailVisible=q;let fe=d.seatProgram.uniforms;fe.uSeatScale.value=oe.scale,fe.uSeatFade.value=oe.fade;let Me=!!ne&&ro(ne.seatCount,A.canvas.clientWidth||1,A.canvas.clientHeight||1),Rt=io(o.seats.count,re,C.currentDistance,C.camera.fov,A.canvas.clientHeight||1),mt=M.detailVisible||Me||Rt?1:0,It=M.detailVisible||N()>=0||o.floors.length>1?1:0;return M.ease(U,mt,It),fe.uSeatDetail.value=M.seatDetailMix,d.solidProgram.uniforms.uStructureDetail.value=M.structureDetailMix,fe.uMinPixels.value=oe.minPixels,fe.uPixelToWorld.value=2*Math.tan(C.camera.fov*ac/2)/Math.max(1,A.pixelHeight),M.update(M.detailVisible),A.renderer.render({scene:d.background,clear:!0}),A.renderer.render({scene:d.main,camera:C.camera,clear:!1}),L.update(C.camera.projectionViewMatrix,A.canvas.clientWidth||1,A.canvas.clientHeight||1,C.currentDistance,re,[C.camera.position.x,C.camera.position.y,C.camera.position.z]),W||M.seatDetailMix!==mt||M.structureDetailMix!==It}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>un.resize()):null;K?.observe(e);let J=U=>{let j=re=>{let oe=o.seats.idToIndex.get(re);return oe===void 0?void 0:o.seats.iState[oe]},{updates:W,next:ne}=Xr(b,U,j);if(b=ne,L.setSelectedSeatIds(b.keys()),V&&k(V),W.length){let re=Pn(o.seats,W);d&&d.uploadSeatStateRuns(re),Y.requestRender()}},Z=()=>R!==null?R:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=8,te=U=>{if(!n.getSeatView)return null;let j=w.get(U);if(!j)for(j=Promise.resolve(n.getSeatView(U)),w.set(U,j),j.catch(()=>{w.get(U)===j&&w.delete(U)});w.size>$;){let W=w.keys().next().value;if(W===void 0)break;w.delete(W)}return j},Ue=(U,j)=>{let W=s.get(U),ne=Math.max(0,Math.round(o.seats.iFloor[j]??0)),re=t.doc.floors?.[ne],oe=o.floors[ne],ce=re?.focalPoint??t.doc.focalPoint,ue=oe?{x:oe.focalWorld[0]/_,y:oe.focalWorld[2]/_}:ce,Ye=W?.focalPoint?{x:W.focalPoint.x+ue.x-ce.x,y:W.focalPoint.y+ue.y-ce.y}:ue,Oe=[o.seats.iPosition[j*3],o.seats.iPosition[j*3+1],o.seats.iPosition[j*3+2]];return Qr(Oe,Ye,re?.baseHeightM??0,W?.eyeHeightM)},je=()=>(e.clientWidth||A.canvas.clientWidth)<=520,Re,Ie=ui({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:je,isDisposed:()=>p,flightGen:()=>me.flightGen(),flyToSeat:U=>jn(U),openPanorama:(U,j,W)=>Re(U,j,W)}),Ee=Ie.show,xe=Ie.remove,ve=Ie.layout,ie=di({container:e,orbit:C,isNarrow:je}),Je=ie.element,Le=ie.setNavigationMode,Te=ie.setSeatViewLocked,Xe=ie.layout,dt=ie.utilityControls,me=fi({container:e,model:o,opts:n,orbit:C,cinematic:z,analytics:i,loop:Y,labelOverlay:L,stageAzimuth:P,overviewFraming:F,gpu:()=>d,isDisposed:()=>p,panorama:()=>y,setPanorama:U=>{y=U},setPanoramaSphereVisible:U=>{O=U},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:U=>{g=U},setFrozen:U=>{h=U},restorePanoramaLayer:D,reducedMotion:Z,resolvedSeatViewPose:Ue,showSectionSeatLabels:k,setNearFieldDetailEnabled:v,setSeatViewLocked:Te,setNavigationMode:Le,showArriveChip:Ee,removeArriveChip:xe});B=!0;let ln=me.overviewChip,bi=me.layoutOverviewChip,yi=me.applyFloorFocus,gi=me.focusOverview,Un=me.cancelFlight,jn=me.flyToSeat,Xn=me.focusSectionCamera;dt.appendChild(ln),Re=si({container:e,model:o,opts:n,analytics:i,orbit:C,loop:Y,seatsById:s,ensureSeatView:te,resolvedSeatViewPose:Ue,gpu:()=>d,gl:A.gl,isContextLost:()=>f,isDisposed:()=>p,flightGen:()=>me.flightGen(),setPanorama:U=>{y=U},getLoadAbort:()=>g,setLoadAbort:U=>{g=U},setPanoramaSphereVisible:U=>{O=U},setFrozen:U=>{h=U},raisePanoramaLayer:S,restorePanoramaLayer:D,getOverviewChip:()=>ln,labelOverlay:L,reducedMotion:Z,removeArriveChip:xe,showArriveChip:Ee});let _e=mi({glctx:A,orbit:C,model:o,seats:t.seats,opts:n,cinematic:z,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:sc,tapMs:cc,gpu:()=>d,pick:()=>m,seatViewLocked:()=>ie.seatViewLocked(),focusedSectionId:()=>V,selection:()=>b,cancelFlight:Un,focusSectionCamera:Xn,setSelection:J,ensureSeatView:te});A.canvas.addEventListener("pointerdown",_e.onDown),A.canvas.addEventListener("pointermove",_e.onMove),A.canvas.addEventListener("pointerup",_e.onUp),A.canvas.addEventListener("pointercancel",_e.onUp),Y.requestRender();let un={setAvailability(U){let j=jr(b,U),W=Pn(o.seats,j);W.length&&d&&d.uploadSeatStateRuns(W),Y.requestRender()},setSelection:J,flyToSeat:jn,focusOverview:gi,resize(){let{width:U,height:j}=A.resize();C.setAspect(U/Math.max(1,j)),ve(),Xe(),bi(),Y.requestRender()},stats(){return{...Y.stats(),drawCalls:d?d.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let U=Y.stats(),j=A.canvas.clientWidth||1,W=A.canvas.clientHeight||1,ne=o.bounds.center,re=Ve(C.camera.projectionViewMatrix,[ne[0],o.bounds.box.min[1],ne[2]],j,W),oe=Ve(C.camera.projectionViewMatrix,[ne[0],o.bounds.box.max[1],ne[2]],j,W),ce=o.bounds.box,ue=[ce.min[0],ce.max[0]].flatMap(q=>[ce.min[1],ce.max[1]].flatMap(fe=>[ce.min[2],ce.max[2]].map(Me=>Ve(C.camera.projectionViewMatrix,[q,fe,Me],j,W)))).filter(q=>Number.isFinite(q.x)&&Number.isFinite(q.y)&&Number.isFinite(q.depth)),Ye=ue.length?(()=>{let q=Math.min(...ue.map(We=>We.x)),fe=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(j,fe),Se=Math.max(0,Me),ft=Math.min(W,Rt),Et=Math.max(0,It-mt),dn=Math.max(0,ft-Se);return{box:{x:mt,y:Se,width:Et,height:dn},horizontalFillRatio:Et/j,verticalFillRatio:dn/W,visibleAreaRatio:Et*dn/(j*W),clippedEdges:[...Me<0?["top"]:[],...fe>j?["right"]:[],...Rt>W?["bottom"]:[],...q<0?["left"]:[]]}})():void 0,Oe=String(A.gl.getParameter(A.gl.VERSION)??"");return{viewport:{width:j,height:W},context:{webgl2:/webgl\s*2/i.test(Oe),lost:f},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[C.camera.position.x,C.camera.position.y,C.camera.position.z],distance:C.currentDistance,verticalFovDeg:C.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:re.visible&&oe.visible?Math.abs(re.y-oe.y):0},labels:L.qualityEvidence(),framing:Ye}},getQualityReport(){return qt(un.getQualityEvidence())},loseContextForTest(){A.simulateContextLossCycle()},floors(){return o.floors},focusFloor(U){if(U!==null&&!o.floors.some(W=>W.index===U))return!1;let j=U??-1;if(v(U!==null),Te(!1),yi(j),Le("orbit"),U===null)z.cancel(),Z()?C.frame(o.bounds,!1,P,n.portraitOverviewCrop===!0,F):C.frameSoft(o.bounds,P,n.portraitOverviewCrop===!0,F);else{let W=o.floors[U];if(W.seatCount>0){z.cancel();let ne=W.focalWorld[0]-W.center[0],re=W.focalWorld[2]-W.center[2],oe=Math.hypot(ne,re)>W.radius*.12?Math.atan2(ne,re):P;C.frame({center:W.center,radius:W.radius,box:W.box},!1,oe,!1,{polarDeg:58,margin:1.12})}}return Y.requestRender(),!0},zones(){return o.zones},focusZone(U){let j=o.zones.find(oe=>oe.id===U);if(!j||j.seatCount===0)return!1;v(!1),Te(!1),z.cancel(),Le("orbit"),k(null),n.onSectionFocusChange?.(null);let W=j.focalWorld[0]-j.center[0],ne=j.focalWorld[2]-j.center[2],re=Math.hypot(W,ne)>j.radius*.12?Math.atan2(W,ne):void 0;return C.frame({center:j.center,radius:j.radius*1.25},!1,re),Y.requestRender(),!0},sections(){return o.sections},focusSection(U){return Xn(U)},rows(U){return U?o.rows.filter(j=>j.sectionId===U):o.rows},seatsInRow(U){return t.seats.filter(j=>j.rowId===U).map(j=>({id:j.id,label:j.displayLabel||j.label}))},focusRow(U){let j=o.rows.find(W=>W.id===U);return!j||j.seatCount===0?!1:(v(!0),Te(!1),z.cancel(),Le("pan"),j.sectionId&&(k(j.sectionId),n.onSectionFocusChange?.(j.sectionId)),C.frame({center:j.center,radius:Math.max(2.5,j.radius*.65)}),Y.requestRender(),!0)},setReducedMotionForTest(U){R=U},dispose(){p=!0,xe(),ln.remove(),Je.remove(),Un(),Y.stop(),L.dispose(),K?.disconnect(),y&&(y.dispose(),y=null),D(),E(),A.canvas.removeEventListener("pointerdown",_e.onDown),A.canvas.removeEventListener("pointermove",_e.onMove),A.canvas.removeEventListener("pointerup",_e.onUp),A.canvas.removeEventListener("pointercancel",_e.onUp),C.dispose(),m&&m.dispose(),d&&d.dispose(),d=null,m=null,A.dispose()}};return i.opened(o.seatCount,u,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),un}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});
|