@seatlayer/core 0.70.0 → 0.71.2
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/chunk-WYXHD6J2.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/view3d/index.cjs +10 -10
- package/dist/view3d/index.js +29 -29
- package/dist/view3d/scene/scene.worker.cjs +1 -0
- package/dist/view3d/scene/scene.worker.d.cts +2 -0
- package/dist/view3d/scene/scene.worker.d.ts +2 -0
- package/dist/view3d/scene/scene.worker.js +1 -0
- package/package.json +1 -1
- /package/dist/{localeLoaders-2KZHFEV7.js → localeLoaders-EMBA3SWS.js} +0 -0
package/dist/view3d/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ia=Object.create;var Ut=Object.defineProperty;var Ea=Object.getOwnPropertyDescriptor;var Ra=Object.getOwnPropertyNames;var Ta=Object.getPrototypeOf,ka=Object.prototype.hasOwnProperty;var St=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var vo=(e,t)=>{for(var n in t)Ut(e,n,{get:t[n],enumerable:!0})},So=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ra(t))!ka.call(e,o)&&o!==n&&Ut(e,o,{get:()=>t[o],enumerable:!(r=Ea(t,o))||r.enumerable});return e};var it=(e,t,n)=>(n=e!=null?Ia(Ta(e)):{},So(t||!e||!e.__esModule?Ut(n,"default",{value:e,enumerable:!0}):n,e)),La=e=>So(Ut({},"__esModule",{value:!0}),e);function Yl(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Wl(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function bn(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Wl(t?.deviceMemory)}}function yn(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};if(t.saveData)return{...r,reason:"save-data"};let o=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,l)=>c.width*c.height-l.width*l.height);if(!o.length)return{...r,upgradeUrl:e.url,reason:"progressive"};let i=o.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...r,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||Yl(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...r,reason:"memory-limit"};let s=a[a.length-1];return{...r,upgradeUrl:s.url,reason:"progressive"}}function ea(){return new DOMException("Panorama image load aborted","AbortError")}function Ot(e,t){return new Promise((n,r)=>{if(t?.aborted){r(ea());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(ea())};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 gn(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var mo=St(()=>{"use strict"});function na(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":e.coverage==="floor-representative"?"AI-generated representative floor 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==="floor-representative"?"Representative floor view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function fo(e){return Math.max(Kl,Math.min(ql,e))}function Ql(e,t,n){let r=(.5+e/360)*n;return t/2-r}function Zl(e,t=vn){return e*(180/t)}function ta(e,t,n){return(e-t)/2+xn(n,t)}function xn(e,t){let n=Le/180*t;return Math.max(-n,Math.min(n,e))}function oa(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=yn(t,bn()),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 p=document.createElement("div");Object.assign(p.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(p);let u=document.createElement("button");if(u.type="button",u.setAttribute("aria-label","Close"),u.textContent="\u2715",Object.assign(u.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(u),n.disclosure){let L=document.createElement("div");L.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(L.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(L)}let d=document.createElement("div");d.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(d.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(d),e.appendChild(c),u.focus({preventScroll:!0});let m=0,f=0,h=0,y=0,b=vn,g=()=>{let L=c.clientHeight||1,F=c.clientWidth||1,X=A.naturalWidth||F*2,W=A.naturalHeight||L,q=m>0?(F/2-h)/m:0,Q=f>0?y/f:0;f=Zl(L,b),m=f*(X/W),p.style.backgroundSize=`${m}px ${f}px`,x?h=F/2-q*m:(h=Ql(o,F,m),y=xn((t.initialPitchDeg??0)/180*f,f),x=!0),y=xn(Q*f,f),p.style.backgroundPosition=`${h}px ${ta(L,f,y)}px`},x=!1,v=()=>{let L=c.clientHeight||1;y=xn(y,f),p.style.backgroundPosition=`${h}px ${ta(L,f,y)}px`},A=new Image;A.onload=g,A.src=i.initialUrl;let S=()=>{};i.upgradeUrl&&(S=gn(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(F=>!F||a.signal.aborted?null:Ot(F,a.signal).then(X=>({full:X,url:F}))).then(F=>{F&&(M||a.signal.aborted||(A=F.full,p.style.backgroundImage=`url("${F.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let E=!1,_=0,O=0,j=0,V=new Map,R=()=>{let[L,F]=[...V.values()];return L&&F?Math.hypot(L.x-F.x,L.y-F.y):0},P=L=>{let F=fo(L);F!==b&&(b=F,g())},I=L=>{V.set(L.pointerId,{x:L.clientX,y:L.clientY}),E=V.size===1,_=L.clientX,O=L.clientY,V.size===2&&(j=R()),p.style.cursor="grabbing";try{p.setPointerCapture?.(L.pointerId)}catch{}},w=L=>{if(V.has(L.pointerId)){if(V.set(L.pointerId,{x:L.clientX,y:L.clientY}),V.size>=2){let F=R();j>0&&F>0&&P(b*(j/F)),j=F,E=!1;return}E&&(h+=L.clientX-_,y+=L.clientY-O,_=L.clientX,O=L.clientY,v())}},C=L=>{V.delete(L.pointerId),j=V.size===2?R():0;let F=V.values().next().value;E=V.size===1,F?(_=F.x,O=F.y):p.style.cursor="grab";try{p.releasePointerCapture?.(L.pointerId)}catch{}},G=L=>{L.preventDefault(),P(b+L.deltaY*.04)};p.addEventListener("pointerdown",I),p.addEventListener("pointermove",w),p.addEventListener("pointerup",C),p.addEventListener("pointercancel",C),p.addEventListener("wheel",G,{passive:!1});let k=!1,M=!1,T=0,D=()=>{p.removeEventListener("pointerdown",I),p.removeEventListener("pointermove",w),p.removeEventListener("pointerup",C),p.removeEventListener("pointercancel",C),p.removeEventListener("wheel",G),window.removeEventListener("keydown",H)},B=()=>{S(),a.abort(),n.signal?.removeEventListener("abort",s),T&&(window.clearTimeout(T),T=0),D(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},U=()=>{if(k)return;k=!0,c.style.opacity="0";let L=()=>{T=0,!M&&(B(),n.onClose?.())};T=window.setTimeout(L,r)},H=L=>{if(L.key==="Tab"){L.preventDefault(),u.focus({preventScroll:!0});return}if(L.key==="Escape"){L.stopPropagation(),U();return}if(L.key==="ArrowLeft"||L.key==="ArrowRight")h+=L.key==="ArrowLeft"?-32:32;else if(L.key==="ArrowUp"||L.key==="ArrowDown")y+=(L.key==="ArrowUp"?4:-4)*(f/180);else if(L.key==="+"||L.key==="="){P(b-5),L.preventDefault();return}else if(L.key==="-"){P(b+5),L.preventDefault();return}else return;L.preventDefault(),v()};return window.addEventListener("keydown",H),u.addEventListener("click",U),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:U,dispose(){k=!0,M=!0,B()}}}var vn,Kl,ql,Le,po=St(()=>{"use strict";mo();vn=70,Kl=35,ql=90;Le=35});function tu(e=$l,t=Jl,n=eu){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let p=0;p<o;p++){let u=p/t,d=u*Math.PI,m=Math.sin(d),f=Math.cos(d);for(let h=0;h<r;h++){let y=h/e,b=(y-.5)*Math.PI*2,g=p*r+h;a[g*3]=n*m*Math.sin(b),a[g*3+1]=n*f,a[g*3+2]=-n*m*Math.cos(b),s[g*2]=y,s[g*2+1]=u}}let c=new Uint16Array(e*t*6),l=0;for(let p=0;p<t;p++)for(let u=0;u<e;u++){let d=p*r+u,m=d+r;c[l++]=d,c[l++]=m,c[l++]=d+1,c[l++]=d+1,c[l++]=m,c[l++]=m+1}return{position:a,uv:s,index:c}}function ra(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}function ia(e,t){let{position:n,uv:r,index:o}=tu(),i=new Ke.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ke.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ke.Program(e,{vertex:nu,fragment:ou,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new Ke.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 Ke,$l,Jl,eu,nu,ou,aa=St(()=>{"use strict";Ke=require("ogl"),$l=64,Jl=32,eu=500;nu=`#version 300 es
|
|
1
|
+
"use strict";var Ia=Object.create;var Ut=Object.defineProperty;var Ea=Object.getOwnPropertyDescriptor;var Ra=Object.getOwnPropertyNames;var Ta=Object.getPrototypeOf,ka=Object.prototype.hasOwnProperty;var St=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var So=(e,t)=>{for(var n in t)Ut(e,n,{get:t[n],enumerable:!0})},Mo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ra(t))!ka.call(e,o)&&o!==n&&Ut(e,o,{get:()=>t[o],enumerable:!(r=Ea(t,o))||r.enumerable});return e};var it=(e,t,n)=>(n=e!=null?Ia(Ta(e)):{},Mo(t||!e||!e.__esModule?Ut(n,"default",{value:e,enumerable:!0}):n,e)),La=e=>Mo(Ut({},"__esModule",{value:!0}),e);function Yl(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Wl(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function bn(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Wl(t?.deviceMemory)}}function yn(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};if(t.saveData)return{...r,reason:"save-data"};let o=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,l)=>c.width*c.height-l.width*l.height);if(!o.length)return{...r,upgradeUrl:e.url,reason:"progressive"};let i=o.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...r,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||Yl(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...r,reason:"memory-limit"};let s=a[a.length-1];return{...r,upgradeUrl:s.url,reason:"progressive"}}function ta(){return new DOMException("Panorama image load aborted","AbortError")}function Ot(e,t){return new Promise((n,r)=>{if(t?.aborted){r(ta());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(ta())};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 gn(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var mo=St(()=>{"use strict"});function oa(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":e.coverage==="floor-representative"?"AI-generated representative floor 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==="floor-representative"?"Representative floor view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function fo(e){return Math.max(Kl,Math.min(ql,e))}function Ql(e,t,n){let r=(.5+e/360)*n;return t/2-r}function Zl(e,t=vn){return e*(180/t)}function na(e,t,n){return(e-t)/2+xn(n,t)}function xn(e,t){let n=Le/180*t;return Math.max(-n,Math.min(n,e))}function ra(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=yn(t,bn()),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 p=document.createElement("div");Object.assign(p.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(p);let u=document.createElement("button");if(u.type="button",u.setAttribute("aria-label","Close"),u.textContent="\u2715",Object.assign(u.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(u),n.disclosure){let L=document.createElement("div");L.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(L.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(L)}let d=document.createElement("div");d.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(d.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(d),e.appendChild(c),u.focus({preventScroll:!0});let m=0,f=0,h=0,y=0,b=vn,g=()=>{let L=c.clientHeight||1,F=c.clientWidth||1,X=A.naturalWidth||F*2,W=A.naturalHeight||L,q=m>0?(F/2-h)/m:0,Q=f>0?y/f:0;f=Zl(L,b),m=f*(X/W),p.style.backgroundSize=`${m}px ${f}px`,x?h=F/2-q*m:(h=Ql(o,F,m),y=xn((t.initialPitchDeg??0)/180*f,f),x=!0),y=xn(Q*f,f),p.style.backgroundPosition=`${h}px ${na(L,f,y)}px`},x=!1,v=()=>{let L=c.clientHeight||1;y=xn(y,f),p.style.backgroundPosition=`${h}px ${na(L,f,y)}px`},A=new Image;A.onload=g,A.src=i.initialUrl;let S=()=>{};i.upgradeUrl&&(S=gn(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(F=>!F||a.signal.aborted?null:Ot(F,a.signal).then(X=>({full:X,url:F}))).then(F=>{F&&(M||a.signal.aborted||(A=F.full,p.style.backgroundImage=`url("${F.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let E=!1,_=0,O=0,j=0,V=new Map,R=()=>{let[L,F]=[...V.values()];return L&&F?Math.hypot(L.x-F.x,L.y-F.y):0},P=L=>{let F=fo(L);F!==b&&(b=F,g())},I=L=>{V.set(L.pointerId,{x:L.clientX,y:L.clientY}),E=V.size===1,_=L.clientX,O=L.clientY,V.size===2&&(j=R()),p.style.cursor="grabbing";try{p.setPointerCapture?.(L.pointerId)}catch{}},w=L=>{if(V.has(L.pointerId)){if(V.set(L.pointerId,{x:L.clientX,y:L.clientY}),V.size>=2){let F=R();j>0&&F>0&&P(b*(j/F)),j=F,E=!1;return}E&&(h+=L.clientX-_,y+=L.clientY-O,_=L.clientX,O=L.clientY,v())}},C=L=>{V.delete(L.pointerId),j=V.size===2?R():0;let F=V.values().next().value;E=V.size===1,F?(_=F.x,O=F.y):p.style.cursor="grab";try{p.releasePointerCapture?.(L.pointerId)}catch{}},G=L=>{L.preventDefault(),P(b+L.deltaY*.04)};p.addEventListener("pointerdown",I),p.addEventListener("pointermove",w),p.addEventListener("pointerup",C),p.addEventListener("pointercancel",C),p.addEventListener("wheel",G,{passive:!1});let k=!1,M=!1,T=0,D=()=>{p.removeEventListener("pointerdown",I),p.removeEventListener("pointermove",w),p.removeEventListener("pointerup",C),p.removeEventListener("pointercancel",C),p.removeEventListener("wheel",G),window.removeEventListener("keydown",H)},B=()=>{S(),a.abort(),n.signal?.removeEventListener("abort",s),T&&(window.clearTimeout(T),T=0),D(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},U=()=>{if(k)return;k=!0,c.style.opacity="0";let L=()=>{T=0,!M&&(B(),n.onClose?.())};T=window.setTimeout(L,r)},H=L=>{if(L.key==="Tab"){L.preventDefault(),u.focus({preventScroll:!0});return}if(L.key==="Escape"){L.stopPropagation(),U();return}if(L.key==="ArrowLeft"||L.key==="ArrowRight")h+=L.key==="ArrowLeft"?-32:32;else if(L.key==="ArrowUp"||L.key==="ArrowDown")y+=(L.key==="ArrowUp"?4:-4)*(f/180);else if(L.key==="+"||L.key==="="){P(b-5),L.preventDefault();return}else if(L.key==="-"){P(b+5),L.preventDefault();return}else return;L.preventDefault(),v()};return window.addEventListener("keydown",H),u.addEventListener("click",U),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:U,dispose(){k=!0,M=!0,B()}}}var vn,Kl,ql,Le,po=St(()=>{"use strict";mo();vn=70,Kl=35,ql=90;Le=35});function tu(e=$l,t=Jl,n=eu){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let p=0;p<o;p++){let u=p/t,d=u*Math.PI,m=Math.sin(d),f=Math.cos(d);for(let h=0;h<r;h++){let y=h/e,b=(y-.5)*Math.PI*2,g=p*r+h;a[g*3]=n*m*Math.sin(b),a[g*3+1]=n*f,a[g*3+2]=-n*m*Math.cos(b),s[g*2]=y,s[g*2+1]=u}}let c=new Uint16Array(e*t*6),l=0;for(let p=0;p<t;p++)for(let u=0;u<e;u++){let d=p*r+u,m=d+r;c[l++]=d,c[l++]=m,c[l++]=d+1,c[l++]=d+1,c[l++]=m,c[l++]=m+1}return{position:a,uv:s,index:c}}function ia(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}function aa(e,t){let{position:n,uv:r,index:o}=tu(),i=new Ke.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ke.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ke.Program(e,{vertex:nu,fragment:ou,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new Ke.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 Ke,$l,Jl,eu,nu,ou,sa=St(()=>{"use strict";Ke=require("ogl"),$l=64,Jl=32,eu=500;nu=`#version 300 es
|
|
2
2
|
precision highp float;
|
|
3
3
|
in vec3 position;
|
|
4
4
|
in vec2 uv;
|
|
@@ -17,15 +17,15 @@ out vec4 fragColor;
|
|
|
17
17
|
void main() {
|
|
18
18
|
vec3 rgb = texture(uPano, vUv).rgb;
|
|
19
19
|
fragColor = vec4(rgb, uOpacity);
|
|
20
|
-
}`});async function ca(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Le,Math.min(Le,t?.initialPitchDeg??0)),s=vn,c=!1,l=new AbortController,p=()=>l.abort();r.signal?.addEventListener("abort",p,{once:!0});let u=()=>{},d=[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 D=n.camera.position,B=n.focalWorld[0]-D.x,U=n.focalWorld[1]-D.y,H=n.focalWorld[2]-D.z,L=Math.hypot(B,H);L>.001&&(i=Math.atan2(B,-H)*180/Math.PI,a=Math.max(-Le,Math.min(Le,Math.atan2(U,L)*180/Math.PI)))}let m=null;if(t){let D=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),B=yn(t,bn(D)),U;try{let H=t.resolveUrl?await t.resolveUrl(B.initialUrl):B.initialUrl;if(!H)throw new Error("panorama_asset_unavailable");U=await Ot(H,l.signal)}catch{return r.signal?.removeEventListener("abort",p),null}try{m=ia(n.gl,U)}catch{return l.abort(),r.signal?.removeEventListener("abort",p),null}m.mesh.renderOrder=999,m.mesh.setParent(n.scene),B.upgradeUrl&&(u=gn(()=>{(t.resolveUrl?t.resolveUrl(B.upgradeUrl):Promise.resolve(B.upgradeUrl)).then(L=>!L||l.signal.aborted?null:Ot(L,l.signal)).then(L=>{L&&(c||l.signal.aborted||(m?.setImage(L),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),y=()=>{let D=n.camera.position;m?.mesh.position.set(D.x,D.y,D.z);let[B,U,H]=ra(i,a);n.camera.lookAt([D.x+B,D.y+U,D.z+H]),n.requestRender()};y();let b=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),b.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),b.tabIndex=-1,Object.assign(b.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"}),b.appendChild(x),r.disclosure){let D=document.createElement("div");D.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(D.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)"}),b.appendChild(D)}let v=document.createElement("div");v.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(v.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"}),b.appendChild(v),e.appendChild(b),x.focus({preventScroll:!0});let A=!1,S=0,E=0,_=0,O=new Map,j=()=>{let[D,B]=[...O.values()];return D&&B?Math.hypot(D.x-B.x,D.y-B.y):0},V=D=>{let B=fo(D);B!==s&&(s=B,n.camera.perspective({fov:s,aspect:n.camera.aspect}),y())},R=D=>{D.target!==x&&(O.set(D.pointerId,{x:D.clientX,y:D.clientY}),A=O.size===1,S=D.clientX,E=D.clientY,O.size===2&&(_=j()),b.setPointerCapture?.(D.pointerId),b.style.cursor="grabbing")},P=D=>{if(O.has(D.pointerId)){if(O.set(D.pointerId,{x:D.clientX,y:D.clientY}),O.size>=2){let B=j();_>0&&B>0&&V(s*(_/B)),_=B,A=!1;return}A&&(i+=(D.clientX-S)*sa,a=Math.max(-Le,Math.min(Le,a+(D.clientY-E)*sa)),S=D.clientX,E=D.clientY,y())}},I=D=>{O.delete(D.pointerId),_=O.size===2?j():0;let B=O.values().next().value;A=O.size===1,B?(S=B.x,E=B.y):b.style.cursor="grab";try{b.releasePointerCapture?.(D.pointerId)}catch{}},w=D=>{D.preventDefault(),V(s+D.deltaY*.04)};b.addEventListener("pointerdown",R),b.addEventListener("pointermove",P),b.addEventListener("pointerup",I),b.addEventListener("pointercancel",I),b.addEventListener("wheel",w,{passive:!1});let C=D=>{if(!c){if(D.key==="Tab"){D.preventDefault(),x.focus({preventScroll:!0});return}if(D.key==="Escape"){D.stopPropagation(),T.close();return}if(D.key==="ArrowLeft"||D.key==="ArrowRight")i+=D.key==="ArrowLeft"?-4:4;else if(D.key==="ArrowUp"||D.key==="ArrowDown")a=Math.max(-Le,Math.min(Le,a+(D.key==="ArrowUp"?4:-4)));else if(D.key==="+"||D.key==="="){V(s-5),D.preventDefault();return}else if(D.key==="-"){V(s+5),D.preventDefault();return}else return;D.preventDefault(),y()}};window.addEventListener("keydown",C);let G=0,k=(D,B)=>{if(!m){B?.();return}let U=D===1?0:1,H=performance.now(),L=()=>{if(c)return;let F=o<=0?1:Math.min(1,(performance.now()-H)/o);m?.setOpacity(U+(D-U)*F),n.requestRender(),F<1?G=requestAnimationFrame(L):B?.()};G=requestAnimationFrame(L)};k(1);let M=()=>{c||(c=!0,u(),l.abort(),r.signal?.removeEventListener("abort",p),cancelAnimationFrame(G),b.removeEventListener("pointerdown",R),b.removeEventListener("pointermove",P),b.removeEventListener("pointerup",I),b.removeEventListener("pointercancel",I),b.removeEventListener("wheel",w),window.removeEventListener("keydown",C),b.remove(),g?.isConnected&&g.focus({preventScroll:!0}),m?.dispose(),n.camera.position.set(d[0],d[1],d[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},T={close(){if(c)return;let D=()=>{M(),r.onClose?.()};cancelAnimationFrame(G),k(0,D)},dispose:M};return x.addEventListener("click",()=>T.close()),T}var sa,la=St(()=>{"use strict";aa();po();mo();sa=.15});var ua={};vo(ua,{createOpenPanorama:()=>ru});function ru(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:p,gl:u,isContextLost:d,isDisposed:m,flightGen:f,setPanorama:h,getLoadAbort:y,setLoadAbort:b,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:v,restorePanoramaLayer:A,getOverviewChip:S,labelOverlay:E,reducedMotion:_,removeArriveChip:O,showArriveChip:j}=e;return async(V,R,P)=>{y()?.abort();let I=new AbortController;b(I);let w=n.seats.idToIndex.get(V);if(w===void 0){i.syncFromCamera();return}let C=s.get(V)?.label??V,G=l(V,w),k=c(V);if(!k){I.abort(),y()===I&&b(null),i.syncFromCamera();return}x(!0),a.stop();let M;try{M=await k}catch{if(y()===I&&b(null),o.panoramaFailed(V,"source"),!m()&&P===f()){x(!1),i.resumeAfterFlight(G.focal),a.requestRender();let X=j(V,P,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(m()||P!==f()){I.abort(),y()===I&&b(null);return}O();let T=S(),D=()=>{I.abort(),y()===I&&b(null),h(null),g(!1),A(),T.style.display="",E.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(G.focal),a.requestRender();let X=j(V,f());requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())},B=M.generated===!0,U=na(M);v(),g(!B),T.style.display="none";let H=_()?0:R,L=p(),F=L&&!d()?await ca(t,B?null:M,{gl:u,scene:L.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:B?G.eye:void 0,focalWorld:G.focal},{fadeMs:H,seatLabel:C,disclosure:U,disclosurePrefix:B?"Live seat-eye view":"360\xB0 panorama",onClose:D,signal:I.signal}):null;if(m()||P!==f()){I.abort(),g(!1),y()===I&&b(null),F?.dispose(),T.style.display="",A();return}if(F)i.syncFromCamera(),E.setVisible(!1),x(!1),a.requestRender(),h(F);else if(B){A(),T.style.display="",x(!1),i.resumeAfterFlight(G.focal),a.requestRender(),h(null),g(!1),o.panoramaFailed(V,"mount");let X=j(V,f(),!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus()),y()===I&&b(null);return}else g(!1),o.panoramaFallback(V),h(oa(t,M,{fadeMs:H,seatLabel:C,disclosure:U,onClose:D,signal:I.signal}));o.panoramaOpened()}}var da=St(()=>{"use strict";po();la()});var uu={};vo(uu,{VENUE3D_QUALITY_REPORT_VERSION:()=>mi,buildSceneModel:()=>pt,inspectVenue3DQualityEvidence:()=>dn,mountVenue3D:()=>lu,prepareVenue3D:()=>va});module.exports=La(uu);var Co=require("ogl");var _a=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Fa(e){let t=_a.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=Fa(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function En(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Da(e){return .2126*En(e[0])+.7152*En(e[1])+.0722*En(e[2])}function Mo(e){return Da([e[0]*255,e[1]*255,e[2]*255])}function Oa(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 Mt(e,t){let n=Oa(e);return he(e,[n,n,n],t)}var Ce=["available","held","sold","selected","dimmed"];function wt(e){let t=Ce.indexOf(e);return t<0?0:t}var wo={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Po(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 Rn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},$e={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ve(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Va(){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 Ht=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 Co.Renderer({canvas:this.canvas,dpr:Va(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[$e.top[0],$e.top[1],$e.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 st=require("ogl"),me=Math.PI/180,Tn=15*me,kn=80*me,at=.12,Ao=35,Io=1.25,jt=class{constructor(t,n,r,o){this.fovY=Ao;this.target=new st.Vec3;this.azimuth=-30*me;this.polar=55*me;this.distance=10;this.azT=-30*me;this.polT=55*me;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 st.Vec3;this.panAnchor=new st.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new st.Camera(t,{fov:Ao,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(Tn,Math.min(kn,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*me;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(Tn,Math.min(kn,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*me/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),p=Math.sin(this.polar),u=-i*l,d=-a*l;this.targetT.x+=(-t*s+n*u)*o,this.targetT.z+=(-t*c+n*d)*o,this.targetT.y+=n*p*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*me/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*me,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*me;let p=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=p*Math.max(1.05,Math.min(2,i?.margin??Io)),this.minDist=Math.max(2,a*.12),this.maxDist=p*4,n?(this.azimuth=this.azT,this.polar=12*me,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*me/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))*me;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Io))}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),p=-l*Math.sin(o),u=-Math.cos(i),d=-l*Math.cos(o);if(Math.abs(u)>.999)return s;let m=-d,f=p,h=Math.hypot(m,f);m/=h,f/=h;let y=-f*u,b=f*p-m*d,g=m*u,x=Math.tan(r),v=Math.tan(n),A=1;for(let S=0;S<8;S++){let E=(S&1?c.max[0]:c.min[0])-t.center[0],_=(S&2?c.max[1]:c.min[1])-t.center[1],O=(S&4?c.max[2]:c.min[2])-t.center[2],j=E*p+_*u+O*d,V=Math.abs(E*m+O*f),R=Math.abs(E*y+_*b+O*g);A=Math.max(A,V/x-j,R/v-j)}return Math.min(s,Math.max(A,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*at,this.polar+=n*at,this.distance+=r*at,this.target.x+=o*at,this.target.y+=i*at,this.target.z+=a*at,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(Tn,Math.min(kn,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 Xt=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 ct=2.5,Ba=1.15,Pt=6,lt=10,Eo=6,Ro=9.5,To=.9,ko=2.2,Ln=30,_n=4,Yt=8192;var xu=lt+_n;function Lo(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ct};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ct+o*(Ba-ct)}}function _o(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function Fo(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 Na=[{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"}],Su=new Map(Na.map(e=>[e.key,e]));var Ga={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 Do(e){let t=e?.[0];return t&&Ga[t]||"#3b82f6"}var za=[{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"}],Mu=new Map(za.map(e=>[e.key,e]));var Ua=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],wu=new Set(Ua);var Vo=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],Bo=Vo.map(e=>e.key),Ha=new Map(Vo.map(e=>[e.key,e]));function Oo(e){return typeof e=="string"&&Ha.has(e)}function No(e,t){return Oo(e)?e:Oo(t?.seatGlyph)?t.seatGlyph:"circle"}var Re=.02291666666666667,He=1/Re,ja=58,Xa=ja*Re;var Ya=3,Go=0,Fn=120,Wa=0,Ka=45,qa=7,Wt=1.2;function Dn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Qa(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=qa?e:Ya}function zo(e,t={}){let n=Dn(t.floorBaseHeightM,Go,Fn,0),r=Math.min(Fn,n+Qa(e.elevation)*Xa),o=e.height===void 0?r:Dn(e.height,Go,Fn,r),i=Dn(e.rake,Wa,Ka,0);return{height:o,rake:i}}var Ho=it(require("earcut"),1),jo=it(require("polygon-clipping"),1);var Ru=Math.PI/180;function On(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 Ct(e){return e.length?On(e):null}function Je(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 At(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 N=Re,Za=.002;function $a(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<Za}var et=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)}},Qt=class{constructor(){this.pos=new et;this.nor=new et;this.col=new et;this.flr=new et;this.mat=new et;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){$a(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 Ja(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,p=i*a-r*c,u=r*s-o*a,d=Math.hypot(l,p,u)||1;return l/=d,p/=d,u/=d,[l,p,u]}function es(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,Ho.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Vn(e){return Je(e)<0?[...e].reverse():e}var ts=3;function ns(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(m,f,h,y)=>Math.abs(r({x:(m.x+f.x)/2,y:(m.y+f.y)/2})-(h+y)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,p=(o+i+a)/3,u=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:l})-p)),d=(m,f,h)=>{let y=Math.abs(r({x:(m+c)/2,y:(f+l)/2})-(h+p)/2);y>u&&(u=y)};return d((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),d((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),d((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),u}function It(e,t,n,r,o){if(o<=0)return ns(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(It(e,i,s,r,o-1),It(i,t,a,r,o-1),It(s,a,n,r,o-1),It(i,a,s,r,o-1))}function Et(e,t,n,r,o,i,a,s){if(a>0){let d={x:(t.x+n.x)/2,y:(t.y+n.y)/2},m={x:(n.x+r.x)/2,y:(n.y+r.y)/2},f={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Et(e,t,d,f,o,i,a-1,s),Et(e,d,n,m,o,i,a-1,s),Et(e,f,m,r,o,i,a-1,s),Et(e,d,m,f,o,i,a-1,s);return}let c=[t.x*N,o(t),t.y*N],l=[n.x*N,o(n),n.y*N],p=[r.x*N,o(r),r.y*N];if(s){e.triN(c,l,p,s(t),s(n),s(r),i);return}let u=Ja(c,l,p);u[1]<0&&(u=[-u[0],-u[1],-u[2]]),e.tri(c,l,p,u,i)}var os=8;function Uo(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,l)=>{if(l>0){let p={x:(i.x+a.x)/2,y:(i.y+a.y)/2},u=t(p);if(Math.abs(u-(s+c)/2)>n){o(i,p,s,u,l-1),o(p,a,u,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),os)}return r}function Kt(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,p=Math.hypot(c,l);p>t&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/p<t||r.push(a)}return r.length>=3?r:n}var qt=.001*He*.1;function le(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(Je(t))<1e-4))return;let p=Kt(Uo(Kt(Vn(t),qt),r,c),qt),u=n?.map(S=>Kt(Uo(Kt(Vn(S),qt),r,c),qt)).filter(S=>S.length>=3&&Math.abs(Je(S))>=1e-4),{pts:d,tris:m}=es(p,u),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],h=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],y=[a[0]*s.top,a[1]*s.top,a[2]*s.top],b=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<ts;g++){let S=0;for(let E=0;E<m.length;E+=3){let _=It(d[m[E]],d[m[E+1]],d[m[E+2]],r,g);_>S&&(S=_)}if(S<=c)break}for(let S=0;S<m.length;S+=3){let E=d[m[S]],_=d[m[S+1]],O=d[m[S+2]];Et(e,E,_,O,r,f,g,l);let j=[E.x*N,o,E.y*N],V=[_.x*N,o,_.y*N],R=[O.x*N,o,O.y*N];e.tri(j,R,V,[0,-1,0],h)}let x=S=>{if(g<=0)return S;let E=1<<g,_=[];for(let O=0;O<S.length;O++){let j=S[O],V=S[(O+1)%S.length];for(let R=0;R<E;R++){let P=R/E;_.push({x:j.x+(V.x-j.x)*P,y:j.y+(V.y-j.y)*P})}}return _},v=On(p),A=[{ring:x(p),flip:!1}];if(u)for(let S of u)S.length>=3&&A.push({ring:x(S),flip:!0});for(let{ring:S,flip:E}of A)for(let _=0;_<S.length;_++){let O=S[_],j=S[(_+1)%S.length],V=(j.x-O.x)*N,P=(j.y-O.y)*N,I=-V,w=Math.hypot(P,I)||1;P/=w,I/=w;let C=(O.x+j.x)/2-v.x,G=(O.y+j.y)/2-v.y,k=P*C+I*G;E&&(k=-k),k<0&&(P=-P,I=-I);let M=[P,0,I],T=[O.x*N,r(O),O.y*N],D=[j.x*N,r(j),j.y*N],B=[O.x*N,o,O.y*N],U=[j.x*N,o,j.y*N];e.tri(T,D,U,M,y,y,b),e.tri(T,U,B,M,y,b,b)}}function Xo(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:t}}function Zt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Vn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],p=l.x-c.x,u=l.y-c.y,d=Math.hypot(p,u)||1;i.push({x:u/d,y:-p/d})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],p=i[s],u=l.x+p.x,d=l.y+p.y,m=Math.hypot(u,d),f=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+p.x*t,c.y+p.y*t])};if(m<1e-9){f();continue}u/=m,d/=m;let h=u*l.x+d*l.y,y=1/Math.max(h,1e-6);if(!Number.isFinite(y)||y>n){f();continue}a.push([c.x+u*t*y,c.y+d*t*y])}if(a.length<3)return e;try{let s=jo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let u of s){let d=Math.abs(Je(u[0].map(([m,f])=>({x:m,y:f}))));d>l&&(l=d,c=u[0])}if(!c)return e;let p=c.map(([u,d])=>({x:u,y:d}));if(p.length>1){let u=p[0],d=p[p.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&p.pop()}return p.length>=3?p:e}catch{return e}}function $t(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 Rt(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ie={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},rs=.44,is=.15,as=.3,ss=.24;function Yo(e){return e===void 0||!Number.isFinite(e)||e<=0?ss:Math.min(as,Math.max(is,e*rs))}var Bn=.21,cs=.05,Nn=.45,Jt=Nn+cs,ls=[{part:ie.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ie.pad,min:[-1,.36,-.95],max:[1,Nn,1]},{part:ie.back,min:[-1,Jt,-1],max:[1,.92,-.72]},{part:ie.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ie.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ie.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ie.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ie.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ie.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ie.leg,min:[.62,0,.48],max:[.82,.37,.7]}],us=[{part:ie.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ie.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ie.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ie.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ie.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],ds=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function Wo(){let e=[],t=[],n=[],r=[],o=(w,C,G)=>{let k=n.length,[M,T,D]=w,B=[T[0]-M[0],T[1]-M[1],T[2]-M[2]],U=[D[0]-M[0],D[1]-M[1],D[2]-M[2]],H=B[1]*U[2]-B[2]*U[1],L=B[2]*U[0]-B[0]*U[2],F=B[0]*U[1]-B[1]*U[0],X=Math.hypot(H,L,F);X>1e-9?(H/=X,L/=X,F/=X):[H,L,F]=C,H*C[0]+L*C[1]+F*C[2]<0&&(H=-H,L=-L,F=-F);for(let W of w)e.push(...W),t.push(H,L,F),n.push(G);r.push(k,k+1,k+2,k,k+2,k+3)},i=w=>{for(let C of ds){let G=C.c.map(k=>k.map((M,T)=>M?w.max[T]:w.min[T]));o(G,C.n,w.part)}};for(let w of ls)i(w);for(let w of us)i(w);let a=Nn,s=1.08,c=.47,l=.69,p=-.55,u=.08,d=-.48,m=.01,f=[-c,a,p],h=[c,a,p],y=[-c,a,u],b=[c,a,u],g=[-l,s,d],x=[l,s,d],v=[-l,s,m],A=[l,s,m];o([h,x,A,b],[1,0,0],ie.body),o([y,v,g,f],[-1,0,0],ie.body),o([v,A,x,g],[0,1,0],ie.body),o([f,h,b,y],[0,-1,0],ie.body),o([b,A,v,y],[0,0,1],ie.body),o([f,g,x,h],[0,0,-1],ie.body);let S=10,E=8,_=[0,1.205,-.23],O=[.42,.115,.38],j=n.length;for(let w=0;w<=E;w++){let C=Math.PI*w/E,G=Math.cos(C),k=Math.sin(C);for(let M=0;M<=S;M++){let T=Math.PI*2*M/S,D=k*Math.cos(T),B=k*Math.sin(T);e.push(_[0]+O[0]*D,_[1]+O[1]*G,_[2]+O[2]*B);let U=D/O[0],H=G/O[1],L=B/O[2],F=Math.hypot(U,H,L)||1;U/=F,H/=F,L/=F,t.push(U,H,L),n.push(ie.head)}}for(let w=0;w<E;w++)for(let C=0;C<S;C++){let G=j+w*(S+1)+C,k=G+S+1;r.push(G,k,G+1,G+1,k,k+1)}let V=new Float32Array(e),R=new Float32Array(t),P=new Float32Array(n),I=new Uint16Array(r);return{position:V,normal:R,part:P,index:I,vertexCount:n.length,indexCount:r.length}}function Ko(e,t,n,r){let o=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,p)=>{let u=p-l;for(let d=l;d<p;d++){let[m,f]=r(d),h=m-i(d),y=f-a(d);if(u>=2){let b=Math.max(l,d-1),g=Math.min(p-1,d+1),x=i(g)-i(b),v=a(g)-a(b),A=Math.hypot(x,v);if(A>1e-6){let S=-v/A,E=x/A;S*h+E*y<0&&(S=-S,E=-E),h=S,y=E}}o[d]=h===0&&y===0?0:Math.atan2(h,y)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var Oe=.22;function qo(e,t){let n=Ce[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 ms=.42;function fs(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let f of e)f.x<r&&(r=f.x),f.y<o&&(o=f.y),f.x>i&&(i=f.x),f.y>a&&(a=f.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),p=Math.max(1,Math.ceil(s/l)+1),u=Math.max(1,Math.ceil(c/l)+1),d=new Map,m=(f,h)=>{let y=Math.min(p-1,Math.max(0,Math.floor((f-r)/l)));return Math.min(u-1,Math.max(0,Math.floor((h-o)/l)))*p+y};for(let f=0;f<t;f++){let h=m(e[f].x,e[f].y),y=d.get(h);y?y.push(f):d.set(h,[f])}for(let f=0;f<t;f++){let h=e[f],y=Math.min(p-1,Math.max(0,Math.floor((h.x-r)/l))),b=Math.min(u-1,Math.max(0,Math.floor((h.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let v=b-x;v<=b+x;v++)if(!(v<0||v>=u))for(let A=y-x;A<=y+x;A++){if(A<0||A>=p||x>1&&Math.abs(v-b)<x&&Math.abs(A-y)<x)continue;let S=d.get(v*p+A);if(S)for(let E of S){if(E===f)continue;let _=Math.hypot(e[E].x-h.x,e[E].y-h.y);_<g&&(g=_)}}if(Number.isFinite(g)&&g<=x*l)break}n[f]=g}return n}function ps(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Wt):0}function Qo(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),p=new Float32Array(a),u=new Float32Array(a),d=new Float32Array(a),m=new Float32Array(a),f=new Float32Array(a*3),h=new Map,y=fs(e);for(let b=0;b<a;b++){let g=e[b],v=(n?.seatPitchU(b)??y[b])*N;p[b]=Number.isFinite(v)?Math.max(.06,Math.min(Oe,v*ms)):Oe,u[b]=Yo(Number.isFinite(v)?v:void 0);let A=No(g.glyph,{seatGlyph:i?.get(g.categoryKey)});d[b]=Bo.indexOf(A),m[b]=g.wheelchairSpaceType==="no-seat"?0:1,s[b*3]=g.x*N,s[b*3+1]=n?n.seatDeckY(b):ps(g),s[b*3+2]=g.y*N,c[b]=wt(t?t(g):"available");let S=ee(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[b*3]=S[0],l[b*3+1]=S[1],l[b*3+2]=S[2],g.accessibility?.length){let E=ee(Do(g.accessibility));E&&(f[b*3]=E[0],f[b*3+1]=E[1],f[b*3+2]=E[2])}h.set(g.id,b)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:p,iRing:f,idToIndex:h,iChairWidth:u,iGlyph:d,iPhysicalSeat:m,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var hs=64;function Gn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=wt(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+hs){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 bs=.15,ys=.9,gs=1.76,xs=.7,vs=1.6;function Ss(){return{background:{top:[...$e.top],bottom:[...$e.bottom]},structure:Rn,seatStates:{...wo},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Zo(e){let t=Ss();if(!e)return t;let n=ee(e.background);if(n){t.background={top:ve(n,ys),bottom:ve(n,gs)};let a={};for(let[s,c]of Object.entries(Rn))a[s]=he(c,n,bs);t.structure=a}let r=ee(e.selectionColor)??ee(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(vs,Math.max(xs,o)));let i=e.venue3d;if(i){let a=ee(i.deck),s=ee(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=ee(i.seat),t.materials.shell=ee(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function $o(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Jo(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 ut(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,p=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;p<0?p=0:p>1&&(p=1);let u=Math.hypot(t-(i.x+p*s),n-(i.y+p*c));u<r&&(r=u)}return r}function Ms(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 er(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function zn(e,t){let n=1/0;for(let r of Jo(e)){let o=ut(t,r.x,r.y);o<n&&(n=o)}for(let r of Jo(t)){let o=ut(e,r.x,r.y);o<n&&(n=o)}return n}function ws(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let p of e)n+=p.x,r+=p.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let p of e){let u=Math.hypot(p.x-n,p.y-r);u>o&&(o=u,i=p)}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((p,u)=>({p,i:u,t:(p.x-n)*a+(p.y-r)*s})).sort((p,u)=>p.t-u.t);return{pts:l.map(p=>p.p),seatIndices:l.map(p=>t[p.i])}}function Un(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,p=0;for(let g of e){let x=g.x-n,v=g.y-r;o+=x*x,a+=v*v,i+=x*v,s+=x*x*x,c+=v*v*v,l+=x*v*v,p+=v*x*x}let u=o*a-i*i;if(Math.abs(u)<1e-9)return null;let d=(s+l)/2,m=(c+p)/2,f=(d*a-m*i)/u,h=(m*o-d*i)/u,y=f+n,b=h+r;return!Number.isFinite(y)||!Number.isFinite(b)?null:{cx:y,cy:b}}var Ps=.15;function Cs(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,v=0;for(let A of g.pts)x+=A.x,v+=A.y;return{x:x/g.pts.length,y:v/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,v=g.y-r;o+=x*x,i+=x*v,a+=v*v}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),p,u;Math.abs(i)>1e-12?(p=l-a,u=i):o>=a?(p=1,u=0):(p=0,u=1);let d=Math.hypot(p,u);if(!(d>1e-12))return null;p/=d,u/=d;let m=1/0,f=-1/0,h=[];for(let g of e){let x=1/0,v=-1/0;for(let A of g.pts){let S=A.x*p+A.y*u;S<x&&(x=S),S>v&&(v=S),S<m&&(m=S),S>f&&(f=S)}h.push(v-x)}let y=f-m;return y>1e-9?(h.sort((g,x)=>g-x),h[Math.min(h.length-1,Math.floor(h.length*.9))]/y<=As?{x:p,y:u}:null):null}var As=.35;function tr(e,t,n,r){let o=new Map;for(let y of n){let b=t[y],g=b.rowId||`__seat-${y}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:b.x,y:b.y}),x.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[y,b]of o){let g=ws(b.pts,b.idx),x=0;for(let v of g.pts)x+=Math.hypot(v.x-r.x,v.y-r.y);i.push({id:y,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(y=>Ms(y.pts)),s=[];for(let y=0;y<i.length;y++){let b=1/0;for(let g=0;g<i.length;g++){if(y===g||er(a[y],a[g])>=b)continue;let x=zn(i[y].pts,i[g].pts);x<b&&(b=x)}Number.isFinite(b)&&s.push(b)}s.sort((y,b)=>y-b);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),p=i.map(()=>[]);for(let y=0;y<i.length;y++)for(let b=y+1;b<i.length;b++)er(a[y],a[b])>l||zn(i[y].pts,i[b].pts)<=l&&(p[y].push(b),p[b].push(y));let u=0;for(let y=0;y<i.length;y++){if(i[y].blockId!==-1)continue;let b=u++,g=[y];for(i[y].blockId=b;g.length;){let x=g.pop();for(let v of p[x])i[v].blockId===-1&&(i[v].blockId=b,g.push(v))}}let d=new Map;for(let y of i){let b=d.get(y.blockId)??[];b.push(y),d.set(y.blockId,b)}let m=[];for(let y of i){if(y.pts.length<4)continue;let b=Un(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||m.push({x:b.cx,y:b.cy}))}let f=m.length>=2?(()=>{let y=m.map(x=>x.x).sort((x,v)=>x-v),b=m.map(x=>x.y).sort((x,v)=>x-v),g=Math.floor(m.length/2);return{cx:y[g],cy:b[g]}})():null;if(f){let y=S=>Math.hypot(S.x-f.cx,S.y-f.cy),b=1/0,g=-1/0,x=[];for(let S of i){let E=1/0,_=-1/0;for(let O of S.pts){let j=y(O);j<E&&(E=j),j>_&&(_=j)}x.push(_-E),E<b&&(b=E),_>g&&(g=_)}let v=g-b;x.sort((S,E)=>S-E);let A=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(v>1e-9&&A/v<=Ps){let S=i.map(C=>{let G=0;for(let k of C.pts)G+=y(k);return{row:C,radius:G/C.pts.length}}),E=0,_=0;for(let C of S)E+=C.radius,_+=C.row.focalDistance;E/=S.length,_/=S.length;let O=0;for(let C of S)O+=(C.radius-E)*(C.row.focalDistance-_);if(O<0)for(let C of S)C.radius=-C.radius;let V=1/0;for(let C of S)C.radius<V&&(V=C.radius);S.sort((C,G)=>C.radius-G.radius);let R=-1,P=-1/0,I=v/Math.max(1,S.length)*.5,w=[];for(let C of S)C.radius-P>I&&(R++,P=C.radius),C.row.ordinal=R,C.row.blockDepth=C.radius-V,w.push(C.row);return{sectionId:e,rows:w,blockCount:u}}}let h=[];for(let[,y]of d){let b=Cs(y);if(b){let g=v=>{let A=0;for(let S of v.pts)A+=S.x*b.x+S.y*b.y;return A/v.pts.length};y.sort((v,A)=>g(v)-g(A)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let x=0;for(let v=0;v<y.length;v++)v>0&&(x+=zn(y[v-1].pts,y[v].pts)),y[v].ordinal=v,y[v].blockDepth=x,h.push(y[v])}else{let g=1/0;for(let x of y)x.focalDistance<g&&(g=x.focalDistance);y.sort((x,v)=>x.focalDistance-v.focalDistance);for(let x=0;x<y.length;x++)y[x].ordinal=x,y[x].blockDepth=Math.max(0,y[x].focalDistance-g),h.push(y[x])}}return{sectionId:e,rows:h,blockCount:u}}var Ku=Math.PI/180;function nr(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 Is(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 Hn(e,t,n){return nr(e,t)&&!(n??[]).some(r=>nr(e,r)||Is(e,r))}function Es(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 Rs(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let m of e)n+=m.x,r+=m.y,o+=Math.hypot(m.x-t.x,m.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let m of e){let f=Math.hypot(m.x-n,m.y-r);f>s&&(s=f,a=m)}let c=a.x-n,l=a.y-r,p=Math.hypot(c,l);p>1e-9?(c/=p,l/=p):(c=1,l=0);let u=[...e].sort((m,f)=>(m.x-n)*c+(m.y-r)*l-((f.x-n)*c+(f.y-r)*l)),d=0;for(let m of u){let f=Math.hypot(m.x-n,m.y-r);f>d&&(d=f)}return{pts:u,cx:n,cy:r,radius:d,depth:o}}function or(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,p=c*c+l*l,u=p>1e-12?((t-a.x)*c+(n-a.y)*l)/p:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(a.x+u*c),n-(a.y+u*l));d<o&&(o=d)}return o}var en=8;function Ts(e,t,n){let r=new Array(en).fill(1/0),o=new Array(en).fill(-1);for(let p=0;p<e.length;p++){let u=e[p],d=Math.hypot(t-u.cx,n-u.cy)-u.radius;for(let m=0;m<en;m++)if(d<r[m]){for(let f=en-1;f>m;f--)r[f]=r[f-1],o[f]=o[f-1];r[m]=d,o[m]=p;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let p of o){if(p<0)continue;let u=or(e[p],t,n);for(let d=0;d<3;d++)if(u<i[d]){for(let m=2;m>d;m--)i[m]=i[m-1],a[m]=a[m-1];i[d]=u,a[d]=p;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 p=0;p<3;p++){let u=a[p];if(u<0||i[p]>s)continue;let d=1/(i[p]*i[p]);c+=d*e[u].depth,l+=d}return l>0?c/l:e[a[0]].depth}function ks(e){let t=(r,o)=>Ts(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=or(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 rr(e,t){let n=[];for(let r of e){let o=Rs(r.points,t);o&&n.push(o)}return n.length<2?Es(t):(n.sort((r,o)=>r.depth-o.depth),ks(n))}var Yn=it(require("polygon-clipping"),1);var cr=it(require("earcut"),1);var Ls=.58,ir=.01,Se=Oe*1.5*He,_s=.5,Fs=.6;function Ds(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,p=c.y-s.y,u=Math.hypot(l,p);if(u<1e-9){r.push([0,0]);continue}l/=u,p/=u,r.push([-p,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 Os(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,p=Math.hypot(c,l)||1;return{x:c/p,y:l/p}},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 ar=Math.PI/12;function Vs(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 lr(e,t){if(!e.length||!(t>0))return[];let n=Vs(e),r=(s,c,l,p)=>{let u=l-c;for(;u<0;)u+=Math.PI*2;for(;u>Math.PI*2;)u-=Math.PI*2;let d=Math.max(1,Math.ceil(u/ar)),m=t/Math.cos(u/d/2);for(let f=0;f<=d;f++){let h=c+u*f/d;p.push({x:s.x+Math.cos(h)*m,y:s.y+Math.sin(h)*m})}};if(n.length<3){let s=0,c=0;for(let m of n)s+=m.x,c+=m.y;s/=n.length||1,c/=n.length||1;let l=0;for(let m of n)l=Math.max(l,Math.hypot(m.x-s,m.y-c));let p=[],u=Math.max(3,Math.ceil(Math.PI*2/ar)),d=(l+t)/Math.cos(Math.PI/u);for(let m=0;m<u;m++){let f=m/u*Math.PI*2;p.push({x:s+Math.cos(f)*d,y:c+Math.sin(f)*d})}return p}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 pr(a)}function Bs(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,p=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;p<0?p=0:p>1&&(p=1);let u=Math.hypot(t-(i.x+p*s),n-(i.y+p*c));u<r&&(r=u)}return r}function tn(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 p=Math.hypot(l.x-i,l.y-a);p>c&&(c=p)}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 p of i){let u=1/0;for(let d=0;d<e.length;d++){if(d===o||Math.abs(e[d].y-e[o].y)<.001)continue;let m=t[d],f=Math.hypot(p.x-m.cx,p.y-m.cy)-m.rad;if(f>=u&&f>=s)continue;let h=Bs(e[d].pts,p.x,p.y);h<u&&(u=h),e[d].depth<e[o].depth&&h<s&&(s=h,c=e[d].y)}Number.isFinite(u)&&u>0&&a.push(u)}a.sort((p,u)=>p-u);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function ur(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let p=o.pts[0],u=p.x-r.x,d=p.y-r.y,m=Math.hypot(u,d)||1;u/=m,d/=m;let f=Math.max(n[t].pitch,.001)*.5;return[{x:p.x+d*f,y:p.y-u*f},{x:p.x-d*f,y:p.y+u*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let p=1;p<i.length;p++){let u=Math.hypot(i[p].x-i[p-1].x,i[p].y-i[p-1].y);u>1e-6&&(a+=u,s++)}let c=s>0?a/s:0,l=Os(i,Math.max(c*Fs,Se));return{pts:l,nrm:Ds(l,r),front:Math.max(n[t].pitch*Ls,Se),back:Math.max(n[t].pitch*_s,Se)}}var dt=1.5,dr=.3;function jn(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 u=1;u<e.length-1;u++){let d=e[u],m=a>1e-12?Math.abs((d.x-n.x)*i-(d.y-n.y)*o)/a:Math.hypot(d.x-n.x,d.y-n.y);m>s&&(s=m,c=u)}if(s<=t||c<0)return[n,r];let l=jn(e.slice(0,c+1),t),p=jn(e.slice(c),t);return[...l.slice(0,-1),...p]}function mr(e,t){if(e.length<4)return e;let n=jn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function fr(e,t,n){if(e.length<2)return[];let r=n??tn(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=>ur(e,g,r,t)).filter(g=>g!==null);if(!l.length)continue;let p=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+dt),y:g.pts[x].y-g.nrm[x][1]*(g.front+dt)}),u=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+dt),y:g.pts[x].y+g.nrm[x][1]*(g.back+dt)}),d=l[0],m=l[l.length-1],f=[];for(let g=0;g<d.pts.length;g++)f.push(p(d,g));for(let g of l)f.push(u(g,g.pts.length-1));for(let g=m.pts.length-1;g>=0;g--)f.push(u(m,g));for(let g=l.length-1;g>=0;g--)f.push(p(l[g],0));let h=pr(f),y=1/0;for(let g of s)e[g].y<y&&(y=e[g].y);if(!Number.isFinite(y))continue;if(h.length>=3&&Math.abs(Je(h))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return At(h,x.x,x.y)})){i.push({outline:mr(h,dr),holes:[],topY:y});continue}for(let g of Ns(l))i.push({outline:g,holes:[],topY:y})}return i}function Ns(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+dt,a=n.back+dt;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],p=n.nrm[c];r.push([l.x-p[0]*i,l.y-p[1]*i]),o.push([l.x+p[0]*a,l.y+p[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=Yn.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(mr(i,dr))}return r}catch{return[]}}function pr(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 Xn=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(!At(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function sr(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],p=r[0];for(let u=1;u+1<r.length;u++){let d=r[u],m=r[u+1];e.tri([p.x*N,o,p.y*N],[d.x*N,o,d.y*N],[m.x*N,o,m.y*N],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=Yn.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 p=l[0],u=[],d=[];for(let f=0;f<p.length-1;f++)u.push(p[f][0],p[f][1]),d.push([p[f][0],p[f][1]]);if(d.length<3)continue;let m=(0,cr.default)(u,void 0,2);for(let f=0;f<m.length;f+=3){let h=d[m[f]],y=d[m[f+1]],b=d[m[f+2]];e.tri([h[0]*N,o,h[1]*N],[y[0]*N,o,y[1]*N],[b[0]*N,o,b[1]*N],c,i)}}}function hr(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??tn(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(m=>[m.x,m.y]),[i[0].x,i[0].y]]]:null,p=i&&i.length>=3?new Xn([[...i]]):null,u=m=>{e.setMaterial(2),m(),e.setMaterial(0)},d=m=>{e.setMaterial(3),m(),e.setMaterial(0)};for(let m=0;m<t.length;m++){let f=t[m];if(f.patch&&f.patch.length>=3){let A=[...f.patch],S=s[m].belowY??r;if(d(()=>{if(l&&p)sr(e,l,p,A,f.y,o.tread);else{let E=A[0];for(let _=1;_+1<A.length;_++){let O=A[_],j=A[_+1];e.tri([E.x*N,f.y,E.y*N],[O.x*N,f.y,O.y*N],[j.x*N,f.y,j.y*N],c,o.tread)}}}),f.y>S+ir){let E=0,_=0;for(let O of A)E+=O.x,_+=O.y;E/=A.length,_/=A.length,u(()=>{for(let O=0;O<A.length;O++){let j=A[O],V=A[(O+1)%A.length],R=V.x-j.x,P=V.y-j.y,I=Math.hypot(R,P);if(I<1e-6)continue;let w=P/I,C=-R/I;(j.x-E)*w+(j.y-_)*C<0&&(w=-w,C=-C);let G=[w,0,C],k=[j.x*N,f.y,j.y*N],M=[V.x*N,f.y,V.y*N],T=[j.x*N,S,j.y*N],D=[V.x*N,S,V.y*N];e.tri(k,M,D,G,o.riser),e.tri(k,D,T,G,o.riser)}})}continue}let h=ur(t,m,s,n);if(!h)continue;let{pts:y,nrm:b,front:g,back:x}=h,v=s[m].belowY??r;for(let A=0;A+1<y.length;A++){let S=y[A],E=y[A+1],_=b[A],O=b[A+1];if(Math.hypot(E.x-S.x,E.y-S.y)<1e-6||_[0]===0&&_[1]===0||O[0]===0&&O[1]===0)continue;let j=[(S.x-_[0]*g)*N,f.y,(S.y-_[1]*g)*N],V=[(E.x-O[0]*g)*N,f.y,(E.y-O[1]*g)*N],R=[(S.x+_[0]*x)*N,f.y,(S.y+_[1]*x)*N],P=[(E.x+O[0]*x)*N,f.y,(E.y+O[1]*x)*N];if(d(()=>{l&&p?sr(e,l,p,[{x:S.x-_[0]*g,y:S.y-_[1]*g},{x:E.x-O[0]*g,y:E.y-O[1]*g},{x:E.x+O[0]*x,y:E.y+O[1]*x},{x:S.x+_[0]*x,y:S.y+_[1]*x}],f.y,o.tread):(e.tri(j,V,P,c,o.tread),e.tri(j,P,R,c,o.tread))}),f.y>v+ir){let I=[j[0],v,j[2]],w=[V[0],v,V[2]],C=[-_[0],0,-_[1]];u(()=>{e.tri(j,V,w,C,o.riser),e.tri(j,w,I,C,o.riser)})}}}}function br(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 nn(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Wn=it(require("polygon-clipping"),1);function Gs(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function yr(e,t){return e.filter(n=>n.type!=="shape"||Gs(n,t))}function gr(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:yr(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:yr(e.objects,t),focal:n,baseHeightM:0,index:0}]}var zs={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function mt(e){return br(e)??zs}function xr(e,t){let n=Zt(e.outline,Se),r=mt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&nn(r,mt(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=Wn.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(([p,u])=>({x:p,y:u}));if(l.length>1){let p=l[0],u=l[l.length-1];Math.abs(p.x-u.x)<1e-9&&Math.abs(p.y-u.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function vr(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=Wn.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,p])=>({x:l,y:p}));if(c.length>1){let l=c[0],p=c[c.length-1];Math.abs(l.x-p.x)<1e-9&&Math.abs(l.y-p.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var Us=.05,Sr=.05,Hs=.15,Kn=25;function Mr(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=[],p=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"&&p.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let h=Zt(f.outline,Se);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:mt(h),section:f,unit:m,outline:h})}}let u=new Map;for(let d of l){let m=u.get(d.floorIndex);m?m.push(d):u.set(d.floorIndex,[d])}for(let d=0;d<t.length;d++){let m=t[d],f=n?u.get(n[d])??[]:l,h=m.sectionId?f.find(b=>b.id===m.sectionId)??f.find(b=>b.section.logicalSectionId===m.sectionId&&Hn({x:m.x,y:m.y},b.outline,b.section.holes)):void 0,y=h?[h]:f;for(let b of y){if(n&&b.floorIndex!==n[d]||!h&&(m.x<b.box.minX||m.x>b.box.maxX||m.y<b.box.minY||m.y>b.box.maxY||!Hn({x:m.x,y:m.y},b.outline,b.section.holes)))continue;o[d]=b.id;let g=c.get(b.id);g.hasSeats=!0;let x=m.focalPoint??b.unit.focal,v=Math.hypot(m.x-x.x,m.y-x.y);v<g.frontU&&(g.frontU=v),g.seatIndices.push(d);let A=m.rowId||`__seat-${d}`,S=g.rows.get(A);S?S.push({x:m.x,y:m.y}):g.rows.set(A,[{x:m.x,y:m.y}]);break}}for(let[d,m]of c){let f=zo(m.section,{floorBaseHeightM:m.unit.baseHeightM}),h=m.unit.baseHeightM,y=f.rake>0?Math.tan(f.rake*Math.PI/180):0,b=f.rake<=.01&&f.height<=h+.001,g=m.section.surfaceKind,x=g==="flat"?!0:g==="rakedRows"&&f.rake>.01?!1:b,v=m.hasSeats?tr(d,t,m.seatIndices,m.unit.focal):{sectionId:d,rows:[],blockCount:0},S=v.rows.length<2?rr([...m.rows.values()].map(k=>({points:k})),m.unit.focal):null,E=1/0;if(S){if(m.hasSeats)for(let k of m.rows.values())for(let M of k){let T=S.depthAt(M.x,M.y);T<E&&(E=T)}if(!m.hasSeats||!Number.isFinite(E)){E=1/0;for(let k of m.section.outline){let M=S.depthAt(k.x,k.y);M<E&&(E=M)}}}let _=h+Us,O=Math.max(_,f.height),j=k=>{let M=Math.max(0,k-E)*Re,T=Math.min(M*y,Kn);return Math.max(_,f.height+T)},V=k=>{let M=Math.max(0,k)*Re,T=Math.min(M*y,Kn);return Math.max(_,f.height+T)},R=x?[]:v.rows.map(k=>({pts:k.pts,y:V(k.blockDepth),depth:k.blockDepth,blockId:k.blockId,...p.has(k.id)?{patch:lr(k.pts,Se)}:{}})),P=R.length?R[0].y:O,I=R.map(k=>{let M=k.patch&&k.patch.length>=3?k.patch:k.pts,T=0,D=0;for(let H of M)T+=H.x,D+=H.y;let B=M.length||1;T/=B,D/=B;let U=0;for(let H of M){let L=Math.hypot(H.x-T,H.y-D);L>U&&(U=L)}return{cx:T,cy:D,rad:U}}),w=x?()=>O:R.length>=2?(k,M)=>{let T=1/0,D=P;for(let B=0;B<R.length;B++){let U=I[B];if(Math.hypot(k-U.cx,M-U.cy)-U.rad>=T)continue;let H=R[B].patch,L=H&&H.length>=3?At(H,k,M)?0:ut(H,k,M):ut(R[B].pts,k,M);L<T&&(T=L,D=R[B].y)}return D}:(k,M)=>S?j(S.depthAt(k,M)):O,C=[0,1,0],G=R.length>=2||x?()=>C:(k,M)=>{if(!S)return C;let T=S.depthAt(k,M);if(T<=E)return C;let D=(T-E)*Re;if(D*y>=Kn||f.height+D*y<=_)return C;let[B,U]=S.gradientAt(k,M);if(B===0&&U===0)return C;let H=1/Math.hypot(y,1);return[-B*y*H,H,-U*y*H]};if(!x)for(let k of v.rows){let M=V(k.blockDepth);for(let T of k.seatIndices)a[T]=M}for(let k of v.rows){let M=[];for(let H=1;H<k.pts.length;H++){let L=Math.hypot(k.pts[H].x-k.pts[H-1].x,k.pts[H].y-k.pts[H-1].y);L>1e-6&&M.push(L)}M.sort((H,L)=>H-L);let T=M.length?M[Math.floor(M.length/2)]:1/0,D=1/0,B=k.pts[Math.floor(k.pts.length/2)];if(B)for(let H of v.rows){if(H===k||H.blockId!==k.blockId)continue;let L=ut(H.pts,B.x,B.y);L>1e-6&&L<D&&(D=L)}let U=Math.min(T,Math.max(D,T*.5));if(Number.isFinite(U)&&U>0)for(let H of k.seatIndices)s[H]=U}r.set(d,{sectionId:d,deckAt:w,normalAt:G,flat:x,bottomY:h,rowLevels:R,landingY:P})}for(let d=0;d<t.length;d++){let m=o[d],f=t[d];if(m){let y=a[d];i[d]=(y??r.get(m).deckAt(f.x,f.y))+Hs;continue}let h=f.eyeHeightM;i[d]=Number.isFinite(h)?Math.max(0,h-Wt):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var ce={top:1,wallBottom:.5,bottomCap:.4};function Ve(e,t){if(!e)return t;let n=ve(Mt(e,.4),.62);return he(t,n,.72)}function wr(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,p=0;for(let[u,d]of a){let m=ee(n.get(u));m&&(s+=m[0]*d,c+=m[1]*d,l+=m[2]*d,p+=d)}p>0&&o.set(i,[s/p,c/p,l/p])}return o}function Pr(e,t){return ee(e.color)??t.get(e.logicalSectionId??e.id)??null}var xd=Math.PI*2;function Cr(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Ar=it(require("polygon-clipping"),1);function js(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var on=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=mt(t),i=this.rings.filter((c,l)=>nn(o,this.boxes[l])&&js(n,this.levels[l])),a=[[r]];if(i.length)try{a=Ar.default.difference([r],...i).map(l=>l.map(p=>p.map(([u,d])=>[u,d])))}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(([p,u])=>({x:p,y:u}));if(l.length>1){let p=l[0],u=l[l.length-1];Math.abs(p.x-u.x)<1e-9&&Math.abs(p.y-u.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Xs(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let u of e)n=Math.min(n,u.x),r=Math.max(r,u.x),o=Math.min(o,u.y),i=Math.max(i,u.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,l=Math.cos(c),p=Math.sin(c);return e.map(u=>{let d=u.x-a,m=u.y-s;return{x:a+d*l-m*p,y:s+d*p+m*l}})}function tt(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=Rt(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=$t(n,r,e.width/2,e.height/2)}return t?Xs(t,e.rotation):null}function Tt(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=t==="stage"&&Cr(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Ys=.08;function Ir(e,t){let n=tt(e),r=Tt(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 p of n)i=Math.min(i,p.x),a=Math.min(a,p.y),s=Math.max(s,p.x),c=Math.max(c,p.y);let l=o;for(let p of t)s>p.minX&&i<p.maxX&&c>p.minY&&a<p.maxY&&l<=p.topOffsetM+1e-6&&(l=p.topOffsetM+Ys);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function je(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Er(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 kt(e,t,n){return[je(e[0],e[1],t),je(e[0],e[1],n),je(e[3],e[2],n),je(e[3],e[2],t)]}function Rr(e,t,n){return[je(e[0],e[3],t),je(e[1],e[2],t),je(e[1],e[2],n),je(e[0],e[3],n)]}function Be(e,t,n,r,o,i){le(e,t,void 0,()=>n,r,o,i,ce)}var qn=2.4,Ws=.75,Ks=.15;function Lt(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(([p,u])=>({x:t.x+p*a-u*s,y:t.y+p*s+u*a}))}function Tr(e,t,n,r,o){let i=Lt(t);i&&le(e,i,void 0,()=>n+qn,n,Ve(r,o.boothTop),o.boothWall,ce)}function Qn(e){if(e.shape==="round"){let p=e.radius;return p?$t(e.center.x,e.center.y,p,p,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(([p,u])=>({x:o.x+p*a-u*s,y:o.y+p*s+u*a}))}function kr(e,t,n,r,o){let i=Qn(t);i&&le(e,i,void 0,()=>n+Ws,n,Ve(r,o.tableTop),o.tableWall,ce)}function Lr(e,t,n,r,o,i,a,s){let c=tt(t);if(!c)return;let l=s?s.kind==="stage":t.role==="stage",p=s?s.kind==="screen":t.role==="screen",u=s?{kind:l?"stage":"solid",heightM:s.topY-s.baseY}:Tt(t),d=s?.baseY??n,m=s?.topY??n+r;if(l&&a){let g=1/0,x=-1/0,v=1/0,A=-1/0;for(let S of c)S.x<g&&(g=S.x),S.x>x&&(x=S.x),S.y<v&&(v=S.y),S.y>A&&(A=S.y);a.push({cx:(g+x)/2*N,cz:(v+A)/2*N,y:m,halfX:Math.max((x-g)/2*N,.5),halfZ:Math.max((A-v)/2*N,.5)})}let f=ee(t.fill),h=l&&f?he(o.stageTop,ve(Mt(f,.18),.9),.9):Ve(f,l?o.stageTop:o.decorTop),y=p?f:null,b=l?f?he(o.stageWall,ve(f,.58),.82):o.stageWall:p?y?he(ve(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Ve(ee(t.fill),o.decorWall);if(u.kind==="portal"&&c.length===4){let g=Er(c);Be(e,kt(g,0,.16),m,d,h,b),Be(e,kt(g,.84,1),m,d,h,b),Be(e,g,m,Math.max(d,m-.35),h,b);return}if(u.kind==="suite"&&c.length===4){let g=c.map((A,S)=>{let E=c[(S+1)%4],_=(A.x+E.x)/2,O=(A.y+E.y)/2;return Math.hypot(_-i.x,O-i.y)}),x=g.indexOf(Math.min(...g)),v=[0,1,2,3].map(A=>c[(x+A)%4]);Be(e,kt(v,0,.08),m,d,h,b),Be(e,kt(v,.92,1),m,d,h,b),Be(e,Rr(v,.88,1),m,d,h,b),Be(e,v,m,Math.max(d,m-.18),h,b);return}Be(e,c,m,d,h,b)}function Zn(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),p=r/2,u=o/2;return[[-p,-u],[p,-u],[p,u],[-p,u]].map(([d,m])=>({x:i+d*c-m*l,y:a+d*l+m*c}))}function qs(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 _r(e,t,n,r){if(t.layer==="foreground")return;let o=Zn(t);if(!o)return;let i=n+Ks,a=Ve(qs(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=he(r.ground,a,s)),le(e,o,void 0,()=>i,n,a,he(a,r.decorWall,.5),ce)}function Fr(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Ve(r,o.gaTop);le(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ce)}var Qs=Math.PI/180,te=96,Zs=6,$s=60,Js=150,Dr=.2,ec=.35;function tc(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Qs;return n<0?n+360:n}function rn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function an(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 Or(e,t){let n=e.filter(d=>d.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let d of n)for(let m of d.rows){for(let f of m.pts)o+=f.x,i+=f.y,a++;if(m.pts.length>=4){let f=Un(m.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&r.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let d=rn(r.map(b=>b.x)),m=rn(r.map(b=>b.y)),f=0;for(let b of n)for(let g of b.rows)for(let x of g.pts){let v=Math.hypot(x.x-s.x,x.y-s.y);v>f&&(f=v)}let h=0,y=f*.2;for(let b of n)for(let g of b.rows)for(let x of g.pts)Math.hypot(x.x-d,x.y-m)<y&&h++;Math.hypot(d-s.x,m-s.y)<=f&&h/a<.01&&(c={x:d,y:m})}let l=[];for(let d of n){let m={sectionId:d.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of d.rows)for(let h of f.pts){let y=Math.hypot(h.x-c.x,h.y-c.y),b=Math.min(te-1,Math.floor(tc(c,h)/(360/te)));m.samples.push({r:y,bin:b,levelM:f.levelM}),y<m.rMin&&(m.rMin=y),y>m.rMax&&(m.rMax=y)}m.samples.length&&l.push(m)}if(!l.length)return null;l.sort((d,m)=>d.rMin+d.rMax-(m.rMin+m.rMax));let p=[];for(let d of l){let m=!1;for(let f of p){let h=Math.min(d.rMax,f.rMax)-Math.max(d.rMin,f.rMin),y=Math.min(d.rMax-d.rMin,f.rMax-f.rMin);if(y>1e-9&&h>=ec*y){f.members.push(d),f.rMin=Math.min(f.rMin,d.rMin),f.rMax=Math.max(f.rMax,d.rMax),m=!0;break}}m||p.push({members:[d],rMin:d.rMin,rMax:d.rMax})}let u=[];for(let d of p){let m=new Array(te).fill(null);for(let P of d.members)for(let I of P.samples){let w=m[I.bin];w||(w={samples:[]},m[I.bin]=w),w.samples.push({r:I.r,levelM:I.levelM})}let f=m.map(P=>!!P);if(!f.filter(Boolean).length)continue;let y=[],b=[];for(let P of m){if(!P)continue;let I=1/0,w=-1/0;for(let C of P.samples)C.r<I&&(I=C.r),C.r>w&&(w=C.r);y.push(I),b.push(w)}let g=rn(y),x=rn(b);if(!(g>=Dr*x)||!(x>0))continue;let v=[...y].sort((P,I)=>P-I);if(!(v[Math.floor(v.length*.1)]>=Dr*x))continue;let S=m.map(P=>{if(!P)return null;let I=[...P.samples].sort((B,U)=>B.r-U.r),w=I[0].r,C=I[I.length-1].r,G=I[0].levelM,k=-1/0;for(let B of I)B.levelM>k&&(k=B.levelM);let M=[];for(let B of I){let U={r:B.r,l:B.levelM};for(;M.length&&Math.abs(M[M.length-1].r-U.r)<1e-9;){if(M[M.length-1].l<=U.l){U.skip=!0;break}M.pop()}if(!U.skip){for(;M.length>=2;){let H=M[M.length-2],L=M[M.length-1];if((L.r-H.r)*(U.l-H.l)-(L.l-H.l)*(U.r-H.r)<=0)M.pop();else break}M.push(U)}}let T=M.map(B=>B.r),D=M.map(B=>B.l);return{inner:w,outer:C,front:G,top:k,profile:{rs:T,ls:D}}}),E=f.slice();for(let P=0;P<te;P++){if(E[P])continue;let I=-1,w=-1,C=0;for(let F=1;F<=te;F++){let X=(P-F+te*2)%te;if(E[X]){I=X;break}}for(let F=1;F<=te;F++){let X=(P+F)%te;if(E[X]){w=X,C=F;break}}if(I<0||w<0)continue;let G=0;for(let F=1;F<=te;F++){let X=(P-F+te*2)%te;if(f[X]){G=F;break}}if(G-1+C>Zs)continue;let M=S[I],T=S[w],D=G/(G+C),B=M.inner+(T.inner-M.inner)*D,U=M.outer+(T.outer-M.outer)*D,H=M.front+(T.front-M.front)*D,L=M.top+(T.top-M.top)*D;S[P]={inner:B,outer:U,front:H,top:L,profile:{rs:[B,U],ls:[H,L]}}}for(let P=0;P<te;P++)S[P]&&(E[P]=!0);let _=360/te,O=[],j=E.filter(Boolean).length,V=[];if(j===te)V.push({start:0,len:te});else{let P=0;for(;E[P];)P=(P+1)%te;let I=-1;for(let w=0;w<=te;w++){let C=(P+w)%te,G=w<te&&E[C];if(G&&I<0)I=C;else if(!G&&I>=0){let k=(C-I+te)%te||te;V.push({start:I,len:k}),I=-1}}}for(let P of V){if(P.len*_<$s&&P.len<te)continue;let I=P.len===te,w=new Float64Array(P.len),C=new Float64Array(P.len),G=new Float64Array(P.len),k=new Float64Array(P.len),M=[];for(let F=0;F<P.len;F++){let X=S[(P.start+F)%te];w[F]=X.inner,C[F]=X.outer,G[F]=X.front,k[F]=X.top,M.push(X.profile??{rs:[X.inner,X.outer],ls:[X.front,X.top]})}let T=an(w,I),D=an(C,I),B=an(G,I),U=an(k,I);for(let F=0;F<P.len;F++)T[F]>w[F]&&(T[F]=w[F]),D[F]<C[F]&&(D[F]=C[F]),T[F]>D[F]-1e-6&&(T[F]=Math.max(0,D[F]-1e-6)),U[F]<B[F]&&(U[F]=B[F]);let H={startBin:P.start,binCount:P.len,closed:I,innerR:T,outerR:D,frontLevelM:B,topLevelM:U,profiles:M},L=(F,X,W)=>{let q=M[F],Q=q.rs,$=q.ls;if(X<=Q[0]){$[0]>W&&($[0]=W);return}if(X>=Q[Q.length-1]){$[$.length-1]>W&&($[$.length-1]=W);return}for(let re=0;re+1<Q.length;re++)if(X<=Q[re+1]){$[re]>W&&($[re]=W),$[re+1]>W&&($[re+1]=W);return}};for(let F=0;F<P.len;F++){let X=m[(P.start+F)%te];if(X)for(let W of X.samples){L(F,W.r,W.levelM);let q=I?(F-1+P.len)%P.len:F-1,Q=I?(F+1)%P.len:F+1;q>=0&&L(q,W.r,W.levelM),Q<P.len&&L(Q,W.r,W.levelM)}}O.push(H)}O.reduce((P,I)=>P+I.binCount*_,0)<Js||u.push({arcs:O,sectionIds:d.members.map(P=>P.sectionId),innerRMedian:g,outerRMedian:x})}if(!u.length)return null;if(u.sort((d,m)=>d.innerRMedian-m.innerRMedian),t){let d=u[u.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*d)return null}return{centre:c,binCount:te,binStepDeg:360/te,rings:u}}function Vr(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,l=p=>{let u=t.profiles[p],d=u.rs,m=u.ls;if(r<=d[0])return m[0];if(r>=d[d.length-1])return m[m.length-1];for(let f=0;f+1<d.length;f++)if(r<=d[f+1]){let h=d[f+1]-d[f],y=h>1e-9?(r-d[f])/h:0;return m[f]+(m[f+1]-m[f])*y}return m[m.length-1]};return l(a)*(1-c)+l(s)*c}var nc=.25,oc=1.2,rc=.6,ic=.45,ac=2.3,sc=Math.PI/180;function nt(e,t,n){let r=n*sc;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function cc(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 lc=24;function uc(e,t,n,r,o,i,a,s){let c=n.binCount,l=lc,p=Re,u=i+.02,d=[];for(let R=0;R<c;R++){let P=(n.startBin+R+.5)*t.binStepDeg,I=new Float64Array(l+1);for(let w=0;w<=l;w++){let C=r[R]+(o[R]-r[R])*w/l;I[w]=Math.max(u,Vr(t,n,P,C)-nc)}d.push(I)}let m=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],f=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],h=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],y=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],b=(R,P)=>{let I=(n.startBin+R+.5)*t.binStepDeg,w=r[R]+(o[R]-r[R])*P/l,C=nt(t.centre,w,I);return[C.x*p,d[R][P],C.y*p]};{let R=Math.tan(12*Math.PI/180);for(let P=0;P<6;P++){let I=!1;for(let C=0;C<c;C++)for(let G=l-1;G>=0;G--)d[C][G]>d[C][G+1]&&(d[C][G]=d[C][G+1],I=!0);let w=n.closed?c:c-1;for(let C=0;C<w;C++){let G=(C+1)%c;for(let k=0;k<=l;k++){let M=d[G][k]-d[C][k];if(Math.abs(M)>1)continue;let T=r[C]+(o[C]-r[C])*k/l,D=r[G]+(o[G]-r[G])*k/l,B=nt(t.centre,T,(n.startBin+C+.5)*t.binStepDeg),U=nt(t.centre,D,(n.startBin+G+.5)*t.binStepDeg),H=R*Math.hypot(U.x-B.x,U.y-B.y)*p;M>H?(d[G][k]=d[C][k]+H,I=!0):-M>H&&(d[C][k]=d[G][k]+H,I=!0)}}if(!I)break}}let g=1,x=(R,P)=>{for(let I=0;I<=l;I+=4)if(Math.abs(d[R][I]-d[P][I])>g)return!0;return Math.abs(d[R][l]-d[P][l])>g},v=Math.tan(38*Math.PI/180),A=R=>(o[R]-r[R])/l*p,S=(R,P)=>d[R][P+1]-d[R][P]>v*Math.max(1e-6,A(R)),E=(R,P)=>{let I=n.closed?(R-1+c)%c:Math.max(0,R-1),w=n.closed?(R+1)%c:Math.min(c-1,R+1);Math.abs(d[I][P]-d[R][P])>g&&(I=R),Math.abs(d[w][P]-d[R][P])>g&&(w=R);let C=Math.max(0,P-1),G=Math.min(l,P+1);C<P&&S(R,C)&&(C=P),G>P&&S(R,P)&&(G=P);let k=b(I,P),M=b(w,P),T=b(R,C),D=b(R,G),B=M[0]-k[0],U=M[1]-k[1],H=M[2]-k[2],L=D[0]-T[0],F=D[1]-T[1],X=D[2]-T[2],W=U*X-H*F,q=H*L-B*X,Q=B*F-U*L,$=Math.hypot(W,q,Q);return $>1e-12?(W/=$,q/=$,Q/=$,q<0&&(W=-W,q=-q,Q=-Q),[W,q,Q]):[0,1,0]},_=(R,P)=>{let I=[R[0],i,R[2]],w=[P[0],i,P[2]],C=P[0]-R[0],G=P[2]-R[2],k=Math.hypot(C,G);if(!(k>1e-12))return;let M=[G/k,0,-C/k];e.tri(R,P,w,M,h,h,y),e.tri(R,w,I,M,h,y,y)},O=.05*He,j=R=>o[R]-r[R]<O,V=n.closed?c:c-1;for(let R=0;R<V;R++){let P=(R+1)%c;if(j(R)||j(P))continue;if(x(R,P)){let M=(n.startBin+R+1)*t.binStepDeg,T=(F,X)=>{let W=(r[R]+r[P])/2,q=(o[R]+o[P])/2,Q=W+(q-W)*X/l,$=nt(t.centre,Q,M);return[$.x*p,d[F][X],$.y*p]};for(let F=0;F<l;F++){let X=b(R,F),W=b(R,F+1),q=T(R,F),Q=T(R,F+1),$=E(R,F),re=E(R,F+1);e.triN(X,q,Q,$,$,re,m),e.triN(X,Q,W,$,re,re,m);let Ae=b(P,F),Me=b(P,F+1),we=T(P,F),_e=T(P,F+1),Fe=E(P,F),Ne=E(P,F+1);e.triN(we,Ae,Me,Fe,Fe,Ne,m),e.triN(we,Me,_e,Fe,Ne,Ne,m);let xe=T(R,F),de=T(R,F+1),Ge=T(P,F+1),yt=T(P,F),Pe=de[0]-xe[0],qe=de[2]-xe[2],De=Math.hypot(Pe,qe);if(De>1e-12){let Vt=[qe/De,0,-Pe/De];e.tri(xe,de,Ge,Vt,h),e.tri(xe,Ge,yt,Vt,h)}}let D=b(R,0),B=b(P,0),U=b(P,l),H=b(R,l),L=F=>[F[0],i,F[2]];e.tri(L(D),L(U),L(B),[0,-1,0],f),e.tri(L(D),L(H),L(U),[0,-1,0],f),_(D,B),_(H,U);continue}for(let M=0;M<l;M++){let T=E(R,M),D=E(P,M),B=E(P,M+1),U=E(R,M+1);if(S(R,M)||S(P,M)){let W=(de,Ge)=>{let yt=(n.startBin+de+.5)*t.binStepDeg,Pe=r[de]+(o[de]-r[de])*(M+.5)/l,qe=nt(t.centre,Pe,yt);return[qe.x*p,Ge,qe.y*p]},q=b(R,M),Q=b(P,M),$=W(R,d[R][M]),re=W(P,d[P][M]);e.triN(q,Q,re,T,D,D,m),e.triN(q,re,$,T,D,T,m);let Ae=b(P,M+1),Me=b(R,M+1),we=W(R,d[R][M+1]),_e=W(P,d[P][M+1]);e.triN(we,_e,Ae,U,B,B,m),e.triN(we,Ae,Me,U,B,U,m);let Fe=re[0]-$[0],Ne=re[2]-$[2],xe=Math.hypot(Fe,Ne);if(xe>1e-12){let de=[-Ne/xe,0,Fe/xe];e.tri($,re,_e,de,h),e.tri($,_e,we,de,h)}continue}let H=b(R,M),L=b(P,M),F=b(P,M+1),X=b(R,M+1);e.triN(H,L,F,T,D,B,m),e.triN(H,F,X,T,B,U,m)}let I=b(R,0),w=b(P,0),C=b(P,l),G=b(R,l),k=M=>[M[0],i,M[2]];e.tri(k(I),k(C),k(w),[0,-1,0],f),e.tri(k(I),k(G),k(C),[0,-1,0],f),_(I,w),_(G,C)}if(!n.closed)for(let R of[0,c-1])for(let P=0;P<l;P++)_(b(R,P),b(R,P+1))}function Br(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let p of t.rings)for(let u of p.arcs){let d=new Float64Array(u.binCount),m=new Float64Array(u.binCount);for(let h=0;h<u.binCount;h++){let y=(u.startBin+h)%t.binCount,b=Math.max(0,u.innerR[h]-Se);d[h]=Math.max(b,a[y]+.001),m[h]=Math.max(d[h]+.001,u.outerR[h]+Se)}let f=0;for(let h=0;h<u.binCount;h++){let y=u.topLevelM[h]-r;y>f&&(f=y)}f>=oc&&uc(e,t,u,d,m,r,o,i);for(let h=0;h<u.binCount;h++){let y=(u.startBin+h)%t.binCount;m[h]>a[y]&&(a[y]=m[h])}}if(n.deriveShell===!1||cc(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=rc*He,l=ic*He;for(let p of s.arcs){let u=[],d=[];for(let h=0;h<p.binCount;h++){let y=(p.startBin+h+.5)*t.binStepDeg,b=p.outerR[h]+Se+c;u.push(nt(t.centre,b,y)),d.push(nt(t.centre,b+l,y))}let m=-1/0;for(let h=0;h<p.binCount;h++)p.topLevelM[h]>m&&(m=p.topLevelM[h]);let f=()=>m+ac;p.closed?le(e,d,[u.slice().reverse()],f,r,o.shellTop,o.shellWall,i):le(e,[...d,...u.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function Nr(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=Ve(r,s.tierTop);if(!o)return;let p=y=>o.deckAt(y.x,y.y),u=xr(t,a),d=u[0]??t.outline;if(o.rowLevels.length>=2){let y=tn(o.rowLevels),b=vr(fr(o.rowLevels,n.focal,y),u),g=()=>[0,1,0];for(let v of b){let A=Math.max(c,v.topY-.02);for(let S of i.subtract(v.outline,A))le(e,S,v.holes,()=>A,c,l,s.tierWall,ce,void 0,g)}b.length||le(e,d,t.holes,()=>o.landingY,c,l,s.tierWall,ce);let x={tread:[l[0]*ce.top,l[1]*ce.top,l[2]*ce.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let v of u.length?u:[d])hr(e,o.rowLevels,n.focal,o.landingY,x,v,y);return}let m=o.flat?1/0:Sr,f=y=>o.normalAt(y.x,y.y),h=o.flat?o.landingY:void 0;for(let y of i.subtract(d,h))le(e,y,t.holes,p,c,l,s.tierWall,ce,m,f)}function dc(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],p=o.get(s);p||(p=new Map,o.set(s,p));let u=l.rowId||`__seat-${a}`,d=p.get(u);d||(d={pts:[],levelM:0,n:0},p.set(u,d)),d.pts.push({x:l.x,y:l.y}),d.levelM+=n.seatDeckY(a),d.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(p=>!p.patch).map(p=>({pts:p.pts,levelM:p.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 Gr(e,t,n,r,o,i,a=!0){let s=dc(t,n,r);if(!s.length)return;let c=Or(s,t.focal);c&&(e.setMaterial(0),Br(e,c,{bottomY:t.baseHeightM,colors:{bandTop:ve(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??ve(o.tierWall,1.15),shellWall:i??o.tierWall},ao:ce,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:a}))}function zr(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 mc=1.15,fc=3.25,pc=4.5,hc=.85,bc=.5,yc=.26;function Hr(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>=mc&&a.add("zone"),o<=(i?fc:pc)&&(a.add("section"),a.add("ga")),o<=hc&&(a.add("annotation"),a.add("booth")),o<=bc&&a.add("row"),o<=yc&&a.add("seat"),a}function Xe(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],p=o[2]*i+o[6]*a+o[10]*s+o[14],u=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(u>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let d=c/u,m=l/u,f=p/u,h=d>=-1.05&&d<=1.05&&m>=-1.05&&m<=1.05&&f<=1;return{x:(d*.5+.5)*n,y:(1-(m*.5+.5))*r,depth:f,visible:h}}function jr(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if($n(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var gc=6;function $n(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+gc):n;return o<a&&i<r}function Xr(e,t,n){return e.length*t*.58+(n?14:0)}var Jn={row:8,seat:14};function Yr(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 eo(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let l of o)if($n(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if($n(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var xc=6,vc=2.2,Wr=.1,Sc=.3,Mc=1.8,wc=.9,Pc=.55,Cc=6e3;function Kr(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let p of n)for(let u of p.objects)u.type==="section"&&u.zone&&c.set(u.id,u.zone);let l=new Map;for(let p=0;p<r.length;p++){let u=r[p],d=o.seatOwner[p],m=u.zoneId??(d?c.get(d):void 0);if(!m)continue;let f=l.get(m);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(m,f)),f.n++,u.x<f.minX&&(f.minX=u.x),u.y<f.minY&&(f.minY=u.y),u.x>f.maxX&&(f.maxX=u.x),u.y>f.maxY&&(f.maxY=u.y),f.sumY+=o.seatDeckY(p)}for(let p of a){let u=l.get(p.id),d=[];for(let[m,f]of c)f===p.id&&d.push(m);if(!u||u.n===0){s.push({id:p.id,label:p.label,color:ee(p.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(p.focalPoint??i).x*N,1.5,(p.focalPoint??i).y*N]});continue}s.push({id:p.id,label:p.label,color:ee(p.color),sectionIds:d,seatCount:u.n,center:[(u.minX+u.maxX)/2*N,u.sumY/u.n,(u.minY+u.maxY)/2*N],radius:.5*Math.hypot((u.maxX-u.minX)*N,(u.maxY-u.minY)*N)||1,focalWorld:[(p.focalPoint??i).x*N,1.5,(p.focalPoint??i).y*N]})}}return s}function qr(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],p=[],u=[];for(let d of s)d.seatCount!==0&&l.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[d.center[0],d.center[1]+xc,d.center[2]],color:t.zones?.find(m=>m.id===d.id)?.color});{let d=new Map,m=new Map;for(let f=0;f<r.length;f++){let h=o.seatOwner[f];if(!h)continue;let y=d.get(h);y||(y={n:0,x:0,y:0,deck:0},d.set(h,y)),y.n++,y.x+=r[f].x,y.y+=r[f].y,y.deck+=o.seatDeckY(f);let b=m.get(h);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},m.set(h,b)),r[f].x<b.minX&&(b.minX=r[f].x),r[f].x>b.maxX&&(b.maxX=r[f].x),r[f].y<b.minY&&(b.minY=r[f].y),r[f].y>b.maxY&&(b.maxY=r[f].y)}for(let f of n)for(let h of f.objects){if(h.type!=="section")continue;let y=d.get(h.id);if(!y||y.n===0)continue;let b=m.get(h.id),g=[y.x/y.n*N,y.deck/y.n,y.y/y.n*N],x=h.displayLabel||h.label||h.id;p.push({id:h.id,floorIndex:f.index,label:x,seatCount:y.n,center:g,radius:Math.max(1,Math.hypot(b.maxX-b.minX,b.maxY-b.minY)*.5*N),focalWorld:[f.focal.x*N,f.baseHeightM+1.5,f.focal.y*N]});let v=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&v===x.trim().toLocaleLowerCase()||l.push({id:`section:${h.id}`,kind:"section",text:x,anchor:[g[0],g[1]+vc,g[2]],floorIndex:f.index})}}{for(let f of n)for(let h of f.objects){if(h.type!=="gaArea")continue;let y=Ct(h.points);if(!y)continue;let b=h.displayLabel||h.label||h.id;l.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${b} \xB7 ${h.capacity.toLocaleString()}`:b,anchor:[y.x*N,f.baseHeightM+Mc,y.y*N],floorIndex:f.index})}let d=new Map;for(let f=0;f<r.length;f++){let h=r[f],y=Math.hypot(h.x-c.x,h.y-c.y),b=d.get(h.rowId);(!b||y>b.far)&&d.set(h.rowId,{seat:h,index:f,far:y})}for(let[f,h]of d){let y=h.seat.label?h.seat.label.lastIndexOf("-"):-1,b=y>0?h.seat.label.slice(0,y):f;b&&l.push({id:`row:${f}`,kind:"row",text:b,anchor:[h.seat.x*N,o.seatDeckY(h.index)+wc,h.seat.y*N],floorIndex:a[h.index]})}let m=new Map;for(let f=0;f<r.length;f++){let h=r[f],y=h.label?h.label.lastIndexOf("-"):-1,b=m.get(h.rowId);b||(b={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?h.label.slice(0,y):h.rowId,sectionId:h.sectionId},m.set(h.rowId,b));let g=f*3,x=i.iPosition[g],v=i.iPosition[g+1],A=i.iPosition[g+2];b.n++,b.x+=x,b.y+=v,b.z+=A,b.minX=Math.min(b.minX,x),b.maxX=Math.max(b.maxX,x),b.minZ=Math.min(b.minZ,A),b.maxZ=Math.max(b.maxZ,A)}for(let[f,h]of m)u.push({id:f,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=Cc)for(let f=0;f<r.length;f++){let h=r[f],y=h.displayLabel||h.label;y&&l.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*N,o.seatDeckY(f)+Pc,h.y*N],floorIndex:a[f]})}}for(let d of n)for(let m of d.objects)if(m.type==="shape"&&m.role&&["entrance","exit","screen","suite","obstruction"].includes(m.role)){let f=tt(m),h=f?Ct(f):null;if(!h||!m.label)continue;l.push({id:`architecture:${m.id}`,kind:"annotation",text:m.label,anchor:[h.x*N,d.baseHeightM+Tt(m).heightM+Wr,h.y*N],color:m.fill,floorIndex:d.index})}else if(m.type==="text"){if(!m.text)continue;l.push({id:`text:${m.id}`,kind:"annotation",text:m.text,anchor:[m.position.x*N,d.baseHeightM+Wr,m.position.y*N],color:m.color,rotation:m.rotation,floorIndex:d.index})}else if(m.type==="booth"){let f=Lt(m);if(!f)continue;let h=Ct(f);if(!h)continue;l.push({id:`booth:${m.id}`,kind:"booth",text:m.displayLabel||m.label||m.id,anchor:[h.x*N,d.baseHeightM+qn+Sc,h.y*N],floorIndex:d.index})}return{labels:l,sections:p,rows:u}}function Qr(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 Zr(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 d=0;d<i.floor.length;d+=1){let m=Math.max(0,Math.min(n.length-1,Math.round(i.floor[d]))),f=d*3,h=l[m];h.minX=Math.min(h.minX,i.position[f]),h.minY=Math.min(h.minY,i.position[f+1]),h.minZ=Math.min(h.minZ,i.position[f+2]),h.maxX=Math.max(h.maxX,i.position[f]),h.maxY=Math.max(h.maxY,i.position[f+1]),h.maxZ=Math.max(h.maxZ,i.position[f+2])}let p=new Map;for(let d=0;d<n.length;d++)for(let m of n[d].objects)m.type==="section"&&p.set(m.id,d);let u=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 d=0;d<r.length;d++){let m=o.seatOwner[d],f=(m!==null?p.get(m):void 0)??a[d];if(f===void 0)continue;let h=u[f],y=r[d];h.n++,y.x<h.minX&&(h.minX=y.x),y.y<h.minY&&(h.minY=y.y),y.x>h.maxX&&(h.maxX=y.x),y.y>h.maxY&&(h.maxY=y.y);let b=o.seatDeckY(d);h.sumX+=y.x*N,h.sumDeck+=b,h.sumZ+=y.y*N,h.minDeck=Math.min(h.minDeck,b),h.maxDeck=Math.max(h.maxDeck,b+1.6),s[d]=f}for(let d=0;d<n.length;d++){let m=u[d],f=t.floors?.[d],h=l[d],y=Math.min(m.n?m.minX*N:n[d].focal.x*N-1,Number.isFinite(h.minX)?h.minX:1/0),b=Math.max(m.n?m.maxX*N:n[d].focal.x*N+1,Number.isFinite(h.maxX)?h.maxX:-1/0),g=Math.min(m.n?m.minY*N:n[d].focal.y*N-1,Number.isFinite(h.minZ)?h.minZ:1/0),x=Math.max(m.n?m.maxY*N:n[d].focal.y*N+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),v=Math.min(m.n?Math.min(n[d].baseHeightM,m.minDeck):n[d].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),A=Math.max(m.n?Math.max(m.maxDeck,v+.5):v+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[m.n?m.sumX/m.n:(y+b)/2,m.n?m.sumDeck/m.n:(v+A)/2,m.n?m.sumZ/m.n:(g+x)/2],E=Math.max(1,.5*Math.hypot(b-y,A-v,x-g));c.push({index:d,id:f?.id??`floor-${d}`,label:f?.name??(n.length>1?`Floor ${d+1}`:"Venue"),seatCount:m.n,center:S,radius:E,box:{min:[y,v,g],max:[b,A,x]},focalWorld:[n[d].focal.x*N,n[d].baseHeightM+1.5,n[d].focal.y*N]})}}return c}function to(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=Lt(c);if(l)for(let p of l)a(p.x,p.y)}else if(c.type==="table"){let l=Qn(c);if(l)for(let p of l)a(p.x,p.y)}else if(c.type==="decorImage"){let l=Zn(c);if(l)for(let p of l)a(p.x,p.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function $r(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Rt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);le(e,s,void 0,()=>0,-.4,i.ground,i.ground,ce)}else{let a=t.reduce((m,f)=>f.baseHeightM<m.baseHeightM?f:m);e.setFloor(a.index);let s=n.filter((m,f)=>r[f]===a.index),c=to([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),p=Math.max(28,Math.min(80,l*.04)),u=Rt(c.minX-p,c.minY-p,c.maxX-c.minX+p*2,c.maxY-c.minY+p*2),d=a.baseHeightM-.03;le(e,u,void 0,()=>d,d-.22,i.ground,i.ground,ce)}}function Jr(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,p=-1/0,u=-1/0,d=(h,y,b)=>{a=Math.min(a,h),l=Math.max(l,h),s=Math.min(s,y),p=Math.max(p,y),c=Math.min(c,b),u=Math.max(u,b)};for(let h=0;h<e.position.length;h+=3)d(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let y=h*3,b=t.iPosition[y],g=t.iPosition[y+1],x=t.iPosition[y+2],v=Math.max(.35,t.iMaxRadius[h]??.35);d(b-v,g,x-v),d(b+v,g+1.6,x+v)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,p=i*.16,c=o-i,u=o+i);let m=[(a+l)/2,(s+p)/2,(c+u)/2],f=Math.max(1,.5*Math.hypot(l-a,p-s,u-c));return{center:m,radius:f,minY:s,maxY:p}}function ei(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let v=0;v<e.count;v++){let A=v*3,S=e.iPosition[A],E=e.iPosition[A+2];S<a&&(a=S),S>c&&(c=S),E<s&&(s=E),E>l&&(l=E)}for(let v of t)a=Math.min(a,v.cx-v.halfX),c=Math.max(c,v.cx+v.halfX),s=Math.min(s,v.cz-v.halfZ),l=Math.max(l,v.cz+v.halfZ);let p=n.minX*N,u=n.maxX*N,d=n.minY*N,m=n.maxY*N,f=p,h=u,y=d,b=m;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,l-s));f=Math.max(p,a-v),h=Math.min(u,c+v),y=Math.max(d,s-v),b=Math.min(m,l+v)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[f,g,y],max:[h,x,b]}}var Ac=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Ic=/[\s"'<>`\\]/;function Ec(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Ac.test(e);if(Ic.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function ti(e){let t=e.trim();return Ec(t)?t:null}var no="seatlayer.event-configuration/1";var ft=100,Rc=120,Tc=1e5,kc=1e4,Lc=/^[a-f0-9]{64}$/,_c=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function _t(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ot(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Fc(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function ni(e){return!Array.isArray(e)||e.length>Tc||!e.every(t=>ot(t,ft))?null:[...new Set(e)].sort()}function Dc(e){return!_t(e)||!ot(e.chartId,ft)||!ot(e.version,ft)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Lc.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function oo(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Oc(e){return _t(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&oo(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Vc(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>kc)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!_t(s)||!ot(s.id,ft)||!ot(s.objectId,ft)||!n.has(s.objectId)||!_c.has(String(s.kind))||!oo(s.heightM,.05,50)||s.baseElevationM!==void 0&&!oo(s.baseElevationM,-10,100))return null;let c=Oc(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let l=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?ti(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!l||s.kind!=="screen"||++i>1))return null;r.add(s.id),o.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function Bc(e){let t=[];if(!_t(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==no&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${no}`}),ot(e.id,ft)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),ot(e.label,Rc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Fc(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Dc(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=_t(e.overlay)?e.overlay:null,o=ni(r?.objectIds),i=ni(r?.productionKillSeatIds),a=o?Vc(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||a===null?{issues:t}:{issues:t,value:{schema:no,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function oi(e){let t=Bc(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function ri(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=oi(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let u of n)for(let d of u.objects)d.type==="shape"&&i.set(d.id,{shape:d,unit:u});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(u=>{let d=u.runtimeContentImageUrl;return[u.id,typeof d=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(d)?d:void 0]})),l=[];for(let u of o.value.overlay.productionElements??[]){let d=i.get(u.objectId),m=d?tt(d.shape):null,f=u.baseElevationM??0;if(!d||!m||m.length<3||!u.id||a.has(u.id)||s.has(u.objectId)||!Number.isFinite(u.heightM)||u.heightM<.05||u.heightM>50||!Number.isFinite(f)||f<-10||f>100)return r();a.add(u.id),s.add(u.objectId);let h=m.map(_=>_.x*N),y=m.map(_=>_.y*N),b=d.unit.baseHeightM+f,g=Math.min(...h),x=Math.max(...h),v=Math.min(...y),A=Math.max(...y),S,E=c.get(u.id)??u.contentImageUrl;if(u.kind==="screen"&&E)if(x-g>=A-v){let _=Math.abs(v-d.unit.focal.y*N)<=Math.abs(A-d.unit.focal.y*N)?v-.006:A+.006;S=[[g,b,_],[x,b,_],[g,b+u.heightM,_],[x,b+u.heightM,_]]}else{let _=Math.abs(g-d.unit.focal.x*N)<=Math.abs(x-d.unit.focal.x*N)?g-.006:x+.006;S=[[_,b,v],[_,b,A],[_,b+u.heightM,v],[_,b+u.heightM,A]]}l.push({id:u.id,objectId:u.objectId,kind:u.kind,floorIndex:d.unit.index,baseY:b,topY:b+u.heightM,bounds:{min:[g,b,v],max:[x,b+u.heightM,A]},occlusion:u.occlusion,...E?{contentImageUrl:E}:{},...S?{contentPlane:S}:{}})}let p=l.sort((u,d)=>u.id.localeCompare(d.id));return{byObjectId:new Map(p.map(u=>[u.objectId,u])),elements:p}}function ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function be(e){return Array.isArray(e)?e:[]}function Nc(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ye(n))continue;let r=ye(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function sn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Gc(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function zc(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function Uc(e){let t=sn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:sn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:sn(e.rotation,4),o=e.scale===void 0?[1,1,1]:sn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,l=Math.hypot(i,a,s,c);if(!(l>1e-8))return null;let p=i/l,u=a/l,d=s/l,m=c/l,f=p+p,h=u+u,y=d+d,b=p*f,g=p*h,x=p*y,v=u*h,A=u*y,S=d*y,E=m*f,_=m*h,O=m*y;return[(1-(v+S))*o[0],(g+O)*o[0],(x-_)*o[0],0,(g-O)*o[1],(1-(b+S))*o[1],(A+E)*o[1],0,(x+_)*o[2],(A-E)*o[2],(1-(b+v))*o[2],0,n[0],n[1],n[2],1]}function Hc(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function jc(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],l=e[10],p=i*l-a*c,u=a*s-o*l,d=o*c-i*s,m=t*p+n*u+r*d;if(Math.abs(m)<1e-12)return null;let f=1/m;return[p*f,u*f,d*f,(r*c-n*l)*f,(t*l-r*s)*f,(n*s-t*c)*f,(n*a-r*i)*f,(r*o-t*a)*f,(t*i-n*o)*f]}function ii(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,a=e[6]*t+e[7]*n+e[8]*r,s=Math.hypot(o,i,a)||1;return o/=s,i/=s,a/=s,[o,i,a]}function Xc(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!r)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!ye(c))return null;r=c}catch{return null}else if(a===5130562&&!o)o=s;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function Yc(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Wc(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Kc(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function qc(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Xc(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ye(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=be(r.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||Nc(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||be(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(be(r.images).length||be(r.textures).length)return{ok:!1,issue:"external_resource"};let a=be(r.buffers);if(a.length!==1||!ye(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=be(r.accessors),c=be(r.bufferViews),l=be(r.meshes),p=be(r.nodes),u=be(r.scenes),d=typeof r.scene=="number"?r.scene:0;if(!ye(u[d]))return{ok:!1,issue:"unsupported_glb"};let m=new DataView(o.buffer,o.byteOffset,o.byteLength),f=(v,A,S)=>{if(typeof v!="number"||!Number.isInteger(v)||!ye(s[v]))return null;let E=s[v];if(E.type!==A||E.sparse!==void 0||E.normalized===!0||typeof E.count!="number"||!Number.isInteger(E.count)||E.count<1||typeof E.componentType!="number"||!S.includes(E.componentType)||typeof E.bufferView!="number")return null;let _=c[E.bufferView];if(!ye(_)||_.buffer!==0||typeof _.byteLength!="number"||!Number.isInteger(_.byteLength)||_.byteLength<0)return null;let O=Wc(E.type),j=Yc(E.componentType),V=typeof _.byteStride=="number"?_.byteStride:O*j,R=typeof _.byteOffset=="number"?_.byteOffset:0,P=typeof E.byteOffset=="number"?E.byteOffset:0,I=R+P,w=P+(E.count-1)*V+O*j;if(!Number.isInteger(V)||!Number.isInteger(R)||!Number.isInteger(P)||V<O*j||R<0||P<0||R+_.byteLength>o.byteLength||w>_.byteLength)return null;let C=[];for(let G=0;G<E.count;G++){let k=[];for(let M=0;M<O;M++){let T=Kc(m,I+G*V+M*j,E.componentType);if(!Number.isFinite(T))return null;k.push(T)}C.push(k)}return C},h=[],y=[],b=0,g=new Set,x=(v,A)=>{if(typeof v!="number"||!Number.isInteger(v)||!ye(p[v])||g.has(v))return!1;g.add(v);let S=p[v],E=Uc(S);if(!E)return!1;let _=zc(A,E),O=jc(_);if(!O)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let j=l[S.mesh];if(!ye(j))return!1;for(let V of be(j.primitives)){if(!ye(V)||V.mode!==void 0&&V.mode!==4||!ye(V.attributes))return!1;let R=f(V.attributes.POSITION,"VEC3",[5126]),P=V.attributes.NORMAL===void 0?null:f(V.attributes.NORMAL,"VEC3",[5126]);if(!R||V.attributes.NORMAL!==void 0&&!P)return!1;let I=R.length;if(V.indices!==void 0){let C=typeof V.indices=="number"?s[V.indices]:null;I=ye(C)?C.count:void 0}if(typeof I!="number"||!Number.isInteger(I)||I%3!==0||(b+=I/3,b>1e5))return!1;let w=V.indices===void 0?R.map((C,G)=>[G]):f(V.indices,"SCALAR",[5121,5123,5125]);if(!w||w.length%3!==0||w.length!==I)return!1;for(let C=0;C<w.length;C+=3){let G=[w[C][0],w[C+1][0],w[C+2][0]];if(G.some(T=>!Number.isInteger(T)||T<0||T>=R.length))return!1;let k=G.map(T=>Hc(_,...R[T])),M=null;if(!P){let T=k[1][0]-k[0][0],D=k[1][1]-k[0][1],B=k[1][2]-k[0][2],U=k[2][0]-k[0][0],H=k[2][1]-k[0][1],L=k[2][2]-k[0][2];M=ii([1,0,0,0,1,0,0,0,1],D*L-B*H,B*U-T*L,T*H-D*U)}for(let T=0;T<3;T++)h.push(...k[T]),y.push(...P?ii(O,...P[G[T]]):M)}}}for(let j of be(S.children))if(!x(j,_))return!1;return g.delete(v),!0};for(let v of be(u[d].nodes))if(!x(v,Gc()))return{ok:!1,issue:b>1e5?"triangle_limit":"unsupported_glb"};return!b||h.length!==b*9||y.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:b,position:new Float32Array(h),normal:new Float32Array(y)}}function ai(e){try{return qc(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function pt(e){let{doc:t}=e,n=Zo(t.theme),r=n.structure,o=gr(t,e.eventConfigurationId??t.eventConfigurationId),i=ri(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new Qt,c=null;if(e.registeredShellGlb){let w=ai(e.registeredShellGlb);if(w.ok){let C=w.position.length/3,G=new Float32Array(w.position.length),k=n.materials.shell??r.tierWall;for(let M=0;M<C;M++){let T=w.normal[M*3+1],D=T<-.25?.4:.62+.38*Math.max(0,T);G[M*3]=k[0]*D,G[M*3+1]=k[1]*D,G[M*3+2]=k[2]*D}c={position:w.position,normal:w.normal,color:G,floor:new Float32Array(C).fill(-2),material:new Float32Array(C),count:C}}}let l=new Map;for(let w of o)for(let C of w.objects)l.set(C.id,w.index),C.type==="section"&&l.set(C.logicalSectionId??C.id,w.index);let p=a.map(w=>l.get(w.sectionId??"")??l.get(w.rowId??"")??0),u=to(o,a);$r(s,o,a,p,u,r);let d=wr(t,a),m=new Map,f=new Map;for(let w of t.categories??[])m.set(w.key,w.color),w.seatGlyph&&f.set(w.key,w.seatGlyph);let h=[],y=Mr(o,a,p),b=new Float32Array(a.length);for(let w=0;w<o.length;w++){let C=o[w];s.setFloor(w);let G=new on,k=[],M=C.objects.filter(T=>T.type==="section"&&!!T.outline&&T.outline.length>=3);for(let T of C.objects)if(T.type==="section")Nr(s,T,C,Pr(T,d),y.bySection.get(T.id),G,M,r);else if(T.type==="shape"){let D=i.byObjectId.get(T.id);s.setMaterial((D?.kind??T.role)==="screen"?1:0),Lr(s,T,C.baseHeightM,Ir(T,k),r,C.focal,h,D),s.setMaterial(0)}else T.type==="gaArea"?Fr(s,T,C.baseHeightM,ee(m.get(T.categoryKey)),r):T.type==="booth"?Tr(s,T,C.baseHeightM,ee(m.get(T.categoryKey)),r):T.type==="table"?kr(s,T,C.baseHeightM,ee(m.get(T.categoryKey)),r):T.type==="decorImage"&&_r(s,T,C.baseHeightM,r);Gr(s,C,a,y,r,n.materials.shell,!c)}let g=o.length>1?{x:o.reduce((w,C)=>w+C.focal.x,0)/o.length,y:o.reduce((w,C)=>w+C.focal.y,0)/o.length}:t.focalPoint??{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2},x=Xo(c?[s.build(),c]:[s.build()]),v=Qo(a,e.initialState,y,b,m,f),A=Kr({doc:t,units:o,seats:a,surfaces:y,focal:g}),{labels:S,sections:E,rows:_}=qr({doc:t,units:o,seats:a,surfaces:y,seatData:v,hintedSeatFloor:p,zones:A,focal:g}),O=Zr({doc:t,units:o,seats:a,surfaces:y,solids:x,hintedSeatFloor:p,seatFloor:b});Qr(S,O),v.iYaw=Ko(v.iPosition,a.length,w=>a[w].rowId,w=>{let C=o[b[w]]?.focal??g;return[C.x*N,C.y*N]});let j=(u.minX+u.maxX)/2*N,V=(u.minY+u.maxY)/2*N,R=.5*Math.hypot((u.maxX-u.minX)*N,(u.maxY-u.minY)*N)||10,P=Jr(x,v,{cx:j,cz:V,radius:R}),I=ei(v,h,u,P.minY,P.maxY,R);return{solids:x,seats:v,bounds:{center:[(I.min[0]+I.max[0])/2,(I.min[1]+I.max[1])/2,(I.min[2]+I.max[2])/2],radius:R,groundY:0,box:I},renderBounds:{center:P.center,radius:P.radius},stateColorLUT:$o(n,Ce),theme:n,seatCount:a.length,focalWorld:[g.x*N,1.5,g.y*N],zones:A,stages:h,productionElements:i.elements,sections:E,rows:_,labels:S,floors:O}}var Qc=88,Zc=20,si={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}},cn=new Set(["row","seat"]),ci={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},ln={row:{x:62,y:16},seat:{x:46,y:18}},li=ee,ro=e=>Mo(e);function ui(e,t){let n=ro(e),r=ro(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function io(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 $c(e,t=[.04,.06,.1],n=!0){let r=ro(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?io(i,t):t,s=li(e),c=n?7:4.5,l=s&&ui(s,a)>=c?e:o;return r?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}var un=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=Hr(o,i,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let g of this.labels){if(!s.has(g.kind))continue;let x=Xe(t,g.anchor,n,r);if(!x.visible)continue;let v=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:x,focus:Yr(x,v,n,r),halfWidth:Xr(g.text,si[g.kind].size,!cn.has(g.kind))/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let l=Ur(c.filter(g=>g.label.kind==="floor"),n),p=[...c.filter(g=>!cn.has(g.label.kind)&&g.label.kind!=="floor"),...l],u=jr(p,Qc,Zc),d=eo(c.filter(g=>g.label.kind==="row"),ln.row.x,ln.row.y,Jn.row,u),m=eo(c.filter(g=>g.label.kind==="seat"),ln.seat.x,ln.seat.y,Jn.seat,[...u,...d]),f=[...u,...d,...m],h=new Set(f.map(g=>g.label.id));for(let{label:g,screen:x}of f){let A=this.nodeFor(g).style;A.display="",A.transform=`translate(-50%, -50%) translate(${x.x.toFixed(1)}px, ${x.y.toFixed(1)}px)`}let y=f.filter(({label:g})=>!cn.has(g.kind)).sort((g,x)=>ci[x.label.kind]-ci[g.label.kind]||g.screen.depth-x.screen.depth||g.focus-x.focus),b=[];for(let{label:g}of y){let x=this.nodes.get(g.id);if(!x||x.style.display==="none")continue;let v=x.getBoundingClientRect();b.some(S=>v.left<S.right+3&&v.right+3>S.left&&v.top<S.bottom+3&&v.bottom+3>S.top)?x.style.display="none":b.push(v)}for(let[g,x]of this.nodes)h.has(g)||(x.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let u=n.style;u.position="absolute",u.left="0",u.top="0",u.whiteSpace="nowrap",u.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",u.display="none",this.root.appendChild(n),this.nodes.set(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=si[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=!cn.has(t.kind),s=$c(t.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"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=li(r?"#ecf8ff":s.ink)??[1,1,1],p=r?io("rgba(10,28,45,.9)",c):a?io(s.backing,c):c;return n.dataset.qualityContrast=ui(l,p).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var mi=1;var Jc=new Set(["floor","zone","section","ga","booth","annotation"]);function el(e){return e.every(t=>Number.isFinite(t))}function tl(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 di(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function rt(e){return Math.round(e*1e4)/1e4}function nl(e){if(e)return{box:{x:rt(e.box.x),y:rt(e.box.y),width:rt(e.box.width),height:rt(e.box.height)},horizontalFillRatio:rt(e.horizontalFillRatio),verticalFillRatio:rt(e.verticalFillRatio),visibleAreaRatio:rt(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Te(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function dn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Jc.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)tl(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=[Te("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Te("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Te("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Te("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}`}]),Te("camera-invalid","The capture camera must have a finite physical pose",el(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Te("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}]),Te("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`}]),Te("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}))),Te("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}))),Te("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:nl(e.framing)},metrics:{minimumHierarchyFontPx:di(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:di(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var se=require("ogl");var Ye=require("ogl");var mn=`
|
|
20
|
+
}`});async function la(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Le,Math.min(Le,t?.initialPitchDeg??0)),s=vn,c=!1,l=new AbortController,p=()=>l.abort();r.signal?.addEventListener("abort",p,{once:!0});let u=()=>{},d=[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 D=n.camera.position,B=n.focalWorld[0]-D.x,U=n.focalWorld[1]-D.y,H=n.focalWorld[2]-D.z,L=Math.hypot(B,H);L>.001&&(i=Math.atan2(B,-H)*180/Math.PI,a=Math.max(-Le,Math.min(Le,Math.atan2(U,L)*180/Math.PI)))}let m=null;if(t){let D=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),B=yn(t,bn(D)),U;try{let H=t.resolveUrl?await t.resolveUrl(B.initialUrl):B.initialUrl;if(!H)throw new Error("panorama_asset_unavailable");U=await Ot(H,l.signal)}catch{return r.signal?.removeEventListener("abort",p),null}try{m=aa(n.gl,U)}catch{return l.abort(),r.signal?.removeEventListener("abort",p),null}m.mesh.renderOrder=999,m.mesh.setParent(n.scene),B.upgradeUrl&&(u=gn(()=>{(t.resolveUrl?t.resolveUrl(B.upgradeUrl):Promise.resolve(B.upgradeUrl)).then(L=>!L||l.signal.aborted?null:Ot(L,l.signal)).then(L=>{L&&(c||l.signal.aborted||(m?.setImage(L),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),y=()=>{let D=n.camera.position;m?.mesh.position.set(D.x,D.y,D.z);let[B,U,H]=ia(i,a);n.camera.lookAt([D.x+B,D.y+U,D.z+H]),n.requestRender()};y();let b=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),b.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),b.tabIndex=-1,Object.assign(b.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"}),b.appendChild(x),r.disclosure){let D=document.createElement("div");D.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(D.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)"}),b.appendChild(D)}let v=document.createElement("div");v.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(v.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"}),b.appendChild(v),e.appendChild(b),x.focus({preventScroll:!0});let A=!1,S=0,E=0,_=0,O=new Map,j=()=>{let[D,B]=[...O.values()];return D&&B?Math.hypot(D.x-B.x,D.y-B.y):0},V=D=>{let B=fo(D);B!==s&&(s=B,n.camera.perspective({fov:s,aspect:n.camera.aspect}),y())},R=D=>{D.target!==x&&(O.set(D.pointerId,{x:D.clientX,y:D.clientY}),A=O.size===1,S=D.clientX,E=D.clientY,O.size===2&&(_=j()),b.setPointerCapture?.(D.pointerId),b.style.cursor="grabbing")},P=D=>{if(O.has(D.pointerId)){if(O.set(D.pointerId,{x:D.clientX,y:D.clientY}),O.size>=2){let B=j();_>0&&B>0&&V(s*(_/B)),_=B,A=!1;return}A&&(i+=(D.clientX-S)*ca,a=Math.max(-Le,Math.min(Le,a+(D.clientY-E)*ca)),S=D.clientX,E=D.clientY,y())}},I=D=>{O.delete(D.pointerId),_=O.size===2?j():0;let B=O.values().next().value;A=O.size===1,B?(S=B.x,E=B.y):b.style.cursor="grab";try{b.releasePointerCapture?.(D.pointerId)}catch{}},w=D=>{D.preventDefault(),V(s+D.deltaY*.04)};b.addEventListener("pointerdown",R),b.addEventListener("pointermove",P),b.addEventListener("pointerup",I),b.addEventListener("pointercancel",I),b.addEventListener("wheel",w,{passive:!1});let C=D=>{if(!c){if(D.key==="Tab"){D.preventDefault(),x.focus({preventScroll:!0});return}if(D.key==="Escape"){D.stopPropagation(),T.close();return}if(D.key==="ArrowLeft"||D.key==="ArrowRight")i+=D.key==="ArrowLeft"?-4:4;else if(D.key==="ArrowUp"||D.key==="ArrowDown")a=Math.max(-Le,Math.min(Le,a+(D.key==="ArrowUp"?4:-4)));else if(D.key==="+"||D.key==="="){V(s-5),D.preventDefault();return}else if(D.key==="-"){V(s+5),D.preventDefault();return}else return;D.preventDefault(),y()}};window.addEventListener("keydown",C);let G=0,k=(D,B)=>{if(!m){B?.();return}let U=D===1?0:1,H=performance.now(),L=()=>{if(c)return;let F=o<=0?1:Math.min(1,(performance.now()-H)/o);m?.setOpacity(U+(D-U)*F),n.requestRender(),F<1?G=requestAnimationFrame(L):B?.()};G=requestAnimationFrame(L)};k(1);let M=()=>{c||(c=!0,u(),l.abort(),r.signal?.removeEventListener("abort",p),cancelAnimationFrame(G),b.removeEventListener("pointerdown",R),b.removeEventListener("pointermove",P),b.removeEventListener("pointerup",I),b.removeEventListener("pointercancel",I),b.removeEventListener("wheel",w),window.removeEventListener("keydown",C),b.remove(),g?.isConnected&&g.focus({preventScroll:!0}),m?.dispose(),n.camera.position.set(d[0],d[1],d[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},T={close(){if(c)return;let D=()=>{M(),r.onClose?.()};cancelAnimationFrame(G),k(0,D)},dispose:M};return x.addEventListener("click",()=>T.close()),T}var ca,ua=St(()=>{"use strict";sa();po();mo();ca=.15});var da={};So(da,{createOpenPanorama:()=>ru});function ru(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:p,gl:u,isContextLost:d,isDisposed:m,flightGen:f,setPanorama:h,getLoadAbort:y,setLoadAbort:b,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:v,restorePanoramaLayer:A,getOverviewChip:S,labelOverlay:E,reducedMotion:_,removeArriveChip:O,showArriveChip:j}=e;return async(V,R,P)=>{y()?.abort();let I=new AbortController;b(I);let w=n.seats.idToIndex.get(V);if(w===void 0){i.syncFromCamera();return}let C=s.get(V)?.label??V,G=l(V,w),k=c(V);if(!k){I.abort(),y()===I&&b(null),i.syncFromCamera();return}x(!0),a.stop();let M;try{M=await k}catch{if(y()===I&&b(null),o.panoramaFailed(V,"source"),!m()&&P===f()){x(!1),i.resumeAfterFlight(G.focal),a.requestRender();let X=j(V,P,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(m()||P!==f()){I.abort(),y()===I&&b(null);return}O();let T=S(),D=()=>{I.abort(),y()===I&&b(null),h(null),g(!1),A(),T.style.display="",E.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(G.focal),a.requestRender();let X=j(V,f());requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())},B=M.generated===!0,U=oa(M);v(),g(!B),T.style.display="none";let H=_()?0:R,L=p(),F=L&&!d()?await la(t,B?null:M,{gl:u,scene:L.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:B?G.eye:void 0,focalWorld:G.focal},{fadeMs:H,seatLabel:C,disclosure:U,disclosurePrefix:B?"Live seat-eye view":"360\xB0 panorama",onClose:D,signal:I.signal}):null;if(m()||P!==f()){I.abort(),g(!1),y()===I&&b(null),F?.dispose(),T.style.display="",A();return}if(F)i.syncFromCamera(),E.setVisible(!1),x(!1),a.requestRender(),h(F);else if(B){A(),T.style.display="",x(!1),i.resumeAfterFlight(G.focal),a.requestRender(),h(null),g(!1),o.panoramaFailed(V,"mount");let X=j(V,f(),!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus()),y()===I&&b(null);return}else g(!1),o.panoramaFallback(V),h(ra(t,M,{fadeMs:H,seatLabel:C,disclosure:U,onClose:D,signal:I.signal}));o.panoramaOpened()}}var ma=St(()=>{"use strict";po();ua()});var uu={};So(uu,{VENUE3D_QUALITY_REPORT_VERSION:()=>fi,buildSceneModel:()=>pt,inspectVenue3DQualityEvidence:()=>dn,mountVenue3D:()=>lu,prepareVenue3D:()=>va});module.exports=La(uu);var Ao=require("ogl");var _a=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Fa(e){let t=_a.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=Fa(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function En(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Da(e){return .2126*En(e[0])+.7152*En(e[1])+.0722*En(e[2])}function wo(e){return Da([e[0]*255,e[1]*255,e[2]*255])}function Oa(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 Mt(e,t){let n=Oa(e);return he(e,[n,n,n],t)}var Ce=["available","held","sold","selected","dimmed"];function wt(e){let t=Ce.indexOf(e);return t<0?0:t}var Po={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Co(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 Rn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},$e={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ve(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Va(){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 Ht=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new Ao.Renderer({canvas:this.canvas,dpr:Va(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[$e.top[0],$e.top[1],$e.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 st=require("ogl"),me=Math.PI/180,Tn=15*me,kn=80*me,at=.12,Io=35,Eo=1.25,jt=class{constructor(t,n,r,o){this.fovY=Io;this.target=new st.Vec3;this.azimuth=-30*me;this.polar=55*me;this.distance=10;this.azT=-30*me;this.polT=55*me;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 st.Vec3;this.panAnchor=new st.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new st.Camera(t,{fov:Io,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(Tn,Math.min(kn,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*me;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(Tn,Math.min(kn,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*me/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),p=Math.sin(this.polar),u=-i*l,d=-a*l;this.targetT.x+=(-t*s+n*u)*o,this.targetT.z+=(-t*c+n*d)*o,this.targetT.y+=n*p*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*me/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*me,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*me;let p=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=p*Math.max(1.05,Math.min(2,i?.margin??Eo)),this.minDist=Math.max(2,a*.12),this.maxDist=p*4,n?(this.azimuth=this.azT,this.polar=12*me,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*me/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))*me;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Eo))}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),p=-l*Math.sin(o),u=-Math.cos(i),d=-l*Math.cos(o);if(Math.abs(u)>.999)return s;let m=-d,f=p,h=Math.hypot(m,f);m/=h,f/=h;let y=-f*u,b=f*p-m*d,g=m*u,x=Math.tan(r),v=Math.tan(n),A=1;for(let S=0;S<8;S++){let E=(S&1?c.max[0]:c.min[0])-t.center[0],_=(S&2?c.max[1]:c.min[1])-t.center[1],O=(S&4?c.max[2]:c.min[2])-t.center[2],j=E*p+_*u+O*d,V=Math.abs(E*m+O*f),R=Math.abs(E*y+_*b+O*g);A=Math.max(A,V/x-j,R/v-j)}return Math.min(s,Math.max(A,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*at,this.polar+=n*at,this.distance+=r*at,this.target.x+=o*at,this.target.y+=i*at,this.target.z+=a*at,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(Tn,Math.min(kn,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 Xt=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 ct=2.5,Ba=1.15,Pt=6,lt=10,Ro=6,To=9.5,ko=.9,Lo=2.2,Ln=30,_n=4,Yt=8192;var xu=lt+_n;function _o(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ct};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ct+o*(Ba-ct)}}function Fo(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function Do(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 Na=[{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"}],Su=new Map(Na.map(e=>[e.key,e]));var Ga={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 Oo(e){let t=e?.[0];return t&&Ga[t]||"#3b82f6"}var za=[{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"}],Mu=new Map(za.map(e=>[e.key,e]));var Ua=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],wu=new Set(Ua);var Bo=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],No=Bo.map(e=>e.key),Ha=new Map(Bo.map(e=>[e.key,e]));function Vo(e){return typeof e=="string"&&Ha.has(e)}function Go(e,t){return Vo(e)?e:Vo(t?.seatGlyph)?t.seatGlyph:"circle"}var Re=.02291666666666667,He=1/Re,ja=58,Xa=ja*Re;var Ya=3,zo=0,Fn=120,Wa=0,Ka=45,qa=7,Wt=1.2;function Dn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Qa(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=qa?e:Ya}function Uo(e,t={}){let n=Dn(t.floorBaseHeightM,zo,Fn,0),r=Math.min(Fn,n+Qa(e.elevation)*Xa),o=e.height===void 0?r:Dn(e.height,zo,Fn,r),i=Dn(e.rake,Wa,Ka,0);return{height:o,rake:i}}var jo=it(require("earcut"),1),Xo=it(require("polygon-clipping"),1);var Ru=Math.PI/180;function On(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 Ct(e){return e.length?On(e):null}function Je(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 At(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 N=Re,Za=.002;function $a(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<Za}var et=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)}},Qt=class{constructor(){this.pos=new et;this.nor=new et;this.col=new et;this.flr=new et;this.mat=new et;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){$a(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 Ja(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,p=i*a-r*c,u=r*s-o*a,d=Math.hypot(l,p,u)||1;return l/=d,p/=d,u/=d,[l,p,u]}function es(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,jo.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Vn(e){return Je(e)<0?[...e].reverse():e}var ts=3;function ns(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(m,f,h,y)=>Math.abs(r({x:(m.x+f.x)/2,y:(m.y+f.y)/2})-(h+y)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,p=(o+i+a)/3,u=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:l})-p)),d=(m,f,h)=>{let y=Math.abs(r({x:(m+c)/2,y:(f+l)/2})-(h+p)/2);y>u&&(u=y)};return d((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),d((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),d((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),u}function It(e,t,n,r,o){if(o<=0)return ns(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(It(e,i,s,r,o-1),It(i,t,a,r,o-1),It(s,a,n,r,o-1),It(i,a,s,r,o-1))}function Et(e,t,n,r,o,i,a,s){if(a>0){let d={x:(t.x+n.x)/2,y:(t.y+n.y)/2},m={x:(n.x+r.x)/2,y:(n.y+r.y)/2},f={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Et(e,t,d,f,o,i,a-1,s),Et(e,d,n,m,o,i,a-1,s),Et(e,f,m,r,o,i,a-1,s),Et(e,d,m,f,o,i,a-1,s);return}let c=[t.x*N,o(t),t.y*N],l=[n.x*N,o(n),n.y*N],p=[r.x*N,o(r),r.y*N];if(s){e.triN(c,l,p,s(t),s(n),s(r),i);return}let u=Ja(c,l,p);u[1]<0&&(u=[-u[0],-u[1],-u[2]]),e.tri(c,l,p,u,i)}var os=8;function Ho(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,l)=>{if(l>0){let p={x:(i.x+a.x)/2,y:(i.y+a.y)/2},u=t(p);if(Math.abs(u-(s+c)/2)>n){o(i,p,s,u,l-1),o(p,a,u,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),os)}return r}function Kt(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,p=Math.hypot(c,l);p>t&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/p<t||r.push(a)}return r.length>=3?r:n}var qt=.001*He*.1;function le(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(Je(t))<1e-4))return;let p=Kt(Ho(Kt(Vn(t),qt),r,c),qt),u=n?.map(S=>Kt(Ho(Kt(Vn(S),qt),r,c),qt)).filter(S=>S.length>=3&&Math.abs(Je(S))>=1e-4),{pts:d,tris:m}=es(p,u),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],h=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],y=[a[0]*s.top,a[1]*s.top,a[2]*s.top],b=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<ts;g++){let S=0;for(let E=0;E<m.length;E+=3){let _=It(d[m[E]],d[m[E+1]],d[m[E+2]],r,g);_>S&&(S=_)}if(S<=c)break}for(let S=0;S<m.length;S+=3){let E=d[m[S]],_=d[m[S+1]],O=d[m[S+2]];Et(e,E,_,O,r,f,g,l);let j=[E.x*N,o,E.y*N],V=[_.x*N,o,_.y*N],R=[O.x*N,o,O.y*N];e.tri(j,R,V,[0,-1,0],h)}let x=S=>{if(g<=0)return S;let E=1<<g,_=[];for(let O=0;O<S.length;O++){let j=S[O],V=S[(O+1)%S.length];for(let R=0;R<E;R++){let P=R/E;_.push({x:j.x+(V.x-j.x)*P,y:j.y+(V.y-j.y)*P})}}return _},v=On(p),A=[{ring:x(p),flip:!1}];if(u)for(let S of u)S.length>=3&&A.push({ring:x(S),flip:!0});for(let{ring:S,flip:E}of A)for(let _=0;_<S.length;_++){let O=S[_],j=S[(_+1)%S.length],V=(j.x-O.x)*N,P=(j.y-O.y)*N,I=-V,w=Math.hypot(P,I)||1;P/=w,I/=w;let C=(O.x+j.x)/2-v.x,G=(O.y+j.y)/2-v.y,k=P*C+I*G;E&&(k=-k),k<0&&(P=-P,I=-I);let M=[P,0,I],T=[O.x*N,r(O),O.y*N],D=[j.x*N,r(j),j.y*N],B=[O.x*N,o,O.y*N],U=[j.x*N,o,j.y*N];e.tri(T,D,U,M,y,y,b),e.tri(T,U,B,M,y,b,b)}}function Yo(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:t}}function Zt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Vn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],p=l.x-c.x,u=l.y-c.y,d=Math.hypot(p,u)||1;i.push({x:u/d,y:-p/d})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],p=i[s],u=l.x+p.x,d=l.y+p.y,m=Math.hypot(u,d),f=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+p.x*t,c.y+p.y*t])};if(m<1e-9){f();continue}u/=m,d/=m;let h=u*l.x+d*l.y,y=1/Math.max(h,1e-6);if(!Number.isFinite(y)||y>n){f();continue}a.push([c.x+u*t*y,c.y+d*t*y])}if(a.length<3)return e;try{let s=Xo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let u of s){let d=Math.abs(Je(u[0].map(([m,f])=>({x:m,y:f}))));d>l&&(l=d,c=u[0])}if(!c)return e;let p=c.map(([u,d])=>({x:u,y:d}));if(p.length>1){let u=p[0],d=p[p.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&p.pop()}return p.length>=3?p:e}catch{return e}}function $t(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 Rt(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ie={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},rs=.44,is=.15,as=.3,ss=.24;function Wo(e){return e===void 0||!Number.isFinite(e)||e<=0?ss:Math.min(as,Math.max(is,e*rs))}var Bn=.21,cs=.05,Nn=.45,Jt=Nn+cs,ls=[{part:ie.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ie.pad,min:[-1,.36,-.95],max:[1,Nn,1]},{part:ie.back,min:[-1,Jt,-1],max:[1,.92,-.72]},{part:ie.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ie.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ie.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ie.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ie.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ie.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ie.leg,min:[.62,0,.48],max:[.82,.37,.7]}],us=[{part:ie.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ie.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ie.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ie.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ie.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],ds=[{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 Ko(){let e=[],t=[],n=[],r=[],o=(w,C,G)=>{let k=n.length,[M,T,D]=w,B=[T[0]-M[0],T[1]-M[1],T[2]-M[2]],U=[D[0]-M[0],D[1]-M[1],D[2]-M[2]],H=B[1]*U[2]-B[2]*U[1],L=B[2]*U[0]-B[0]*U[2],F=B[0]*U[1]-B[1]*U[0],X=Math.hypot(H,L,F);X>1e-9?(H/=X,L/=X,F/=X):[H,L,F]=C,H*C[0]+L*C[1]+F*C[2]<0&&(H=-H,L=-L,F=-F);for(let W of w)e.push(...W),t.push(H,L,F),n.push(G);r.push(k,k+1,k+2,k,k+2,k+3)},i=w=>{for(let C of ds){let G=C.c.map(k=>k.map((M,T)=>M?w.max[T]:w.min[T]));o(G,C.n,w.part)}};for(let w of ls)i(w);for(let w of us)i(w);let a=Nn,s=1.08,c=.47,l=.69,p=-.55,u=.08,d=-.48,m=.01,f=[-c,a,p],h=[c,a,p],y=[-c,a,u],b=[c,a,u],g=[-l,s,d],x=[l,s,d],v=[-l,s,m],A=[l,s,m];o([h,x,A,b],[1,0,0],ie.body),o([y,v,g,f],[-1,0,0],ie.body),o([v,A,x,g],[0,1,0],ie.body),o([f,h,b,y],[0,-1,0],ie.body),o([b,A,v,y],[0,0,1],ie.body),o([f,g,x,h],[0,0,-1],ie.body);let S=10,E=8,_=[0,1.205,-.23],O=[.42,.115,.38],j=n.length;for(let w=0;w<=E;w++){let C=Math.PI*w/E,G=Math.cos(C),k=Math.sin(C);for(let M=0;M<=S;M++){let T=Math.PI*2*M/S,D=k*Math.cos(T),B=k*Math.sin(T);e.push(_[0]+O[0]*D,_[1]+O[1]*G,_[2]+O[2]*B);let U=D/O[0],H=G/O[1],L=B/O[2],F=Math.hypot(U,H,L)||1;U/=F,H/=F,L/=F,t.push(U,H,L),n.push(ie.head)}}for(let w=0;w<E;w++)for(let C=0;C<S;C++){let G=j+w*(S+1)+C,k=G+S+1;r.push(G,k,G+1,G+1,k,k+1)}let V=new Float32Array(e),R=new Float32Array(t),P=new Float32Array(n),I=new Uint16Array(r);return{position:V,normal:R,part:P,index:I,vertexCount:n.length,indexCount:r.length}}function qo(e,t,n,r){let o=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,p)=>{let u=p-l;for(let d=l;d<p;d++){let[m,f]=r(d),h=m-i(d),y=f-a(d);if(u>=2){let b=Math.max(l,d-1),g=Math.min(p-1,d+1),x=i(g)-i(b),v=a(g)-a(b),A=Math.hypot(x,v);if(A>1e-6){let S=-v/A,E=x/A;S*h+E*y<0&&(S=-S,E=-E),h=S,y=E}}o[d]=h===0&&y===0?0:Math.atan2(h,y)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var Oe=.22;function Qo(e,t){let n=Ce[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 ms=.42;function fs(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let f of e)f.x<r&&(r=f.x),f.y<o&&(o=f.y),f.x>i&&(i=f.x),f.y>a&&(a=f.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),p=Math.max(1,Math.ceil(s/l)+1),u=Math.max(1,Math.ceil(c/l)+1),d=new Map,m=(f,h)=>{let y=Math.min(p-1,Math.max(0,Math.floor((f-r)/l)));return Math.min(u-1,Math.max(0,Math.floor((h-o)/l)))*p+y};for(let f=0;f<t;f++){let h=m(e[f].x,e[f].y),y=d.get(h);y?y.push(f):d.set(h,[f])}for(let f=0;f<t;f++){let h=e[f],y=Math.min(p-1,Math.max(0,Math.floor((h.x-r)/l))),b=Math.min(u-1,Math.max(0,Math.floor((h.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let v=b-x;v<=b+x;v++)if(!(v<0||v>=u))for(let A=y-x;A<=y+x;A++){if(A<0||A>=p||x>1&&Math.abs(v-b)<x&&Math.abs(A-y)<x)continue;let S=d.get(v*p+A);if(S)for(let E of S){if(E===f)continue;let _=Math.hypot(e[E].x-h.x,e[E].y-h.y);_<g&&(g=_)}}if(Number.isFinite(g)&&g<=x*l)break}n[f]=g}return n}function ps(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Wt):0}function Zo(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),p=new Float32Array(a),u=new Float32Array(a),d=new Float32Array(a),m=new Float32Array(a),f=new Float32Array(a*3),h=new Map,y=fs(e);for(let b=0;b<a;b++){let g=e[b],v=(n?.seatPitchU(b)??y[b])*N;p[b]=Number.isFinite(v)?Math.max(.06,Math.min(Oe,v*ms)):Oe,u[b]=Wo(Number.isFinite(v)?v:void 0);let A=Go(g.glyph,{seatGlyph:i?.get(g.categoryKey)});d[b]=No.indexOf(A),m[b]=g.wheelchairSpaceType==="no-seat"?0:1,s[b*3]=g.x*N,s[b*3+1]=n?n.seatDeckY(b):ps(g),s[b*3+2]=g.y*N,c[b]=wt(t?t(g):"available");let S=ee(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[b*3]=S[0],l[b*3+1]=S[1],l[b*3+2]=S[2],g.accessibility?.length){let E=ee(Oo(g.accessibility));E&&(f[b*3]=E[0],f[b*3+1]=E[1],f[b*3+2]=E[2])}h.set(g.id,b)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:p,iRing:f,idToIndex:h,iChairWidth:u,iGlyph:d,iPhysicalSeat:m,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var hs=64;function Gn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=wt(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+hs){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 bs=.15,ys=.9,gs=1.76,xs=.7,vs=1.6;function Ss(){return{background:{top:[...$e.top],bottom:[...$e.bottom]},structure:Rn,seatStates:{...Po},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function $o(e){let t=Ss();if(!e)return t;let n=ee(e.background);if(n){t.background={top:ve(n,ys),bottom:ve(n,gs)};let a={};for(let[s,c]of Object.entries(Rn))a[s]=he(c,n,bs);t.structure=a}let r=ee(e.selectionColor)??ee(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(vs,Math.max(xs,o)));let i=e.venue3d;if(i){let a=ee(i.deck),s=ee(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=ee(i.seat),t.materials.shell=ee(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function Jo(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function er(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 ut(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,p=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;p<0?p=0:p>1&&(p=1);let u=Math.hypot(t-(i.x+p*s),n-(i.y+p*c));u<r&&(r=u)}return r}function Ms(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 tr(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function zn(e,t){let n=1/0;for(let r of er(e)){let o=ut(t,r.x,r.y);o<n&&(n=o)}for(let r of er(t)){let o=ut(e,r.x,r.y);o<n&&(n=o)}return n}function ws(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let p of e)n+=p.x,r+=p.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let p of e){let u=Math.hypot(p.x-n,p.y-r);u>o&&(o=u,i=p)}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((p,u)=>({p,i:u,t:(p.x-n)*a+(p.y-r)*s})).sort((p,u)=>p.t-u.t);return{pts:l.map(p=>p.p),seatIndices:l.map(p=>t[p.i])}}function Un(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,p=0;for(let g of e){let x=g.x-n,v=g.y-r;o+=x*x,a+=v*v,i+=x*v,s+=x*x*x,c+=v*v*v,l+=x*v*v,p+=v*x*x}let u=o*a-i*i;if(Math.abs(u)<1e-9)return null;let d=(s+l)/2,m=(c+p)/2,f=(d*a-m*i)/u,h=(m*o-d*i)/u,y=f+n,b=h+r;return!Number.isFinite(y)||!Number.isFinite(b)?null:{cx:y,cy:b}}var Ps=.15;function Cs(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,v=0;for(let A of g.pts)x+=A.x,v+=A.y;return{x:x/g.pts.length,y:v/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,v=g.y-r;o+=x*x,i+=x*v,a+=v*v}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),p,u;Math.abs(i)>1e-12?(p=l-a,u=i):o>=a?(p=1,u=0):(p=0,u=1);let d=Math.hypot(p,u);if(!(d>1e-12))return null;p/=d,u/=d;let m=1/0,f=-1/0,h=[];for(let g of e){let x=1/0,v=-1/0;for(let A of g.pts){let S=A.x*p+A.y*u;S<x&&(x=S),S>v&&(v=S),S<m&&(m=S),S>f&&(f=S)}h.push(v-x)}let y=f-m;return y>1e-9?(h.sort((g,x)=>g-x),h[Math.min(h.length-1,Math.floor(h.length*.9))]/y<=As?{x:p,y:u}:null):null}var As=.35;function nr(e,t,n,r){let o=new Map;for(let y of n){let b=t[y],g=b.rowId||`__seat-${y}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:b.x,y:b.y}),x.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[y,b]of o){let g=ws(b.pts,b.idx),x=0;for(let v of g.pts)x+=Math.hypot(v.x-r.x,v.y-r.y);i.push({id:y,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(y=>Ms(y.pts)),s=[];for(let y=0;y<i.length;y++){let b=1/0;for(let g=0;g<i.length;g++){if(y===g||tr(a[y],a[g])>=b)continue;let x=zn(i[y].pts,i[g].pts);x<b&&(b=x)}Number.isFinite(b)&&s.push(b)}s.sort((y,b)=>y-b);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),p=i.map(()=>[]);for(let y=0;y<i.length;y++)for(let b=y+1;b<i.length;b++)tr(a[y],a[b])>l||zn(i[y].pts,i[b].pts)<=l&&(p[y].push(b),p[b].push(y));let u=0;for(let y=0;y<i.length;y++){if(i[y].blockId!==-1)continue;let b=u++,g=[y];for(i[y].blockId=b;g.length;){let x=g.pop();for(let v of p[x])i[v].blockId===-1&&(i[v].blockId=b,g.push(v))}}let d=new Map;for(let y of i){let b=d.get(y.blockId)??[];b.push(y),d.set(y.blockId,b)}let m=[];for(let y of i){if(y.pts.length<4)continue;let b=Un(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||m.push({x:b.cx,y:b.cy}))}let f=m.length>=2?(()=>{let y=m.map(x=>x.x).sort((x,v)=>x-v),b=m.map(x=>x.y).sort((x,v)=>x-v),g=Math.floor(m.length/2);return{cx:y[g],cy:b[g]}})():null;if(f){let y=S=>Math.hypot(S.x-f.cx,S.y-f.cy),b=1/0,g=-1/0,x=[];for(let S of i){let E=1/0,_=-1/0;for(let O of S.pts){let j=y(O);j<E&&(E=j),j>_&&(_=j)}x.push(_-E),E<b&&(b=E),_>g&&(g=_)}let v=g-b;x.sort((S,E)=>S-E);let A=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(v>1e-9&&A/v<=Ps){let S=i.map(C=>{let G=0;for(let k of C.pts)G+=y(k);return{row:C,radius:G/C.pts.length}}),E=0,_=0;for(let C of S)E+=C.radius,_+=C.row.focalDistance;E/=S.length,_/=S.length;let O=0;for(let C of S)O+=(C.radius-E)*(C.row.focalDistance-_);if(O<0)for(let C of S)C.radius=-C.radius;let V=1/0;for(let C of S)C.radius<V&&(V=C.radius);S.sort((C,G)=>C.radius-G.radius);let R=-1,P=-1/0,I=v/Math.max(1,S.length)*.5,w=[];for(let C of S)C.radius-P>I&&(R++,P=C.radius),C.row.ordinal=R,C.row.blockDepth=C.radius-V,w.push(C.row);return{sectionId:e,rows:w,blockCount:u}}}let h=[];for(let[,y]of d){let b=Cs(y);if(b){let g=v=>{let A=0;for(let S of v.pts)A+=S.x*b.x+S.y*b.y;return A/v.pts.length};y.sort((v,A)=>g(v)-g(A)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let x=0;for(let v=0;v<y.length;v++)v>0&&(x+=zn(y[v-1].pts,y[v].pts)),y[v].ordinal=v,y[v].blockDepth=x,h.push(y[v])}else{let g=1/0;for(let x of y)x.focalDistance<g&&(g=x.focalDistance);y.sort((x,v)=>x.focalDistance-v.focalDistance);for(let x=0;x<y.length;x++)y[x].ordinal=x,y[x].blockDepth=Math.max(0,y[x].focalDistance-g),h.push(y[x])}}return{sectionId:e,rows:h,blockCount:u}}var Ku=Math.PI/180;function or(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 Is(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 Hn(e,t,n){return or(e,t)&&!(n??[]).some(r=>or(e,r)||Is(e,r))}function Es(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 Rs(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let m of e)n+=m.x,r+=m.y,o+=Math.hypot(m.x-t.x,m.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let m of e){let f=Math.hypot(m.x-n,m.y-r);f>s&&(s=f,a=m)}let c=a.x-n,l=a.y-r,p=Math.hypot(c,l);p>1e-9?(c/=p,l/=p):(c=1,l=0);let u=[...e].sort((m,f)=>(m.x-n)*c+(m.y-r)*l-((f.x-n)*c+(f.y-r)*l)),d=0;for(let m of u){let f=Math.hypot(m.x-n,m.y-r);f>d&&(d=f)}return{pts:u,cx:n,cy:r,radius:d,depth:o}}function rr(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,p=c*c+l*l,u=p>1e-12?((t-a.x)*c+(n-a.y)*l)/p:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(a.x+u*c),n-(a.y+u*l));d<o&&(o=d)}return o}var en=8;function Ts(e,t,n){let r=new Array(en).fill(1/0),o=new Array(en).fill(-1);for(let p=0;p<e.length;p++){let u=e[p],d=Math.hypot(t-u.cx,n-u.cy)-u.radius;for(let m=0;m<en;m++)if(d<r[m]){for(let f=en-1;f>m;f--)r[f]=r[f-1],o[f]=o[f-1];r[m]=d,o[m]=p;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let p of o){if(p<0)continue;let u=rr(e[p],t,n);for(let d=0;d<3;d++)if(u<i[d]){for(let m=2;m>d;m--)i[m]=i[m-1],a[m]=a[m-1];i[d]=u,a[d]=p;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 p=0;p<3;p++){let u=a[p];if(u<0||i[p]>s)continue;let d=1/(i[p]*i[p]);c+=d*e[u].depth,l+=d}return l>0?c/l:e[a[0]].depth}function ks(e){let t=(r,o)=>Ts(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=rr(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 ir(e,t){let n=[];for(let r of e){let o=Rs(r.points,t);o&&n.push(o)}return n.length<2?Es(t):(n.sort((r,o)=>r.depth-o.depth),ks(n))}var Yn=it(require("polygon-clipping"),1);var lr=it(require("earcut"),1);var Ls=.58,ar=.01,Se=Oe*1.5*He,_s=.5,Fs=.6;function Ds(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,p=c.y-s.y,u=Math.hypot(l,p);if(u<1e-9){r.push([0,0]);continue}l/=u,p/=u,r.push([-p,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 Os(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,p=Math.hypot(c,l)||1;return{x:c/p,y:l/p}},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 sr=Math.PI/12;function Vs(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 ur(e,t){if(!e.length||!(t>0))return[];let n=Vs(e),r=(s,c,l,p)=>{let u=l-c;for(;u<0;)u+=Math.PI*2;for(;u>Math.PI*2;)u-=Math.PI*2;let d=Math.max(1,Math.ceil(u/sr)),m=t/Math.cos(u/d/2);for(let f=0;f<=d;f++){let h=c+u*f/d;p.push({x:s.x+Math.cos(h)*m,y:s.y+Math.sin(h)*m})}};if(n.length<3){let s=0,c=0;for(let m of n)s+=m.x,c+=m.y;s/=n.length||1,c/=n.length||1;let l=0;for(let m of n)l=Math.max(l,Math.hypot(m.x-s,m.y-c));let p=[],u=Math.max(3,Math.ceil(Math.PI*2/sr)),d=(l+t)/Math.cos(Math.PI/u);for(let m=0;m<u;m++){let f=m/u*Math.PI*2;p.push({x:s+Math.cos(f)*d,y:c+Math.sin(f)*d})}return p}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 hr(a)}function Bs(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,p=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;p<0?p=0:p>1&&(p=1);let u=Math.hypot(t-(i.x+p*s),n-(i.y+p*c));u<r&&(r=u)}return r}function tn(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 p=Math.hypot(l.x-i,l.y-a);p>c&&(c=p)}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 p of i){let u=1/0;for(let d=0;d<e.length;d++){if(d===o||Math.abs(e[d].y-e[o].y)<.001)continue;let m=t[d],f=Math.hypot(p.x-m.cx,p.y-m.cy)-m.rad;if(f>=u&&f>=s)continue;let h=Bs(e[d].pts,p.x,p.y);h<u&&(u=h),e[d].depth<e[o].depth&&h<s&&(s=h,c=e[d].y)}Number.isFinite(u)&&u>0&&a.push(u)}a.sort((p,u)=>p-u);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function dr(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let p=o.pts[0],u=p.x-r.x,d=p.y-r.y,m=Math.hypot(u,d)||1;u/=m,d/=m;let f=Math.max(n[t].pitch,.001)*.5;return[{x:p.x+d*f,y:p.y-u*f},{x:p.x-d*f,y:p.y+u*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let p=1;p<i.length;p++){let u=Math.hypot(i[p].x-i[p-1].x,i[p].y-i[p-1].y);u>1e-6&&(a+=u,s++)}let c=s>0?a/s:0,l=Os(i,Math.max(c*Fs,Se));return{pts:l,nrm:Ds(l,r),front:Math.max(n[t].pitch*Ls,Se),back:Math.max(n[t].pitch*_s,Se)}}var dt=1.5,mr=.3;function jn(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 u=1;u<e.length-1;u++){let d=e[u],m=a>1e-12?Math.abs((d.x-n.x)*i-(d.y-n.y)*o)/a:Math.hypot(d.x-n.x,d.y-n.y);m>s&&(s=m,c=u)}if(s<=t||c<0)return[n,r];let l=jn(e.slice(0,c+1),t),p=jn(e.slice(c),t);return[...l.slice(0,-1),...p]}function fr(e,t){if(e.length<4)return e;let n=jn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function pr(e,t,n){if(e.length<2)return[];let r=n??tn(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=>dr(e,g,r,t)).filter(g=>g!==null);if(!l.length)continue;let p=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+dt),y:g.pts[x].y-g.nrm[x][1]*(g.front+dt)}),u=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+dt),y:g.pts[x].y+g.nrm[x][1]*(g.back+dt)}),d=l[0],m=l[l.length-1],f=[];for(let g=0;g<d.pts.length;g++)f.push(p(d,g));for(let g of l)f.push(u(g,g.pts.length-1));for(let g=m.pts.length-1;g>=0;g--)f.push(u(m,g));for(let g=l.length-1;g>=0;g--)f.push(p(l[g],0));let h=hr(f),y=1/0;for(let g of s)e[g].y<y&&(y=e[g].y);if(!Number.isFinite(y))continue;if(h.length>=3&&Math.abs(Je(h))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return At(h,x.x,x.y)})){i.push({outline:fr(h,mr),holes:[],topY:y});continue}for(let g of Ns(l))i.push({outline:g,holes:[],topY:y})}return i}function Ns(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+dt,a=n.back+dt;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],p=n.nrm[c];r.push([l.x-p[0]*i,l.y-p[1]*i]),o.push([l.x+p[0]*a,l.y+p[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=Yn.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(fr(i,mr))}return r}catch{return[]}}function hr(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 Xn=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(!At(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function cr(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],p=r[0];for(let u=1;u+1<r.length;u++){let d=r[u],m=r[u+1];e.tri([p.x*N,o,p.y*N],[d.x*N,o,d.y*N],[m.x*N,o,m.y*N],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=Yn.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 p=l[0],u=[],d=[];for(let f=0;f<p.length-1;f++)u.push(p[f][0],p[f][1]),d.push([p[f][0],p[f][1]]);if(d.length<3)continue;let m=(0,lr.default)(u,void 0,2);for(let f=0;f<m.length;f+=3){let h=d[m[f]],y=d[m[f+1]],b=d[m[f+2]];e.tri([h[0]*N,o,h[1]*N],[y[0]*N,o,y[1]*N],[b[0]*N,o,b[1]*N],c,i)}}}function br(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??tn(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(m=>[m.x,m.y]),[i[0].x,i[0].y]]]:null,p=i&&i.length>=3?new Xn([[...i]]):null,u=m=>{e.setMaterial(2),m(),e.setMaterial(0)},d=m=>{e.setMaterial(3),m(),e.setMaterial(0)};for(let m=0;m<t.length;m++){let f=t[m];if(f.patch&&f.patch.length>=3){let A=[...f.patch],S=s[m].belowY??r;if(d(()=>{if(l&&p)cr(e,l,p,A,f.y,o.tread);else{let E=A[0];for(let _=1;_+1<A.length;_++){let O=A[_],j=A[_+1];e.tri([E.x*N,f.y,E.y*N],[O.x*N,f.y,O.y*N],[j.x*N,f.y,j.y*N],c,o.tread)}}}),f.y>S+ar){let E=0,_=0;for(let O of A)E+=O.x,_+=O.y;E/=A.length,_/=A.length,u(()=>{for(let O=0;O<A.length;O++){let j=A[O],V=A[(O+1)%A.length],R=V.x-j.x,P=V.y-j.y,I=Math.hypot(R,P);if(I<1e-6)continue;let w=P/I,C=-R/I;(j.x-E)*w+(j.y-_)*C<0&&(w=-w,C=-C);let G=[w,0,C],k=[j.x*N,f.y,j.y*N],M=[V.x*N,f.y,V.y*N],T=[j.x*N,S,j.y*N],D=[V.x*N,S,V.y*N];e.tri(k,M,D,G,o.riser),e.tri(k,D,T,G,o.riser)}})}continue}let h=dr(t,m,s,n);if(!h)continue;let{pts:y,nrm:b,front:g,back:x}=h,v=s[m].belowY??r;for(let A=0;A+1<y.length;A++){let S=y[A],E=y[A+1],_=b[A],O=b[A+1];if(Math.hypot(E.x-S.x,E.y-S.y)<1e-6||_[0]===0&&_[1]===0||O[0]===0&&O[1]===0)continue;let j=[(S.x-_[0]*g)*N,f.y,(S.y-_[1]*g)*N],V=[(E.x-O[0]*g)*N,f.y,(E.y-O[1]*g)*N],R=[(S.x+_[0]*x)*N,f.y,(S.y+_[1]*x)*N],P=[(E.x+O[0]*x)*N,f.y,(E.y+O[1]*x)*N];if(d(()=>{l&&p?cr(e,l,p,[{x:S.x-_[0]*g,y:S.y-_[1]*g},{x:E.x-O[0]*g,y:E.y-O[1]*g},{x:E.x+O[0]*x,y:E.y+O[1]*x},{x:S.x+_[0]*x,y:S.y+_[1]*x}],f.y,o.tread):(e.tri(j,V,P,c,o.tread),e.tri(j,P,R,c,o.tread))}),f.y>v+ar){let I=[j[0],v,j[2]],w=[V[0],v,V[2]],C=[-_[0],0,-_[1]];u(()=>{e.tri(j,V,w,C,o.riser),e.tri(j,w,I,C,o.riser)})}}}}function yr(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 nn(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Wn=it(require("polygon-clipping"),1);function Gs(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function gr(e,t){return e.filter(n=>n.type!=="shape"||Gs(n,t))}function xr(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:gr(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:gr(e.objects,t),focal:n,baseHeightM:0,index:0}]}var zs={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function mt(e){return yr(e)??zs}function vr(e,t){let n=Zt(e.outline,Se),r=mt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&nn(r,mt(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=Wn.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(([p,u])=>({x:p,y:u}));if(l.length>1){let p=l[0],u=l[l.length-1];Math.abs(p.x-u.x)<1e-9&&Math.abs(p.y-u.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function Sr(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=Wn.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,p])=>({x:l,y:p}));if(c.length>1){let l=c[0],p=c[c.length-1];Math.abs(l.x-p.x)<1e-9&&Math.abs(l.y-p.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var Us=.05,Mr=.05,Hs=.15,Kn=25;function wr(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=[],p=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"&&p.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let h=Zt(f.outline,Se);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:mt(h),section:f,unit:m,outline:h})}}let u=new Map;for(let d of l){let m=u.get(d.floorIndex);m?m.push(d):u.set(d.floorIndex,[d])}for(let d=0;d<t.length;d++){let m=t[d],f=n?u.get(n[d])??[]:l,h=m.sectionId?f.find(b=>b.id===m.sectionId)??f.find(b=>b.section.logicalSectionId===m.sectionId&&Hn({x:m.x,y:m.y},b.outline,b.section.holes)):void 0,y=h?[h]:f;for(let b of y){if(n&&b.floorIndex!==n[d]||!h&&(m.x<b.box.minX||m.x>b.box.maxX||m.y<b.box.minY||m.y>b.box.maxY||!Hn({x:m.x,y:m.y},b.outline,b.section.holes)))continue;o[d]=b.id;let g=c.get(b.id);g.hasSeats=!0;let x=m.focalPoint??b.unit.focal,v=Math.hypot(m.x-x.x,m.y-x.y);v<g.frontU&&(g.frontU=v),g.seatIndices.push(d);let A=m.rowId||`__seat-${d}`,S=g.rows.get(A);S?S.push({x:m.x,y:m.y}):g.rows.set(A,[{x:m.x,y:m.y}]);break}}for(let[d,m]of c){let f=Uo(m.section,{floorBaseHeightM:m.unit.baseHeightM}),h=m.unit.baseHeightM,y=f.rake>0?Math.tan(f.rake*Math.PI/180):0,b=f.rake<=.01&&f.height<=h+.001,g=m.section.surfaceKind,x=g==="flat"?!0:g==="rakedRows"&&f.rake>.01?!1:b,v=m.hasSeats?nr(d,t,m.seatIndices,m.unit.focal):{sectionId:d,rows:[],blockCount:0},S=v.rows.length<2?ir([...m.rows.values()].map(k=>({points:k})),m.unit.focal):null,E=1/0;if(S){if(m.hasSeats)for(let k of m.rows.values())for(let M of k){let T=S.depthAt(M.x,M.y);T<E&&(E=T)}if(!m.hasSeats||!Number.isFinite(E)){E=1/0;for(let k of m.section.outline){let M=S.depthAt(k.x,k.y);M<E&&(E=M)}}}let _=h+Us,O=Math.max(_,f.height),j=k=>{let M=Math.max(0,k-E)*Re,T=Math.min(M*y,Kn);return Math.max(_,f.height+T)},V=k=>{let M=Math.max(0,k)*Re,T=Math.min(M*y,Kn);return Math.max(_,f.height+T)},R=x?[]:v.rows.map(k=>({pts:k.pts,y:V(k.blockDepth),depth:k.blockDepth,blockId:k.blockId,...p.has(k.id)?{patch:ur(k.pts,Se)}:{}})),P=R.length?R[0].y:O,I=R.map(k=>{let M=k.patch&&k.patch.length>=3?k.patch:k.pts,T=0,D=0;for(let H of M)T+=H.x,D+=H.y;let B=M.length||1;T/=B,D/=B;let U=0;for(let H of M){let L=Math.hypot(H.x-T,H.y-D);L>U&&(U=L)}return{cx:T,cy:D,rad:U}}),w=x?()=>O:R.length>=2?(k,M)=>{let T=1/0,D=P;for(let B=0;B<R.length;B++){let U=I[B];if(Math.hypot(k-U.cx,M-U.cy)-U.rad>=T)continue;let H=R[B].patch,L=H&&H.length>=3?At(H,k,M)?0:ut(H,k,M):ut(R[B].pts,k,M);L<T&&(T=L,D=R[B].y)}return D}:(k,M)=>S?j(S.depthAt(k,M)):O,C=[0,1,0],G=R.length>=2||x?()=>C:(k,M)=>{if(!S)return C;let T=S.depthAt(k,M);if(T<=E)return C;let D=(T-E)*Re;if(D*y>=Kn||f.height+D*y<=_)return C;let[B,U]=S.gradientAt(k,M);if(B===0&&U===0)return C;let H=1/Math.hypot(y,1);return[-B*y*H,H,-U*y*H]};if(!x)for(let k of v.rows){let M=V(k.blockDepth);for(let T of k.seatIndices)a[T]=M}for(let k of v.rows){let M=[];for(let H=1;H<k.pts.length;H++){let L=Math.hypot(k.pts[H].x-k.pts[H-1].x,k.pts[H].y-k.pts[H-1].y);L>1e-6&&M.push(L)}M.sort((H,L)=>H-L);let T=M.length?M[Math.floor(M.length/2)]:1/0,D=1/0,B=k.pts[Math.floor(k.pts.length/2)];if(B)for(let H of v.rows){if(H===k||H.blockId!==k.blockId)continue;let L=ut(H.pts,B.x,B.y);L>1e-6&&L<D&&(D=L)}let U=Math.min(T,Math.max(D,T*.5));if(Number.isFinite(U)&&U>0)for(let H of k.seatIndices)s[H]=U}r.set(d,{sectionId:d,deckAt:w,normalAt:G,flat:x,bottomY:h,rowLevels:R,landingY:P})}for(let d=0;d<t.length;d++){let m=o[d],f=t[d];if(m){let y=a[d];i[d]=(y??r.get(m).deckAt(f.x,f.y))+Hs;continue}let h=f.eyeHeightM;i[d]=Number.isFinite(h)?Math.max(0,h-Wt):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var ce={top:1,wallBottom:.5,bottomCap:.4};function Ve(e,t){if(!e)return t;let n=ve(Mt(e,.4),.62);return he(t,n,.72)}function Pr(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,p=0;for(let[u,d]of a){let m=ee(n.get(u));m&&(s+=m[0]*d,c+=m[1]*d,l+=m[2]*d,p+=d)}p>0&&o.set(i,[s/p,c/p,l/p])}return o}function Cr(e,t){return ee(e.color)??t.get(e.logicalSectionId??e.id)??null}var xd=Math.PI*2;function Ar(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Ir=it(require("polygon-clipping"),1);function js(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var on=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=mt(t),i=this.rings.filter((c,l)=>nn(o,this.boxes[l])&&js(n,this.levels[l])),a=[[r]];if(i.length)try{a=Ir.default.difference([r],...i).map(l=>l.map(p=>p.map(([u,d])=>[u,d])))}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(([p,u])=>({x:p,y:u}));if(l.length>1){let p=l[0],u=l[l.length-1];Math.abs(p.x-u.x)<1e-9&&Math.abs(p.y-u.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Xs(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let u of e)n=Math.min(n,u.x),r=Math.max(r,u.x),o=Math.min(o,u.y),i=Math.max(i,u.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,l=Math.cos(c),p=Math.sin(c);return e.map(u=>{let d=u.x-a,m=u.y-s;return{x:a+d*l-m*p,y:s+d*p+m*l}})}function tt(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=Rt(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=$t(n,r,e.width/2,e.height/2)}return t?Xs(t,e.rotation):null}function Tt(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"&&Ar(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Ys=.08;function Er(e,t){let n=tt(e),r=Tt(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 p of n)i=Math.min(i,p.x),a=Math.min(a,p.y),s=Math.max(s,p.x),c=Math.max(c,p.y);let l=o;for(let p of t)s>p.minX&&i<p.maxX&&c>p.minY&&a<p.maxY&&l<=p.topOffsetM+1e-6&&(l=p.topOffsetM+Ys);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function je(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Rr(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 kt(e,t,n){return[je(e[0],e[1],t),je(e[0],e[1],n),je(e[3],e[2],n),je(e[3],e[2],t)]}function Tr(e,t,n){return[je(e[0],e[3],t),je(e[1],e[2],t),je(e[1],e[2],n),je(e[0],e[3],n)]}function Be(e,t,n,r,o,i){le(e,t,void 0,()=>n,r,o,i,ce)}var qn=2.4,Ws=.75,Ks=.15;function Lt(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(([p,u])=>({x:t.x+p*a-u*s,y:t.y+p*s+u*a}))}function kr(e,t,n,r,o){let i=Lt(t);i&&le(e,i,void 0,()=>n+qn,n,Ve(r,o.boothTop),o.boothWall,ce)}function Qn(e){if(e.shape==="round"){let p=e.radius;return p?$t(e.center.x,e.center.y,p,p,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(([p,u])=>({x:o.x+p*a-u*s,y:o.y+p*s+u*a}))}function Lr(e,t,n,r,o){let i=Qn(t);i&&le(e,i,void 0,()=>n+Ws,n,Ve(r,o.tableTop),o.tableWall,ce)}function _r(e,t,n,r,o,i,a,s){let c=tt(t);if(!c)return;let l=s?s.kind==="stage":t.role==="stage",p=s?s.kind==="screen":t.role==="screen",u=s?{kind:l?"stage":"solid",heightM:s.topY-s.baseY}:Tt(t),d=s?.baseY??n,m=s?.topY??n+r;if(l&&a){let g=1/0,x=-1/0,v=1/0,A=-1/0;for(let S of c)S.x<g&&(g=S.x),S.x>x&&(x=S.x),S.y<v&&(v=S.y),S.y>A&&(A=S.y);a.push({cx:(g+x)/2*N,cz:(v+A)/2*N,y:m,halfX:Math.max((x-g)/2*N,.5),halfZ:Math.max((A-v)/2*N,.5)})}let f=ee(t.fill),h=l&&f?he(o.stageTop,ve(Mt(f,.18),.9),.9):Ve(f,l?o.stageTop:o.decorTop),y=p?f:null,b=l?f?he(o.stageWall,ve(f,.58),.82):o.stageWall:p?y?he(ve(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Ve(ee(t.fill),o.decorWall);if(u.kind==="portal"&&c.length===4){let g=Rr(c);Be(e,kt(g,0,.16),m,d,h,b),Be(e,kt(g,.84,1),m,d,h,b),Be(e,g,m,Math.max(d,m-.35),h,b);return}if(u.kind==="suite"&&c.length===4){let g=c.map((A,S)=>{let E=c[(S+1)%4],_=(A.x+E.x)/2,O=(A.y+E.y)/2;return Math.hypot(_-i.x,O-i.y)}),x=g.indexOf(Math.min(...g)),v=[0,1,2,3].map(A=>c[(x+A)%4]);Be(e,kt(v,0,.08),m,d,h,b),Be(e,kt(v,.92,1),m,d,h,b),Be(e,Tr(v,.88,1),m,d,h,b),Be(e,v,m,Math.max(d,m-.18),h,b);return}Be(e,c,m,d,h,b)}function Zn(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),p=r/2,u=o/2;return[[-p,-u],[p,-u],[p,u],[-p,u]].map(([d,m])=>({x:i+d*c-m*l,y:a+d*l+m*c}))}function qs(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 Fr(e,t,n,r){if(t.layer==="foreground")return;let o=Zn(t);if(!o)return;let i=n+Ks,a=Ve(qs(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=he(r.ground,a,s)),le(e,o,void 0,()=>i,n,a,he(a,r.decorWall,.5),ce)}function Dr(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Ve(r,o.gaTop);le(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ce)}var Qs=Math.PI/180,te=96,Zs=6,$s=60,Js=150,Or=.2,ec=.35;function tc(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Qs;return n<0?n+360:n}function rn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function an(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 Vr(e,t){let n=e.filter(d=>d.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let d of n)for(let m of d.rows){for(let f of m.pts)o+=f.x,i+=f.y,a++;if(m.pts.length>=4){let f=Un(m.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&r.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let d=rn(r.map(b=>b.x)),m=rn(r.map(b=>b.y)),f=0;for(let b of n)for(let g of b.rows)for(let x of g.pts){let v=Math.hypot(x.x-s.x,x.y-s.y);v>f&&(f=v)}let h=0,y=f*.2;for(let b of n)for(let g of b.rows)for(let x of g.pts)Math.hypot(x.x-d,x.y-m)<y&&h++;Math.hypot(d-s.x,m-s.y)<=f&&h/a<.01&&(c={x:d,y:m})}let l=[];for(let d of n){let m={sectionId:d.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of d.rows)for(let h of f.pts){let y=Math.hypot(h.x-c.x,h.y-c.y),b=Math.min(te-1,Math.floor(tc(c,h)/(360/te)));m.samples.push({r:y,bin:b,levelM:f.levelM}),y<m.rMin&&(m.rMin=y),y>m.rMax&&(m.rMax=y)}m.samples.length&&l.push(m)}if(!l.length)return null;l.sort((d,m)=>d.rMin+d.rMax-(m.rMin+m.rMax));let p=[];for(let d of l){let m=!1;for(let f of p){let h=Math.min(d.rMax,f.rMax)-Math.max(d.rMin,f.rMin),y=Math.min(d.rMax-d.rMin,f.rMax-f.rMin);if(y>1e-9&&h>=ec*y){f.members.push(d),f.rMin=Math.min(f.rMin,d.rMin),f.rMax=Math.max(f.rMax,d.rMax),m=!0;break}}m||p.push({members:[d],rMin:d.rMin,rMax:d.rMax})}let u=[];for(let d of p){let m=new Array(te).fill(null);for(let P of d.members)for(let I of P.samples){let w=m[I.bin];w||(w={samples:[]},m[I.bin]=w),w.samples.push({r:I.r,levelM:I.levelM})}let f=m.map(P=>!!P);if(!f.filter(Boolean).length)continue;let y=[],b=[];for(let P of m){if(!P)continue;let I=1/0,w=-1/0;for(let C of P.samples)C.r<I&&(I=C.r),C.r>w&&(w=C.r);y.push(I),b.push(w)}let g=rn(y),x=rn(b);if(!(g>=Or*x)||!(x>0))continue;let v=[...y].sort((P,I)=>P-I);if(!(v[Math.floor(v.length*.1)]>=Or*x))continue;let S=m.map(P=>{if(!P)return null;let I=[...P.samples].sort((B,U)=>B.r-U.r),w=I[0].r,C=I[I.length-1].r,G=I[0].levelM,k=-1/0;for(let B of I)B.levelM>k&&(k=B.levelM);let M=[];for(let B of I){let U={r:B.r,l:B.levelM};for(;M.length&&Math.abs(M[M.length-1].r-U.r)<1e-9;){if(M[M.length-1].l<=U.l){U.skip=!0;break}M.pop()}if(!U.skip){for(;M.length>=2;){let H=M[M.length-2],L=M[M.length-1];if((L.r-H.r)*(U.l-H.l)-(L.l-H.l)*(U.r-H.r)<=0)M.pop();else break}M.push(U)}}let T=M.map(B=>B.r),D=M.map(B=>B.l);return{inner:w,outer:C,front:G,top:k,profile:{rs:T,ls:D}}}),E=f.slice();for(let P=0;P<te;P++){if(E[P])continue;let I=-1,w=-1,C=0;for(let F=1;F<=te;F++){let X=(P-F+te*2)%te;if(E[X]){I=X;break}}for(let F=1;F<=te;F++){let X=(P+F)%te;if(E[X]){w=X,C=F;break}}if(I<0||w<0)continue;let G=0;for(let F=1;F<=te;F++){let X=(P-F+te*2)%te;if(f[X]){G=F;break}}if(G-1+C>Zs)continue;let M=S[I],T=S[w],D=G/(G+C),B=M.inner+(T.inner-M.inner)*D,U=M.outer+(T.outer-M.outer)*D,H=M.front+(T.front-M.front)*D,L=M.top+(T.top-M.top)*D;S[P]={inner:B,outer:U,front:H,top:L,profile:{rs:[B,U],ls:[H,L]}}}for(let P=0;P<te;P++)S[P]&&(E[P]=!0);let _=360/te,O=[],j=E.filter(Boolean).length,V=[];if(j===te)V.push({start:0,len:te});else{let P=0;for(;E[P];)P=(P+1)%te;let I=-1;for(let w=0;w<=te;w++){let C=(P+w)%te,G=w<te&&E[C];if(G&&I<0)I=C;else if(!G&&I>=0){let k=(C-I+te)%te||te;V.push({start:I,len:k}),I=-1}}}for(let P of V){if(P.len*_<$s&&P.len<te)continue;let I=P.len===te,w=new Float64Array(P.len),C=new Float64Array(P.len),G=new Float64Array(P.len),k=new Float64Array(P.len),M=[];for(let F=0;F<P.len;F++){let X=S[(P.start+F)%te];w[F]=X.inner,C[F]=X.outer,G[F]=X.front,k[F]=X.top,M.push(X.profile??{rs:[X.inner,X.outer],ls:[X.front,X.top]})}let T=an(w,I),D=an(C,I),B=an(G,I),U=an(k,I);for(let F=0;F<P.len;F++)T[F]>w[F]&&(T[F]=w[F]),D[F]<C[F]&&(D[F]=C[F]),T[F]>D[F]-1e-6&&(T[F]=Math.max(0,D[F]-1e-6)),U[F]<B[F]&&(U[F]=B[F]);let H={startBin:P.start,binCount:P.len,closed:I,innerR:T,outerR:D,frontLevelM:B,topLevelM:U,profiles:M},L=(F,X,W)=>{let q=M[F],Q=q.rs,$=q.ls;if(X<=Q[0]){$[0]>W&&($[0]=W);return}if(X>=Q[Q.length-1]){$[$.length-1]>W&&($[$.length-1]=W);return}for(let re=0;re+1<Q.length;re++)if(X<=Q[re+1]){$[re]>W&&($[re]=W),$[re+1]>W&&($[re+1]=W);return}};for(let F=0;F<P.len;F++){let X=m[(P.start+F)%te];if(X)for(let W of X.samples){L(F,W.r,W.levelM);let q=I?(F-1+P.len)%P.len:F-1,Q=I?(F+1)%P.len:F+1;q>=0&&L(q,W.r,W.levelM),Q<P.len&&L(Q,W.r,W.levelM)}}O.push(H)}O.reduce((P,I)=>P+I.binCount*_,0)<Js||u.push({arcs:O,sectionIds:d.members.map(P=>P.sectionId),innerRMedian:g,outerRMedian:x})}if(!u.length)return null;if(u.sort((d,m)=>d.innerRMedian-m.innerRMedian),t){let d=u[u.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*d)return null}return{centre:c,binCount:te,binStepDeg:360/te,rings:u}}function Br(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=p=>{let u=t.profiles[p],d=u.rs,m=u.ls;if(r<=d[0])return m[0];if(r>=d[d.length-1])return m[m.length-1];for(let f=0;f+1<d.length;f++)if(r<=d[f+1]){let h=d[f+1]-d[f],y=h>1e-9?(r-d[f])/h:0;return m[f]+(m[f+1]-m[f])*y}return m[m.length-1]};return l(a)*(1-c)+l(s)*c}var nc=.25,oc=1.2,rc=.6,ic=.45,ac=2.3,sc=Math.PI/180;function nt(e,t,n){let r=n*sc;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function cc(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 lc=24;function uc(e,t,n,r,o,i,a,s){let c=n.binCount,l=lc,p=Re,u=i+.02,d=[];for(let R=0;R<c;R++){let P=(n.startBin+R+.5)*t.binStepDeg,I=new Float64Array(l+1);for(let w=0;w<=l;w++){let C=r[R]+(o[R]-r[R])*w/l;I[w]=Math.max(u,Br(t,n,P,C)-nc)}d.push(I)}let m=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],f=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],h=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],y=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],b=(R,P)=>{let I=(n.startBin+R+.5)*t.binStepDeg,w=r[R]+(o[R]-r[R])*P/l,C=nt(t.centre,w,I);return[C.x*p,d[R][P],C.y*p]};{let R=Math.tan(12*Math.PI/180);for(let P=0;P<6;P++){let I=!1;for(let C=0;C<c;C++)for(let G=l-1;G>=0;G--)d[C][G]>d[C][G+1]&&(d[C][G]=d[C][G+1],I=!0);let w=n.closed?c:c-1;for(let C=0;C<w;C++){let G=(C+1)%c;for(let k=0;k<=l;k++){let M=d[G][k]-d[C][k];if(Math.abs(M)>1)continue;let T=r[C]+(o[C]-r[C])*k/l,D=r[G]+(o[G]-r[G])*k/l,B=nt(t.centre,T,(n.startBin+C+.5)*t.binStepDeg),U=nt(t.centre,D,(n.startBin+G+.5)*t.binStepDeg),H=R*Math.hypot(U.x-B.x,U.y-B.y)*p;M>H?(d[G][k]=d[C][k]+H,I=!0):-M>H&&(d[C][k]=d[G][k]+H,I=!0)}}if(!I)break}}let g=1,x=(R,P)=>{for(let I=0;I<=l;I+=4)if(Math.abs(d[R][I]-d[P][I])>g)return!0;return Math.abs(d[R][l]-d[P][l])>g},v=Math.tan(38*Math.PI/180),A=R=>(o[R]-r[R])/l*p,S=(R,P)=>d[R][P+1]-d[R][P]>v*Math.max(1e-6,A(R)),E=(R,P)=>{let I=n.closed?(R-1+c)%c:Math.max(0,R-1),w=n.closed?(R+1)%c:Math.min(c-1,R+1);Math.abs(d[I][P]-d[R][P])>g&&(I=R),Math.abs(d[w][P]-d[R][P])>g&&(w=R);let C=Math.max(0,P-1),G=Math.min(l,P+1);C<P&&S(R,C)&&(C=P),G>P&&S(R,P)&&(G=P);let k=b(I,P),M=b(w,P),T=b(R,C),D=b(R,G),B=M[0]-k[0],U=M[1]-k[1],H=M[2]-k[2],L=D[0]-T[0],F=D[1]-T[1],X=D[2]-T[2],W=U*X-H*F,q=H*L-B*X,Q=B*F-U*L,$=Math.hypot(W,q,Q);return $>1e-12?(W/=$,q/=$,Q/=$,q<0&&(W=-W,q=-q,Q=-Q),[W,q,Q]):[0,1,0]},_=(R,P)=>{let I=[R[0],i,R[2]],w=[P[0],i,P[2]],C=P[0]-R[0],G=P[2]-R[2],k=Math.hypot(C,G);if(!(k>1e-12))return;let M=[G/k,0,-C/k];e.tri(R,P,w,M,h,h,y),e.tri(R,w,I,M,h,y,y)},O=.05*He,j=R=>o[R]-r[R]<O,V=n.closed?c:c-1;for(let R=0;R<V;R++){let P=(R+1)%c;if(j(R)||j(P))continue;if(x(R,P)){let M=(n.startBin+R+1)*t.binStepDeg,T=(F,X)=>{let W=(r[R]+r[P])/2,q=(o[R]+o[P])/2,Q=W+(q-W)*X/l,$=nt(t.centre,Q,M);return[$.x*p,d[F][X],$.y*p]};for(let F=0;F<l;F++){let X=b(R,F),W=b(R,F+1),q=T(R,F),Q=T(R,F+1),$=E(R,F),re=E(R,F+1);e.triN(X,q,Q,$,$,re,m),e.triN(X,Q,W,$,re,re,m);let Ae=b(P,F),Me=b(P,F+1),we=T(P,F),_e=T(P,F+1),Fe=E(P,F),Ne=E(P,F+1);e.triN(we,Ae,Me,Fe,Fe,Ne,m),e.triN(we,Me,_e,Fe,Ne,Ne,m);let xe=T(R,F),de=T(R,F+1),Ge=T(P,F+1),yt=T(P,F),Pe=de[0]-xe[0],qe=de[2]-xe[2],De=Math.hypot(Pe,qe);if(De>1e-12){let Vt=[qe/De,0,-Pe/De];e.tri(xe,de,Ge,Vt,h),e.tri(xe,Ge,yt,Vt,h)}}let D=b(R,0),B=b(P,0),U=b(P,l),H=b(R,l),L=F=>[F[0],i,F[2]];e.tri(L(D),L(U),L(B),[0,-1,0],f),e.tri(L(D),L(H),L(U),[0,-1,0],f),_(D,B),_(H,U);continue}for(let M=0;M<l;M++){let T=E(R,M),D=E(P,M),B=E(P,M+1),U=E(R,M+1);if(S(R,M)||S(P,M)){let W=(de,Ge)=>{let yt=(n.startBin+de+.5)*t.binStepDeg,Pe=r[de]+(o[de]-r[de])*(M+.5)/l,qe=nt(t.centre,Pe,yt);return[qe.x*p,Ge,qe.y*p]},q=b(R,M),Q=b(P,M),$=W(R,d[R][M]),re=W(P,d[P][M]);e.triN(q,Q,re,T,D,D,m),e.triN(q,re,$,T,D,T,m);let Ae=b(P,M+1),Me=b(R,M+1),we=W(R,d[R][M+1]),_e=W(P,d[P][M+1]);e.triN(we,_e,Ae,U,B,B,m),e.triN(we,Ae,Me,U,B,U,m);let Fe=re[0]-$[0],Ne=re[2]-$[2],xe=Math.hypot(Fe,Ne);if(xe>1e-12){let de=[-Ne/xe,0,Fe/xe];e.tri($,re,_e,de,h),e.tri($,_e,we,de,h)}continue}let H=b(R,M),L=b(P,M),F=b(P,M+1),X=b(R,M+1);e.triN(H,L,F,T,D,B,m),e.triN(H,F,X,T,B,U,m)}let I=b(R,0),w=b(P,0),C=b(P,l),G=b(R,l),k=M=>[M[0],i,M[2]];e.tri(k(I),k(C),k(w),[0,-1,0],f),e.tri(k(I),k(G),k(C),[0,-1,0],f),_(I,w),_(G,C)}if(!n.closed)for(let R of[0,c-1])for(let P=0;P<l;P++)_(b(R,P),b(R,P+1))}function Nr(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let p of t.rings)for(let u of p.arcs){let d=new Float64Array(u.binCount),m=new Float64Array(u.binCount);for(let h=0;h<u.binCount;h++){let y=(u.startBin+h)%t.binCount,b=Math.max(0,u.innerR[h]-Se);d[h]=Math.max(b,a[y]+.001),m[h]=Math.max(d[h]+.001,u.outerR[h]+Se)}let f=0;for(let h=0;h<u.binCount;h++){let y=u.topLevelM[h]-r;y>f&&(f=y)}f>=oc&&uc(e,t,u,d,m,r,o,i);for(let h=0;h<u.binCount;h++){let y=(u.startBin+h)%t.binCount;m[h]>a[y]&&(a[y]=m[h])}}if(n.deriveShell===!1||cc(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=rc*He,l=ic*He;for(let p of s.arcs){let u=[],d=[];for(let h=0;h<p.binCount;h++){let y=(p.startBin+h+.5)*t.binStepDeg,b=p.outerR[h]+Se+c;u.push(nt(t.centre,b,y)),d.push(nt(t.centre,b+l,y))}let m=-1/0;for(let h=0;h<p.binCount;h++)p.topLevelM[h]>m&&(m=p.topLevelM[h]);let f=()=>m+ac;p.closed?le(e,d,[u.slice().reverse()],f,r,o.shellTop,o.shellWall,i):le(e,[...d,...u.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function Gr(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=Ve(r,s.tierTop);if(!o)return;let p=y=>o.deckAt(y.x,y.y),u=vr(t,a),d=u[0]??t.outline;if(o.rowLevels.length>=2){let y=tn(o.rowLevels),b=Sr(pr(o.rowLevels,n.focal,y),u),g=()=>[0,1,0];for(let v of b){let A=Math.max(c,v.topY-.02);for(let S of i.subtract(v.outline,A))le(e,S,v.holes,()=>A,c,l,s.tierWall,ce,void 0,g)}b.length||le(e,d,t.holes,()=>o.landingY,c,l,s.tierWall,ce);let x={tread:[l[0]*ce.top,l[1]*ce.top,l[2]*ce.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let v of u.length?u:[d])br(e,o.rowLevels,n.focal,o.landingY,x,v,y);return}let m=o.flat?1/0:Mr,f=y=>o.normalAt(y.x,y.y),h=o.flat?o.landingY:void 0;for(let y of i.subtract(d,h))le(e,y,t.holes,p,c,l,s.tierWall,ce,m,f)}function dc(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],p=o.get(s);p||(p=new Map,o.set(s,p));let u=l.rowId||`__seat-${a}`,d=p.get(u);d||(d={pts:[],levelM:0,n:0},p.set(u,d)),d.pts.push({x:l.x,y:l.y}),d.levelM+=n.seatDeckY(a),d.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(p=>!p.patch).map(p=>({pts:p.pts,levelM:p.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 zr(e,t,n,r,o,i,a=!0){let s=dc(t,n,r);if(!s.length)return;let c=Vr(s,t.focal);c&&(e.setMaterial(0),Nr(e,c,{bottomY:t.baseHeightM,colors:{bandTop:ve(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??ve(o.tierWall,1.15),shellWall:i??o.tierWall},ao:ce,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:a}))}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 Hr(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 mc=1.15,fc=3.25,pc=4.5,hc=.85,bc=.5,yc=.26;function jr(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>=mc&&a.add("zone"),o<=(i?fc:pc)&&(a.add("section"),a.add("ga")),o<=hc&&(a.add("annotation"),a.add("booth")),o<=bc&&a.add("row"),o<=yc&&a.add("seat"),a}function Xe(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],p=o[2]*i+o[6]*a+o[10]*s+o[14],u=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(u>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let d=c/u,m=l/u,f=p/u,h=d>=-1.05&&d<=1.05&&m>=-1.05&&m<=1.05&&f<=1;return{x:(d*.5+.5)*n,y:(1-(m*.5+.5))*r,depth:f,visible:h}}function Xr(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if($n(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var gc=6;function $n(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+gc):n;return o<a&&i<r}function Yr(e,t,n){return e.length*t*.58+(n?14:0)}var Jn={row:8,seat:14};function Wr(e,t,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-r/2)/o);return t*(1+1.5*i)}function eo(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let l of o)if($n(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if($n(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var xc=6,vc=2.2,Kr=.1,Sc=.3,Mc=1.8,wc=.9,Pc=.55,Cc=6e3;function qr(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 p of n)for(let u of p.objects)u.type==="section"&&u.zone&&c.set(u.id,u.zone);let l=new Map;for(let p=0;p<r.length;p++){let u=r[p],d=o.seatOwner[p],m=u.zoneId??(d?c.get(d):void 0);if(!m)continue;let f=l.get(m);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(m,f)),f.n++,u.x<f.minX&&(f.minX=u.x),u.y<f.minY&&(f.minY=u.y),u.x>f.maxX&&(f.maxX=u.x),u.y>f.maxY&&(f.maxY=u.y),f.sumY+=o.seatDeckY(p)}for(let p of a){let u=l.get(p.id),d=[];for(let[m,f]of c)f===p.id&&d.push(m);if(!u||u.n===0){s.push({id:p.id,label:p.label,color:ee(p.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(p.focalPoint??i).x*N,1.5,(p.focalPoint??i).y*N]});continue}s.push({id:p.id,label:p.label,color:ee(p.color),sectionIds:d,seatCount:u.n,center:[(u.minX+u.maxX)/2*N,u.sumY/u.n,(u.minY+u.maxY)/2*N],radius:.5*Math.hypot((u.maxX-u.minX)*N,(u.maxY-u.minY)*N)||1,focalWorld:[(p.focalPoint??i).x*N,1.5,(p.focalPoint??i).y*N]})}}return s}function Qr(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],p=[],u=[];for(let d of s)d.seatCount!==0&&l.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[d.center[0],d.center[1]+xc,d.center[2]],color:t.zones?.find(m=>m.id===d.id)?.color});{let d=new Map,m=new Map;for(let f=0;f<r.length;f++){let h=o.seatOwner[f];if(!h)continue;let y=d.get(h);y||(y={n:0,x:0,y:0,deck:0},d.set(h,y)),y.n++,y.x+=r[f].x,y.y+=r[f].y,y.deck+=o.seatDeckY(f);let b=m.get(h);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},m.set(h,b)),r[f].x<b.minX&&(b.minX=r[f].x),r[f].x>b.maxX&&(b.maxX=r[f].x),r[f].y<b.minY&&(b.minY=r[f].y),r[f].y>b.maxY&&(b.maxY=r[f].y)}for(let f of n)for(let h of f.objects){if(h.type!=="section")continue;let y=d.get(h.id);if(!y||y.n===0)continue;let b=m.get(h.id),g=[y.x/y.n*N,y.deck/y.n,y.y/y.n*N],x=h.displayLabel||h.label||h.id;p.push({id:h.id,floorIndex:f.index,label:x,seatCount:y.n,center:g,radius:Math.max(1,Math.hypot(b.maxX-b.minX,b.maxY-b.minY)*.5*N),focalWorld:[f.focal.x*N,f.baseHeightM+1.5,f.focal.y*N]});let v=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&v===x.trim().toLocaleLowerCase()||l.push({id:`section:${h.id}`,kind:"section",text:x,anchor:[g[0],g[1]+vc,g[2]],floorIndex:f.index})}}{for(let f of n)for(let h of f.objects){if(h.type!=="gaArea")continue;let y=Ct(h.points);if(!y)continue;let b=h.displayLabel||h.label||h.id;l.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${b} \xB7 ${h.capacity.toLocaleString()}`:b,anchor:[y.x*N,f.baseHeightM+Mc,y.y*N],floorIndex:f.index})}let d=new Map;for(let f=0;f<r.length;f++){let h=r[f],y=Math.hypot(h.x-c.x,h.y-c.y),b=d.get(h.rowId);(!b||y>b.far)&&d.set(h.rowId,{seat:h,index:f,far:y})}for(let[f,h]of d){let y=h.seat.label?h.seat.label.lastIndexOf("-"):-1,b=y>0?h.seat.label.slice(0,y):f;b&&l.push({id:`row:${f}`,kind:"row",text:b,anchor:[h.seat.x*N,o.seatDeckY(h.index)+wc,h.seat.y*N],floorIndex:a[h.index]})}let m=new Map;for(let f=0;f<r.length;f++){let h=r[f],y=h.label?h.label.lastIndexOf("-"):-1,b=m.get(h.rowId);b||(b={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?h.label.slice(0,y):h.rowId,sectionId:h.sectionId},m.set(h.rowId,b));let g=f*3,x=i.iPosition[g],v=i.iPosition[g+1],A=i.iPosition[g+2];b.n++,b.x+=x,b.y+=v,b.z+=A,b.minX=Math.min(b.minX,x),b.maxX=Math.max(b.maxX,x),b.minZ=Math.min(b.minZ,A),b.maxZ=Math.max(b.maxZ,A)}for(let[f,h]of m)u.push({id:f,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=Cc)for(let f=0;f<r.length;f++){let h=r[f],y=h.displayLabel||h.label;y&&l.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*N,o.seatDeckY(f)+Pc,h.y*N],floorIndex:a[f]})}}for(let d of n)for(let m of d.objects)if(m.type==="shape"&&m.role&&["entrance","exit","screen","suite","obstruction"].includes(m.role)){let f=tt(m),h=f?Ct(f):null;if(!h||!m.label)continue;l.push({id:`architecture:${m.id}`,kind:"annotation",text:m.label,anchor:[h.x*N,d.baseHeightM+Tt(m).heightM+Kr,h.y*N],color:m.fill,floorIndex:d.index})}else if(m.type==="text"){if(!m.text)continue;l.push({id:`text:${m.id}`,kind:"annotation",text:m.text,anchor:[m.position.x*N,d.baseHeightM+Kr,m.position.y*N],color:m.color,rotation:m.rotation,floorIndex:d.index})}else if(m.type==="booth"){let f=Lt(m);if(!f)continue;let h=Ct(f);if(!h)continue;l.push({id:`booth:${m.id}`,kind:"booth",text:m.displayLabel||m.label||m.id,anchor:[h.x*N,d.baseHeightM+qn+Sc,h.y*N],floorIndex:d.index})}return{labels:l,sections:p,rows:u}}function Zr(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 $r(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 d=0;d<i.floor.length;d+=1){let m=Math.max(0,Math.min(n.length-1,Math.round(i.floor[d]))),f=d*3,h=l[m];h.minX=Math.min(h.minX,i.position[f]),h.minY=Math.min(h.minY,i.position[f+1]),h.minZ=Math.min(h.minZ,i.position[f+2]),h.maxX=Math.max(h.maxX,i.position[f]),h.maxY=Math.max(h.maxY,i.position[f+1]),h.maxZ=Math.max(h.maxZ,i.position[f+2])}let p=new Map;for(let d=0;d<n.length;d++)for(let m of n[d].objects)m.type==="section"&&p.set(m.id,d);let u=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 d=0;d<r.length;d++){let m=o.seatOwner[d],f=(m!==null?p.get(m):void 0)??a[d];if(f===void 0)continue;let h=u[f],y=r[d];h.n++,y.x<h.minX&&(h.minX=y.x),y.y<h.minY&&(h.minY=y.y),y.x>h.maxX&&(h.maxX=y.x),y.y>h.maxY&&(h.maxY=y.y);let b=o.seatDeckY(d);h.sumX+=y.x*N,h.sumDeck+=b,h.sumZ+=y.y*N,h.minDeck=Math.min(h.minDeck,b),h.maxDeck=Math.max(h.maxDeck,b+1.6),s[d]=f}for(let d=0;d<n.length;d++){let m=u[d],f=t.floors?.[d],h=l[d],y=Math.min(m.n?m.minX*N:n[d].focal.x*N-1,Number.isFinite(h.minX)?h.minX:1/0),b=Math.max(m.n?m.maxX*N:n[d].focal.x*N+1,Number.isFinite(h.maxX)?h.maxX:-1/0),g=Math.min(m.n?m.minY*N:n[d].focal.y*N-1,Number.isFinite(h.minZ)?h.minZ:1/0),x=Math.max(m.n?m.maxY*N:n[d].focal.y*N+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),v=Math.min(m.n?Math.min(n[d].baseHeightM,m.minDeck):n[d].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),A=Math.max(m.n?Math.max(m.maxDeck,v+.5):v+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[m.n?m.sumX/m.n:(y+b)/2,m.n?m.sumDeck/m.n:(v+A)/2,m.n?m.sumZ/m.n:(g+x)/2],E=Math.max(1,.5*Math.hypot(b-y,A-v,x-g));c.push({index:d,id:f?.id??`floor-${d}`,label:f?.name??(n.length>1?`Floor ${d+1}`:"Venue"),seatCount:m.n,center:S,radius:E,box:{min:[y,v,g],max:[b,A,x]},focalWorld:[n[d].focal.x*N,n[d].baseHeightM+1.5,n[d].focal.y*N]})}}return c}function to(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=Lt(c);if(l)for(let p of l)a(p.x,p.y)}else if(c.type==="table"){let l=Qn(c);if(l)for(let p of l)a(p.x,p.y)}else if(c.type==="decorImage"){let l=Zn(c);if(l)for(let p of l)a(p.x,p.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Jr(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=Rt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);le(e,s,void 0,()=>0,-.4,i.ground,i.ground,ce)}else{let a=t.reduce((m,f)=>f.baseHeightM<m.baseHeightM?f:m);e.setFloor(a.index);let s=n.filter((m,f)=>r[f]===a.index),c=to([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),p=Math.max(28,Math.min(80,l*.04)),u=Rt(c.minX-p,c.minY-p,c.maxX-c.minX+p*2,c.maxY-c.minY+p*2),d=a.baseHeightM-.03;le(e,u,void 0,()=>d,d-.22,i.ground,i.ground,ce)}}function ei(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,p=-1/0,u=-1/0,d=(h,y,b)=>{a=Math.min(a,h),l=Math.max(l,h),s=Math.min(s,y),p=Math.max(p,y),c=Math.min(c,b),u=Math.max(u,b)};for(let h=0;h<e.position.length;h+=3)d(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let y=h*3,b=t.iPosition[y],g=t.iPosition[y+1],x=t.iPosition[y+2],v=Math.max(.35,t.iMaxRadius[h]??.35);d(b-v,g,x-v),d(b+v,g+1.6,x+v)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,p=i*.16,c=o-i,u=o+i);let m=[(a+l)/2,(s+p)/2,(c+u)/2],f=Math.max(1,.5*Math.hypot(l-a,p-s,u-c));return{center:m,radius:f,minY:s,maxY:p}}function ti(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let v=0;v<e.count;v++){let A=v*3,S=e.iPosition[A],E=e.iPosition[A+2];S<a&&(a=S),S>c&&(c=S),E<s&&(s=E),E>l&&(l=E)}for(let v of t)a=Math.min(a,v.cx-v.halfX),c=Math.max(c,v.cx+v.halfX),s=Math.min(s,v.cz-v.halfZ),l=Math.max(l,v.cz+v.halfZ);let p=n.minX*N,u=n.maxX*N,d=n.minY*N,m=n.maxY*N,f=p,h=u,y=d,b=m;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,l-s));f=Math.max(p,a-v),h=Math.min(u,c+v),y=Math.max(d,s-v),b=Math.min(m,l+v)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[f,g,y],max:[h,x,b]}}var Ac=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Ic=/[\s"'<>`\\]/;function Ec(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Ac.test(e);if(Ic.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function ni(e){let t=e.trim();return Ec(t)?t:null}var no="seatlayer.event-configuration/1";var ft=100,Rc=120,Tc=1e5,kc=1e4,Lc=/^[a-f0-9]{64}$/,_c=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function _t(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ot(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Fc(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function oi(e){return!Array.isArray(e)||e.length>Tc||!e.every(t=>ot(t,ft))?null:[...new Set(e)].sort()}function Dc(e){return!_t(e)||!ot(e.chartId,ft)||!ot(e.version,ft)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Lc.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function oo(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Oc(e){return _t(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&oo(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Vc(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>kc)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!_t(s)||!ot(s.id,ft)||!ot(s.objectId,ft)||!n.has(s.objectId)||!_c.has(String(s.kind))||!oo(s.heightM,.05,50)||s.baseElevationM!==void 0&&!oo(s.baseElevationM,-10,100))return null;let c=Oc(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let l=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?ni(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!l||s.kind!=="screen"||++i>1))return null;r.add(s.id),o.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function Bc(e){let t=[];if(!_t(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==no&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${no}`}),ot(e.id,ft)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),ot(e.label,Rc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Fc(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Dc(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=_t(e.overlay)?e.overlay:null,o=oi(r?.objectIds),i=oi(r?.productionKillSeatIds),a=o?Vc(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||a===null?{issues:t}:{issues:t,value:{schema:no,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function ri(e){let t=Bc(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function ii(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=ri(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let u of n)for(let d of u.objects)d.type==="shape"&&i.set(d.id,{shape:d,unit:u});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(u=>{let d=u.runtimeContentImageUrl;return[u.id,typeof d=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(d)?d:void 0]})),l=[];for(let u of o.value.overlay.productionElements??[]){let d=i.get(u.objectId),m=d?tt(d.shape):null,f=u.baseElevationM??0;if(!d||!m||m.length<3||!u.id||a.has(u.id)||s.has(u.objectId)||!Number.isFinite(u.heightM)||u.heightM<.05||u.heightM>50||!Number.isFinite(f)||f<-10||f>100)return r();a.add(u.id),s.add(u.objectId);let h=m.map(_=>_.x*N),y=m.map(_=>_.y*N),b=d.unit.baseHeightM+f,g=Math.min(...h),x=Math.max(...h),v=Math.min(...y),A=Math.max(...y),S,E=c.get(u.id)??u.contentImageUrl;if(u.kind==="screen"&&E)if(x-g>=A-v){let _=Math.abs(v-d.unit.focal.y*N)<=Math.abs(A-d.unit.focal.y*N)?v-.006:A+.006;S=[[g,b,_],[x,b,_],[g,b+u.heightM,_],[x,b+u.heightM,_]]}else{let _=Math.abs(g-d.unit.focal.x*N)<=Math.abs(x-d.unit.focal.x*N)?g-.006:x+.006;S=[[_,b,v],[_,b,A],[_,b+u.heightM,v],[_,b+u.heightM,A]]}l.push({id:u.id,objectId:u.objectId,kind:u.kind,floorIndex:d.unit.index,baseY:b,topY:b+u.heightM,bounds:{min:[g,b,v],max:[x,b+u.heightM,A]},occlusion:u.occlusion,...E?{contentImageUrl:E}:{},...S?{contentPlane:S}:{}})}let p=l.sort((u,d)=>u.id.localeCompare(d.id));return{byObjectId:new Map(p.map(u=>[u.objectId,u])),elements:p}}function ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function be(e){return Array.isArray(e)?e:[]}function Nc(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ye(n))continue;let r=ye(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function sn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Gc(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function zc(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function Uc(e){let t=sn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:sn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:sn(e.rotation,4),o=e.scale===void 0?[1,1,1]:sn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,l=Math.hypot(i,a,s,c);if(!(l>1e-8))return null;let p=i/l,u=a/l,d=s/l,m=c/l,f=p+p,h=u+u,y=d+d,b=p*f,g=p*h,x=p*y,v=u*h,A=u*y,S=d*y,E=m*f,_=m*h,O=m*y;return[(1-(v+S))*o[0],(g+O)*o[0],(x-_)*o[0],0,(g-O)*o[1],(1-(b+S))*o[1],(A+E)*o[1],0,(x+_)*o[2],(A-E)*o[2],(1-(b+v))*o[2],0,n[0],n[1],n[2],1]}function Hc(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function jc(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],l=e[10],p=i*l-a*c,u=a*s-o*l,d=o*c-i*s,m=t*p+n*u+r*d;if(Math.abs(m)<1e-12)return null;let f=1/m;return[p*f,u*f,d*f,(r*c-n*l)*f,(t*l-r*s)*f,(n*s-t*c)*f,(n*a-r*i)*f,(r*o-t*a)*f,(t*i-n*o)*f]}function ai(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,a=e[6]*t+e[7]*n+e[8]*r,s=Math.hypot(o,i,a)||1;return o/=s,i/=s,a/=s,[o,i,a]}function Xc(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!r)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!ye(c))return null;r=c}catch{return null}else if(a===5130562&&!o)o=s;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function Yc(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Wc(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Kc(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function qc(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Xc(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ye(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=be(r.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||Nc(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||be(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(be(r.images).length||be(r.textures).length)return{ok:!1,issue:"external_resource"};let a=be(r.buffers);if(a.length!==1||!ye(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=be(r.accessors),c=be(r.bufferViews),l=be(r.meshes),p=be(r.nodes),u=be(r.scenes),d=typeof r.scene=="number"?r.scene:0;if(!ye(u[d]))return{ok:!1,issue:"unsupported_glb"};let m=new DataView(o.buffer,o.byteOffset,o.byteLength),f=(v,A,S)=>{if(typeof v!="number"||!Number.isInteger(v)||!ye(s[v]))return null;let E=s[v];if(E.type!==A||E.sparse!==void 0||E.normalized===!0||typeof E.count!="number"||!Number.isInteger(E.count)||E.count<1||typeof E.componentType!="number"||!S.includes(E.componentType)||typeof E.bufferView!="number")return null;let _=c[E.bufferView];if(!ye(_)||_.buffer!==0||typeof _.byteLength!="number"||!Number.isInteger(_.byteLength)||_.byteLength<0)return null;let O=Wc(E.type),j=Yc(E.componentType),V=typeof _.byteStride=="number"?_.byteStride:O*j,R=typeof _.byteOffset=="number"?_.byteOffset:0,P=typeof E.byteOffset=="number"?E.byteOffset:0,I=R+P,w=P+(E.count-1)*V+O*j;if(!Number.isInteger(V)||!Number.isInteger(R)||!Number.isInteger(P)||V<O*j||R<0||P<0||R+_.byteLength>o.byteLength||w>_.byteLength)return null;let C=[];for(let G=0;G<E.count;G++){let k=[];for(let M=0;M<O;M++){let T=Kc(m,I+G*V+M*j,E.componentType);if(!Number.isFinite(T))return null;k.push(T)}C.push(k)}return C},h=[],y=[],b=0,g=new Set,x=(v,A)=>{if(typeof v!="number"||!Number.isInteger(v)||!ye(p[v])||g.has(v))return!1;g.add(v);let S=p[v],E=Uc(S);if(!E)return!1;let _=zc(A,E),O=jc(_);if(!O)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let j=l[S.mesh];if(!ye(j))return!1;for(let V of be(j.primitives)){if(!ye(V)||V.mode!==void 0&&V.mode!==4||!ye(V.attributes))return!1;let R=f(V.attributes.POSITION,"VEC3",[5126]),P=V.attributes.NORMAL===void 0?null:f(V.attributes.NORMAL,"VEC3",[5126]);if(!R||V.attributes.NORMAL!==void 0&&!P)return!1;let I=R.length;if(V.indices!==void 0){let C=typeof V.indices=="number"?s[V.indices]:null;I=ye(C)?C.count:void 0}if(typeof I!="number"||!Number.isInteger(I)||I%3!==0||(b+=I/3,b>1e5))return!1;let w=V.indices===void 0?R.map((C,G)=>[G]):f(V.indices,"SCALAR",[5121,5123,5125]);if(!w||w.length%3!==0||w.length!==I)return!1;for(let C=0;C<w.length;C+=3){let G=[w[C][0],w[C+1][0],w[C+2][0]];if(G.some(T=>!Number.isInteger(T)||T<0||T>=R.length))return!1;let k=G.map(T=>Hc(_,...R[T])),M=null;if(!P){let T=k[1][0]-k[0][0],D=k[1][1]-k[0][1],B=k[1][2]-k[0][2],U=k[2][0]-k[0][0],H=k[2][1]-k[0][1],L=k[2][2]-k[0][2];M=ai([1,0,0,0,1,0,0,0,1],D*L-B*H,B*U-T*L,T*H-D*U)}for(let T=0;T<3;T++)h.push(...k[T]),y.push(...P?ai(O,...P[G[T]]):M)}}}for(let j of be(S.children))if(!x(j,_))return!1;return g.delete(v),!0};for(let v of be(u[d].nodes))if(!x(v,Gc()))return{ok:!1,issue:b>1e5?"triangle_limit":"unsupported_glb"};return!b||h.length!==b*9||y.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:b,position:new Float32Array(h),normal:new Float32Array(y)}}function si(e){try{return qc(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function pt(e){let{doc:t}=e,n=$o(t.theme),r=n.structure,o=xr(t,e.eventConfigurationId??t.eventConfigurationId),i=ii(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new Qt,c=null;if(e.registeredShellGlb){let w=si(e.registeredShellGlb);if(w.ok){let C=w.position.length/3,G=new Float32Array(w.position.length),k=n.materials.shell??r.tierWall;for(let M=0;M<C;M++){let T=w.normal[M*3+1],D=T<-.25?.4:.62+.38*Math.max(0,T);G[M*3]=k[0]*D,G[M*3+1]=k[1]*D,G[M*3+2]=k[2]*D}c={position:w.position,normal:w.normal,color:G,floor:new Float32Array(C).fill(-2),material:new Float32Array(C),count:C}}}let l=new Map;for(let w of o)for(let C of w.objects)l.set(C.id,w.index),C.type==="section"&&l.set(C.logicalSectionId??C.id,w.index);let p=a.map(w=>l.get(w.sectionId??"")??l.get(w.rowId??"")??0),u=to(o,a);Jr(s,o,a,p,u,r);let d=Pr(t,a),m=new Map,f=new Map;for(let w of t.categories??[])m.set(w.key,w.color),w.seatGlyph&&f.set(w.key,w.seatGlyph);let h=[],y=wr(o,a,p),b=new Float32Array(a.length);for(let w=0;w<o.length;w++){let C=o[w];s.setFloor(w);let G=new on,k=[],M=C.objects.filter(T=>T.type==="section"&&!!T.outline&&T.outline.length>=3);for(let T of C.objects)if(T.type==="section")Gr(s,T,C,Cr(T,d),y.bySection.get(T.id),G,M,r);else if(T.type==="shape"){let D=i.byObjectId.get(T.id);s.setMaterial((D?.kind??T.role)==="screen"?1:0),_r(s,T,C.baseHeightM,Er(T,k),r,C.focal,h,D),s.setMaterial(0)}else T.type==="gaArea"?Dr(s,T,C.baseHeightM,ee(m.get(T.categoryKey)),r):T.type==="booth"?kr(s,T,C.baseHeightM,ee(m.get(T.categoryKey)),r):T.type==="table"?Lr(s,T,C.baseHeightM,ee(m.get(T.categoryKey)),r):T.type==="decorImage"&&Fr(s,T,C.baseHeightM,r);zr(s,C,a,y,r,n.materials.shell,!c)}let g=o.length>1?{x:o.reduce((w,C)=>w+C.focal.x,0)/o.length,y:o.reduce((w,C)=>w+C.focal.y,0)/o.length}:t.focalPoint??{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2},x=Yo(c?[s.build(),c]:[s.build()]),v=Zo(a,e.initialState,y,b,m,f),A=qr({doc:t,units:o,seats:a,surfaces:y,focal:g}),{labels:S,sections:E,rows:_}=Qr({doc:t,units:o,seats:a,surfaces:y,seatData:v,hintedSeatFloor:p,zones:A,focal:g}),O=$r({doc:t,units:o,seats:a,surfaces:y,solids:x,hintedSeatFloor:p,seatFloor:b});Zr(S,O),v.iYaw=qo(v.iPosition,a.length,w=>a[w].rowId,w=>{let C=o[b[w]]?.focal??g;return[C.x*N,C.y*N]});let j=(u.minX+u.maxX)/2*N,V=(u.minY+u.maxY)/2*N,R=.5*Math.hypot((u.maxX-u.minX)*N,(u.maxY-u.minY)*N)||10,P=ei(x,v,{cx:j,cz:V,radius:R}),I=ti(v,h,u,P.minY,P.maxY,R);return{solids:x,seats:v,bounds:{center:[(I.min[0]+I.max[0])/2,(I.min[1]+I.max[1])/2,(I.min[2]+I.max[2])/2],radius:R,groundY:0,box:I},renderBounds:{center:P.center,radius:P.radius},stateColorLUT:Jo(n,Ce),theme:n,seatCount:a.length,focalWorld:[g.x*N,1.5,g.y*N],zones:A,stages:h,productionElements:i.elements,sections:E,rows:_,labels:S,floors:O}}var Qc=88,Zc=20,ci={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}},cn=new Set(["row","seat"]),li={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},ln={row:{x:62,y:16},seat:{x:46,y:18}},ui=ee,ro=e=>wo(e);function di(e,t){let n=ro(e),r=ro(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function io(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 $c(e,t=[.04,.06,.1],n=!0){let r=ro(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?io(i,t):t,s=ui(e),c=n?7:4.5,l=s&&di(s,a)>=c?e:o;return r?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}var un=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=jr(o,i,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let g of this.labels){if(!s.has(g.kind))continue;let x=Xe(t,g.anchor,n,r);if(!x.visible)continue;let v=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:x,focus:Wr(x,v,n,r),halfWidth:Yr(g.text,ci[g.kind].size,!cn.has(g.kind))/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let l=Hr(c.filter(g=>g.label.kind==="floor"),n),p=[...c.filter(g=>!cn.has(g.label.kind)&&g.label.kind!=="floor"),...l],u=Xr(p,Qc,Zc),d=eo(c.filter(g=>g.label.kind==="row"),ln.row.x,ln.row.y,Jn.row,u),m=eo(c.filter(g=>g.label.kind==="seat"),ln.seat.x,ln.seat.y,Jn.seat,[...u,...d]),f=[...u,...d,...m],h=new Set(f.map(g=>g.label.id));for(let{label:g,screen:x}of f){let A=this.nodeFor(g).style;A.display="",A.transform=`translate(-50%, -50%) translate(${x.x.toFixed(1)}px, ${x.y.toFixed(1)}px)`}let y=f.filter(({label:g})=>!cn.has(g.kind)).sort((g,x)=>li[x.label.kind]-li[g.label.kind]||g.screen.depth-x.screen.depth||g.focus-x.focus),b=[];for(let{label:g}of y){let x=this.nodes.get(g.id);if(!x||x.style.display==="none")continue;let v=x.getBoundingClientRect();b.some(S=>v.left<S.right+3&&v.right+3>S.left&&v.top<S.bottom+3&&v.bottom+3>S.top)?x.style.display="none":b.push(v)}for(let[g,x]of this.nodes)h.has(g)||(x.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let u=n.style;u.position="absolute",u.left="0",u.top="0",u.whiteSpace="nowrap",u.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",u.display="none",this.root.appendChild(n),this.nodes.set(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=ci[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=!cn.has(t.kind),s=$c(t.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"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=ui(r?"#ecf8ff":s.ink)??[1,1,1],p=r?io("rgba(10,28,45,.9)",c):a?io(s.backing,c):c;return n.dataset.qualityContrast=di(l,p).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var fi=1;var Jc=new Set(["floor","zone","section","ga","booth","annotation"]);function el(e){return e.every(t=>Number.isFinite(t))}function tl(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 mi(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function rt(e){return Math.round(e*1e4)/1e4}function nl(e){if(e)return{box:{x:rt(e.box.x),y:rt(e.box.y),width:rt(e.box.width),height:rt(e.box.height)},horizontalFillRatio:rt(e.horizontalFillRatio),verticalFillRatio:rt(e.verticalFillRatio),visibleAreaRatio:rt(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Te(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function dn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Jc.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)tl(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=[Te("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Te("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Te("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Te("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}`}]),Te("camera-invalid","The capture camera must have a finite physical pose",el(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Te("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}]),Te("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`}]),Te("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}))),Te("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}))),Te("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:nl(e.framing)},metrics:{minimumHierarchyFontPx:mi(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:mi(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var se=require("ogl");var Ye=require("ogl");var mn=`
|
|
21
21
|
float chairWeight(float depth) {
|
|
22
22
|
return 1.0 - smoothstep(uChairFull, uChairNone, depth);
|
|
23
|
-
}`,
|
|
23
|
+
}`,pi=`
|
|
24
24
|
float occupantWeight(float depth) {
|
|
25
|
-
float nearWeight = smoothstep(${
|
|
26
|
-
float farWeight = 1.0 - smoothstep(${
|
|
25
|
+
float nearWeight = smoothstep(${ko.toFixed(1)}, ${Lo.toFixed(1)}, depth);
|
|
26
|
+
float farWeight = 1.0 - smoothstep(${Ro.toFixed(1)}, ${To.toFixed(1)}, depth);
|
|
27
27
|
return nearWeight * farWeight;
|
|
28
|
-
}`,
|
|
28
|
+
}`,hi=`
|
|
29
29
|
float glyphEq(float glyph, float expected) {
|
|
30
30
|
return 1.0 - step(0.25, abs(glyph - expected));
|
|
31
31
|
}
|
|
@@ -335,8 +335,8 @@ out float vDim;
|
|
|
335
335
|
out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
|
|
336
336
|
out vec3 vOccupantTint;
|
|
337
337
|
${mn}
|
|
338
|
-
${fi}
|
|
339
338
|
${pi}
|
|
339
|
+
${hi}
|
|
340
340
|
void main() {
|
|
341
341
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
342
342
|
float viewDepth = -anchor.z;
|
|
@@ -570,8 +570,8 @@ uniform float uFocusFloor;
|
|
|
570
570
|
flat out vec3 vPick;
|
|
571
571
|
out float vHidden;
|
|
572
572
|
${mn}
|
|
573
|
-
${fi}
|
|
574
573
|
${pi}
|
|
574
|
+
${hi}
|
|
575
575
|
void main() {
|
|
576
576
|
int id = int(iPickIndex + 0.5); // already global index + 1
|
|
577
577
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -630,7 +630,7 @@ out vec4 fragColor;
|
|
|
630
630
|
void main() {
|
|
631
631
|
if (vHidden > 0.5) discard;
|
|
632
632
|
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
633
|
-
}`;function
|
|
633
|
+
}`;function bi(e){return new Ye.Program(e,{vertex:dl,fragment:ml,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Oe},uSeatScale:{value:1},uMinPixels:{value:ct},uPixelToWorld:{value:.002},uChairFull:{value:Pt},uChairNone:{value:lt},uFocusFloor:{value:-1}}})}function yi(e){return new Ye.Program(e,{vertex:fl,fragment:pl,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:Pt},uChairNone:{value:lt},uBackRake:{value:Bn},uBackBase:{value:Jt},uFocusFloor:{value:-1}}})}function gi(e){return new Ye.Program(e,{vertex:hl,fragment:bl,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function xi(e,t=.78){return new Ye.Program(e,{vertex:ol,fragment:rl,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:t}}})}function vi(e){return new Ye.Program(e,{vertex:il,fragment:al,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Oe},uSeatScale:{value:1},uMinPixels:{value:ct},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:Pt},uChairNone:{value:lt}}})}function Si(e,t=.78){return new Ye.Program(e,{vertex:sl,fragment:cl,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:Pt},uChairNone:{value:lt},uBackRake:{value:Bn},uBackBase:{value:Jt},uFocusFloor:{value:-1},uRoughness:{value:t}}})}function Mi(e,t,n){return new Ye.Program(e,{vertex:ll,fragment:ul,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function wi(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 yl=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),gl=new Float32Array([-1,-1,3,-1,-1,3]);function Pi(e,t){let n=new se.Transform,r=new se.Transform,o=new se.Geometry(e,{position:{size:2,data:gl}}),i=Mi(e,t.theme.background.top,t.theme.background.bottom),a=new se.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new se.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=xi(e,t.theme.materials.roughness),l=new se.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let p=vi(e),u=new Float32Array(t.seats.count*3),d=Ce.map(L=>t.theme.seatStates[L]);wi(u,t.seats.iState,0,t.seats.count,d,t.seats.iCategory);let m=new se.Geometry(e,{position:{size:2,data:yl},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:u,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),f=new se.Mesh(e,{geometry:m,program:p});f.frustumCulled=!1,t.seats.count>0&&f.setParent(n);let h=m.attributes.iColor,y=Ko(),b=Si(e,t.theme.materials.roughness),g=Yt,x=new Float32Array(g*3),v=new Float32Array(g*3),A=new Float32Array(g),S=new Float32Array(g),E=new Float32Array(g),_=new Float32Array(g*3),O=new Float32Array(g),j=new Float32Array(g),V=new Float32Array(g),R=new Float32Array(g),P=new se.Geometry(e,{position:{size:3,data:y.position},normal:{size:3,data:y.normal},part:{size:1,data:y.part},index:{data:y.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:v,instanced:1},iRadius:{size:1,data:A,instanced:1},iYaw:{size:1,data:S,instanced:1},iGlyph:{size:1,data:E,instanced:1},iRing:{size:3,data:_,instanced:1},iFloor:{size:1,data:O,instanced:1},iPhysicalSeat:{size:1,data:j,instanced:1},iSeed:{size:1,data:R,instanced:1},iPickIndex:{size:1,data:V,instanced:1}}),I=new se.Mesh(e,{geometry:P,program:b});I.frustumCulled=!1;let w=0,C=!1,G=!1,k=null,M=null,T=null,D=new Int32Array(0),B=()=>{let L=t.seats;for(let F=0;F<w;F++){let X=D[F];R[F]=Qo(L.iState[X],X);let q=L.iCategory&&L.iState[X]===0?null:d[L.iState[X]]??d[0];if(q)v[F*3]=q[0],v[F*3+1]=q[1],v[F*3+2]=q[2];else{let Q=t.theme.materials.seat??Co([L.iCategory[X*3],L.iCategory[X*3+1],L.iCategory[X*3+2]]);v[F*3]=Q[0],v[F*3+1]=Q[1],v[F*3+2]=Q[2]}}P.attributes.iColor.needsUpdate=!0,P.attributes.iSeed.needsUpdate=!0},U={main:n,background:r,seatProgram:p,solidProgram:c,chairProgram:b,seatGeometry:m,chairGeometry:P,solidGeometry:s,drawCalls:3,setNearSeats(L,F){let X=Math.min(F,g);if(D=L,w=X,X===0){I.parent&&I.setParent(null),P.instancedCount=0,U.drawCalls=3+(C?1:0);return}let W=t.seats;for(let q=0;q<X;q++){let Q=L[q];x[q*3]=W.iPosition[Q*3],x[q*3+1]=W.iPosition[Q*3+1],x[q*3+2]=W.iPosition[Q*3+2],A[q]=W.iChairWidth[Q],S[q]=W.iYaw[Q],E[q]=W.iGlyph[Q],_[q*3]=W.iRing[Q*3],_[q*3+1]=W.iRing[Q*3+1],_[q*3+2]=W.iRing[Q*3+2],O[q]=W.iFloor[Q],j[q]=W.iPhysicalSeat[Q],V[q]=Q+1}B(),P.attributes.iOffset.needsUpdate=!0,P.attributes.iRadius.needsUpdate=!0,P.attributes.iYaw.needsUpdate=!0,P.attributes.iGlyph.needsUpdate=!0,P.attributes.iRing.needsUpdate=!0,P.attributes.iFloor.needsUpdate=!0,P.attributes.iPhysicalSeat.needsUpdate=!0,P.attributes.iSeed.needsUpdate=!0,P.attributes.iPickIndex.needsUpdate=!0,P.instancedCount=X,I.parent||I.setParent(n),U.drawCalls=4+(C?1:0)},nearSeatCount(){return w},uploadSeatStateRuns(L){if(!L.length)return;w&&B();for(let X of L)wi(u,t.seats.iState,X.start,X.length,d,t.seats.iCategory);let F=h.buffer;if(!F){h.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,F);for(let X of L){let W=u.subarray(X.start*3,(X.start+X.length)*3);e.bufferSubData(e.ARRAY_BUFFER,X.start*3*Float32Array.BYTES_PER_ELEMENT,W)}},dispose(){G=!0,o.remove(),i.remove(),s.remove(),c.remove(),m.remove(),p.remove(),P.remove(),b.remove(),k?.remove(),M?.remove(),T?.texture&&e.deleteTexture(T.texture)}},H=t.productionElements.find(L=>L.contentImageUrl&&L.contentPlane);if(H?.contentImageUrl&&H.contentPlane?.length===4&&typeof Image<"u"){let L=new Image;L.crossOrigin="anonymous",L.onload=()=>{if(G)return;let F=H.contentPlane;k=new se.Geometry(e,{position:{size:3,data:new Float32Array(F.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(H.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),T=new se.Texture(e,{image:L,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),M=new se.Program(e,{vertex:`#version 300 es
|
|
634
634
|
precision highp float;
|
|
635
635
|
in vec3 position; in vec2 uv; in float floorIndex;
|
|
636
636
|
uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
|
|
@@ -638,4 +638,4 @@ void main() {
|
|
|
638
638
|
void main(){ vUv=uv; vDim=(uFocusFloor < -0.5 || abs(floorIndex-uFocusFloor)<0.5)?0.0:1.0; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }`,fragment:`#version 300 es
|
|
639
639
|
precision highp float;
|
|
640
640
|
in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
|
|
641
|
-
void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:T},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let X=new se.Mesh(e,{geometry:k,program:M});X.frustumCulled=!1,X.setParent(n),U.screenProgram=M,C=!0,U.drawCalls=3+(w?1:0)+1},L.src=H.contentImageUrl}return U}var ke=require("ogl");function xl(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function Pi(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 p=(c*t+l)*4,u=xl(e[p],e[p+1],e[p+2]);if(u<0||u>=i)continue;let d=l-r,m=c-o,f=d*d+m*m;f<s&&(s=f,a=u)}return a}function Ci(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 vl=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],fn=class{constructor(t,n,r,o,i){this.seatScene=new ke.Transform;this.chairScene=new ke.Transform;this.solidScene=new ke.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=hi(this.gl),this.chairProg=bi(this.gl),this.depthProg=yi(this.gl);let a=new ke.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new ke.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new ke.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 vl)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 ke.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),p=Math.max(0,r-o),u=Math.max(1,Math.min(s,n+o+1)-l),d=Math.max(1,Math.min(c,r+o+1)-p);i.enable(i.SCISSOR_TEST),i.scissor(l,p,u,d);let[m,f,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(m,f,h,1),i.disable(i.SCISSOR_TEST);let y=new Uint8Array(u*d*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,p,u,d,i.RGBA,i.UNSIGNED_BYTE,y),this.renderer.bindFramebuffer(),Pi(y,u,d,n-l,r-p,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Ai(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,wt(r.state)):n.push(r);return n}function Ii(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:Ce[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 We=require("ogl");function Sl(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Ei(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Ml(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ri(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 ao(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function so(e,t){return Math.max(0,Math.min(1,e+t))}function Ti(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],p=e[Math.min(n-1,i+2)],u=a*a,d=u*a,m=[0,0,0];for(let f=0;f<3;f++)m[f]=.5*(2*c[f]+(-s[f]+l[f])*a+(2*s[f]-5*c[f]+4*l[f]-p[f])*u+(-s[f]+3*c[f]-3*l[f]+p[f])*d);return m}function co(e,t,n,r,o){let i=Ri(Sl(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Ei(Ei(t,Ml(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=Ri(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,o),p=[r[0]+c[0]*l*1.3,r[1]+l*.75,r[2]+c[2]*l*1.3];return{waypoints:[e,p,a],finalPos:a}}function lo(e,t,n=35,r=28){let o=ao(t),i=Ti(e,o),a=ao(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Fi(e,t,n){let r=e.position.clone(),o=new We.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new We.Vec3(n[0],n[1],n[2]));let i=new We.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var pn=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new We.Quat;this.endQuat=new We.Quat;this.outQuat=new We.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}=lo(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,so(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 wl=1.02,Pl=1.5;function Di(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+wl;return{eye:[e[0],o,e[2]],focal:[t.x*N,n+Pl,t.y*N]}}var bt=Math.PI/180,Cl=45,Oi=80,Al=.25,uo=1,Il=.25,El=12*bt,Rl=.2,Tl=1.5,Vi=.8,Bi=6,Ui=1.9,kl=2/3,Ll=.12,_l=.9,Fl=1.2,Dl=2,Hi=.05,Ol=6;function ji(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+Vi,t[1]),t[2]+6]};let r=1/0,o=-1/0,i=1/0,a=-1/0,s=n;for(let f of e)r=Math.min(r,f.cx-f.halfX),o=Math.max(o,f.cx+f.halfX),i=Math.min(i,f.cz-f.halfZ),a=Math.max(a,f.cz+f.halfZ),s=Math.max(s,f.y);let c=o-r,l=a-i,p=Math.max(c,Math.min(l,Bi))/2,u=Math.max(l,Math.min(c,Bi))/2,d=(r+o)/2,m=(i+a)/2;return{min:[d-p,n,m-u],max:[d+p,Math.max(n+Vi,s),m+u]}}function Vl(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Ui,e.max[2]]}}function Bl(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Tl,t+Rl,t+Ui*kl),(e.min[2]+e.max[2])/2]}function Xi(e,t){let n=e[0]-t[0],r=e[2]-t[2],o=Math.hypot(n,r);return o<.001?{x:0,z:1}:{x:n/o,z:r/o}}function Ni(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let p=1/0,u=-1/0;for(let d=0;d<8;d++){let m=(d&1?n.max[0]:n.min[0])-e[0],f=(d&2?n.max[1]:n.min[1])-e[1],h=(d&4?n.max[2]:n.min[2])-e[2],y=Math.max(Hi,m*r+f*o+h*i),b=(m*s+h*c)/y;b<p&&(p=b),b>u&&(u=b)}return u-p}function Gi(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let p=-c*o,u=c*r-s*i,d=s*o,m=1/0,f=-1/0;for(let h=0;h<8;h++){let y=(h&1?n.max[0]:n.min[0])-e[0],b=(h&2?n.max[1]:n.min[1])-e[1],g=(h&4?n.max[2]:n.min[2])-e[2],x=Math.max(Hi,y*r+b*o+g*i),v=(y*p+b*u+g*d)/x;v<m&&(m=v),v>f&&(f=v)}return f-m}function hn(e,t){return Math.tan(e*bt/2)*Math.max(.05,t)}function zi(e,t,n){let r=s=>Math.max(Cl,Math.min(Oi,s)),o=s=>2*Math.atan(s)/bt,i=Number.isFinite(e)&&e>0?r(o(e/(2*Al)/Math.max(.05,n))):Oi;if(!(Number.isFinite(t)&&t>0))return i;let a=Math.min(i,r(o(t/(2*Ll))));return e/(2*hn(a,n))>uo?i:a}function Yi(e,t,n){let r=Bl(t),o=[e[0],e[1],e[2]],i=0,a=0,s=m=>{if(!(m>0))return;let f=Xi(o,r);o[0]+=f.x*m,o[2]+=f.z*m,a+=m},c=t.max[1]+Il-o[1];c>0&&(o[1]+=c,i=c,s(c/Math.tan(El)));let l=Vl(t),p=Ni(o,r,t),u=zi(p,Gi(o,r,l),n),d=p/(2*hn(u,n));for(let m=0;m<Ol&&d>uo;m++){let f=Math.max(1,Math.hypot(o[0]-r[0],o[2]-r[2])),h=Number.isFinite(d)?d/uo:2;s(Math.min(60,f*(Math.min(4,h)-1)+.5)),p=Ni(o,r,t),u=zi(p,Gi(o,r,l),n),d=p/(2*hn(u,n))}return{eye:o,focal:r,fov:u,raisedM:i,pulledBackM:a,stageFrameWidth:d}}function Nl(e,t,n){let r=Math.tan(t*bt/2),o=hn(t,n);return Math.max(1,e/Math.max(.05,Math.min(r,o)))}function Wi(e,t){let{aspect:n,venue:r}=t,o=e.focal,i=Xi(e.eye,o),a=d=>(d[0]-o[0])*i.x+(d[2]-o[2])*i.z,s=[{name:"seat",eye:e.eye,focal:o,fov:e.fov}],c=Dl*(t.rowDepthM??_l);s.push({name:"row",eye:[e.eye[0]+i.x*c,e.eye[1]+Fl,e.eye[2]+i.z*c],focal:o,fov:e.fov});let l=(d,m,f,h)=>{let y=Nl(f,e.fov,n)*1.08,b=y*Math.sin(h*bt),g=y*Math.cos(h*bt);return{name:d,eye:[m[0]+i.x*g,m[1]+b,m[2]+i.z*g],focal:m,fov:e.fov}};t.section&&t.section.radius>0&&s.push(l("section",t.section.center,t.section.radius,14)),s.push(l("venue",r.center,Math.max(1,r.radius),26));let p=[],u=-1/0;for(let d of s){let m=a(d.eye);p.length&&m<=u+.5||(p.push(d),u=m)}return p}var $i=require("ogl"),Dt=Math.PI/180,Ki=320,qi=70*Dt,Gl=32*Dt,zl=24*Dt,Qi=.0026,Ul=.22,Hl=.006,jl=180,Xl=4,ge=(e,t,n)=>Math.max(t,Math.min(n,e)),Zi=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Ji(e){let{canvas:t,camera:n}=e,r=[],o=!1,i=0,a=0,s=0,c=0,l=0,p=0,u=!1,d=[0,0],m=0,f=!1,h=null,y=null,b=new Map,g=!1,x=0,v=0,A=0,S=0,E=()=>o&&r.length?r[ge(Math.round(i),0,r.length-1)].name:null,_=()=>{let M=E();M!==h&&(h=M,e.onStopChange?.(M))},O=()=>{if(!o||!r.length)return;let M=r[ge(Math.floor(i),0,r.length-1)],T=r[ge(Math.ceil(i),0,r.length-1)],D=ge(i-Math.floor(i),0,1),B=(Me,we)=>Me+(we-Me)*D,U=[B(M.eye[0],T.eye[0]),B(M.eye[1],T.eye[1]),B(M.eye[2],T.eye[2])],H=[B(M.focal[0],T.focal[0]),B(M.focal[1],T.focal[1]),B(M.focal[2],T.focal[2])],L=H[0]-U[0],F=H[1]-U[1],X=H[2]-U[2],W=Math.hypot(L,F,X)||1,q=Math.atan2(L,X),Q=Math.asin(ge(F/W,-1,1)),$=q+a,re=ge(Q+s,-80*Dt,80*Dt),Ae=Math.cos(re)*W;L=Math.sin($)*Ae,F=Math.sin(re)*W,X=Math.cos($)*Ae,n.position.set(U[0],U[1],U[2]),n.fov=B(M.fov,T.fov),n.updateProjectionMatrix(),n.lookAt(new $i.Vec3(U[0]+L,U[1]+F,U[2]+X)),e.onApplied?.()},j=()=>{if(!o||!r.length)return;let M=ge(Math.round(i),0,r.length-1);if(e.reducedMotion()){u=!1,i=M,O(),_(),e.requestRender();return}if(Math.abs(M-i)<.001){u=!1,_();return}c=i,l=M,p=performance.now(),u=!0,e.requestRender()},V=M=>{!o||r.length<2||(u=!1,i=ge(i+M,0,r.length-1),O(),_(),e.requestRender())},R=(M,T)=>{o&&(u=!1,f=!1,a=ge(a-M*Qi,-qi,qi),s=ge(s-T*Qi,-zl,Gl),O(),e.requestRender())},P=M=>{o&&(b.set(M.pointerId,{x:M.clientX,y:M.clientY}),b.size===1?(g=!0,S=0,x=M.clientX,v=M.clientY):b.size===2&&(g=!1,A=I()))},I=()=>{let M=[...b.values()];return M.length<2?0:Math.hypot(M[0].x-M[1].x,M[0].y-M[1].y)},w=M=>{if(!o||!b.has(M.pointerId))return;if(b.set(M.pointerId,{x:M.clientX,y:M.clientY}),b.size>=2){let B=I();A>0&&V((A-B)*Hl),A=B;return}if(!g)return;let T=M.clientX-x,D=M.clientY-v;x=M.clientX,v=M.clientY,S+=Math.abs(T)+Math.abs(D),!(S<=Xl)&&R(T,D)},C=M=>{b.delete(M.pointerId)&&(b.size<2&&(A=0),b.size===0&&(g=!1,j()))},G=M=>{if(!o)return;M.preventDefault();let T=M.deltaMode===1?16:M.deltaMode===2?100:1,D=ge(M.deltaY*T/100,-2,2);V(D*Ul),y&&clearTimeout(y),y=setTimeout(()=>{y=null,j()},jl)},k=()=>{o&&(o=!1,u=!1,f=!1,r=[],b.clear(),g=!1,y&&(clearTimeout(y),y=null),h!==null&&(h=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",P),t.addEventListener("pointermove",w),t.addEventListener("pointerup",C),t.addEventListener("pointercancel",C),t.addEventListener("wheel",G,{passive:!1}),{get active(){return o},enter(M){if(M.length<2){k();return}r=M,o=!0,i=0,a=0,s=0,u=!1,f=!1,h=null,O(),_(),e.requestRender()},exit:k,recentre(){return o?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(f=!1,a=0,s=0,O(),e.requestRender(),!0):(d=[a,s],m=performance.now(),f=!0,e.requestRender(),!0):!1},update(M){if(!o)return!1;let T=!1;if(f){let D=ge((M-m)/Ki,0,1),B=1-Zi(D);a=d[0]*B,s=d[1]*B,D>=1?(f=!1,a=0,s=0):T=!0}if(u){let D=ge((M-p)/Ki,0,1);i=c+(l-c)*Zi(D),D>=1?(u=!1,i=l,_()):T=!0}return O(),T},currentStop:E,dispose(){k(),t.removeEventListener("pointerdown",P),t.removeEventListener("pointermove",w),t.removeEventListener("pointerup",C),t.removeEventListener("pointercancel",C),t.removeEventListener("wheel",G)}}}var ho=null;function ma(){return ho??=Promise.resolve().then(()=>(da(),ua)).catch(e=>{throw ho=null,e}),ho}var fa=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Sn=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=fa(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(fa()-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 pa(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function ha(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let u=a();Object.assign(s.style,u?{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:(u,d,m=!1)=>{if(l(),e.isDisposed())return null;let f=document.createElement("div");f.setAttribute("role","group"),Object.assign(f.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let h=o.get(u),y=h?.sectionId?n.sections.find(_=>_.id===h.sectionId):void 0,b=h?.label??u;f.setAttribute("aria-label",`Explore views near ${y?.label?`${y.label}, `:""}seat ${b}`);let g=document.createElement("span");g.textContent=r.seatViewCaption?.(u)??["Live 3D seat view",y?.label,b].filter(Boolean).join(" \xB7 "),Object.assign(g.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),f.appendChild(g);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(x);let v=h?.rowId?i.get(h.rowId):void 0,A=v?.indexOf(u)??-1,S=A>=0?[v?.[A-1],v?.[A+1]]:[void 0,void 0],E=(_,O,j,V=!1)=>{let R=document.createElement("button");R.type="button",R.textContent=_,R.setAttribute("aria-label",O),Object.assign(R.style,{minHeight:"44px",padding:V?"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"}),V||(R.style.minWidth="44px"),V&&(R.dataset.panoramaTrigger=""),R.addEventListener("click",j),x.appendChild(R)};if(S[0]){let _=o.get(S[0])?.label??S[0];E("\u2039",`View previous seat ${_}`,()=>{e.flyToSeat(S[0])})}if(r.getSeatView){let _=r.seatViewActionLabel?.(u)??"Open 360\xB0 panorama";E(m?`\u21BB Retry ${_}`:`\u25C9 ${_}`,`${m?"Retry":_} from seat ${b}`,()=>{if(e.isDisposed()||d!==e.flightGen()){l();return}l(),e.openPanorama(u,400,d)},!0)}if(S[1]){let _=o.get(S[1])?.label??S[1];E("\u203A",`View next seat ${_}`,()=>{e.flyToSeat(S[1])})}return x.childElementCount?(t.appendChild(f),s=f,c(),f):null},remove:l,layout:c}}function ba(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 p=document.createElement("button");p.type="button",p.textContent="\u2212",p.setAttribute("aria-label","Zoom out of the 3D venue"),p.dataset.tooltip="Zoom out";let u=document.createElement("button");u.type="button",u.textContent="+",u.setAttribute("aria-label","Zoom into the 3D venue"),u.dataset.tooltip="Zoom in";for(let h of[c,l,p,u])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(u,p);let d=h=>{n.setPrimaryDragMode(h);let y=h==="orbit";c.setAttribute("aria-pressed",String(y)),l.setAttribute("aria-pressed",String(!y)),c.style.background=y?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=y?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=y?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>d("orbit")),l.addEventListener("click",()=>d("pan")),p.addEventListener("click",()=>n.zoomBy(1.22)),u.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),d("orbit"),t.appendChild(o);let m=()=>{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",u.style.display=h?"none":"",p.style.display=h?"none":""};return m(),{element:o,utilityControls:s,setNavigationMode:d,setSeatViewLocked:h=>{i=h,n.setInteractionEnabled(!h),m()},seatViewLocked:()=>i,layout:m}}function ya(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:p,tapMs:u,cancelFlight:d,focusSectionCamera:m,setSelection:f,ensureSeatView:h}=e,y=0,b=0,g=0,x=-1,v=!1,A=!1,S=V=>{e.seatViewLocked()||x===-1&&(x=V.pointerId,y=V.clientX,b=V.clientY,g=performance.now(),v=!1,A=a.active,a.active&&(s.cinematicCancelled(),d(),i.onViewTargetChange?.(null)))},E=V=>{V.pointerId===x&&Math.hypot(V.clientX-y,V.clientY-b)>p&&(v=!0)},_=(V,R,P,I,w)=>{let C=t.canvas.getBoundingClientRect(),G=t.canvas.clientWidth||C.width||1,k=t.canvas.clientHeight||C.height||1,M=V-C.left,T=R-C.top,D=I*I,B=-1,U=D,H=1/0;for(let L of o){if(P&&L.sectionId!==P)continue;let F=r.seats.idToIndex.get(L.id);if(F===void 0)continue;if(w){let re=Math.round(r.seats.iState[F]??0);if(re!==0&&re!==3)continue}let X=F*3,W=Xe(n.camera.projectionViewMatrix,[r.seats.iPosition[X],r.seats.iPosition[X+1]+.55,r.seats.iPosition[X+2]],G,k);if(!W.visible)continue;let q=W.x-M,Q=W.y-T,$=q*q+Q*Q;($<U||Math.abs($-U)<1&&W.depth<H)&&(B=F,U=$,H=W.depth)}return B},O=(V,R)=>{let P=e.gpu(),I=e.pick();if(!P||!I)return-1;I.syncFromSeatProgram(P.seatProgram);let w=t.canvas.getBoundingClientRect(),C=t.renderer.dpr,{x:G,y:k}=Ci(V,R,w,C,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),M=Math.max(2,Math.round(8*C));return I.pick(n.camera,G,k,M)};return{onDown:S,onMove:E,onUp:V=>{if(V.pointerId!==x)return;let R=!v&&performance.now()-g<u;if(x=-1,A){A=!1;return}let P=e.gpu(),I=e.pick();if(!R||!P||!I)return;let w=O(V.clientX,V.clientY);if(e.focusedSectionId()&&w>=0){let k=c[w],M=k?l.get(k):void 0;if(M&&M!==e.focusedSectionId()&&m(M))return}if(e.focusedSectionId()&&w<0&&(w=_(V.clientX,V.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&w<0){let k=_(V.clientX,V.clientY,null,72,!1),M=k>=0?c[k]:void 0,T=M?l.get(M):void 0;if(T&&T!==e.focusedSectionId()&&m(T))return}if(!e.focusedSectionId()){w<0&&(w=_(V.clientX,V.clientY,null,42,!1));let k=w>=0?c[w]:void 0,M=k?l.get(k):void 0;if(M&&m(M))return}if(w<0||w>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let C=c[w],G=Ce[Math.round(r.seats.iState[w]??0)]??"available";if(G!=="available"&&G!=="selected"){i.onSeatInspect?.(C,G);return}if(e.selection().has(C)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null),i.onSeatPick?.(C);return}f([C]),h(C),s.seatPicked(C,l.get(C)),i.onSeatPick?.(C)}}}var Mn=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 m=0;m<this.count;m++){let f=t[m*3],h=t[m*3+2];f<n&&(n=f),f>o&&(o=f),h<r&&(r=h),h>i&&(i=h)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,l=new Int32Array(c+1),p=m=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((t[m*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[m*3+2]-r)/this.cell)))*this.cols+f};for(let m=0;m<this.count;m++)l[p(m)+1]++;for(let m=0;m<c;m++)l[m+1]+=l[m];let u=new Int32Array(this.count),d=l.slice(0,c);for(let m=0;m<this.count;m++)u[d[p(m)]++]=m;this.cellStart=l,this.cellItems=u}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),p=Math.floor((n-this.minZ)/this.cell),u=Math.ceil(r/this.cell)+1,d=this.iPosition,m=0;for(let f=0;f<=u&&m<s;f++){let h=p-f,y=p+f,b=l-f,g=l+f;for(let x=h;x<=y&&m<s;x++){if(x<0||x>=this.rows)continue;let v=x===h||x===y;for(let A=b;A<=g&&m<s;A++){if(!v&&A!==b&&A!==g){A=g-1;continue}if(A<0||A>=this.cols)continue;let S=x*this.cols+A;for(let E=i[S],_=i[S+1];E<_&&m<s;E++){let O=a[E],j=d[O*3]-t,V=d[O*3+2]-n;j*j+V*V<=c&&(o[m++]=O)}}}}return m}};var wn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Yt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new Mn(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)<_n)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>Ln){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Ln,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 Pn=require("ogl");function ga(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:p}=e,u=0,d=-1,m=(A,S,E=28)=>{o.camera.position.set(A[0],A[1],A[2]),o.camera.lookAt(new Pn.Vec3(S[0],S[1],S[2])),o.camera.fov=E,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.textContent="\u2302",f.setAttribute("aria-label","Fit the active level or whole venue in view"),f.dataset.tooltip="Fit view",Object.assign(f.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let h=()=>{f.textContent="\u2302"};h();let y=A=>{d=A;let S=e.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=A,S.solidProgram.uniforms.uFocusFloor.value=A,S.chairProgram.uniforms.uFocusFloor.value=A),e.showSectionSeatLabels(null)},b=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),f.style.display="",c.setVisible(!0),e.setFrozen(!1);let A=d>=0?n.floors[d]:null;if(e.setNearFieldDetailEnabled(!!A),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),A){let S=A.focalWorld[0]-A.center[0],E=A.focalWorld[2]-A.center[2],_=Math.hypot(S,E)>A.radius*.12?Math.atan2(S,E):l,O={center:A.center,radius:A.radius,box:A.box},j={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(O,!1,_,!1,j):o.frameSoft(O,_,!1,j)}else e.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,p):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,p);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{u++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=A=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let S=n.seats.idToIndex.get(A);if(S===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(A),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),f.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let E=e.inSeatView()&&r.arriveAtSeatEye===!0;e.setSeatStepping(E),e.setSeatViewLocked(!1);let _=++u;E?e.showArriveChip(A,_):e.removeArriveChip();let{eye:O,focal:j}=e.resolvedSeatViewPose(A,S),V=r.arriveAtSeatEye?e.seatViewArrival(A,S):null,R=V?V.focal:j,P=[o.camera.position.x,o.camera.position.y,o.camera.position.z],I=co(P,V?.eye??O,R,n.bounds.center,n.bounds.radius),w=V?V.eye:r.arriveAtSeatEye?O:I.finalPos,C=V?V.fov:r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,G=[I.waypoints[0],I.waypoints[1],w];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),m(w,R,C),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),V&&e.enterSeatView(V.stops),e.showArriveChip(A,_),Promise.resolve();let k=new Pn.Quat().copy(o.camera.quaternion),M=Fi(o.camera,w,R);s.requestRender();let T=E?700:2500;return i.start(G,k,M,T,C).then(()=>{e.isDisposed()||_!==u||(e.setSeatStepping(!1),a.cinematicPlayed(T),o.resumeAfterFlight(R),e.setSeatViewLocked(r.arriveAtSeatEye===!0),V&&e.enterSeatView(V.stops),s.requestRender(),e.showArriveChip(A,_))})},v=A=>{let S=n.sections.find(j=>j.id===A);if(!S||S.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&d!==S.floorIndex&&y(S.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(A);let E=S.focalWorld[0]-S.center[0],_=S.focalWorld[2]-S.center[2],O=Math.hypot(E,_)>S.radius*.12?Math.atan2(E,_):void 0;return o.frame({center:S.center,radius:Math.max(5,S.radius*.5)},!1,O),r.onSectionFocusChange?.(A),s.requestRender(),!0};return f.addEventListener("click",b),{overviewChip:f,layoutOverviewChip:h,flightGen:()=>u,focusedFloor:()=>d,applyFloorFocus:y,placeCameraFinal:m,cancelFlight:g,focusOverview:b,flyToSeat:x,focusSectionCamera:v}}var iu={};function xa(e){let t=performance.now();return{model:pt(e),buildMs:performance.now()-t,source:"main"}}function va(e){return typeof Worker>"u"?Promise.resolve(xa(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",iu.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(xa(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 au=Math.PI/180,su=6,cu=500;function lu(e,t,n={}){let r=performance.now(),o=t.prepared?.model??pt(t),i=new Sn(n.onAnalytics),a=new Array(o.seats.count);for(let[z,Y]of o.seats.idToIndex)a[Y]=z;let s=new Map(t.seats.map(z=>[z.id,z])),c=new Map;for(let z of t.seats){if(!z.rowId)continue;let Y=c.get(z.rowId);Y?Y.push(z.id):c.set(z.rowId,[z.id])}let l=new Map;for(let z of t.seats)l.set(z.id,z.sectionId);let p=t.doc.floors?.some(Y=>(Y.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&((Y.height??0)>0||(Y.rake??0)>0)),u=null,d=null,m=!1,f=!1,h=!1,y=new Map,b=null,g=null,x=null,v=new Map,A=null,S=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},E=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},_=!1,O=()=>_?fe.focusedFloor():-1,j=()=>{u=wi(I.gl,o),d=new fn(I.renderer,u.seatGeometry,u.chairGeometry,u.solidGeometry,o.seats.count),I.setClearColor(o.theme.background.top),d.setRestoreClear(o.theme.background.top),u.seatProgram.uniforms.uSeatRadius.value=Oe*o.theme.seatScale,u.seatProgram.uniforms.uFocusFloor.value=O(),u.solidProgram.uniforms.uFocusFloor.value=O(),u.chairProgram.uniforms.uFocusFloor.value=O(),u.screenProgram&&(u.screenProgram.uniforms.uFocusFloor.value=O()),R.forceRegather()},V=!1,R=new wn({model:o,orbit:()=>w,gpu:()=>u}),P=z=>R.setDetailEnabled(z),I=new Ht(e,{onContextLost:()=>{h||i.contextLost(),m=!0,W.stop(),u=null,d=null},onContextRestored:()=>{j(),m=!1,h||i.contextRestored(),W.requestRender()}}),w=new jt(I.gl,I.canvas,()=>W.requestRender(),()=>i.orbitEngaged());w.setAspect(I.aspect);let C=(t.doc.floors?.flatMap(z=>z.objects)??t.doc.objects).some(z=>z.type==="section"&&z.physical3dProvenance?.surfaceKind?.status==="inferred"),G=(()=>{if(C&&o.stages.length===0)return;let z=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(z,Y)>o.bounds.radius*.12?Math.atan2(z,Y):void 0})(),k=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,M=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;w.frame(o.bounds,!M&&n.skipInitialOverviewAnimation!==!0,G,n.portraitOverviewCrop===!0,k);let T=new pn(w.camera),D=pa(e),B=new un(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),U=o.labels,H=()=>zr(U,o.floors.length,O());B.setLabels(H());let L=null,F=z=>{if(L=z,B.setForcedDense(!!z),!z){B.setLabels(H());return}let Y=t.seats.filter(Z=>Z.sectionId===z),K=new Set(Y.map(Z=>Z.id)),J=new Set(Y.map(Z=>Z.rowId)),ne=new Set(y.keys()),oe=new Set(Y.filter(Z=>ne.has(Z.id)).map(Z=>Z.id)),ae=H().filter(Z=>Z.kind!=="row"&&Z.kind!=="seat"||(Z.kind==="row"?J.has(Z.id.slice(4)):K.has(Z.id.slice(5))&&(oe.size===0||oe.has(Z.id.slice(5)))));if(o.seatCount<=6e3&&oe.size===0){B.setLabels(ae);return}let ue=oe.size?Y.filter(Z=>oe.has(Z.id)):Y,Qe=new Set(ue.map(Z=>`seat:${Z.id}`)),Ue=ue.flatMap(Z=>{let pe=o.seats.idToIndex.get(Z.id);if(pe===void 0)return[];let Ie=pe*3;return[{id:`seat:${Z.id}`,kind:"seat",text:Z.displayLabel||Z.label,anchor:[o.seats.iPosition[Ie],o.seats.iPosition[Ie+1]+(ne.has(Z.id)?1.05:.55),o.seats.iPosition[Ie+2]]}]});B.setLabels([...ae.filter(Z=>!Qe.has(Z.id)),...Ue])};j();let X=null,W=new Xt(z=>{if(m||!u||f)return!1;let K=T.active?T.update(performance.now()):X?.active?X.update(performance.now()):w.update(),J=O()>=0?o.floors[O()]:null,ne=J?.radius??o.bounds.radius,oe=Lo(w.currentDistance,ne),ae=V?{center:[w.camera.position.x,w.camera.position.y,w.camera.position.z],radius:520}:o.renderBounds;w.updateClipping(ae);let ue=J?.center??o.renderBounds.center,Qe=J?.radius??o.renderBounds.radius,Ue=(Ee,vt)=>Math.hypot(w.camera.position.x-Ee[0],w.camera.position.y-Ee[1],w.camera.position.z-Ee[2])<=vt*(R.detailVisible?1.8:1.55),Z=Ue(ue,Qe);if(!Z&&L){let Ee=o.sections.find(vt=>vt.id===L);Ee&&(Z=Ue(Ee.center,Math.max(12,Ee.radius*2)))}R.detailVisible=Z;let pe=u.seatProgram.uniforms;pe.uSeatScale.value=oe.scale,pe.uSeatFade.value=oe.fade;let Ie=!!J&&_o(J.seatCount,I.canvas.clientWidth||1,I.canvas.clientHeight||1),Nt=Fo(o.seats.count,ne,w.currentDistance,w.camera.fov,I.canvas.clientHeight||1),xt=R.detailVisible||Ie||Nt?1:0,Gt=R.detailVisible||O()>=0||o.floors.length>1?1:0;return R.ease(z,xt,Gt),pe.uSeatDetail.value=R.seatDetailMix,u.solidProgram.uniforms.uStructureDetail.value=R.structureDetailMix,pe.uMinPixels.value=oe.minPixels,pe.uPixelToWorld.value=2*Math.tan(w.camera.fov*au/2)/Math.max(1,I.pixelHeight),R.update(R.detailVisible),I.renderer.render({scene:u.background,clear:!0}),I.renderer.render({scene:u.main,camera:w.camera,clear:!1}),B.update(w.camera.projectionViewMatrix,I.canvas.clientWidth||1,I.canvas.clientHeight||1,w.currentDistance,ne,[w.camera.position.x,w.camera.position.y,w.camera.position.z]),K||R.seatDetailMix!==xt||R.structureDetailMix!==Gt}),q=typeof ResizeObserver<"u"?new ResizeObserver(()=>An.resize()):null;q?.observe(e);let Q=z=>{let Y=ne=>{let oe=o.seats.idToIndex.get(ne);return oe===void 0?void 0:o.seats.iState[oe]},{updates:K,next:J}=Ii(y,z,Y);if(y=J,B.setSelectedSeatIds(y.keys()),L&&F(L),K.length){let ne=Gn(o.seats,K);u&&u.uploadSeatStateRuns(ne),W.requestRender()}},$=()=>A!==null?A:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=8,Ae=z=>{if(!n.getSeatView)return null;let Y=v.get(z);if(!Y)for(Y=Promise.resolve(n.getSeatView(z)),v.set(z,Y),Y.catch(()=>{v.get(z)===Y&&v.delete(z)});v.size>re;){let K=v.keys().next().value;if(K===void 0)break;v.delete(K)}return Y},Me=(z,Y)=>{let K=s.get(z),J=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),ne=t.doc.floors?.[J],oe=o.floors[J],ae=ne?.focalPoint??t.doc.focalPoint,ue=oe?{x:oe.focalWorld[0]/N,y:oe.focalWorld[2]/N}:ae,Qe=K?.focalPoint?{x:K.focalPoint.x+ue.x-ae.x,y:K.focalPoint.y+ue.y-ae.y}:ue,Ue=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return Di(Ue,Qe,ne?.baseHeightM??0,K?.eyeHeightM)},we=()=>(e.clientWidth||I.canvas.clientWidth)<=520,_e=null,Fe=null,Ne=async(z,Y,K)=>{if(!n.getSeatView||h||K!==fe.flightGen())return;let J;try{J=await ma()}catch{if(i.panoramaFailed(z,"mount"),!h&&K===fe.flightGen()){let ne=de(z,K,!0);requestAnimationFrame(()=>ne?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(h||K!==fe.flightGen()||!_e))return Fe??=J.createOpenPanorama(_e),Fe(z,Y,K)},xe=ha({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:we,isDisposed:()=>h,flightGen:()=>fe.flightGen(),flyToSeat:z=>go(z),openPanorama:(z,Y,K)=>Ne(z,Y,K)}),de=xe.show,Ge=xe.remove,yt=xe.layout,Pe=ba({container:e,orbit:w,isNarrow:we}),qe=Pe.element,De=Pe.setNavigationMode,Vt=Pe.layout,Sa=Pe.utilityControls,gt=null,bo=!1,Bt=z=>{Pe.setSeatViewLocked(z),z||X?.exit()};X=Ji({canvas:I.canvas,camera:w.camera,requestRender:()=>W.requestRender(),reducedMotion:$,onStopChange:z=>{let Y=z??(bo?"seat":null);gt=Y;try{n.onSeatViewStopChange?.(Y)}catch{}},onApplied:()=>{h||w.syncFromCamera()}});let Ma=ji(o.stages,o.focalWorld,o.bounds.groundY??0),wa=(z,Y)=>{let{eye:K}=Me(z,Y),J=(e.clientWidth||I.canvas.clientWidth||1)/Math.max(1,e.clientHeight||I.canvas.clientHeight||1),ne=Yi(K,Ma,J);if(n.seatViewStops===!1)return{...ne,stops:[]};let oe=l.get(z),ae=oe?o.sections.find(ue=>ue.id===oe):void 0;return{...ne,stops:Wi(ne,{aspect:J,section:ae&&ae.seatCount>0?{center:ae.center,radius:ae.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},fe=ga({container:e,model:o,opts:n,orbit:w,cinematic:T,analytics:i,loop:W,labelOverlay:B,stageAzimuth:G,overviewFraming:k,gpu:()=>u,isDisposed:()=>h,panorama:()=>b,setPanorama:z=>{b=z},setPanoramaSphereVisible:z=>{V=z},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:z=>{g=z},setFrozen:z=>{f=z},restorePanoramaLayer:E,reducedMotion:$,resolvedSeatViewPose:Me,showSectionSeatLabels:F,setNearFieldDetailEnabled:P,setSeatViewLocked:Bt,setNavigationMode:De,showArriveChip:de,removeArriveChip:Ge,inSeatView:()=>gt!==null,setSeatStepping:z=>{bo=z},seatViewArrival:(z,Y)=>n.arriveAtSeatEye?wa(z,Y):null,enterSeatView:z=>X?.enter(z)});_=!0;let Cn=fe.overviewChip,Pa=fe.layoutOverviewChip,Ca=fe.applyFloorFocus,Aa=fe.focusOverview,yo=fe.cancelFlight,go=fe.flyToSeat,xo=fe.focusSectionCamera;Sa.appendChild(Cn),_e={container:e,model:o,opts:n,analytics:i,orbit:w,loop:W,seatsById:s,ensureSeatView:Ae,resolvedSeatViewPose:Me,gpu:()=>u,gl:I.gl,isContextLost:()=>m,isDisposed:()=>h,flightGen:()=>fe.flightGen(),setPanorama:z=>{b=z},getLoadAbort:()=>g,setLoadAbort:z=>{g=z},setPanoramaSphereVisible:z=>{V=z,z&&X?.exit()},setFrozen:z=>{f=z},raisePanoramaLayer:S,restorePanoramaLayer:E,getOverviewChip:()=>Cn,labelOverlay:B,reducedMotion:$,removeArriveChip:Ge,showArriveChip:de};let ze=ya({glctx:I,orbit:w,model:o,seats:t.seats,opts:n,cinematic:T,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:su,tapMs:cu,gpu:()=>u,pick:()=>d,seatViewLocked:()=>Pe.seatViewLocked(),focusedSectionId:()=>L,selection:()=>y,cancelFlight:yo,focusSectionCamera:xo,setSelection:Q,ensureSeatView:Ae});I.canvas.addEventListener("pointerdown",ze.onDown),I.canvas.addEventListener("pointermove",ze.onMove),I.canvas.addEventListener("pointerup",ze.onUp),I.canvas.addEventListener("pointercancel",ze.onUp),W.requestRender();let An={setAvailability(z){let Y=Ai(y,z),K=Gn(o.seats,Y);K.length&&u&&u.uploadSeatStateRuns(K),W.requestRender()},setSelection:Q,setNavigationMode:De,zoomIn(){w.zoomBy(.82),W.requestRender()},zoomOut(){w.zoomBy(1.22),W.requestRender()},flyToSeat:go,focusOverview:Aa,seatViewStop:()=>gt,recentreSeatView:()=>X?.recentre()??!1,resize(){let{width:z,height:Y}=I.resize();w.setAspect(z/Math.max(1,Y)),yt(),Vt(),Pa(),W.requestRender()},stats(){return{...W.stats(),drawCalls:u?u.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let z=W.stats(),Y=I.canvas.clientWidth||1,K=I.canvas.clientHeight||1,J=o.bounds.center,ne=Xe(w.camera.projectionViewMatrix,[J[0],o.bounds.box.min[1],J[2]],Y,K),oe=Xe(w.camera.projectionViewMatrix,[J[0],o.bounds.box.max[1],J[2]],Y,K),ae=o.bounds.box,ue=[ae.min[0],ae.max[0]].flatMap(Z=>[ae.min[1],ae.max[1]].flatMap(pe=>[ae.min[2],ae.max[2]].map(Ie=>Xe(w.camera.projectionViewMatrix,[Z,pe,Ie],Y,K)))).filter(Z=>Number.isFinite(Z.x)&&Number.isFinite(Z.y)&&Number.isFinite(Z.depth)),Qe=ue.length?(()=>{let Z=Math.min(...ue.map(Ze=>Ze.x)),pe=Math.max(...ue.map(Ze=>Ze.x)),Ie=Math.min(...ue.map(Ze=>Ze.y)),Nt=Math.max(...ue.map(Ze=>Ze.y)),xt=Math.max(0,Z),Gt=Math.min(Y,pe),Ee=Math.max(0,Ie),vt=Math.min(K,Nt),zt=Math.max(0,Gt-xt),In=Math.max(0,vt-Ee);return{box:{x:xt,y:Ee,width:zt,height:In},horizontalFillRatio:zt/Y,verticalFillRatio:In/K,visibleAreaRatio:zt*In/(Y*K),clippedEdges:[...Ie<0?["top"]:[],...pe>Y?["right"]:[],...Nt>K?["bottom"]:[],...Z<0?["left"]:[]]}})():void 0,Ue=String(I.gl.getParameter(I.gl.VERSION)??"");return{viewport:{width:Y,height:K},context:{webgl2:/webgl\s*2/i.test(Ue),lost:m},frame:{rendered:z.rendered,idle:z.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:p,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:ne.visible&&oe.visible?Math.abs(ne.y-oe.y):0},labels:B.qualityEvidence(),framing:Qe,...gt?{seatView:{fovDeg:w.camera.fov,stop:gt}}:{}}},getQualityReport(){return dn(An.getQualityEvidence())},loseContextForTest(){I.simulateContextLossCycle()},floors(){return o.floors},focusFloor(z){if(z!==null&&!o.floors.some(K=>K.index===z))return!1;let Y=z??-1;if(P(z!==null),Bt(!1),Ca(Y),De("orbit"),z===null)T.cancel(),$()?w.frame(o.bounds,!1,G,n.portraitOverviewCrop===!0,k):w.frameSoft(o.bounds,G,n.portraitOverviewCrop===!0,k);else{let K=o.floors[z];if(K.seatCount>0){T.cancel();let J=K.focalWorld[0]-K.center[0],ne=K.focalWorld[2]-K.center[2],oe=Math.hypot(J,ne)>K.radius*.12?Math.atan2(J,ne):G;w.frame({center:K.center,radius:K.radius,box:K.box},!1,oe,!1,{polarDeg:58,margin:1.12})}}return W.requestRender(),!0},zones(){return o.zones},focusZone(z){let Y=o.zones.find(oe=>oe.id===z);if(!Y||Y.seatCount===0)return!1;P(!1),Bt(!1),T.cancel(),De("orbit"),F(null),n.onSectionFocusChange?.(null);let K=Y.focalWorld[0]-Y.center[0],J=Y.focalWorld[2]-Y.center[2],ne=Math.hypot(K,J)>Y.radius*.12?Math.atan2(K,J):void 0;return w.frame({center:Y.center,radius:Y.radius*1.25},!1,ne),W.requestRender(),!0},sections(){return o.sections},focusSection(z){return xo(z)},rows(z){return z?o.rows.filter(Y=>Y.sectionId===z):o.rows},seatsInRow(z){return t.seats.filter(Y=>Y.rowId===z).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(z){let Y=o.rows.find(K=>K.id===z);return!Y||Y.seatCount===0?!1:(P(!0),Bt(!1),T.cancel(),De("pan"),Y.sectionId&&(F(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),w.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),W.requestRender(),!0)},setReducedMotionForTest(z){A=z},dispose(){h=!0,Ge(),Cn.remove(),qe.remove(),yo(),X?.dispose(),W.stop(),B.dispose(),q?.disconnect(),b&&(b.dispose(),b=null),E(),D(),I.canvas.removeEventListener("pointerdown",ze.onDown),I.canvas.removeEventListener("pointermove",ze.onMove),I.canvas.removeEventListener("pointerup",ze.onUp),I.canvas.removeEventListener("pointercancel",ze.onUp),w.dispose(),d&&d.dispose(),u&&u.dispose(),u=null,d=null,I.dispose()}};return i.opened(o.seatCount,p,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),An}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});
|
|
641
|
+
void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:T},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let X=new se.Mesh(e,{geometry:k,program:M});X.frustumCulled=!1,X.setParent(n),U.screenProgram=M,C=!0,U.drawCalls=3+(w?1:0)+1},L.src=H.contentImageUrl}return U}var ke=require("ogl");function xl(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function Ci(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 p=(c*t+l)*4,u=xl(e[p],e[p+1],e[p+2]);if(u<0||u>=i)continue;let d=l-r,m=c-o,f=d*d+m*m;f<s&&(s=f,a=u)}return a}function Ai(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 vl=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],fn=class{constructor(t,n,r,o,i){this.seatScene=new ke.Transform;this.chairScene=new ke.Transform;this.solidScene=new ke.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=bi(this.gl),this.chairProg=yi(this.gl),this.depthProg=gi(this.gl);let a=new ke.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new ke.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new ke.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 vl)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 ke.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),p=Math.max(0,r-o),u=Math.max(1,Math.min(s,n+o+1)-l),d=Math.max(1,Math.min(c,r+o+1)-p);i.enable(i.SCISSOR_TEST),i.scissor(l,p,u,d);let[m,f,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(m,f,h,1),i.disable(i.SCISSOR_TEST);let y=new Uint8Array(u*d*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,p,u,d,i.RGBA,i.UNSIGNED_BYTE,y),this.renderer.bindFramebuffer(),Ci(y,u,d,n-l,r-p,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Ii(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,wt(r.state)):n.push(r);return n}function Ei(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:Ce[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 We=require("ogl");function Sl(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Ri(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Ml(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ti(e){let t=Math.hypot(e[0],e[1],e[2]);return t>1e-6?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function ao(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function so(e,t){return Math.max(0,Math.min(1,e+t))}function ki(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],p=e[Math.min(n-1,i+2)],u=a*a,d=u*a,m=[0,0,0];for(let f=0;f<3;f++)m[f]=.5*(2*c[f]+(-s[f]+l[f])*a+(2*s[f]-5*c[f]+4*l[f]-p[f])*u+(-s[f]+3*c[f]-3*l[f]+p[f])*d);return m}function co(e,t,n,r,o){let i=Ti(Sl(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Ri(Ri(t,Ml(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=Ti(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,o),p=[r[0]+c[0]*l*1.3,r[1]+l*.75,r[2]+c[2]*l*1.3];return{waypoints:[e,p,a],finalPos:a}}function lo(e,t,n=35,r=28){let o=ao(t),i=ki(e,o),a=ao(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Di(e,t,n){let r=e.position.clone(),o=new We.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new We.Vec3(n[0],n[1],n[2]));let i=new We.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var pn=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new We.Quat;this.endQuat=new We.Quat;this.outQuat=new We.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}=lo(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,so(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 wl=1.02,Pl=1.5;function Oi(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+wl;return{eye:[e[0],o,e[2]],focal:[t.x*N,n+Pl,t.y*N]}}var bt=Math.PI/180,Cl=45,Vi=80,Al=.25,uo=1,Il=.25,El=12*bt,Rl=.2,Tl=1.5,Bi=.8,Ni=6,Hi=1.9,kl=2/3,Ll=.12,_l=.9,Fl=1.2,Dl=2,ji=.05,Ol=6;function Xi(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+Bi,t[1]),t[2]+6]};let r=1/0,o=-1/0,i=1/0,a=-1/0,s=n;for(let f of e)r=Math.min(r,f.cx-f.halfX),o=Math.max(o,f.cx+f.halfX),i=Math.min(i,f.cz-f.halfZ),a=Math.max(a,f.cz+f.halfZ),s=Math.max(s,f.y);let c=o-r,l=a-i,p=Math.max(c,Math.min(l,Ni))/2,u=Math.max(l,Math.min(c,Ni))/2,d=(r+o)/2,m=(i+a)/2;return{min:[d-p,n,m-u],max:[d+p,Math.max(n+Bi,s),m+u]}}function Vl(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Hi,e.max[2]]}}function Bl(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Tl,t+Rl,t+Hi*kl),(e.min[2]+e.max[2])/2]}function Yi(e,t){let n=e[0]-t[0],r=e[2]-t[2],o=Math.hypot(n,r);return o<.001?{x:0,z:1}:{x:n/o,z:r/o}}function Gi(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let p=1/0,u=-1/0;for(let d=0;d<8;d++){let m=(d&1?n.max[0]:n.min[0])-e[0],f=(d&2?n.max[1]:n.min[1])-e[1],h=(d&4?n.max[2]:n.min[2])-e[2],y=Math.max(ji,m*r+f*o+h*i),b=(m*s+h*c)/y;b<p&&(p=b),b>u&&(u=b)}return u-p}function zi(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let p=-c*o,u=c*r-s*i,d=s*o,m=1/0,f=-1/0;for(let h=0;h<8;h++){let y=(h&1?n.max[0]:n.min[0])-e[0],b=(h&2?n.max[1]:n.min[1])-e[1],g=(h&4?n.max[2]:n.min[2])-e[2],x=Math.max(ji,y*r+b*o+g*i),v=(y*p+b*u+g*d)/x;v<m&&(m=v),v>f&&(f=v)}return f-m}function hn(e,t){return Math.tan(e*bt/2)*Math.max(.05,t)}function Ui(e,t,n){let r=s=>Math.max(Cl,Math.min(Vi,s)),o=s=>2*Math.atan(s)/bt,i=Number.isFinite(e)&&e>0?r(o(e/(2*Al)/Math.max(.05,n))):Vi;if(!(Number.isFinite(t)&&t>0))return i;let a=Math.min(i,r(o(t/(2*Ll))));return e/(2*hn(a,n))>uo?i:a}function Wi(e,t,n){let r=Bl(t),o=[e[0],e[1],e[2]],i=0,a=0,s=m=>{if(!(m>0))return;let f=Yi(o,r);o[0]+=f.x*m,o[2]+=f.z*m,a+=m},c=t.max[1]+Il-o[1];c>0&&(o[1]+=c,i=c,s(c/Math.tan(El)));let l=Vl(t),p=Gi(o,r,t),u=Ui(p,zi(o,r,l),n),d=p/(2*hn(u,n));for(let m=0;m<Ol&&d>uo;m++){let f=Math.max(1,Math.hypot(o[0]-r[0],o[2]-r[2])),h=Number.isFinite(d)?d/uo:2;s(Math.min(60,f*(Math.min(4,h)-1)+.5)),p=Gi(o,r,t),u=Ui(p,zi(o,r,l),n),d=p/(2*hn(u,n))}return{eye:o,focal:r,fov:u,raisedM:i,pulledBackM:a,stageFrameWidth:d}}function Nl(e,t,n){let r=Math.tan(t*bt/2),o=hn(t,n);return Math.max(1,e/Math.max(.05,Math.min(r,o)))}function Ki(e,t){let{aspect:n,venue:r}=t,o=e.focal,i=Yi(e.eye,o),a=d=>(d[0]-o[0])*i.x+(d[2]-o[2])*i.z,s=[{name:"seat",eye:e.eye,focal:o,fov:e.fov}],c=Dl*(t.rowDepthM??_l);s.push({name:"row",eye:[e.eye[0]+i.x*c,e.eye[1]+Fl,e.eye[2]+i.z*c],focal:o,fov:e.fov});let l=(d,m,f,h)=>{let y=Nl(f,e.fov,n)*1.08,b=y*Math.sin(h*bt),g=y*Math.cos(h*bt);return{name:d,eye:[m[0]+i.x*g,m[1]+b,m[2]+i.z*g],focal:m,fov:e.fov}};t.section&&t.section.radius>0&&s.push(l("section",t.section.center,t.section.radius,14)),s.push(l("venue",r.center,Math.max(1,r.radius),26));let p=[],u=-1/0;for(let d of s){let m=a(d.eye);p.length&&m<=u+.5||(p.push(d),u=m)}return p}var Ji=require("ogl"),Dt=Math.PI/180,qi=320,Qi=70*Dt,Gl=32*Dt,zl=24*Dt,Zi=.0026,Ul=.22,Hl=.006,jl=180,Xl=4,ge=(e,t,n)=>Math.max(t,Math.min(n,e)),$i=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function ea(e){let{canvas:t,camera:n}=e,r=[],o=!1,i=0,a=0,s=0,c=0,l=0,p=0,u=!1,d=[0,0],m=0,f=!1,h=null,y=null,b=new Map,g=!1,x=0,v=0,A=0,S=0,E=()=>o&&r.length?r[ge(Math.round(i),0,r.length-1)].name:null,_=()=>{let M=E();M!==h&&(h=M,e.onStopChange?.(M))},O=()=>{if(!o||!r.length)return;let M=r[ge(Math.floor(i),0,r.length-1)],T=r[ge(Math.ceil(i),0,r.length-1)],D=ge(i-Math.floor(i),0,1),B=(Me,we)=>Me+(we-Me)*D,U=[B(M.eye[0],T.eye[0]),B(M.eye[1],T.eye[1]),B(M.eye[2],T.eye[2])],H=[B(M.focal[0],T.focal[0]),B(M.focal[1],T.focal[1]),B(M.focal[2],T.focal[2])],L=H[0]-U[0],F=H[1]-U[1],X=H[2]-U[2],W=Math.hypot(L,F,X)||1,q=Math.atan2(L,X),Q=Math.asin(ge(F/W,-1,1)),$=q+a,re=ge(Q+s,-80*Dt,80*Dt),Ae=Math.cos(re)*W;L=Math.sin($)*Ae,F=Math.sin(re)*W,X=Math.cos($)*Ae,n.position.set(U[0],U[1],U[2]),n.fov=B(M.fov,T.fov),n.updateProjectionMatrix(),n.lookAt(new Ji.Vec3(U[0]+L,U[1]+F,U[2]+X)),e.onApplied?.()},j=()=>{if(!o||!r.length)return;let M=ge(Math.round(i),0,r.length-1);if(e.reducedMotion()){u=!1,i=M,O(),_(),e.requestRender();return}if(Math.abs(M-i)<.001){u=!1,_();return}c=i,l=M,p=performance.now(),u=!0,e.requestRender()},V=M=>{!o||r.length<2||(u=!1,i=ge(i+M,0,r.length-1),O(),_(),e.requestRender())},R=(M,T)=>{o&&(u=!1,f=!1,a=ge(a-M*Zi,-Qi,Qi),s=ge(s-T*Zi,-zl,Gl),O(),e.requestRender())},P=M=>{o&&(b.set(M.pointerId,{x:M.clientX,y:M.clientY}),b.size===1?(g=!0,S=0,x=M.clientX,v=M.clientY):b.size===2&&(g=!1,A=I()))},I=()=>{let M=[...b.values()];return M.length<2?0:Math.hypot(M[0].x-M[1].x,M[0].y-M[1].y)},w=M=>{if(!o||!b.has(M.pointerId))return;if(b.set(M.pointerId,{x:M.clientX,y:M.clientY}),b.size>=2){let B=I();A>0&&V((A-B)*Hl),A=B;return}if(!g)return;let T=M.clientX-x,D=M.clientY-v;x=M.clientX,v=M.clientY,S+=Math.abs(T)+Math.abs(D),!(S<=Xl)&&R(T,D)},C=M=>{b.delete(M.pointerId)&&(b.size<2&&(A=0),b.size===0&&(g=!1,j()))},G=M=>{if(!o)return;M.preventDefault();let T=M.deltaMode===1?16:M.deltaMode===2?100:1,D=ge(M.deltaY*T/100,-2,2);V(D*Ul),y&&clearTimeout(y),y=setTimeout(()=>{y=null,j()},jl)},k=()=>{o&&(o=!1,u=!1,f=!1,r=[],b.clear(),g=!1,y&&(clearTimeout(y),y=null),h!==null&&(h=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",P),t.addEventListener("pointermove",w),t.addEventListener("pointerup",C),t.addEventListener("pointercancel",C),t.addEventListener("wheel",G,{passive:!1}),{get active(){return o},enter(M){if(M.length<2){k();return}r=M,o=!0,i=0,a=0,s=0,u=!1,f=!1,h=null,O(),_(),e.requestRender()},exit:k,recentre(){return o?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(f=!1,a=0,s=0,O(),e.requestRender(),!0):(d=[a,s],m=performance.now(),f=!0,e.requestRender(),!0):!1},update(M){if(!o)return!1;let T=!1;if(f){let D=ge((M-m)/qi,0,1),B=1-$i(D);a=d[0]*B,s=d[1]*B,D>=1?(f=!1,a=0,s=0):T=!0}if(u){let D=ge((M-p)/qi,0,1);i=c+(l-c)*$i(D),D>=1?(u=!1,i=l,_()):T=!0}return O(),T},currentStop:E,dispose(){k(),t.removeEventListener("pointerdown",P),t.removeEventListener("pointermove",w),t.removeEventListener("pointerup",C),t.removeEventListener("pointercancel",C),t.removeEventListener("wheel",G)}}}var ho=null;function fa(){return ho??=Promise.resolve().then(()=>(ma(),da)).catch(e=>{throw ho=null,e}),ho}var pa=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Sn=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=pa(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(pa()-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 ha(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function ba(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let u=a();Object.assign(s.style,u?{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:(u,d,m=!1)=>{if(l(),e.isDisposed())return null;let f=document.createElement("div");f.setAttribute("role","group"),Object.assign(f.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let h=o.get(u),y=h?.sectionId?n.sections.find(_=>_.id===h.sectionId):void 0,b=h?.label??u;f.setAttribute("aria-label",`Explore views near ${y?.label?`${y.label}, `:""}seat ${b}`);let g=document.createElement("span");g.textContent=r.seatViewCaption?.(u)??["Live 3D seat view",y?.label,b].filter(Boolean).join(" \xB7 "),Object.assign(g.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),f.appendChild(g);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(x);let v=h?.rowId?i.get(h.rowId):void 0,A=v?.indexOf(u)??-1,S=A>=0?[v?.[A-1],v?.[A+1]]:[void 0,void 0],E=(_,O,j,V=!1)=>{let R=document.createElement("button");R.type="button",R.textContent=_,R.setAttribute("aria-label",O),Object.assign(R.style,{minHeight:"44px",padding:V?"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"}),V||(R.style.minWidth="44px"),V&&(R.dataset.panoramaTrigger=""),R.addEventListener("click",j),x.appendChild(R)};if(S[0]){let _=o.get(S[0])?.label??S[0];E("\u2039",`View previous seat ${_}`,()=>{e.flyToSeat(S[0])})}if(r.getSeatView){let _=r.seatViewActionLabel?.(u)??"Open 360\xB0 panorama";E(m?`\u21BB Retry ${_}`:`\u25C9 ${_}`,`${m?"Retry":_} from seat ${b}`,()=>{if(e.isDisposed()||d!==e.flightGen()){l();return}l(),e.openPanorama(u,400,d)},!0)}if(S[1]){let _=o.get(S[1])?.label??S[1];E("\u203A",`View next seat ${_}`,()=>{e.flyToSeat(S[1])})}return x.childElementCount?(t.appendChild(f),s=f,c(),f):null},remove:l,layout:c}}function ya(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 p=document.createElement("button");p.type="button",p.textContent="\u2212",p.setAttribute("aria-label","Zoom out of the 3D venue"),p.dataset.tooltip="Zoom out";let u=document.createElement("button");u.type="button",u.textContent="+",u.setAttribute("aria-label","Zoom into the 3D venue"),u.dataset.tooltip="Zoom in";for(let h of[c,l,p,u])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(u,p);let d=h=>{n.setPrimaryDragMode(h);let y=h==="orbit";c.setAttribute("aria-pressed",String(y)),l.setAttribute("aria-pressed",String(!y)),c.style.background=y?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=y?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=y?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>d("orbit")),l.addEventListener("click",()=>d("pan")),p.addEventListener("click",()=>n.zoomBy(1.22)),u.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),d("orbit"),t.appendChild(o);let m=()=>{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",u.style.display=h?"none":"",p.style.display=h?"none":""};return m(),{element:o,utilityControls:s,setNavigationMode:d,setSeatViewLocked:h=>{i=h,n.setInteractionEnabled(!h),m()},seatViewLocked:()=>i,layout:m}}function ga(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:p,tapMs:u,cancelFlight:d,focusSectionCamera:m,setSelection:f,ensureSeatView:h}=e,y=0,b=0,g=0,x=-1,v=!1,A=!1,S=V=>{e.seatViewLocked()||x===-1&&(x=V.pointerId,y=V.clientX,b=V.clientY,g=performance.now(),v=!1,A=a.active,a.active&&(s.cinematicCancelled(),d(),i.onViewTargetChange?.(null)))},E=V=>{V.pointerId===x&&Math.hypot(V.clientX-y,V.clientY-b)>p&&(v=!0)},_=(V,R,P,I,w)=>{let C=t.canvas.getBoundingClientRect(),G=t.canvas.clientWidth||C.width||1,k=t.canvas.clientHeight||C.height||1,M=V-C.left,T=R-C.top,D=I*I,B=-1,U=D,H=1/0;for(let L of o){if(P&&L.sectionId!==P)continue;let F=r.seats.idToIndex.get(L.id);if(F===void 0)continue;if(w){let re=Math.round(r.seats.iState[F]??0);if(re!==0&&re!==3)continue}let X=F*3,W=Xe(n.camera.projectionViewMatrix,[r.seats.iPosition[X],r.seats.iPosition[X+1]+.55,r.seats.iPosition[X+2]],G,k);if(!W.visible)continue;let q=W.x-M,Q=W.y-T,$=q*q+Q*Q;($<U||Math.abs($-U)<1&&W.depth<H)&&(B=F,U=$,H=W.depth)}return B},O=(V,R)=>{let P=e.gpu(),I=e.pick();if(!P||!I)return-1;I.syncFromSeatProgram(P.seatProgram);let w=t.canvas.getBoundingClientRect(),C=t.renderer.dpr,{x:G,y:k}=Ai(V,R,w,C,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),M=Math.max(2,Math.round(8*C));return I.pick(n.camera,G,k,M)};return{onDown:S,onMove:E,onUp:V=>{if(V.pointerId!==x)return;let R=!v&&performance.now()-g<u;if(x=-1,A){A=!1;return}let P=e.gpu(),I=e.pick();if(!R||!P||!I)return;let w=O(V.clientX,V.clientY);if(e.focusedSectionId()&&w>=0){let k=c[w],M=k?l.get(k):void 0;if(M&&M!==e.focusedSectionId()&&m(M))return}if(e.focusedSectionId()&&w<0&&(w=_(V.clientX,V.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&w<0){let k=_(V.clientX,V.clientY,null,72,!1),M=k>=0?c[k]:void 0,T=M?l.get(M):void 0;if(T&&T!==e.focusedSectionId()&&m(T))return}if(!e.focusedSectionId()){w<0&&(w=_(V.clientX,V.clientY,null,42,!1));let k=w>=0?c[w]:void 0,M=k?l.get(k):void 0;if(M&&m(M))return}if(w<0||w>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let C=c[w],G=Ce[Math.round(r.seats.iState[w]??0)]??"available";if(G!=="available"&&G!=="selected"){i.onSeatInspect?.(C,G);return}if(e.selection().has(C)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null),i.onSeatPick?.(C);return}f([C]),h(C),s.seatPicked(C,l.get(C)),i.onSeatPick?.(C)}}}var Mn=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 m=0;m<this.count;m++){let f=t[m*3],h=t[m*3+2];f<n&&(n=f),f>o&&(o=f),h<r&&(r=h),h>i&&(i=h)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,l=new Int32Array(c+1),p=m=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((t[m*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[m*3+2]-r)/this.cell)))*this.cols+f};for(let m=0;m<this.count;m++)l[p(m)+1]++;for(let m=0;m<c;m++)l[m+1]+=l[m];let u=new Int32Array(this.count),d=l.slice(0,c);for(let m=0;m<this.count;m++)u[d[p(m)]++]=m;this.cellStart=l,this.cellItems=u}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),p=Math.floor((n-this.minZ)/this.cell),u=Math.ceil(r/this.cell)+1,d=this.iPosition,m=0;for(let f=0;f<=u&&m<s;f++){let h=p-f,y=p+f,b=l-f,g=l+f;for(let x=h;x<=y&&m<s;x++){if(x<0||x>=this.rows)continue;let v=x===h||x===y;for(let A=b;A<=g&&m<s;A++){if(!v&&A!==b&&A!==g){A=g-1;continue}if(A<0||A>=this.cols)continue;let S=x*this.cols+A;for(let E=i[S],_=i[S+1];E<_&&m<s;E++){let O=a[E],j=d[O*3]-t,V=d[O*3+2]-n;j*j+V*V<=c&&(o[m++]=O)}}}}return m}};var wn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Yt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new Mn(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)<_n)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>Ln){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Ln,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 Pn=require("ogl");function xa(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:p}=e,u=0,d=-1,m=(A,S,E=28)=>{o.camera.position.set(A[0],A[1],A[2]),o.camera.lookAt(new Pn.Vec3(S[0],S[1],S[2])),o.camera.fov=E,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.textContent="\u2302",f.setAttribute("aria-label","Fit the active level or whole venue in view"),f.dataset.tooltip="Fit view",Object.assign(f.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let h=()=>{f.textContent="\u2302"};h();let y=A=>{d=A;let S=e.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=A,S.solidProgram.uniforms.uFocusFloor.value=A,S.chairProgram.uniforms.uFocusFloor.value=A),e.showSectionSeatLabels(null)},b=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),f.style.display="",c.setVisible(!0),e.setFrozen(!1);let A=d>=0?n.floors[d]:null;if(e.setNearFieldDetailEnabled(!!A),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),A){let S=A.focalWorld[0]-A.center[0],E=A.focalWorld[2]-A.center[2],_=Math.hypot(S,E)>A.radius*.12?Math.atan2(S,E):l,O={center:A.center,radius:A.radius,box:A.box},j={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(O,!1,_,!1,j):o.frameSoft(O,_,!1,j)}else e.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,p):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,p);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{u++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=A=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let S=n.seats.idToIndex.get(A);if(S===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(A),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),f.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let E=e.inSeatView()&&r.arriveAtSeatEye===!0;e.setSeatStepping(E),e.setSeatViewLocked(!1);let _=++u;E?e.showArriveChip(A,_):e.removeArriveChip();let{eye:O,focal:j}=e.resolvedSeatViewPose(A,S),V=r.arriveAtSeatEye?e.seatViewArrival(A,S):null,R=V?V.focal:j,P=[o.camera.position.x,o.camera.position.y,o.camera.position.z],I=co(P,V?.eye??O,R,n.bounds.center,n.bounds.radius),w=V?V.eye:r.arriveAtSeatEye?O:I.finalPos,C=V?V.fov:r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,G=[I.waypoints[0],I.waypoints[1],w];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),m(w,R,C),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),V&&e.enterSeatView(V.stops),e.showArriveChip(A,_),Promise.resolve();let k=new Pn.Quat().copy(o.camera.quaternion),M=Di(o.camera,w,R);s.requestRender();let T=E?700:2500;return i.start(G,k,M,T,C).then(()=>{e.isDisposed()||_!==u||(e.setSeatStepping(!1),a.cinematicPlayed(T),o.resumeAfterFlight(R),e.setSeatViewLocked(r.arriveAtSeatEye===!0),V&&e.enterSeatView(V.stops),s.requestRender(),e.showArriveChip(A,_))})},v=A=>{let S=n.sections.find(j=>j.id===A);if(!S||S.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&d!==S.floorIndex&&y(S.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(A);let E=S.focalWorld[0]-S.center[0],_=S.focalWorld[2]-S.center[2],O=Math.hypot(E,_)>S.radius*.12?Math.atan2(E,_):void 0;return o.frame({center:S.center,radius:Math.max(5,S.radius*.5)},!1,O),r.onSectionFocusChange?.(A),s.requestRender(),!0};return f.addEventListener("click",b),{overviewChip:f,layoutOverviewChip:h,flightGen:()=>u,focusedFloor:()=>d,applyFloorFocus:y,placeCameraFinal:m,cancelFlight:g,focusOverview:b,flyToSeat:x,focusSectionCamera:v}}var iu={};function bo(e){let t=performance.now();return{model:pt(e),buildMs:performance.now()-t,source:"main"}}function va(e){if(typeof Worker>"u")return Promise.resolve(bo(e));let t;try{t=new Worker(new URL("./scene/scene.worker.js",iu.url),{type:"module"})}catch{return Promise.resolve(bo(e))}return new Promise(n=>{let r=!1,o=s=>{r||(r=!0,clearTimeout(a),t.terminate(),n(s))},i=()=>o(bo(e)),a=window.setTimeout(i,15e3);t.onerror=i,t.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},t.postMessage(e)})}var au=Math.PI/180,su=6,cu=500;function lu(e,t,n={}){let r=performance.now(),o=t.prepared?.model??pt(t),i=new Sn(n.onAnalytics),a=new Array(o.seats.count);for(let[z,Y]of o.seats.idToIndex)a[Y]=z;let s=new Map(t.seats.map(z=>[z.id,z])),c=new Map;for(let z of t.seats){if(!z.rowId)continue;let Y=c.get(z.rowId);Y?Y.push(z.id):c.set(z.rowId,[z.id])}let l=new Map;for(let z of t.seats)l.set(z.id,z.sectionId);let p=t.doc.floors?.some(Y=>(Y.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&((Y.height??0)>0||(Y.rake??0)>0)),u=null,d=null,m=!1,f=!1,h=!1,y=new Map,b=null,g=null,x=null,v=new Map,A=null,S=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},E=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},_=!1,O=()=>_?fe.focusedFloor():-1,j=()=>{u=Pi(I.gl,o),d=new fn(I.renderer,u.seatGeometry,u.chairGeometry,u.solidGeometry,o.seats.count),I.setClearColor(o.theme.background.top),d.setRestoreClear(o.theme.background.top),u.seatProgram.uniforms.uSeatRadius.value=Oe*o.theme.seatScale,u.seatProgram.uniforms.uFocusFloor.value=O(),u.solidProgram.uniforms.uFocusFloor.value=O(),u.chairProgram.uniforms.uFocusFloor.value=O(),u.screenProgram&&(u.screenProgram.uniforms.uFocusFloor.value=O()),R.forceRegather()},V=!1,R=new wn({model:o,orbit:()=>w,gpu:()=>u}),P=z=>R.setDetailEnabled(z),I=new Ht(e,{onContextLost:()=>{h||i.contextLost(),m=!0,W.stop(),u=null,d=null},onContextRestored:()=>{j(),m=!1,h||i.contextRestored(),W.requestRender()}}),w=new jt(I.gl,I.canvas,()=>W.requestRender(),()=>i.orbitEngaged());w.setAspect(I.aspect);let C=(t.doc.floors?.flatMap(z=>z.objects)??t.doc.objects).some(z=>z.type==="section"&&z.physical3dProvenance?.surfaceKind?.status==="inferred"),G=(()=>{if(C&&o.stages.length===0)return;let z=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(z,Y)>o.bounds.radius*.12?Math.atan2(z,Y):void 0})(),k=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,M=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;w.frame(o.bounds,!M&&n.skipInitialOverviewAnimation!==!0,G,n.portraitOverviewCrop===!0,k);let T=new pn(w.camera),D=ha(e),B=new un(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),U=o.labels,H=()=>Ur(U,o.floors.length,O());B.setLabels(H());let L=null,F=z=>{if(L=z,B.setForcedDense(!!z),!z){B.setLabels(H());return}let Y=t.seats.filter(Z=>Z.sectionId===z),K=new Set(Y.map(Z=>Z.id)),J=new Set(Y.map(Z=>Z.rowId)),ne=new Set(y.keys()),oe=new Set(Y.filter(Z=>ne.has(Z.id)).map(Z=>Z.id)),ae=H().filter(Z=>Z.kind!=="row"&&Z.kind!=="seat"||(Z.kind==="row"?J.has(Z.id.slice(4)):K.has(Z.id.slice(5))&&(oe.size===0||oe.has(Z.id.slice(5)))));if(o.seatCount<=6e3&&oe.size===0){B.setLabels(ae);return}let ue=oe.size?Y.filter(Z=>oe.has(Z.id)):Y,Qe=new Set(ue.map(Z=>`seat:${Z.id}`)),Ue=ue.flatMap(Z=>{let pe=o.seats.idToIndex.get(Z.id);if(pe===void 0)return[];let Ie=pe*3;return[{id:`seat:${Z.id}`,kind:"seat",text:Z.displayLabel||Z.label,anchor:[o.seats.iPosition[Ie],o.seats.iPosition[Ie+1]+(ne.has(Z.id)?1.05:.55),o.seats.iPosition[Ie+2]]}]});B.setLabels([...ae.filter(Z=>!Qe.has(Z.id)),...Ue])};j();let X=null,W=new Xt(z=>{if(m||!u||f)return!1;let K=T.active?T.update(performance.now()):X?.active?X.update(performance.now()):w.update(),J=O()>=0?o.floors[O()]:null,ne=J?.radius??o.bounds.radius,oe=_o(w.currentDistance,ne),ae=V?{center:[w.camera.position.x,w.camera.position.y,w.camera.position.z],radius:520}:o.renderBounds;w.updateClipping(ae);let ue=J?.center??o.renderBounds.center,Qe=J?.radius??o.renderBounds.radius,Ue=(Ee,vt)=>Math.hypot(w.camera.position.x-Ee[0],w.camera.position.y-Ee[1],w.camera.position.z-Ee[2])<=vt*(R.detailVisible?1.8:1.55),Z=Ue(ue,Qe);if(!Z&&L){let Ee=o.sections.find(vt=>vt.id===L);Ee&&(Z=Ue(Ee.center,Math.max(12,Ee.radius*2)))}R.detailVisible=Z;let pe=u.seatProgram.uniforms;pe.uSeatScale.value=oe.scale,pe.uSeatFade.value=oe.fade;let Ie=!!J&&Fo(J.seatCount,I.canvas.clientWidth||1,I.canvas.clientHeight||1),Nt=Do(o.seats.count,ne,w.currentDistance,w.camera.fov,I.canvas.clientHeight||1),xt=R.detailVisible||Ie||Nt?1:0,Gt=R.detailVisible||O()>=0||o.floors.length>1?1:0;return R.ease(z,xt,Gt),pe.uSeatDetail.value=R.seatDetailMix,u.solidProgram.uniforms.uStructureDetail.value=R.structureDetailMix,pe.uMinPixels.value=oe.minPixels,pe.uPixelToWorld.value=2*Math.tan(w.camera.fov*au/2)/Math.max(1,I.pixelHeight),R.update(R.detailVisible),I.renderer.render({scene:u.background,clear:!0}),I.renderer.render({scene:u.main,camera:w.camera,clear:!1}),B.update(w.camera.projectionViewMatrix,I.canvas.clientWidth||1,I.canvas.clientHeight||1,w.currentDistance,ne,[w.camera.position.x,w.camera.position.y,w.camera.position.z]),K||R.seatDetailMix!==xt||R.structureDetailMix!==Gt}),q=typeof ResizeObserver<"u"?new ResizeObserver(()=>An.resize()):null;q?.observe(e);let Q=z=>{let Y=ne=>{let oe=o.seats.idToIndex.get(ne);return oe===void 0?void 0:o.seats.iState[oe]},{updates:K,next:J}=Ei(y,z,Y);if(y=J,B.setSelectedSeatIds(y.keys()),L&&F(L),K.length){let ne=Gn(o.seats,K);u&&u.uploadSeatStateRuns(ne),W.requestRender()}},$=()=>A!==null?A:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=8,Ae=z=>{if(!n.getSeatView)return null;let Y=v.get(z);if(!Y)for(Y=Promise.resolve(n.getSeatView(z)),v.set(z,Y),Y.catch(()=>{v.get(z)===Y&&v.delete(z)});v.size>re;){let K=v.keys().next().value;if(K===void 0)break;v.delete(K)}return Y},Me=(z,Y)=>{let K=s.get(z),J=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),ne=t.doc.floors?.[J],oe=o.floors[J],ae=ne?.focalPoint??t.doc.focalPoint,ue=oe?{x:oe.focalWorld[0]/N,y:oe.focalWorld[2]/N}:ae,Qe=K?.focalPoint?{x:K.focalPoint.x+ue.x-ae.x,y:K.focalPoint.y+ue.y-ae.y}:ue,Ue=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return Oi(Ue,Qe,ne?.baseHeightM??0,K?.eyeHeightM)},we=()=>(e.clientWidth||I.canvas.clientWidth)<=520,_e=null,Fe=null,Ne=async(z,Y,K)=>{if(!n.getSeatView||h||K!==fe.flightGen())return;let J;try{J=await fa()}catch{if(i.panoramaFailed(z,"mount"),!h&&K===fe.flightGen()){let ne=de(z,K,!0);requestAnimationFrame(()=>ne?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(h||K!==fe.flightGen()||!_e))return Fe??=J.createOpenPanorama(_e),Fe(z,Y,K)},xe=ba({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:we,isDisposed:()=>h,flightGen:()=>fe.flightGen(),flyToSeat:z=>xo(z),openPanorama:(z,Y,K)=>Ne(z,Y,K)}),de=xe.show,Ge=xe.remove,yt=xe.layout,Pe=ya({container:e,orbit:w,isNarrow:we}),qe=Pe.element,De=Pe.setNavigationMode,Vt=Pe.layout,Sa=Pe.utilityControls,gt=null,yo=!1,Bt=z=>{Pe.setSeatViewLocked(z),z||X?.exit()};X=ea({canvas:I.canvas,camera:w.camera,requestRender:()=>W.requestRender(),reducedMotion:$,onStopChange:z=>{let Y=z??(yo?"seat":null);gt=Y;try{n.onSeatViewStopChange?.(Y)}catch{}},onApplied:()=>{h||w.syncFromCamera()}});let Ma=Xi(o.stages,o.focalWorld,o.bounds.groundY??0),wa=(z,Y)=>{let{eye:K}=Me(z,Y),J=(e.clientWidth||I.canvas.clientWidth||1)/Math.max(1,e.clientHeight||I.canvas.clientHeight||1),ne=Wi(K,Ma,J);if(n.seatViewStops===!1)return{...ne,stops:[]};let oe=l.get(z),ae=oe?o.sections.find(ue=>ue.id===oe):void 0;return{...ne,stops:Ki(ne,{aspect:J,section:ae&&ae.seatCount>0?{center:ae.center,radius:ae.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},fe=xa({container:e,model:o,opts:n,orbit:w,cinematic:T,analytics:i,loop:W,labelOverlay:B,stageAzimuth:G,overviewFraming:k,gpu:()=>u,isDisposed:()=>h,panorama:()=>b,setPanorama:z=>{b=z},setPanoramaSphereVisible:z=>{V=z},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:z=>{g=z},setFrozen:z=>{f=z},restorePanoramaLayer:E,reducedMotion:$,resolvedSeatViewPose:Me,showSectionSeatLabels:F,setNearFieldDetailEnabled:P,setSeatViewLocked:Bt,setNavigationMode:De,showArriveChip:de,removeArriveChip:Ge,inSeatView:()=>gt!==null,setSeatStepping:z=>{yo=z},seatViewArrival:(z,Y)=>n.arriveAtSeatEye?wa(z,Y):null,enterSeatView:z=>X?.enter(z)});_=!0;let Cn=fe.overviewChip,Pa=fe.layoutOverviewChip,Ca=fe.applyFloorFocus,Aa=fe.focusOverview,go=fe.cancelFlight,xo=fe.flyToSeat,vo=fe.focusSectionCamera;Sa.appendChild(Cn),_e={container:e,model:o,opts:n,analytics:i,orbit:w,loop:W,seatsById:s,ensureSeatView:Ae,resolvedSeatViewPose:Me,gpu:()=>u,gl:I.gl,isContextLost:()=>m,isDisposed:()=>h,flightGen:()=>fe.flightGen(),setPanorama:z=>{b=z},getLoadAbort:()=>g,setLoadAbort:z=>{g=z},setPanoramaSphereVisible:z=>{V=z,z&&X?.exit()},setFrozen:z=>{f=z},raisePanoramaLayer:S,restorePanoramaLayer:E,getOverviewChip:()=>Cn,labelOverlay:B,reducedMotion:$,removeArriveChip:Ge,showArriveChip:de};let ze=ga({glctx:I,orbit:w,model:o,seats:t.seats,opts:n,cinematic:T,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:su,tapMs:cu,gpu:()=>u,pick:()=>d,seatViewLocked:()=>Pe.seatViewLocked(),focusedSectionId:()=>L,selection:()=>y,cancelFlight:go,focusSectionCamera:vo,setSelection:Q,ensureSeatView:Ae});I.canvas.addEventListener("pointerdown",ze.onDown),I.canvas.addEventListener("pointermove",ze.onMove),I.canvas.addEventListener("pointerup",ze.onUp),I.canvas.addEventListener("pointercancel",ze.onUp),W.requestRender();let An={setAvailability(z){let Y=Ii(y,z),K=Gn(o.seats,Y);K.length&&u&&u.uploadSeatStateRuns(K),W.requestRender()},setSelection:Q,setNavigationMode:De,zoomIn(){w.zoomBy(.82),W.requestRender()},zoomOut(){w.zoomBy(1.22),W.requestRender()},flyToSeat:xo,focusOverview:Aa,seatViewStop:()=>gt,recentreSeatView:()=>X?.recentre()??!1,resize(){let{width:z,height:Y}=I.resize();w.setAspect(z/Math.max(1,Y)),yt(),Vt(),Pa(),W.requestRender()},stats(){return{...W.stats(),drawCalls:u?u.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let z=W.stats(),Y=I.canvas.clientWidth||1,K=I.canvas.clientHeight||1,J=o.bounds.center,ne=Xe(w.camera.projectionViewMatrix,[J[0],o.bounds.box.min[1],J[2]],Y,K),oe=Xe(w.camera.projectionViewMatrix,[J[0],o.bounds.box.max[1],J[2]],Y,K),ae=o.bounds.box,ue=[ae.min[0],ae.max[0]].flatMap(Z=>[ae.min[1],ae.max[1]].flatMap(pe=>[ae.min[2],ae.max[2]].map(Ie=>Xe(w.camera.projectionViewMatrix,[Z,pe,Ie],Y,K)))).filter(Z=>Number.isFinite(Z.x)&&Number.isFinite(Z.y)&&Number.isFinite(Z.depth)),Qe=ue.length?(()=>{let Z=Math.min(...ue.map(Ze=>Ze.x)),pe=Math.max(...ue.map(Ze=>Ze.x)),Ie=Math.min(...ue.map(Ze=>Ze.y)),Nt=Math.max(...ue.map(Ze=>Ze.y)),xt=Math.max(0,Z),Gt=Math.min(Y,pe),Ee=Math.max(0,Ie),vt=Math.min(K,Nt),zt=Math.max(0,Gt-xt),In=Math.max(0,vt-Ee);return{box:{x:xt,y:Ee,width:zt,height:In},horizontalFillRatio:zt/Y,verticalFillRatio:In/K,visibleAreaRatio:zt*In/(Y*K),clippedEdges:[...Ie<0?["top"]:[],...pe>Y?["right"]:[],...Nt>K?["bottom"]:[],...Z<0?["left"]:[]]}})():void 0,Ue=String(I.gl.getParameter(I.gl.VERSION)??"");return{viewport:{width:Y,height:K},context:{webgl2:/webgl\s*2/i.test(Ue),lost:m},frame:{rendered:z.rendered,idle:z.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:p,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:ne.visible&&oe.visible?Math.abs(ne.y-oe.y):0},labels:B.qualityEvidence(),framing:Qe,...gt?{seatView:{fovDeg:w.camera.fov,stop:gt}}:{}}},getQualityReport(){return dn(An.getQualityEvidence())},loseContextForTest(){I.simulateContextLossCycle()},floors(){return o.floors},focusFloor(z){if(z!==null&&!o.floors.some(K=>K.index===z))return!1;let Y=z??-1;if(P(z!==null),Bt(!1),Ca(Y),De("orbit"),z===null)T.cancel(),$()?w.frame(o.bounds,!1,G,n.portraitOverviewCrop===!0,k):w.frameSoft(o.bounds,G,n.portraitOverviewCrop===!0,k);else{let K=o.floors[z];if(K.seatCount>0){T.cancel();let J=K.focalWorld[0]-K.center[0],ne=K.focalWorld[2]-K.center[2],oe=Math.hypot(J,ne)>K.radius*.12?Math.atan2(J,ne):G;w.frame({center:K.center,radius:K.radius,box:K.box},!1,oe,!1,{polarDeg:58,margin:1.12})}}return W.requestRender(),!0},zones(){return o.zones},focusZone(z){let Y=o.zones.find(oe=>oe.id===z);if(!Y||Y.seatCount===0)return!1;P(!1),Bt(!1),T.cancel(),De("orbit"),F(null),n.onSectionFocusChange?.(null);let K=Y.focalWorld[0]-Y.center[0],J=Y.focalWorld[2]-Y.center[2],ne=Math.hypot(K,J)>Y.radius*.12?Math.atan2(K,J):void 0;return w.frame({center:Y.center,radius:Y.radius*1.25},!1,ne),W.requestRender(),!0},sections(){return o.sections},focusSection(z){return vo(z)},rows(z){return z?o.rows.filter(Y=>Y.sectionId===z):o.rows},seatsInRow(z){return t.seats.filter(Y=>Y.rowId===z).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(z){let Y=o.rows.find(K=>K.id===z);return!Y||Y.seatCount===0?!1:(P(!0),Bt(!1),T.cancel(),De("pan"),Y.sectionId&&(F(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),w.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),W.requestRender(),!0)},setReducedMotionForTest(z){A=z},dispose(){h=!0,Ge(),Cn.remove(),qe.remove(),go(),X?.dispose(),W.stop(),B.dispose(),q?.disconnect(),b&&(b.dispose(),b=null),E(),D(),I.canvas.removeEventListener("pointerdown",ze.onDown),I.canvas.removeEventListener("pointermove",ze.onMove),I.canvas.removeEventListener("pointerup",ze.onUp),I.canvas.removeEventListener("pointercancel",ze.onUp),w.dispose(),d&&d.dispose(),u&&u.dispose(),u=null,d=null,I.dispose()}};return i.opened(o.seatCount,p,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),An}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});
|